summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp53
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.h22
-rw-r--r--noncore/settings/sysinfo/detail.cpp4
-rw-r--r--noncore/settings/sysinfo/detail.h6
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp22
-rw-r--r--noncore/settings/sysinfo/modulesinfo.h8
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp24
-rw-r--r--noncore/settings/sysinfo/processinfo.h11
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp9
9 files changed, 84 insertions, 75 deletions
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 2c68fd5..3c2c15f 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -1,431 +1,436 @@
1/********************************************************************** 1/**********************************************************************
2** BenchmarkInfo 2** BenchmarkInfo
3** 3**
4** A benchmark for Qt/Embedded 4** A benchmark 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"
20
19/* OPIE */ 21/* OPIE */
20#include <opie2/ostorageinfo.h> 22#include <opie2/ostorageinfo.h>
23#include <opie2/olistview.h>
21#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
22#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpedecoration_qws.h> 26#include <qpe/qpedecoration_qws.h>
24#include <qpe/resource.h> 27#include <qpe/resource.h>
25#include <qpe/config.h> 28#include <qpe/config.h>
26 29
27/* QT */ 30/* QT */
28#include <qclipboard.h> 31#include <qclipboard.h>
29#include <qcolor.h> 32#include <qcolor.h>
30#include <qcombobox.h> 33#include <qcombobox.h>
31#include <qdirectpainter_qws.h> 34#include <qdirectpainter_qws.h>
32#include <qfile.h> 35#include <qfile.h>
33#include <qtextstream.h> 36#include <qtextstream.h>
34#include <qfiledialog.h> 37#include <qfiledialog.h>
35#include <qlabel.h> 38#include <qlabel.h>
36#include <qlayout.h> 39#include <qlayout.h>
37#include <qpainter.h> 40#include <qpainter.h>
38#include <qpushbutton.h> 41#include <qpushbutton.h>
39#include <qtimer.h> 42#include <qtimer.h>
43#include <qwhatsthis.h>
40 44
41/* STD */ 45/* STD */
42#include <time.h> 46#include <time.h>
43#include <stdio.h> 47#include <stdio.h>
44#include <stdlib.h> 48#include <stdlib.h>
45#include <math.h> 49#include <math.h>
46#if defined (__GNUC__) && (__GNUC__ < 3) 50#if defined (__GNUC__) && (__GNUC__ < 3)
47extern double round(double); 51extern double round(double);
48#endif 52#endif
49 53
50
51#include "benchmarkinfo.h"
52
53extern "C" 54extern "C"
54{ 55{
55 void BenchFFT( void ); 56 void BenchFFT( void );
56 double dhry_main( int ); 57 double dhry_main( int );
57} 58}
58 59
59#define DHRYSTONE_RUNS 20000000 60#define DHRYSTONE_RUNS 20000000
60#define TEST_DURATION 3 61#define TEST_DURATION 3
61 62
62#define BUFF_SIZE 8192 63#define BUFF_SIZE 8192
63#define FILE_SIZE 1024 * 1024 // 1Mb 64#define FILE_SIZE 1024 * 1024 // 1Mb
64 65
65//=========================================================================== 66//===========================================================================
66 67
67class BenchmarkPaintWidget : public QWidget 68class BenchmarkPaintWidget : public QWidget
68{ 69{
69 public: 70 public:
70 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 )
71 { 72 {
72 resize( QApplication::desktop()->size() ); 73 resize( QApplication::desktop()->size() );
73 show(); 74 show();
74 p.begin( this ); 75 p.begin( this );
75 }; 76 };
76 77
77 ~BenchmarkPaintWidget() 78 ~BenchmarkPaintWidget()
78 { 79 {
79 p.end(); 80 p.end();
80 hide(); 81 hide();
81 }; 82 };
82 83
83 QPainter p; 84 QPainter p;
84}; 85};
85 86
86//=========================================================================== 87//===========================================================================
87 88
88BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) 89BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
89 : QWidget( parent, name, wFlags ) 90 : QWidget( parent, name, wFlags )
90{ 91{
91 92
92 setMinimumSize( 200, 150 ); 93 setMinimumSize( 200, 150 );
93 94
94 QVBoxLayout* vb = new QVBoxLayout( this ); 95 QVBoxLayout* vb = new QVBoxLayout( this );
95 vb->setSpacing( 4 ); 96 vb->setSpacing( 4 );
96 vb->setMargin( 4 ); 97 vb->setMargin( 4 );
97 98
98 tests = new QListView( this ); 99 tests = new OListView( this );
100 QWhatsThis::add( tests->viewport(), tr( "This area shows the available tests, the results for which the tests "
101 "have been performed, and comparison values for one selected device. "
102 "Use the checkboxes to define which tests you want to perform." ) );
99 tests->setMargin( 0 ); 103 tests->setMargin( 0 );
100 tests->addColumn( tr( "Tests" ) ); 104 tests->addColumn( tr( "Tests" ) );
101 tests->addColumn( tr( "Results" ) ); 105 tests->addColumn( tr( "Results" ) );
102 tests->addColumn( tr( "Comparison" ) ); 106 tests->addColumn( tr( "Comparison" ) );
103 tests->setShowSortIndicator( true ); 107 tests->setShowSortIndicator( true );
104 108
105 test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox ); 109 test_alu = new OCheckListItem( tests, tr( "1. Integer Arithmetic " ), OCheckListItem::CheckBox );
106 test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox ); 110 test_fpu = new OCheckListItem( tests, tr( "2. Floating Point Unit " ), OCheckListItem::CheckBox );
107 test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox ); 111 test_txt = new OCheckListItem( tests, tr( "3. Text Rendering " ), OCheckListItem::CheckBox );
108 test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox ); 112 test_gfx = new OCheckListItem( tests, tr( "4. Gfx Rendering " ), OCheckListItem::CheckBox );
109 test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox ); 113 test_ram = new OCheckListItem( tests, tr( "5. RAM Performance " ), OCheckListItem::CheckBox );
110 test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox ); 114 test_sd = new OCheckListItem( tests, tr( "6. SD Card Performance " ), OCheckListItem::CheckBox );
111 test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox ); 115 test_cf = new OCheckListItem( tests, tr( "7. CF Card Performance " ), OCheckListItem::CheckBox );
112 116
113 test_alu->setText( 1, "n/a" ); 117 test_alu->setText( 1, "n/a" );
114 test_fpu->setText( 1, "n/a" ); 118 test_fpu->setText( 1, "n/a" );
115 test_txt->setText( 1, "n/a" ); 119 test_txt->setText( 1, "n/a" );
116 test_gfx->setText( 1, "n/a" ); 120 test_gfx->setText( 1, "n/a" );
117 test_ram->setText( 1, "n/a" ); 121 test_ram->setText( 1, "n/a" );
118 test_sd->setText( 1, "n/a" ); 122 test_sd->setText( 1, "n/a" );
119 test_cf->setText( 1, "n/a" ); 123 test_cf->setText( 1, "n/a" );
120 124
121 test_alu->setText( 2, "n/a" ); 125 test_alu->setText( 2, "n/a" );
122 test_fpu->setText( 2, "n/a" ); 126 test_fpu->setText( 2, "n/a" );
123 test_txt->setText( 2, "n/a" ); 127 test_txt->setText( 2, "n/a" );
124 test_gfx->setText( 2, "n/a" ); 128 test_gfx->setText( 2, "n/a" );
125 test_ram->setText( 2, "n/a" ); 129 test_ram->setText( 2, "n/a" );
126 test_sd->setText( 2, "n/a" ); 130 test_sd->setText( 2, "n/a" );
127 test_cf->setText( 2, "n/a" ); 131 test_cf->setText( 2, "n/a" );
128 132
129 startButton = new QPushButton( tr( "&Start Tests!" ), this ); 133 startButton = new QPushButton( tr( "&Start Tests!" ), this );
134 QWhatsThis::add( startButton, tr( "Click here to perform the selected tests." ) );
130 connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); 135 connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) );
131
132 vb->addWidget( tests, 2 ); 136 vb->addWidget( tests, 2 );
133 137
134 QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); 138 QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" );
135 if ( f.open( IO_ReadOnly ) ) 139 if ( f.open( IO_ReadOnly ) )
136 { 140 {
137 machineCombo = new QComboBox( this ); 141 machineCombo = new QComboBox( this );
138 142 QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) );
143
139 QTextStream ts( &f ); 144 QTextStream ts( &f );
140 while( !ts.eof() ) 145 while( !ts.eof() )
141 { 146 {
142 QString machline = ts.readLine(); 147 QString machline = ts.readLine();
143 qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); 148 qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline );
144 QString resline = ts.readLine(); 149 QString resline = ts.readLine();
145 machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); 150 machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) );
146 machineCombo->insertItem( machline ); 151 machineCombo->insertItem( machline );
147 } 152 }
148 153
149 QHBoxLayout* hb = new QHBoxLayout( vb ); 154 QHBoxLayout* hb = new QHBoxLayout( vb );
150 hb->addWidget( new QLabel( tr( "Compare To:" ), this ) ); 155 hb->addWidget( new QLabel( tr( "Compare To:" ), this ) );
151 hb->addWidget( machineCombo, 2 ); 156 hb->addWidget( machineCombo, 2 );
152 connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); 157 connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) );
153 } 158 }
154 159
155 vb->addWidget( startButton, 2 ); 160 vb->addWidget( startButton, 2 );
156} 161}
157 162
158 163
159BenchmarkInfo::~BenchmarkInfo() 164BenchmarkInfo::~BenchmarkInfo()
160{} 165{}
161 166
162 167
163void BenchmarkInfo::machineActivated( int index ) 168void BenchmarkInfo::machineActivated( int index )
164{ 169{
165 QStringList* results = machines[ machineCombo->text( index ) ]; 170 QStringList* results = machines[ machineCombo->text( index ) ];
166 if ( !results ) 171 if ( !results )
167 { 172 {
168 qDebug( "sysinfo: no results available." ); 173 qDebug( "sysinfo: no results available." );
169 return; 174 return;
170 } 175 }
171 QStringList::Iterator it = results->begin(); 176 QStringList::Iterator it = results->begin();
172 test_alu->setText( 2, *(it++) ); 177 test_alu->setText( 2, *(it++) );
173 test_fpu->setText( 2, *(it++) ); 178 test_fpu->setText( 2, *(it++) );
174 test_txt->setText( 2, *(it++) ); 179 test_txt->setText( 2, *(it++) );
175 test_gfx->setText( 2, *(it++) ); 180 test_gfx->setText( 2, *(it++) );
176 test_ram->setText( 2, *(it++) ); 181 test_ram->setText( 2, *(it++) );
177 test_sd->setText( 2, *(it++) ); 182 test_sd->setText( 2, *(it++) );
178 test_cf->setText( 2, *(it++) ); 183 test_cf->setText( 2, *(it++) );
179} 184}
180 185
181 186
182void BenchmarkInfo::run() 187void BenchmarkInfo::run()
183{ 188{
184 startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); 189 startButton->setText( "> Don't touch! Running Tests! Don't touch! <" );
185 qApp->processEvents(); 190 qApp->processEvents();
186 QTime t; 191 QTime t;
187 192
188 if ( test_alu->isOn() ) 193 if ( test_alu->isOn() )
189 { 194 {
190 int d = round( dhry_main( DHRYSTONE_RUNS ) ); 195 int d = round( dhry_main( DHRYSTONE_RUNS ) );
191 test_alu->setText( 1, QString( "%1 dhrys" ).arg( QString::number( d ) ) ); 196 test_alu->setText( 1, QString( "%1 dhrys" ).arg( QString::number( d ) ) );
192 test_alu->setOn( false ); 197 test_alu->setOn( false );
193 } 198 }
194 199
195 if ( test_fpu->isOn() ) 200 if ( test_fpu->isOn() )
196 { 201 {
197 t.start(); 202 t.start();
198 BenchFFT(); 203 BenchFFT();
199 test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); 204 test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) );
200 test_fpu->setOn( false ); 205 test_fpu->setOn( false );
201 } 206 }
202 207
203 if ( test_txt->isOn() ) 208 if ( test_txt->isOn() )
204 { 209 {
205 int value = textRendering( TEST_DURATION ); 210 int value = textRendering( TEST_DURATION );
206 test_txt->setText( 1, QString( "%1 chars/sec" ).arg( QString::number( value / TEST_DURATION ) ) ); 211 test_txt->setText( 1, QString( "%1 chars/sec" ).arg( QString::number( value / TEST_DURATION ) ) );
207 test_txt->setOn( false ); 212 test_txt->setOn( false );
208 } 213 }
209 214
210 if ( test_gfx->isOn() ) 215 if ( test_gfx->isOn() )
211 { 216 {
212 int value = gfxRendering( TEST_DURATION ); 217 int value = gfxRendering( TEST_DURATION );
213 test_gfx->setText( 1, QString( "%1 gops/sec" ).arg( QString::number( value / 4 / TEST_DURATION ) ) ); // 4 tests 218 test_gfx->setText( 1, QString( "%1 gops/sec" ).arg( QString::number( value / 4 / TEST_DURATION ) ) ); // 4 tests
214 test_gfx->setOn( false ); 219 test_gfx->setOn( false );
215 } 220 }
216 221
217 if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA 222 if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA
218 { 223 {
219 performFileTest( "/tmp/benchmarkFile.dat", test_ram ); 224 performFileTest( "/tmp/benchmarkFile.dat", test_ram );
220 } 225 }
221 226
222 if ( test_cf->isOn() ) 227 if ( test_cf->isOn() )
223 { 228 {
224 OStorageInfo storage; 229 OStorageInfo storage;
225 performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf ); 230 performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf );
226 } 231 }
227 232
228 if ( test_sd->isOn() ) 233 if ( test_sd->isOn() )
229 { 234 {
230 OStorageInfo storage; 235 OStorageInfo storage;
231 performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd ); 236 performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd );
232 } 237 }
233 238
234 startButton->setText( tr( "&Start Tests!" ) ); 239 startButton->setText( tr( "&Start Tests!" ) );
235} 240}
236 241
237 242
238int BenchmarkInfo::textRendering( int seconds ) 243int BenchmarkInfo::textRendering( int seconds )
239{ 244{
240 QTime t; 245 QTime t;
241 t.start(); 246 t.start();
242 int stop = t.elapsed() + seconds * 1000; 247 int stop = t.elapsed() + seconds * 1000;
243 248
244 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; 249 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 };
245 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; 250 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 };
246 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; 251 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 };
247 const QString text( "Opie Benchmark Test" ); 252 const QString text( "Opie Benchmark Test" );
248 253
249 int w = QApplication::desktop()->width(); 254 int w = QApplication::desktop()->width();
250 int h = QApplication::desktop()->height(); 255 int h = QApplication::desktop()->height();
251 256
252 srand( time( NULL ) ); 257 srand( time( NULL ) );
253 258
254 BenchmarkPaintWidget bpw; 259 BenchmarkPaintWidget bpw;
255 260
256 int loops = 0; 261 int loops = 0;
257 262
258 while ( t.elapsed() < stop ) 263 while ( t.elapsed() < stop )
259 { 264 {
260 int k = rand() % 9; 265 int k = rand() % 9;
261 int s = rand() % 100; 266 int s = rand() % 100;
262 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 267 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
263 bpw.p.setFont( QFont( "Vera", s ) ); 268 bpw.p.setFont( QFont( "Vera", s ) );
264 bpw.p.drawText( rand() % w, rand() % h, text, text.length() ); 269 bpw.p.drawText( rand() % w, rand() % h, text, text.length() );
265 ++loops; 270 ++loops;
266 } 271 }
267 272
268 return loops * text.length(); 273 return loops * text.length();
269} 274}
270 275
271int BenchmarkInfo::gfxRendering( int seconds ) 276int BenchmarkInfo::gfxRendering( int seconds )
272{ 277{
273 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 }; 278 int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 };
274 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 }; 279 int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 };
275 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 }; 280 int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 };
276 281
277 int w = QApplication::desktop()->width(); 282 int w = QApplication::desktop()->width();
278 int h = QApplication::desktop()->height(); 283 int h = QApplication::desktop()->height();
279 284
280 srand( time( NULL ) ); 285 srand( time( NULL ) );
281 286
282 BenchmarkPaintWidget bpw; 287 BenchmarkPaintWidget bpw;
283 288
284 QTime t; 289 QTime t;
285 t.start(); 290 t.start();
286 int stop = t.elapsed() + seconds*1000; 291 int stop = t.elapsed() + seconds*1000;
287 int loops = 0; 292 int loops = 0;
288 293
289 while ( t.elapsed() < stop ) 294 while ( t.elapsed() < stop )
290 { 295 {
291 int k = rand() % 9; 296 int k = rand() % 9;
292 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 297 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
293 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h ); 298 bpw.p.drawLine( rand()%w, rand()%h, rand()%w, rand()%h );
294 ++loops; 299 ++loops;
295 } 300 }
296 301
297 t.restart(); 302 t.restart();
298 stop = t.elapsed() + seconds*1000; 303 stop = t.elapsed() + seconds*1000;
299 304
300 while ( t.elapsed() < stop ) 305 while ( t.elapsed() < stop )
301 { 306 {
302 int k = rand() % 9; 307 int k = rand() % 9;
303 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 308 bpw.p.setPen( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
304 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 ); 309 bpw.p.drawArc( rand()%w, rand()%h, rand()%w, rand()%h, 360 * 16, 360 * 16 );
305 ++loops; 310 ++loops;
306 } 311 }
307 312
308 QBrush br1; 313 QBrush br1;
309 br1.setStyle( SolidPattern ); 314 br1.setStyle( SolidPattern );
310 t.restart(); 315 t.restart();
311 stop = t.elapsed() + seconds*1000; 316 stop = t.elapsed() + seconds*1000;
312 317
313 while ( t.elapsed() < stop ) 318 while ( t.elapsed() < stop )
314 { 319 {
315 int k = rand() % 9; 320 int k = rand() % 9;
316 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) ); 321 br1.setColor( QColor( rr[ k ], gg[ k ], bb[ k ] ) );
317 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 ); 322 bpw.p.fillRect( rand()%w, rand()%h, rand()%w, rand()%h, br1 );
318 ++loops; 323 ++loops;
319 } 324 }
320 325
321 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" ); 326 QPixmap p = Resource::loadPixmap( "sysinfo/pattern" );
322 t.restart(); 327 t.restart();
323 stop = t.elapsed() + seconds*1000; 328 stop = t.elapsed() + seconds*1000;
324 329
325 while ( t.elapsed() < stop ) 330 while ( t.elapsed() < stop )
326 { 331 {
327 bpw.p.drawPixmap( rand()%w, rand()%h, p ); 332 bpw.p.drawPixmap( rand()%w, rand()%h, p );
328 ++loops; 333 ++loops;
329 } 334 }
330 335
331 return loops; 336 return loops;
332 337
333} 338}
334 339
335void BenchmarkInfo::performFileTest( const QString& fname, QCheckListItem* item ) 340void BenchmarkInfo::performFileTest( const QString& fname, OCheckListItem* item )
336{ 341{
337 QTime time; 342 QTime time;
338 time.start(); 343 time.start();
339 if ( writeFile( fname ) && 344 if ( writeFile( fname ) &&
340 readFile( fname ) ) 345 readFile( fname ) )
341 { 346 {
342 QFile::remove( fname ); 347 QFile::remove( fname );
343 item->setText( 1, QString( "%1 kb/sec" ).arg( QString::number( 1024.0 / ( time.elapsed() / 1000.0 ) ) ) ); 348 item->setText( 1, QString( "%1 kb/sec" ).arg( QString::number( 1024.0 / ( time.elapsed() / 1000.0 ) ) ) );
344 item->setOn( false ); 349 item->setOn( false );
345 } 350 }
346 else 351 else
347 { 352 {
348 item->setText( 1, tr( "error" ) ); 353 item->setText( 1, tr( "error" ) );
349 } 354 }
350} 355}
351 356
352char FileBuf[ BUFF_SIZE + 1 ]; 357char FileBuf[ BUFF_SIZE + 1 ];
353 358
354bool BenchmarkInfo::writeFile( const QString& w_path ) 359bool BenchmarkInfo::writeFile( const QString& w_path )
355{ 360{
356 int i; 361 int i;
357 int k; 362 int k;
358 int n; 363 int n;
359 int pos; 364 int pos;
360 int len; 365 int len;
361 char *data = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 62 366 char *data = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 62
362 367
363 368
364 // /*------------------------------------ 369 // /*------------------------------------
365 int w_len; 370 int w_len;
366 371
367 QFile writeFile( w_path ); 372 QFile writeFile( w_path );
368 srand( time( NULL ) ); 373 srand( time( NULL ) );
369 374
370 for ( n = 0 ; n < 20 ; n++ ) 375 for ( n = 0 ; n < 20 ; n++ )
371 { 376 {
372 if ( ! writeFile.open( IO_WriteOnly ) ) 377 if ( ! writeFile.open( IO_WriteOnly ) )
373 { 378 {
374 writeFile.close(); 379 writeFile.close();
375 writeFile.remove(); 380 writeFile.remove();
376 return ( false ); 381 return ( false );
377 } 382 }
378 // ------------------------------------------ sequential write 383 // ------------------------------------------ sequential write
379 for ( k = 0 ; k < 256 ; k++ ) 384 for ( k = 0 ; k < 256 ; k++ )
380 { 385 {
381 n = rand() % 30; 386 n = rand() % 30;
382 memcpy( &FileBuf[ k * 32 ], &data[ n ], 32 ); 387 memcpy( &FileBuf[ k * 32 ], &data[ n ], 32 );
383 } 388 }
384 389
385 for ( i = 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ ) 390 for ( i = 0 ; i < FILE_SIZE / BUFF_SIZE ; i++ )
386 { 391 {
387 w_len = writeFile.writeBlock( FileBuf, BUFF_SIZE ); 392 w_len = writeFile.writeBlock( FileBuf, BUFF_SIZE );
388 if ( w_len != BUFF_SIZE ) 393 if ( w_len != BUFF_SIZE )
389 { 394 {
390 writeFile.close(); 395 writeFile.close();
391 writeFile.remove(); 396 writeFile.remove();
392 return ( false ); 397 return ( false );
393 } 398 }
394 writeFile.flush(); 399 writeFile.flush();
395 } 400 }
396 // ------------------------------------------ random write 401 // ------------------------------------------ random write
397 for ( i = 0 ; i < 400 ; i++ ) 402 for ( i = 0 ; i < 400 ; i++ )
398 { 403 {
399 len = rand() % 90 + 4000; 404 len = rand() % 90 + 4000;
400 for ( k = 0 ; k < 128 ; k++ ) 405 for ( k = 0 ; k < 128 ; k++ )
401 { 406 {
402 n = rand() % 30; 407 n = rand() % 30;
403 memcpy( &FileBuf[ k * 8 ], &data[ n ], 32 ); 408 memcpy( &FileBuf[ k * 8 ], &data[ n ], 32 );
404 } 409 }
405 pos = rand() % ( FILE_SIZE - BUFF_SIZE ); 410 pos = rand() % ( FILE_SIZE - BUFF_SIZE );
406 411
407 writeFile.at( pos ); 412 writeFile.at( pos );
408 w_len = writeFile.writeBlock( FileBuf, len ); 413 w_len = writeFile.writeBlock( FileBuf, len );
409 if ( w_len != len ) 414 if ( w_len != len )
410 { 415 {
411 writeFile.close(); 416 writeFile.close();
412 writeFile.remove(); 417 writeFile.remove();
413 return ( false ); 418 return ( false );
414 } 419 }
415 writeFile.flush(); 420 writeFile.flush();
416 } 421 }
417 writeFile.close(); 422 writeFile.close();
418 } 423 }
419 return ( true ); 424 return ( true );
420 425
421} 426}
422 427
423 428
424bool BenchmarkInfo::readFile( const QString& r_path ) 429bool BenchmarkInfo::readFile( const QString& r_path )
425{ 430{
426 int i; 431 int i;
427 int k; 432 int k;
428 int len; 433 int len;
429 int pos; 434 int pos;
430 int r_len; 435 int r_len;
431 436
diff --git a/noncore/settings/sysinfo/benchmarkinfo.h b/noncore/settings/sysinfo/benchmarkinfo.h
index d143602..c3d44ec 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.h
+++ b/noncore/settings/sysinfo/benchmarkinfo.h
@@ -1,69 +1,69 @@
1/********************************************************************** 1/**********************************************************************
2** BenchmarkInfo 2** BenchmarkInfo
3** 3**
4** A benchmark for Qt/Embedded 4** A benchmark 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 <qwidget.h> 19#include <qwidget.h>
20#include <qdialog.h> 20#include <qdialog.h>
21#include <qdict.h> 21#include <qdict.h>
22#include <qstringlist.h> 22#include <qstringlist.h>
23 23
24class QClipboard; 24class QClipboard;
25class QComboBox; 25class QComboBox;
26class QCheckListItem; 26class OCheckListItem;
27class QPushButton; 27class QPushButton;
28class QListView; 28class OListView;
29 29
30class BenchmarkInfo : public QWidget 30class BenchmarkInfo : public QWidget
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33 33
34public: 34public:
35 BenchmarkInfo( QWidget *parent = 0, const char *name = 0, int wFlags = 0 ); 35 BenchmarkInfo( QWidget *parent = 0, const char *name = 0, int wFlags = 0 );
36 ~BenchmarkInfo(); 36 ~BenchmarkInfo();
37 37
38 QCheckListItem* test_alu; 38 OCheckListItem* test_alu;
39 QCheckListItem* test_fpu; 39 OCheckListItem* test_fpu;
40 QCheckListItem* test_txt; 40 OCheckListItem* test_txt;
41 QCheckListItem* test_gfx; 41 OCheckListItem* test_gfx;
42 QCheckListItem* test_ram; 42 OCheckListItem* test_ram;
43 QCheckListItem* test_sd; 43 OCheckListItem* test_sd;
44 QCheckListItem* test_cf; 44 OCheckListItem* test_cf;
45 45
46 bool main_rd; 46 bool main_rd;
47 bool main_wt; 47 bool main_wt;
48 bool sd_rd; 48 bool sd_rd;
49 bool sd_wt; 49 bool sd_wt;
50 bool cf_rd; 50 bool cf_rd;
51 bool cf_wt; 51 bool cf_wt;
52 52
53 QClipboard* clb; 53 QClipboard* clb;
54 QComboBox* machineCombo; 54 QComboBox* machineCombo;
55 QListView* tests; 55 OListView* tests;
56 QPushButton* startButton; 56 QPushButton* startButton;
57 QDict <QStringList> machines; 57 QDict <QStringList> machines;
58 58
59 int textRendering( int ); 59 int textRendering( int );
60 int gfxRendering( int ); 60 int gfxRendering( int );
61 void performFileTest( const QString& fname, QCheckListItem* item ); 61 void performFileTest( const QString& fname, OCheckListItem* item );
62 62
63private slots: 63private slots:
64 bool writeFile( const QString& ); 64 bool writeFile( const QString& );
65 bool readFile( const QString& ); 65 bool readFile( const QString& );
66 void run(); 66 void run();
67 void machineActivated( int ); 67 void machineActivated( int );
68}; 68};
69 69
diff --git a/noncore/settings/sysinfo/detail.cpp b/noncore/settings/sysinfo/detail.cpp
index 79daa2b..6645fdd 100644
--- a/noncore/settings/sysinfo/detail.cpp
+++ b/noncore/settings/sysinfo/detail.cpp
@@ -1,44 +1,42 @@
1/********************************************************************** 1/**********************************************************************
2** Detail 2** Detail
3** 3**
4** Display module information 4** Display module information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org> 10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "detail.h" 22#include "detail.h"
23 23
24#include <sys/types.h> 24#include <qtextview.h>
25#include <stdio.h>
26
27#include <qlayout.h> 25#include <qlayout.h>
28 26
29Detail::Detail( QWidget* parent, const char* name, WFlags ) 27Detail::Detail( QWidget* parent, const char* name, WFlags )
30 : QWidget( parent, name, WStyle_ContextHelp ) 28 : QWidget( parent, name, WStyle_ContextHelp )
31{ 29{
32 QVBoxLayout *layout = new QVBoxLayout( this ); 30 QVBoxLayout *layout = new QVBoxLayout( this );
33 31
34 detailView = new QTextView( this ); 32 detailView = new QTextView( this );
35 detailView->setTextFormat( PlainText ); 33 detailView->setTextFormat( PlainText );
36 34
37 layout->addWidget( detailView ); 35 layout->addWidget( detailView );
38} 36}
39 37
40Detail::~Detail() 38Detail::~Detail()
41{ 39{
42} 40}
43 41
44 42
diff --git a/noncore/settings/sysinfo/detail.h b/noncore/settings/sysinfo/detail.h
index 7ca9d45..71d3e3a 100644
--- a/noncore/settings/sysinfo/detail.h
+++ b/noncore/settings/sysinfo/detail.h
@@ -1,42 +1,40 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesDetail 2** ModulesDetail
3** 3**
4** Display module information 4** Display module information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org> 10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef DETAIL_H 22#ifndef DETAIL_H
23#define DETAIL_H 23#define DETAIL_H
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qcombo.h> 26
27#include <qtextview.h> 27class QTextView;
28#include <qpushbutton.h>
29#include <qlistview.h>
30 28
31class Detail : public QWidget 29class Detail : public QWidget
32{ 30{
33 Q_OBJECT 31 Q_OBJECT
34 32
35public: 33public:
36 Detail( QWidget * = 0x0, const char * = 0x0, WFlags = 0 ); 34 Detail( QWidget * = 0x0, const char * = 0x0, WFlags = 0 );
37 ~Detail(); 35 ~Detail();
38 36
39 QTextView* detailView; 37 QTextView* detailView;
40}; 38};
41 39
42#endif // DETAIL_H 40#endif // DETAIL_H
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index e688a29..dfe48e1 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -1,190 +1,194 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesInfo 2** ModulesInfo
3** 3**
4** Display Modules information 4** Display Modules information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> 10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "modulesinfo.h" 22#include "modulesinfo.h"
23#include "detail.h" 23#include "detail.h"
24 24
25/* OPIE */ 25/* OPIE */
26#include <opie2/olistview.h>
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
27 28
28/* QT */ 29/* QT */
30#include <qcombobox.h>
29#include <qfile.h> 31#include <qfile.h>
30#include <qlayout.h> 32#include <qlayout.h>
31#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qpushbutton.h>
35#include <qtextview.h>
32#include <qtimer.h> 36#include <qtimer.h>
33#include <qwhatsthis.h> 37#include <qwhatsthis.h>
34 38
35ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 39ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
36 : QWidget( parent, name, fl ) 40 : QWidget( parent, name, fl )
37{ 41{
38 QGridLayout *layout = new QGridLayout( this ); 42 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 4 ); 43 layout->setSpacing( 4 );
40 layout->setMargin( 4 ); 44 layout->setMargin( 4 );
41 45
42 ModulesView = new QListView( this ); 46 ModulesView = new OListView( this );
43 int colnum = ModulesView->addColumn( tr( "Module" ) ); 47 int colnum = ModulesView->addColumn( tr( "Module" ) );
44 colnum = ModulesView->addColumn( tr( "Size" ) ); 48 colnum = ModulesView->addColumn( tr( "Size" ) );
45 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 49 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
46 colnum = ModulesView->addColumn( tr( "Use#" ) ); 50 colnum = ModulesView->addColumn( tr( "Use#" ) );
47 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 51 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
48 colnum = ModulesView->addColumn( tr( "Used by" ) ); 52 colnum = ModulesView->addColumn( tr( "Used by" ) );
49 ModulesView->setAllColumnsShowFocus( TRUE ); 53 ModulesView->setAllColumnsShowFocus( TRUE );
50 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); 54 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
51 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); 55 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) );
52 56
53 // Test if we have /sbin/modinfo, and if so, allow module detail window 57 // Test if we have /sbin/modinfo, and if so, allow module detail window
54 if ( QFile::exists( "/sbin/modinfo" ) ) 58 if ( QFile::exists( "/sbin/modinfo" ) )
55 { 59 {
56 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 60 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
57 connect( ModulesView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), 61 connect( ModulesView, SIGNAL( rightButtonPressed(OListViewItem*,const QPoint&,int) ),
58 this, SLOT( viewModules(QListViewItem*) ) ); 62 this, SLOT( viewModules(OListViewItem*) ) );
59 } 63 }
60 64
61 CommandCB = new QComboBox( FALSE, this ); 65 CommandCB = new QComboBox( FALSE, this );
62 CommandCB->insertItem( "modprobe -r" ); 66 CommandCB->insertItem( "modprobe -r" );
63 CommandCB->insertItem( "rmmod" ); 67 CommandCB->insertItem( "rmmod" );
64 // I can't think of other useful commands yet. Anyone? 68 // I can't think of other useful commands yet. Anyone?
65 layout->addWidget( CommandCB, 1, 0 ); 69 layout->addWidget( CommandCB, 1, 0 );
66 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) ); 70 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) );
67 71
68 QPushButton *btn = new QPushButton( this ); 72 QPushButton *btn = new QPushButton( this );
69 btn->setMinimumSize( QSize( 50, 24 ) ); 73 btn->setMinimumSize( QSize( 50, 24 ) );
70 btn->setMaximumSize( QSize( 50, 24 ) ); 74 btn->setMaximumSize( QSize( 50, 24 ) );
71 btn->setText( tr( "Send" ) ); 75 btn->setText( tr( "Send" ) );
72 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 76 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
73 layout->addWidget( btn, 1, 1 ); 77 layout->addWidget( btn, 1, 1 );
74 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) ); 78 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) );
75 79
76 QTimer *t = new QTimer( this ); 80 QTimer *t = new QTimer( this );
77 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 81 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
78 t->start( 5000 ); 82 t->start( 5000 );
79 83
80 updateData(); 84 updateData();
81 85
82 ModulesDtl = new Detail(); 86 ModulesDtl = new Detail();
83 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) ); 87 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
84} 88}
85 89
86ModulesInfo::~ModulesInfo() 90ModulesInfo::~ModulesInfo()
87{} 91{}
88 92
89void ModulesInfo::updateData() 93void ModulesInfo::updateData()
90{ 94{
91 char modname[64]; 95 char modname[64];
92 char usage[200]; 96 char usage[200];
93 int modsize, usecount; 97 int modsize, usecount;
94 98
95 QString selectedmod; 99 QString selectedmod;
96 QListViewItem *curritem = ModulesView->currentItem(); 100 OListViewItem *curritem = static_cast<OListViewItem*>( ModulesView->currentItem() );
97 if ( curritem ) 101 if ( curritem )
98 { 102 {
99 selectedmod = curritem->text( 0 ); 103 selectedmod = curritem->text( 0 );
100 } 104 }
101 105
102 ModulesView->clear(); 106 ModulesView->clear();
103 107
104 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 108 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
105 109
106 if ( procfile ) 110 if ( procfile )
107 { 111 {
108 QListViewItem *newitem; 112 OListViewItem *newitem;
109 QListViewItem *selecteditem = 0x0; 113 OListViewItem *selecteditem = 0x0;
110 while ( true ) 114 while ( true )
111 { 115 {
112 modname[0] = '\0'; 116 modname[0] = '\0';
113 usage[0] = '\0'; 117 usage[0] = '\0';
114 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 118 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
115 119
116 if ( success == EOF ) 120 if ( success == EOF )
117 break; 121 break;
118 122
119 QString qmodname = QString( modname ); 123 QString qmodname = QString( modname );
120 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 124 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
121 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 125 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
122 QString qusage = QString( usage ); 126 QString qusage = QString( usage );
123 127
124 newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 128 newitem = new OListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
125 if ( qmodname == selectedmod ) 129 if ( qmodname == selectedmod )
126 { 130 {
127 selecteditem = newitem; 131 selecteditem = newitem;
128 } 132 }
129 } 133 }
130 ModulesView->setCurrentItem( selecteditem ); 134 ModulesView->setCurrentItem( selecteditem );
131 135
132 fclose( procfile ); 136 fclose( procfile );
133 } 137 }
134} 138}
135 139
136void ModulesInfo::slotSendClicked() 140void ModulesInfo::slotSendClicked()
137{ 141{
138 if ( !ModulesView->currentItem() ) 142 if ( !ModulesView->currentItem() )
139 { 143 {
140 return; 144 return;
141 } 145 }
142 146
143 QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() ); 147 QString capstr = tr( "You really want to execute\n%1 for this module?" ).arg( CommandCB->currentText() );
144 148
145 QString modname = ModulesView->currentItem()->text( 0 ); 149 QString modname = ModulesView->currentItem()->text( 0 );
146 150
147 if ( QMessageBox::warning( this, modname, capstr, 151 if ( QMessageBox::warning( this, modname, capstr,
148 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 152 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
149 { 153 {
150 QString command = "/sbin/"; 154 QString command = "/sbin/";
151 command.append( CommandCB->currentText() ); 155 command.append( CommandCB->currentText() );
152 command.append( " " ); 156 command.append( " " );
153 command.append( modname ); 157 command.append( modname );
154 158
155 FILE* stream = popen( command, "r" ); 159 FILE* stream = popen( command, "r" );
156 if ( stream ) 160 if ( stream )
157 pclose( stream ); 161 pclose( stream );
158 } 162 }
159 163
160} 164}
161 165
162void ModulesInfo::viewModules( QListViewItem *modules ) 166void ModulesInfo::viewModules( OListViewItem *modules )
163{ 167{
164 QString modname = modules->text( 0 ); 168 QString modname = modules->text( 0 );
165 QString capstr = "Module: "; 169 QString capstr = "Module: ";
166 capstr.append( modname ); 170 capstr.append( modname );
167 ModulesDtl->setCaption( capstr ); 171 ModulesDtl->setCaption( capstr );
168 QString command = "/sbin/modinfo "; 172 QString command = "/sbin/modinfo ";
169 command.append( modname ); 173 command.append( modname );
170 FILE* modinfo = popen( command, "r" ); 174 FILE* modinfo = popen( command, "r" );
171 175
172 if ( modinfo ) 176 if ( modinfo )
173 { 177 {
174 char line[200]; 178 char line[200];
175 ModulesDtl->detailView->setText( " Details:\n------------\n" ); 179 ModulesDtl->detailView->setText( " Details:\n------------\n" );
176 180
177 while( true ) 181 while( true )
178 { 182 {
179 int success = fscanf( modinfo, "%[^\n]\n", line ); 183 int success = fscanf( modinfo, "%[^\n]\n", line );
180 if ( success == EOF ) 184 if ( success == EOF )
181 break; 185 break;
182 ModulesDtl->detailView->append( line ); 186 ModulesDtl->detailView->append( line );
183 } 187 }
184 188
185 pclose( modinfo ); 189 pclose( modinfo );
186 } 190 }
187 191
188 QPEApplication::showWidget( ModulesDtl ); 192 QPEApplication::showWidget( ModulesDtl );
189} 193}
190 194
diff --git a/noncore/settings/sysinfo/modulesinfo.h b/noncore/settings/sysinfo/modulesinfo.h
index e974610..78dce73 100644
--- a/noncore/settings/sysinfo/modulesinfo.h
+++ b/noncore/settings/sysinfo/modulesinfo.h
@@ -1,51 +1,51 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesInfo 2** ModulesInfo
3** 3**
4** Display modules information 4** Display modules information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> 10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef MODULESINFO_H 22#ifndef MODULESINFO_H
23#define MODULESINFO_H 23#define MODULESINFO_H
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26 26
27class Detail; 27class Detail;
28class QComboBox; 28class QComboBox;
29class QListView; 29class OListView;
30class QListViewItem; 30class OListViewItem;
31 31
32class ModulesInfo : public QWidget 32class ModulesInfo : public QWidget
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 ModulesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 36 ModulesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
37 ~ModulesInfo(); 37 ~ModulesInfo();
38 38
39private: 39private:
40 QListView* ModulesView; 40 OListView* ModulesView;
41 QComboBox* CommandCB; 41 QComboBox* CommandCB;
42 42
43 Detail* ModulesDtl; 43 Detail* ModulesDtl;
44 44
45private slots: 45private slots:
46 void updateData(); 46 void updateData();
47 void slotSendClicked(); 47 void slotSendClicked();
48 void viewModules( QListViewItem * ); 48 void viewModules( OListViewItem * );
49}; 49};
50 50
51#endif 51#endif
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 69b4ab5..dd9a05d 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -1,202 +1,206 @@
1/********************************************************************** 1/**********************************************************************
2** ProcessInfo 2** ProcessInfo
3** 3**
4** Display process information 4** Display process information
5** 5**
6** Copyright (C) 2002, Dan Williams 6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org 7** williamsdr@acm.org
8** http://draknor.net 8** http://draknor.net
9** 9**
10** This file may be distributed and/or modified under the terms of the 10** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software 11** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the 12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file. 13** packaging of this file.
14** 14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#include "processinfo.h" 20#include "processinfo.h"
21#include "detail.h" 21#include "detail.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/olistview.h>
24#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
25 26
26/* QT */ 27/* QT */
28#include <qcombobox.h>
27#include <qdir.h> 29#include <qdir.h>
28#include <qlayout.h> 30#include <qlayout.h>
29#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qpushbutton.h>
33#include <qtextview.h>
30#include <qtimer.h> 34#include <qtimer.h>
31#include <qwhatsthis.h> 35#include <qwhatsthis.h>
32 36
33/* STD */ 37/* STD */
34#include <sys/types.h> 38#include <sys/types.h>
35#include <signal.h> 39#include <signal.h>
36 40
37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 41ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
38 : QWidget( parent, name, fl ) 42 : QWidget( parent, name, fl )
39{ 43{
40 QGridLayout *layout = new QGridLayout( this ); 44 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 ); 45 layout->setSpacing( 4 );
42 layout->setMargin( 4 ); 46 layout->setMargin( 4 );
43 47
44 48
45 ProcessView = new QListView( this, "ProcessView" ); 49 ProcessView = new OListView( this, "ProcessView" );
46 int colnum = ProcessView->addColumn( tr( "PID" ) ); 50 int colnum = ProcessView->addColumn( tr( "PID" ) );
47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
48 colnum = ProcessView->addColumn( tr( "Command" ),96 ); 52 colnum = ProcessView->addColumn( tr( "Command" ),96 );
49 colnum = ProcessView->addColumn( tr( "Status" ) ); 53 colnum = ProcessView->addColumn( tr( "Status" ) );
50 colnum = ProcessView->addColumn( tr( "Time" ) ); 54 colnum = ProcessView->addColumn( tr( "Time" ) );
51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 55 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
52 ProcessView->setAllColumnsShowFocus( TRUE ); 56 ProcessView->setAllColumnsShowFocus( TRUE );
53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); 57 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
54 connect( ProcessView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), 58 connect( ProcessView, SIGNAL( rightButtonPressed(OListViewItem*,const QPoint&,int) ),
55 this, SLOT( viewProcess(QListViewItem*) ) ); 59 this, SLOT( viewProcess(OListViewItem*) ) );
56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); 60 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
57 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) ); 61 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) );
58 62
59 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 63 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
60 SignalCB->insertItem( " 1: SIGHUP" ); 64 SignalCB->insertItem( " 1: SIGHUP" );
61 SignalCB->insertItem( " 2: SIGINT" ); 65 SignalCB->insertItem( " 2: SIGINT" );
62 SignalCB->insertItem( " 3: SIGQUIT" ); 66 SignalCB->insertItem( " 3: SIGQUIT" );
63 SignalCB->insertItem( " 5: SIGTRAP" ); 67 SignalCB->insertItem( " 5: SIGTRAP" );
64 SignalCB->insertItem( " 6: SIGABRT" ); 68 SignalCB->insertItem( " 6: SIGABRT" );
65 SignalCB->insertItem( " 9: SIGKILL" ); 69 SignalCB->insertItem( " 9: SIGKILL" );
66 SignalCB->insertItem( "14: SIGALRM" ); 70 SignalCB->insertItem( "14: SIGALRM" );
67 SignalCB->insertItem( "15: SIGTERM" ); 71 SignalCB->insertItem( "15: SIGTERM" );
68 SignalCB->insertItem( "18: SIGCONT" ); 72 SignalCB->insertItem( "18: SIGCONT" );
69 SignalCB->insertItem( "19: SIGSTOP" ); 73 SignalCB->insertItem( "19: SIGSTOP" );
70 layout->addWidget( SignalCB, 1, 0 ); 74 layout->addWidget( SignalCB, 1, 0 );
71 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); 75 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
72 76
73 SendButton = new QPushButton( this, "SendButton" ); 77 SendButton = new QPushButton( this, "SendButton" );
74 SendButton->setMinimumSize( QSize( 50, 24 ) ); 78 SendButton->setMinimumSize( QSize( 50, 24 ) );
75 SendButton->setMaximumSize( QSize( 50, 24 ) ); 79 SendButton->setMaximumSize( QSize( 50, 24 ) );
76 SendButton->setText( tr( "Send" ) ); 80 SendButton->setText( tr( "Send" ) );
77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 81 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
78 layout->addWidget( SendButton, 1, 1 ); 82 layout->addWidget( SendButton, 1, 1 );
79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); 83 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
80 84
81 QTimer *t = new QTimer( this ); 85 QTimer *t = new QTimer( this );
82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 86 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
83 t->start( 5000 ); 87 t->start( 5000 );
84 88
85 updateData(); 89 updateData();
86 90
87 ProcessDtl = new Detail(); 91 ProcessDtl = new Detail();
88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) ); 92 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
89} 93}
90 94
91ProcessInfo::~ProcessInfo() 95ProcessInfo::~ProcessInfo()
92{} 96{}
93 97
94void ProcessInfo::updateData() 98void ProcessInfo::updateData()
95{ 99{
96 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 100 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
97 signal, blocked, sigignore, sigcatch; 101 signal, blocked, sigignore, sigcatch;
98 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, 102 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
99 endcode, startstack, kstkesp, kstkeip, wchan; 103 endcode, startstack, kstkesp, kstkeip, wchan;
100 char state; 104 char state;
101 char comm[64]; 105 char comm[64];
102 106
103 QString selectedpid; 107 QString selectedpid;
104 QListViewItem *curritem = ProcessView->currentItem(); 108 OListViewItem *curritem = static_cast<OListViewItem*>( ProcessView->currentItem() );
105 if ( curritem ) 109 if ( curritem )
106 { 110 {
107 selectedpid = curritem->text( 0 ); 111 selectedpid = curritem->text( 0 );
108 } 112 }
109 113
110 ProcessView->clear(); 114 ProcessView->clear();
111 115
112 QListViewItem *newitem; 116 OListViewItem *newitem;
113 QListViewItem *selecteditem = 0x0; 117 OListViewItem *selecteditem = 0x0;
114 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); 118 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
115 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); 119 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
116 if ( proclist ) 120 if ( proclist )
117 { 121 {
118 QFileInfoListIterator it(*proclist); 122 QFileInfoListIterator it(*proclist);
119 QFileInfo *f; 123 QFileInfo *f;
120 while ( ( f = it.current() ) != 0 ) 124 while ( ( f = it.current() ) != 0 )
121 { 125 {
122 ++it; 126 ++it;
123 QString processnum = f->fileName(); 127 QString processnum = f->fileName();
124 if ( processnum >= "1" && processnum <= "99999" ) 128 if ( processnum >= "1" && processnum <= "99999" )
125 { 129 {
126 FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); 130 FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r");
127 131
128 if ( procfile ) 132 if ( procfile )
129 { 133 {
130 fscanf( procfile, 134 fscanf( procfile,
131 "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u", 135 "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u",
132 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, 136 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt,
133 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, 137 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout,
134 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, 138 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
135 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); 139 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
136 processnum = processnum.rightJustify( 5, ' ' ); 140 processnum = processnum.rightJustify( 5, ' ' );
137 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); 141 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
138 QString processstatus = QChar(state); 142 QString processstatus = QChar(state);
139 QString processtime = QString::number( ( utime + stime ) / 100 ); 143 QString processtime = QString::number( ( utime + stime ) / 100 );
140 processtime = processtime.rightJustify( 9, ' ' ); 144 processtime = processtime.rightJustify( 9, ' ' );
141 fclose( procfile ); 145 fclose( procfile );
142 146
143 newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); 147 newitem = new OListViewItem( ProcessView, processnum, processcmd, processstatus, processtime );
144 if ( processnum == selectedpid ) 148 if ( processnum == selectedpid )
145 { 149 {
146 selecteditem = newitem; 150 selecteditem = newitem;
147 } 151 }
148 } 152 }
149 } 153 }
150 } 154 }
151 ProcessView->setCurrentItem( selecteditem ); 155 ProcessView->setCurrentItem( selecteditem );
152 } 156 }
153 157
154 delete proclist; 158 delete proclist;
155 delete procdir; 159 delete procdir;
156} 160}
157 161
158void ProcessInfo::slotSendClicked() 162void ProcessInfo::slotSendClicked()
159{ 163{
160 QListViewItem *currprocess = ProcessView->currentItem(); 164 OListViewItem *currprocess = static_cast<OListViewItem*>( ProcessView->currentItem() );
161 if ( !currprocess ) 165 if ( !currprocess )
162 { 166 {
163 return; 167 return;
164 } 168 }
165 169
166 QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() ); 170 QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() );
167 171
168 172
169 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr, 173 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
170 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 174 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
171 { 175 {
172 currprocess = ProcessView->currentItem(); 176 currprocess = static_cast<OListViewItem*>( ProcessView->currentItem() );
173 if ( currprocess ) 177 if ( currprocess )
174 { 178 {
175 QString sigstr = SignalCB->currentText(); 179 QString sigstr = SignalCB->currentText();
176 sigstr.truncate(2); 180 sigstr.truncate(2);
177 int sigid = sigstr.toUInt(); 181 int sigid = sigstr.toUInt();
178 kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ); 182 kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid );
179 } 183 }
180 } 184 }
181 185
182} 186}
183 187
184void ProcessInfo::viewProcess( QListViewItem *process ) 188void ProcessInfo::viewProcess( OListViewItem *process )
185{ 189{
186 QString pid= process->text( 0 ).stripWhiteSpace(); 190 QString pid= process->text( 0 ).stripWhiteSpace();
187 QString command = process->text( 1 ); 191 QString command = process->text( 1 );
188 ProcessDtl->setCaption( pid + " - " + command ); 192 ProcessDtl->setCaption( pid + " - " + command );
189 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 193 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
190 if ( statfile ) 194 if ( statfile )
191 { 195 {
192 char line[81]; 196 char line[81];
193 fgets( line, 81, statfile ); 197 fgets( line, 81, statfile );
194 ProcessDtl->detailView->setText( line ); 198 ProcessDtl->detailView->setText( line );
195 while ( fgets( line, 81, statfile ) ) 199 while ( fgets( line, 81, statfile ) )
196 { 200 {
197 ProcessDtl->detailView->append( line ); 201 ProcessDtl->detailView->append( line );
198 } 202 }
199 fclose( statfile ); 203 fclose( statfile );
200 } 204 }
201 QPEApplication::showWidget( ProcessDtl ); 205 QPEApplication::showWidget( ProcessDtl );
202} 206}
diff --git a/noncore/settings/sysinfo/processinfo.h b/noncore/settings/sysinfo/processinfo.h
index 687e080..6e7acd5 100644
--- a/noncore/settings/sysinfo/processinfo.h
+++ b/noncore/settings/sysinfo/processinfo.h
@@ -1,51 +1,50 @@
1/********************************************************************** 1/**********************************************************************
2** ProcessInfo 2** ProcessInfo
3** 3**
4** Display process information 4** Display process information
5** 5**
6** Copyright (C) 2002, Dan Williams 6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org 7** williamsdr@acm.org
8** http://draknor.net 8** http://draknor.net
9** 9**
10** This file may be distributed and/or modified under the terms of the 10** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software 11** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the 12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file. 13** packaging of this file.
14** 14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#ifndef PROCESSINFO_H 20#ifndef PROCESSINFO_H
21#define PROCESSINFO_H 21#define PROCESSINFO_H
22 22
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qlistview.h>
25 24
26class Detail; 25class Detail;
27class QComboBox; 26class QComboBox;
28class QListView; 27class OListView;
29class QListViewItem; 28class OListViewItem;
30 29
31class ProcessInfo : public QWidget 30class ProcessInfo : public QWidget
32{ 31{
33 Q_OBJECT 32 Q_OBJECT
34public: 33public:
35 ProcessInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 34 ProcessInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
36 ~ProcessInfo(); 35 ~ProcessInfo();
37 36
38private: 37private:
39 QListView* ProcessView; 38 OListView* ProcessView;
40 QComboBox* SignalCB; 39 QComboBox* SignalCB;
41 QPushButton* SendButton; 40 QPushButton* SendButton;
42 41
43 Detail *ProcessDtl; 42 Detail *ProcessDtl;
44 43
45private slots: 44private slots:
46 void updateData(); 45 void updateData();
47 void slotSendClicked(); 46 void slotSendClicked();
48 void viewProcess( QListViewItem * ); 47 void viewProcess( OListViewItem * );
49}; 48};
50 49
51#endif 50#endif
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 0ebcebe..4bebd06 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,130 +1,131 @@
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"
22
23/* OPIE */
24#include <opie2/odevice.h>
21#include <qpe/resource.h> 25#include <qpe/resource.h>
22#include <qpe/version.h> 26#include <qpe/version.h>
23 27
28/* QT */
24#include <qfile.h> 29#include <qfile.h>
25#include <qlabel.h> 30#include <qlabel.h>
26#include <qlayout.h> 31#include <qlayout.h>
27#include <qscrollview.h> 32#include <qscrollview.h>
28#include <qtextstream.h> 33#include <qtextstream.h>
29#include <qwhatsthis.h> 34#include <qwhatsthis.h>
30 35
31#include "versioninfo.h"
32
33#include <opie2/odevice.h>
34
35using namespace Opie; 36using namespace Opie;
36 37
37VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 38VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
38 : QWidget( parent, name, f ) 39 : QWidget( parent, name, f )
39{ 40{
40 setMinimumSize( 200, 150 ); 41 setMinimumSize( 200, 150 );
41 42
42 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 43 QVBoxLayout *tmpvb = new QVBoxLayout( this );
43 QScrollView *sv = new QScrollView( this ); 44 QScrollView *sv = new QScrollView( this );
44 tmpvb->addWidget( sv, 0, 0 ); 45 tmpvb->addWidget( sv, 0, 0 );
45 sv->setResizePolicy( QScrollView::AutoOneFit ); 46 sv->setResizePolicy( QScrollView::AutoOneFit );
46 sv->setFrameStyle( QFrame::NoFrame ); 47 sv->setFrameStyle( QFrame::NoFrame );
47 QWidget *container = new QWidget( sv->viewport() ); 48 QWidget *container = new QWidget( sv->viewport() );
48 sv->addChild( container ); 49 sv->addChild( container );
49 50
50 QVBoxLayout *vb = new QVBoxLayout( container, 3 ); 51 QVBoxLayout *vb = new QVBoxLayout( container, 3 );
51 52
52 QString kernelVersionString; 53 QString kernelVersionString;
53 QFile file( "/proc/version" ); 54 QFile file( "/proc/version" );
54 if ( file.open( IO_ReadOnly ) ) 55 if ( file.open( IO_ReadOnly ) )
55 { 56 {
56 QTextStream t( &file ); 57 QTextStream t( &file );
57 QStringList strList; 58 QStringList strList;
58 59
59 strList = QStringList::split( " " , t.read(), false ); 60 strList = QStringList::split( " " , t.read(), false );
60 61
61 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " ); 62 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " );
62 kernelVersionString.append( strList[2] ); 63 kernelVersionString.append( strList[2] );
63 kernelVersionString.append( "<br>" ); 64 kernelVersionString.append( "<br>" );
64 kernelVersionString.append( tr( "Compiled by: " ) ); 65 kernelVersionString.append( tr( "Compiled by: " ) );
65 kernelVersionString.append( strList[3] ); 66 kernelVersionString.append( strList[3] );
66 kernelVersionString.append("</qt>"); 67 kernelVersionString.append("</qt>");
67 file.close(); 68 file.close();
68 } 69 }
69 70
70 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " ); 71 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " );
71 palmtopVersionString.append( QPE_VERSION ); 72 palmtopVersionString.append( QPE_VERSION );
72 palmtopVersionString.append( "<br>" ); 73 palmtopVersionString.append( "<br>" );
73#ifdef QPE_VENDOR 74#ifdef QPE_VENDOR
74 QString builder = QPE_VENDOR; 75 QString builder = QPE_VENDOR;
75#else 76#else
76 QString builder = "Unknown"; 77 QString builder = "Unknown";
77#endif 78#endif
78 palmtopVersionString.append( tr( "Compiled by: " ) ); 79 palmtopVersionString.append( tr( "Compiled by: " ) );
79 palmtopVersionString.append( builder ); 80 palmtopVersionString.append( builder );
80 palmtopVersionString.append( "<br>" ); 81 palmtopVersionString.append( "<br>" );
81 palmtopVersionString.append( tr( "Built on: " ) ); 82 palmtopVersionString.append( tr( "Built on: " ) );
82 palmtopVersionString.append( __DATE__ ); 83 palmtopVersionString.append( __DATE__ );
83 palmtopVersionString.append( "</qt>" ); 84 palmtopVersionString.append( "</qt>" );
84 85
85 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 86 QHBoxLayout *hb1 = new QHBoxLayout( vb );
86 hb1->setSpacing( 2 ); 87 hb1->setSpacing( 2 );
87 88
88 QLabel *palmtopLogo = new QLabel( container ); 89 QLabel *palmtopLogo = new QLabel( container );
89 QImage logo1 = Resource::loadImage( "logo/opielogo" ); 90 QImage logo1 = Resource::loadImage( "logo/opielogo" );
90 logo1 = logo1.smoothScale( 50, 55 ); 91 logo1 = logo1.smoothScale( 50, 55 );
91 QPixmap logo1Pixmap; 92 QPixmap logo1Pixmap;
92 logo1Pixmap.convertFromImage( logo1 ); 93 logo1Pixmap.convertFromImage( logo1 );
93 palmtopLogo->setPixmap( logo1Pixmap ); 94 palmtopLogo->setPixmap( logo1Pixmap );
94 palmtopLogo->setFixedSize( 60, 60 ); 95 palmtopLogo->setFixedSize( 60, 60 );
95 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 96 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
96 97
97 QLabel *palmtopVersion = new QLabel( container ); 98 QLabel *palmtopVersion = new QLabel( container );
98 palmtopVersion->setText( palmtopVersionString ); 99 palmtopVersion->setText( palmtopVersionString );
99 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 100 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
100 101
101 102
102 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 103 QHBoxLayout *hb2 = new QHBoxLayout( vb );
103 hb1->setSpacing( 2 ); 104 hb1->setSpacing( 2 );
104 105
105 QLabel *linuxLogo = new QLabel( container ); 106 QLabel *linuxLogo = new QLabel( container );
106 QImage logo2 = Resource::loadImage( "logo/tux-logo" ); 107 QImage logo2 = Resource::loadImage( "logo/tux-logo" );
107 logo2 = logo2.smoothScale( 55, 60 ); 108 logo2 = logo2.smoothScale( 55, 60 );
108 QPixmap logo2Pixmap; 109 QPixmap logo2Pixmap;
109 logo2Pixmap.convertFromImage( logo2 ); 110 logo2Pixmap.convertFromImage( logo2 );
110 linuxLogo->setPixmap( logo2Pixmap ); 111 linuxLogo->setPixmap( logo2Pixmap );
111 linuxLogo->setFixedSize( 60, 60 ); 112 linuxLogo->setFixedSize( 60, 60 );
112 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 113 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
113 114
114 QLabel *kernelVersion = new QLabel( container ); 115 QLabel *kernelVersion = new QLabel( container );
115 kernelVersion->setText( kernelVersionString ); 116 kernelVersion->setText( kernelVersionString );
116 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 117 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
117 118
118 119
119 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 120 QHBoxLayout *hb3 = new QHBoxLayout( vb );
120 hb3->setSpacing( 2 ); 121 hb3->setSpacing( 2 );
121 122
122 QLabel *palmtopLogo3 = new QLabel( container ); 123 QLabel *palmtopLogo3 = new QLabel( container );
123 124
124 OModel model = ODevice::inst()->model(); 125 OModel model = ODevice::inst()->model();
125 QString modelPixmap = "sysinfo/"; 126 QString modelPixmap = "sysinfo/";
126 if ( model == Model_Zaurus_SLC7x0 ) 127 if ( model == Model_Zaurus_SLC7x0 )
127 modelPixmap += "zaurusc700"; 128 modelPixmap += "zaurusc700";
128 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 ) 129 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 )
129 modelPixmap += "zaurus5500"; 130 modelPixmap += "zaurus5500";
130 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx ) 131 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx )