summaryrefslogtreecommitdiff
authordrw <drw>2005-06-09 21:17:15 (UTC)
committer drw <drw>2005-06-09 21:17:15 (UTC)
commitd5c8de3585a6e94c18156e51299f1e49cc992285 (patch) (unidiff)
treee7a0bf5f44e7d972904c748d8c03f97ae52c5c87
parent346a2cd09c2c28bd4d2086b0c152dd348913eaa9 (diff)
downloadopie-d5c8de3585a6e94c18156e51299f1e49cc992285.zip
opie-d5c8de3585a6e94c18156e51299f1e49cc992285.tar.gz
opie-d5c8de3585a6e94c18156e51299f1e49cc992285.tar.bz2
Resource -> OResource
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp4
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp4
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp8
3 files changed, 8 insertions, 8 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 2a269b8..ac6e1fa 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -1,92 +1,92 @@
1/********************************************************************** 1/**********************************************************************
2** BenchmarkInfo 2** BenchmarkInfo
3** 3**
4** A benchmark widget for Qt/Embedded 4** A benchmark widget for Qt/Embedded
5** 5**
6** Copyright (C) 2004 Michael Lauer <mickey@vanille.de> 6** Copyright (C) 2004 Michael Lauer <mickey@vanille.de>
7** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp> 7** Inspired by ZBench (C) 2002 Satoshi <af230533@im07.alpha-net.ne.jp>
8** 8**
9** This file may be distributed and/or modified under the terms of the 9** This file may be distributed and/or modified under the terms of the
10** GNU General Public License version 2 as published by the Free Software 10** GNU General Public License version 2 as published by the Free Software
11** Foundation and appearing in the file LICENSE.GPL included in the 11** Foundation and appearing in the file LICENSE.GPL included in the
12** packaging of this file. 12** packaging of this file.
13** 13**
14** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
15** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16** 16**
17**********************************************************************/ 17**********************************************************************/
18 18
19#include "benchmarkinfo.h" 19#include "benchmarkinfo.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/odebug.h> 22#include <opie2/odebug.h>
23#include <opie2/ostorageinfo.h> 23#include <opie2/ostorageinfo.h>
24#include <opie2/olistview.h> 24#include <opie2/olistview.h>
25#include <opie2/oresource.h>
25#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
26#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
27#include <qpe/qpedecoration_qws.h> 28#include <qpe/qpedecoration_qws.h>
28#include <qpe/resource.h>
29#include <qpe/config.h> 29#include <qpe/config.h>
30using namespace Opie::Core; 30using namespace Opie::Core;
31using namespace Opie::Ui; 31using namespace Opie::Ui;
32 32
33/* QT */ 33/* QT */
34#include <qclipboard.h> 34#include <qclipboard.h>
35#include <qcolor.h> 35#include <qcolor.h>
36#include <qcombobox.h> 36#include <qcombobox.h>
37#include <qdirectpainter_qws.h> 37#include <qdirectpainter_qws.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qtextstream.h> 39#include <qtextstream.h>
40#include <qfiledialog.h> 40#include <qfiledialog.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qpainter.h> 43#include <qpainter.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qtimer.h> 45#include <qtimer.h>
46#include <qwhatsthis.h> 46#include <qwhatsthis.h>
47 47
48/* STD */ 48/* STD */
49#include <time.h> 49#include <time.h>
50#include <stdio.h> 50#include <stdio.h>
51#include <stdlib.h> 51#include <stdlib.h>
52#include <math.h> 52#include <math.h>
53#if defined (__GNUC__) && (__GNUC__ < 3) 53#if defined (__GNUC__) && (__GNUC__ < 3)
54#define round qRound 54#define round qRound
55#endif 55#endif
56 56
57extern "C" 57extern "C"
58{ 58{
59 void BenchFFT( void ); 59 void BenchFFT( void );
60 double dhry_main( int ); 60 double dhry_main( int );
61} 61}
62 62
63#define DHRYSTONE_RUNS 20000000 63#define DHRYSTONE_RUNS 20000000
64#define TEST_DURATION 3 64#define TEST_DURATION 3
65 65
66//=========================================================================== 66//===========================================================================
67 67
68class BenchmarkPaintWidget : public QWidget 68class BenchmarkPaintWidget : public QWidget
69{ 69{
70 public: 70 public:
71 BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever ) 71 BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever )
72 { 72 {
73 resize( QApplication::desktop()->size() ); 73 resize( QApplication::desktop()->size() );
74 show(); 74 show();
75 p.begin( this ); 75 p.begin( this );
76 }; 76 };
77 77
78 ~BenchmarkPaintWidget() 78 ~BenchmarkPaintWidget()
79 { 79 {
80 p.end(); 80 p.end();
81 hide(); 81 hide();
82 }; 82 };
83 83
84 QPainter p; 84 QPainter p;
85}; 85};
86 86
87//=========================================================================== 87//===========================================================================
88 88
89BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) 89BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
90 : QWidget( parent, name, wFlags ) 90 : QWidget( parent, name, wFlags )
91{ 91{
92 92
@@ -268,129 +268,129 @@ int BenchmarkInfo::textRendering( int seconds )
268 268
269 while ( t.elapsed() < stop ) 269 while ( t.elapsed() < stop )
270 { 270 {
271 int k = rand() % 9; 271 int k = rand() % 9;
272 int s = rand() % 100; 272 int s = rand() % 100;
273 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 273 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
274 bpw.p.setFont( QFont( "Vera", s ) ); 274 bpw.p.setFont( QFont( "Vera", s ) );
275 bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); 275 bpw.p.drawText( rand() % w, rand() % h, text, text.length() );
276 ++loops; 276 ++loops;
277 } 277 }
278 278
279 return loops * text.length(); 279 return loops * text.length();
280} 280}
281 281
282int BenchmarkInfo::gfxRendering( int seconds ) 282int BenchmarkInfo::gfxRendering( int seconds )
283{ 283{
284 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; 284 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 };
285 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; 285 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 };
286 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; 286 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 };
287 287
288 int w = QApplication::desktop()->width(); 288 int w = QApplication::desktop()->width();
289 int h = QApplication::desktop()->height(); 289 int h = QApplication::desktop()->height();
290 290
291 srand( time( NULL ) ); 291 srand( time( NULL ) );
292 292
293 BenchmarkPaintWidget bpw; 293 BenchmarkPaintWidget bpw;
294 294
295 QTime t; 295 QTime t;
296 t.start(); 296 t.start();
297 int stop = t.elapsed() + seconds*1000; 297 int stop = t.elapsed() + seconds*1000;
298 int loops = 0; 298 int loops = 0;
299 299
300 while ( t.elapsed() < stop ) 300 while ( t.elapsed() < stop )
301 { 301 {
302 int k = rand() % 9; 302 int k = rand() % 9;
303 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 303 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
304 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); 304 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h );
305 ++loops; 305 ++loops;
306 } 306 }
307 307
308 t.restart(); 308 t.restart();
309 stop = t.elapsed() + seconds*1000; 309 stop = t.elapsed() + seconds*1000;
310 310
311 while ( t.elapsed() < stop ) 311 while ( t.elapsed() < stop )
312 { 312 {
313 int k = rand() % 9; 313 int k = rand() % 9;
314 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 314 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
315 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); 315 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 );
316 ++loops; 316 ++loops;
317 } 317 }
318 318
319 QBrush br1; 319 QBrush br1;
320 br1.setStyle( SolidPattern ); 320 br1.setStyle( SolidPattern );
321 t.restart(); 321 t.restart();
322 stop = t.elapsed() + seconds*1000; 322 stop = t.elapsed() + seconds*1000;
323 323
324 while ( t.elapsed() < stop ) 324 while ( t.elapsed() < stop )
325 { 325 {
326 int k = rand() % 9; 326 int k = rand() % 9;
327 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 327 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
328 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); 328 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 );
329 ++loops; 329 ++loops;
330 } 330 }
331 331
332 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); 332 QPixmap p = Opie::Core::OResource::loadPixmap( "sysinfo/pattern" );
333 t.restart(); 333 t.restart();
334 stop = t.elapsed() + seconds*1000; 334 stop = t.elapsed() + seconds*1000;
335 335
336 while ( t.elapsed() < stop ) 336 while ( t.elapsed() < stop )
337 { 337 {
338 bpw.p.drawPixmap( rand()%w, rand()%h, p ); 338 bpw.p.drawPixmap( rand()%w, rand()%h, p );
339 ++loops; 339 ++loops;
340 } 340 }
341 341
342 return loops; 342 return loops;
343 343
344} 344}
345 345
346const unsigned int FILE_TEST_COUNT = 8000; 346const unsigned int FILE_TEST_COUNT = 8000;
347const unsigned int FILE_TEST_BLOCKSIZE = 1024; 347const unsigned int FILE_TEST_BLOCKSIZE = 1024;
348 348
349void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item ) 349void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item )
350{ 350{
351 QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname; 351 QString filename = fname == "/benchmarkFile.dat" ? QString( "/tmp/bla" ) : fname;
352 odebug << "performing file test on " << filename << oendl; 352 odebug << "performing file test on " << filename << oendl;
353 353
354 QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename ) 354 QString writeCommand = QString( "dd if=/dev/zero of=%1 count=%2 bs=%3 && sync" ).arg( filename )
355 .arg( FILE_TEST_COUNT ) 355 .arg( FILE_TEST_COUNT )
356 .arg( FILE_TEST_BLOCKSIZE ); 356 .arg( FILE_TEST_BLOCKSIZE );
357 QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename ) 357 QString readCommand = QString( "dd if=%1 of=/dev/null count=%2 bs=%3").arg( filename )
358 .arg( FILE_TEST_COUNT ) 358 .arg( FILE_TEST_COUNT )
359 .arg( FILE_TEST_BLOCKSIZE ); 359 .arg( FILE_TEST_BLOCKSIZE );
360 ::system( "sync" ); 360 ::system( "sync" );
361 odebug << "performing file test on " << filename << oendl; 361 odebug << "performing file test on " << filename << oendl;
362 362
363 int write = 0; 363 int write = 0;
364 int read = 0; 364 int read = 0;
365 365
366 QTime time; 366 QTime time;
367 time.start(); 367 time.start();
368 if ( ::system( writeCommand ) == 0 ) 368 if ( ::system( writeCommand ) == 0 )
369 { 369 {
370 write = time.elapsed(); 370 write = time.elapsed();
371 } 371 }
372 else 372 else
373 { 373 {
374 item->setText( 1, tr( "error" ) ); 374 item->setText( 1, tr( "error" ) );
375 return; 375 return;
376 } 376 }
377 377
378 time.restart(); 378 time.restart();
379 if ( ::system( readCommand ) == 0 ) 379 if ( ::system( readCommand ) == 0 )
380 { 380 {
381 read = time.elapsed(); 381 read = time.elapsed();
382 } 382 }
383 else 383 else
384 { 384 {
385 item->setText( 1, tr( "error" ) ); 385 item->setText( 1, tr( "error" ) );
386 return; 386 return;
387 } 387 }
388 388
389 QFile::remove( filename ); 389 QFile::remove( filename );
390 double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 ); 390 double readSpeed = FILE_TEST_COUNT / ( read / 1000.0 );
391 QString readUnit = "kB/s"; 391 QString readUnit = "kB/s";
392 if ( readSpeed > 1024 ) 392 if ( readSpeed > 1024 )
393 { 393 {
394 readSpeed /= 1024.0; 394 readSpeed /= 1024.0;
395 readUnit = "MB/s"; 395 readUnit = "MB/s";
396 } 396 }
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
index 03db22a..63be111 100644
--- a/noncore/settings/sysinfo/sysinfo.cpp
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -1,66 +1,66 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19********************************************************************** 19**********************************************************************
20** 20**
21** Enhancements by: Dan Williams, <williamsdr@acm.org> 21** Enhancements by: Dan Williams, <williamsdr@acm.org>
22** 22**
23**********************************************************************/ 23**********************************************************************/
24 24
25#include "memory.h" 25#include "memory.h"
26#include "devicesinfo.h" 26#include "devicesinfo.h"
27#include "storage.h" 27#include "storage.h"
28#include "processinfo.h" 28#include "processinfo.h"
29#include "modulesinfo.h" 29#include "modulesinfo.h"
30#include "benchmarkinfo.h" 30#include "benchmarkinfo.h"
31#include "sysloginfo.h" 31#include "sysloginfo.h"
32#include "versioninfo.h" 32#include "versioninfo.h"
33#include "sysinfo.h" 33#include "sysinfo.h"
34 34
35/* OPIE */ 35/* OPIE */
36#include <opie2/oresource.h>
36#include <opie2/otabwidget.h> 37#include <opie2/otabwidget.h>
37using namespace Opie::Ui; 38using namespace Opie::Ui;
38#include <qpe/config.h> 39#include <qpe/config.h>
39#include <qpe/resource.h>
40 40
41/* QT */ 41/* QT */
42#include <qlayout.h> 42#include <qlayout.h>
43 43
44SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags ) 44SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags )
45 : QWidget( parent, name, WStyle_ContextHelp ) 45 : QWidget( parent, name, WStyle_ContextHelp )
46{ 46{
47 setIcon( Resource::loadPixmap( "system_icon" ) ); 47 setIcon( Opie::Core::OResource::loadPixmap( "system_icon", Opie::Core::OResource::SmallIcon ) );
48 setCaption( tr("System Info") ); 48 setCaption( tr("System Info") );
49 49
50 QVBoxLayout *lay = new QVBoxLayout( this ); 50 QVBoxLayout *lay = new QVBoxLayout( this );
51 OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); 51 OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global );
52 lay->addWidget( tab ); 52 lay->addWidget( tab );
53 53
54 tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") ); 54 tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon", tr("Memory") );
55#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 55#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
56 tab->addTab( new FileSysInfo( tab ), "sysinfo/storagetabicon", tr("Storage") ); 56 tab->addTab( new FileSysInfo( tab ), "sysinfo/storagetabicon", tr("Storage") );
57#endif 57#endif
58 tab->addTab( new DevicesInfo( tab ), "sysinfo/cputabicon", tr("Devices") ); 58 tab->addTab( new DevicesInfo( tab ), "sysinfo/cputabicon", tr("Devices") );
59 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr( "Process" ) ); 59 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon", tr( "Process" ) );
60 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr( "Modules" ) ); 60 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon", tr( "Modules" ) );
61 tab->addTab( new SyslogInfo( tab ), "sysinfo/syslogtabicon", tr( "Syslog" ) ); 61 tab->addTab( new SyslogInfo( tab ), "sysinfo/syslogtabicon", tr( "Syslog" ) );
62 tab->addTab( new BenchmarkInfo( tab ), "sysinfo/benchmarktabicon", tr( "Benchmark" ) ); 62 tab->addTab( new BenchmarkInfo( tab ), "sysinfo/benchmarktabicon", tr( "Benchmark" ) );
63 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") ); 63 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon", tr("Version") );
64 64
65 tab->setCurrentTab( tr( "Memory" ) ); 65 tab->setCurrentTab( tr( "Memory" ) );
66} 66}
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 5736faa..29c9a05 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,178 +1,178 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "versioninfo.h" 21#include "versioninfo.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odevice.h> 24#include <opie2/odevice.h>
25#include <qpe/resource.h> 25#include <opie2/oresource.h>
26#include <qpe/version.h> 26#include <qpe/version.h>
27 27
28/* QT */ 28/* QT */
29#include <qfile.h> 29#include <qfile.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qscrollview.h> 32#include <qscrollview.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qwhatsthis.h> 34#include <qwhatsthis.h>
35 35
36using namespace Opie::Core; 36using namespace Opie::Core;
37 37
38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
39 : QWidget( parent, name, f ) 39 : QWidget( parent, name, f )
40{ 40{
41 setMinimumSize( 200, 150 ); 41 setMinimumSize( 200, 150 );
42 42
43 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 43 QVBoxLayout *tmpvb = new QVBoxLayout( this );
44 QScrollView *sv = new QScrollView( this ); 44 QScrollView *sv = new QScrollView( this );
45 tmpvb->addWidget( sv, 0, 0 ); 45 tmpvb->addWidget( sv, 0, 0 );
46 sv->setResizePolicy( QScrollView::AutoOneFit ); 46 sv->setResizePolicy( QScrollView::AutoOneFit );
47 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 47 sv->setHScrollBarMode( QScrollView::AlwaysOff );
48 sv->setVScrollBarMode( QScrollView::AlwaysOff ); 48 sv->setVScrollBarMode( QScrollView::AlwaysOff );
49 sv->setFrameStyle( QFrame::NoFrame ); 49 sv->setFrameStyle( QFrame::NoFrame );
50 QWidget *container = new QWidget( sv->viewport() ); 50 QWidget *container = new QWidget( sv->viewport() );
51 sv->addChild( container ); 51 sv->addChild( container );
52 52
53 QVBoxLayout *vb = new QVBoxLayout( container, 3 ); 53 QVBoxLayout *vb = new QVBoxLayout( container, 3 );
54 54
55 QString kernelVersionString; 55 QString kernelVersionString;
56 QFile file( "/proc/version" ); 56 QFile file( "/proc/version" );
57 if ( file.open( IO_ReadOnly ) ) 57 if ( file.open( IO_ReadOnly ) )
58 { 58 {
59 QTextStream t( &file ); 59 QTextStream t( &file );
60 QStringList strList; 60 QStringList strList;
61 61
62 strList = QStringList::split( " " , t.read(), false ); 62 strList = QStringList::split( " " , t.read(), false );
63 63
64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " ); 64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " );
65 kernelVersionString.append( strList[2] ); 65 kernelVersionString.append( strList[2] );
66 kernelVersionString.append( "<br>" ); 66 kernelVersionString.append( "<br>" );
67 kernelVersionString.append( tr( "Compiled by: " ) ); 67 kernelVersionString.append( tr( "Compiled by: " ) );
68 kernelVersionString.append( strList[3] ); 68 kernelVersionString.append( strList[3] );
69 kernelVersionString.append("</qt>"); 69 kernelVersionString.append("</qt>");
70 file.close(); 70 file.close();
71 } 71 }
72 72
73 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " ); 73 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " );
74 palmtopVersionString.append( QPE_VERSION ); 74 palmtopVersionString.append( QPE_VERSION );
75 palmtopVersionString.append( "<br>" ); 75 palmtopVersionString.append( "<br>" );
76#ifdef QPE_VENDOR 76#ifdef QPE_VENDOR
77 QString builder = QPE_VENDOR; 77 QString builder = QPE_VENDOR;
78#else 78#else
79 QString builder = "Unknown"; 79 QString builder = "Unknown";
80#endif 80#endif
81 palmtopVersionString.append( tr( "Built against Qt/E " ) ); 81 palmtopVersionString.append( tr( "Built against Qt/E " ) );
82 palmtopVersionString.append( QT_VERSION_STR ); 82 palmtopVersionString.append( QT_VERSION_STR );
83 palmtopVersionString.append( "<br>" ); 83 palmtopVersionString.append( "<br>" );
84 palmtopVersionString.append( tr( "Built on: " ) ); 84 palmtopVersionString.append( tr( "Built on: " ) );
85 palmtopVersionString.append( __DATE__ ); 85 palmtopVersionString.append( __DATE__ );
86 palmtopVersionString.append( "</qt>" ); 86 palmtopVersionString.append( "</qt>" );
87 87
88 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 88 QHBoxLayout *hb1 = new QHBoxLayout( vb );
89 hb1->setSpacing( 2 ); 89 hb1->setSpacing( 2 );
90 90
91 QLabel *palmtopLogo = new QLabel( container ); 91 QLabel *palmtopLogo = new QLabel( container );
92 QImage logo1 = Resource::loadImage( "logo/opielogo" ); 92 QImage logo1 = Opie::Core::OResource::loadImage( "logo/opielogo" );
93 logo1 = logo1.smoothScale( 50, 55 ); 93 logo1 = logo1.smoothScale( 50, 55 );
94 QPixmap logo1Pixmap; 94 QPixmap logo1Pixmap;
95 logo1Pixmap.convertFromImage( logo1 ); 95 logo1Pixmap.convertFromImage( logo1 );
96 palmtopLogo->setPixmap( logo1Pixmap ); 96 palmtopLogo->setPixmap( logo1Pixmap );
97 palmtopLogo->setFixedSize( 60, 60 ); 97 palmtopLogo->setFixedSize( 60, 60 );
98 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 98 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
99 99
100 QLabel *palmtopVersion = new QLabel( container ); 100 QLabel *palmtopVersion = new QLabel( container );
101 palmtopVersion->setText( palmtopVersionString ); 101 palmtopVersion->setText( palmtopVersionString );
102 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 102 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
103 103
104 104
105 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 105 QHBoxLayout *hb2 = new QHBoxLayout( vb );
106 hb1->setSpacing( 2 ); 106 hb1->setSpacing( 2 );
107 107
108 QLabel *linuxLogo = new QLabel( container ); 108 QLabel *linuxLogo = new QLabel( container );
109 QImage logo2 = Resource::loadImage( "logo/tux-logo" ); 109 QImage logo2 = Opie::Core::OResource::loadImage( "logo/tux-logo" );
110 logo2 = logo2.smoothScale( 55, 60 ); 110 logo2 = logo2.smoothScale( 55, 60 );
111 QPixmap logo2Pixmap; 111 QPixmap logo2Pixmap;
112 logo2Pixmap.convertFromImage( logo2 ); 112 logo2Pixmap.convertFromImage( logo2 );
113 linuxLogo->setPixmap( logo2Pixmap ); 113 linuxLogo->setPixmap( logo2Pixmap );
114 linuxLogo->setFixedSize( 60, 60 ); 114 linuxLogo->setFixedSize( 60, 60 );
115 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 115 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
116 116
117 QLabel *kernelVersion = new QLabel( container ); 117 QLabel *kernelVersion = new QLabel( container );
118 kernelVersion->setText( kernelVersionString ); 118 kernelVersion->setText( kernelVersionString );
119 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 119 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
120 120
121 121
122 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 122 QHBoxLayout *hb3 = new QHBoxLayout( vb );
123 hb3->setSpacing( 2 ); 123 hb3->setSpacing( 2 );
124 124
125 QLabel *palmtopLogo3 = new QLabel( container ); 125 QLabel *palmtopLogo3 = new QLabel( container );
126 126
127 OModel model = ODevice::inst()->model(); 127 OModel model = ODevice::inst()->model();
128 QString modelPixmap = "sysinfo/"; 128 QString modelPixmap = "sysinfo/";
129 if ( model == Model_Zaurus_SLC7x0 ) 129 if ( model == Model_Zaurus_SLC7x0 )
130 modelPixmap += "zaurusc700"; 130 modelPixmap += "zaurusc700";
131 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 ) 131 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 )
132 modelPixmap += "zaurus5500"; 132 modelPixmap += "zaurus5500";
133 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx ) 133 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx )
134 modelPixmap += "ipaq3600"; 134 modelPixmap += "ipaq3600";
135 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus ) 135 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus )
136 modelPixmap += "simpad"; 136 modelPixmap += "simpad";
137 else if ( model == Model_Jornada_56x ) 137 else if ( model == Model_Jornada_56x )
138 modelPixmap += "jornada56x"; 138 modelPixmap += "jornada56x";
139 else if ( model == Model_Jornada_720 ) 139 else if ( model == Model_Jornada_720 )
140 modelPixmap += "jornada720"; 140 modelPixmap += "jornada720";
141 else 141 else
142 modelPixmap += "pda"; 142 modelPixmap += "pda";
143 143
144 QImage logo3 = Resource::loadImage( modelPixmap ); 144 QImage logo3 = Opie::Core::OResource::loadImage( modelPixmap );
145 145
146 int width = logo3.width(); 146 int width = logo3.width();
147 int height = logo3.height(); 147 int height = logo3.height();
148 float aspect = float( height ) / width; 148 float aspect = float( height ) / width;
149 logo3 = logo3.smoothScale( 50, 50.0 * aspect ); 149 logo3 = logo3.smoothScale( 50, 50.0 * aspect );
150 150
151 QPixmap logo3Pixmap; 151 QPixmap logo3Pixmap;
152 logo3Pixmap.convertFromImage( logo3 ); 152 logo3Pixmap.convertFromImage( logo3 );
153 palmtopLogo3->setPixmap( logo3Pixmap ); 153 palmtopLogo3->setPixmap( logo3Pixmap );
154 palmtopLogo3->setFixedSize( 60, 100 ); 154 palmtopLogo3->setFixedSize( 60, 100 );
155 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); 155 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
156 156
157 QString systemString = "<qt><b>"; 157 QString systemString = "<qt><b>";
158 systemString.append( ODevice::inst()->systemString() ); 158 systemString.append( ODevice::inst()->systemString() );
159 systemString.append( "</b>" ); 159 systemString.append( "</b>" );
160 systemString.append( tr( "<p>Version: " ) ); 160 systemString.append( tr( "<p>Version: " ) );
161 systemString.append( ODevice::inst()->systemVersionString() ); 161 systemString.append( ODevice::inst()->systemVersionString() );
162 systemString.append( tr( "<br>Model: " ) ); 162 systemString.append( tr( "<br>Model: " ) );
163 systemString.append( ODevice::inst()->modelString() ); 163 systemString.append( ODevice::inst()->modelString() );
164 systemString.append( tr( "<br>Vendor: " ) ); 164 systemString.append( tr( "<br>Vendor: " ) );
165 systemString.append( ODevice::inst()->vendorString() ); 165 systemString.append( ODevice::inst()->vendorString() );
166 systemString.append("</qt>"); 166 systemString.append("</qt>");
167 167
168 QLabel *systemVersion = new QLabel( container ); 168 QLabel *systemVersion = new QLabel( container );
169 systemVersion->setText( systemString ); 169 systemVersion->setText( systemString );
170 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 170 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
171 171
172 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); 172 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
173} 173}
174 174
175VersionInfo::~VersionInfo() 175VersionInfo::~VersionInfo()
176{ 176{
177} 177}
178 178