author | mickeyl <mickeyl> | 2005-07-02 12:59:06 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-07-02 12:59:06 (UTC) |
commit | 5d0de3e1d8815820cd6841e62c737b42f7fb5354 (patch) (unidiff) | |
tree | acfd3141cd487c068492ca254dce8f9e1b6ecf5b | |
parent | 094e14624d99d521af6cfc875abafcdc550a7378 (diff) | |
download | opie-5d0de3e1d8815820cd6841e62c737b42f7fb5354.zip opie-5d0de3e1d8815820cd6841e62c737b42f7fb5354.tar.gz opie-5d0de3e1d8815820cd6841e62c737b42f7fb5354.tar.bz2 |
SysInfo:
- add pcmcia device node detail view
- add input device node detail view
- grab preferred fixed font for syslog from qpe.conf
- slightly adjust tree/detail widget space ratio
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 79 | ||||
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.h | 6 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysinfo.pro | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysloginfo.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/sysinfo/sysloginfo.h | 4 |
5 files changed, 81 insertions, 16 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 4940286..76c9b79 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -22,48 +22,49 @@ _;:, .> :=|. This program is free software; you can | |||
22 | -_. . . )=. = General Public License along with | 22 | -_. . . )=. = General Public License along with |
23 | -- :-=` this application; see the file LICENSE.GPL. | 23 | -- :-=` this application; see the file LICENSE.GPL. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "devicesinfo.h" | 29 | #include "devicesinfo.h" |
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/odebug.h> | 31 | #include <opie2/odebug.h> |
32 | #include <opie2/oinputsystem.h> | 32 | #include <opie2/oinputsystem.h> |
33 | #include <opie2/opcmciasystem.h> | 33 | #include <opie2/opcmciasystem.h> |
34 | #include <opie2/olayout.h> | 34 | #include <opie2/olayout.h> |
35 | #include <opie2/olistview.h> | 35 | #include <opie2/olistview.h> |
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
38 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
39 | 39 | ||
40 | /* QT */ | 40 | /* QT */ |
41 | #include <qobjectlist.h> | 41 | #include <qobjectlist.h> |
42 | #include <qlistview.h> | 42 | #include <qlistview.h> |
43 | #include <qcombobox.h> | 43 | #include <qcombobox.h> |
44 | #include <qfile.h> | 44 | #include <qfile.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qstringlist.h> | ||
46 | #include <qtextstream.h> | 47 | #include <qtextstream.h> |
47 | #include <qtextview.h> | 48 | #include <qtextview.h> |
48 | #include <qtimer.h> | 49 | #include <qtimer.h> |
49 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
50 | 51 | ||
51 | //================================================================================================= | 52 | //================================================================================================= |
52 | DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) | 53 | DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) |
53 | :Opie::Ui::OListView( parent, name, fl ) | 54 | :Opie::Ui::OListView( parent, name, fl ) |
54 | { | 55 | { |
55 | addColumn( tr( "My Computer" ) ); | 56 | addColumn( tr( "My Computer" ) ); |
56 | setAllColumnsShowFocus( true ); | 57 | setAllColumnsShowFocus( true ); |
57 | setRootIsDecorated( true ); | 58 | setRootIsDecorated( true ); |
58 | QWhatsThis::add( this, tr( "This is a list of all the devices currently recognized on this device." ) ); | 59 | QWhatsThis::add( this, tr( "This is a list of all the devices currently recognized on this device." ) ); |
59 | 60 | ||
60 | DevicesView* root = this; | 61 | DevicesView* root = this; |
61 | ( new CpuCategory( root ) )->populate(); | 62 | ( new CpuCategory( root ) )->populate(); |
62 | ( new InputCategory( root ) )->populate(); | 63 | ( new InputCategory( root ) )->populate(); |
63 | ( new CardsCategory( root ) )->populate(); | 64 | ( new CardsCategory( root ) )->populate(); |
64 | ( new UsbCategory( root ) )->populate(); | 65 | ( new UsbCategory( root ) )->populate(); |
65 | 66 | ||
66 | connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); | 67 | connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); |
67 | } | 68 | } |
68 | 69 | ||
69 | DevicesView::~DevicesView() | 70 | DevicesView::~DevicesView() |
@@ -75,49 +76,49 @@ void DevicesView::selectionChanged( QListViewItem* item ) | |||
75 | { | 76 | { |
76 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; | 77 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; |
77 | if ( item->parent() ) | 78 | if ( item->parent() ) |
78 | { | 79 | { |
79 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); | 80 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); |
80 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); | 81 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); |
81 | } | 82 | } |
82 | else | 83 | else |
83 | { | 84 | { |
84 | odebug << "DevicesView::not a device node." << oendl; | 85 | odebug << "DevicesView::not a device node." << oendl; |
85 | } | 86 | } |
86 | } | 87 | } |
87 | 88 | ||
88 | 89 | ||
89 | //================================================================================================= | 90 | //================================================================================================= |
90 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) | 91 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) |
91 | :QWidget( parent, name, fl ), details( 0 ) | 92 | :QWidget( parent, name, fl ), details( 0 ) |
92 | { | 93 | { |
93 | layout = new OAutoBoxLayout( this ); | 94 | layout = new OAutoBoxLayout( this ); |
94 | layout->setSpacing( 2 ); | 95 | layout->setSpacing( 2 ); |
95 | layout->setMargin( 2 ); | 96 | layout->setMargin( 2 ); |
96 | view = new DevicesView( this ); | 97 | view = new DevicesView( this ); |
97 | layout->addWidget( view, 100 ); | 98 | layout->addWidget( view, 100 ); |
98 | stack = new QWidgetStack( this ); | 99 | stack = new QWidgetStack( this ); |
99 | layout->addWidget( stack, 70 ); | 100 | layout->addWidget( stack, 80 ); |
100 | } | 101 | } |
101 | 102 | ||
102 | 103 | ||
103 | DevicesInfo::~DevicesInfo() | 104 | DevicesInfo::~DevicesInfo() |
104 | { | 105 | { |
105 | } | 106 | } |
106 | 107 | ||
107 | 108 | ||
108 | void DevicesInfo::setDetailsWidget( QWidget* w ) | 109 | void DevicesInfo::setDetailsWidget( QWidget* w ) |
109 | { | 110 | { |
110 | if ( details ) | 111 | if ( details ) |
111 | { | 112 | { |
112 | qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() ); | 113 | qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() ); |
113 | stack->removeWidget( w ); | 114 | stack->removeWidget( w ); |
114 | } | 115 | } |
115 | 116 | ||
116 | stack->addWidget( details = w, 40 ); | 117 | stack->addWidget( details = w, 40 ); |
117 | stack->raiseWidget( details ); | 118 | stack->raiseWidget( details ); |
118 | } | 119 | } |
119 | 120 | ||
120 | 121 | ||
121 | //================================================================================================= | 122 | //================================================================================================= |
122 | Category::Category( DevicesView* parent, const QString& name ) | 123 | Category::Category( DevicesView* parent, const QString& name ) |
123 | :OListViewItem( parent, name ) | 124 | :OListViewItem( parent, name ) |
@@ -165,71 +166,73 @@ void CpuCategory::populate() | |||
165 | else | 166 | else |
166 | { | 167 | { |
167 | if ( dev ) dev->addInfo( line ); | 168 | if ( dev ) dev->addInfo( line ); |
168 | } | 169 | } |
169 | } | 170 | } |
170 | } | 171 | } |
171 | 172 | ||
172 | //================================================================================================= | 173 | //================================================================================================= |
173 | InputCategory::InputCategory( DevicesView* parent ) | 174 | InputCategory::InputCategory( DevicesView* parent ) |
174 | :Category( parent, "2. Input Subsystem" ) | 175 | :Category( parent, "2. Input Subsystem" ) |
175 | { | 176 | { |
176 | } | 177 | } |
177 | 178 | ||
178 | InputCategory::~InputCategory() | 179 | InputCategory::~InputCategory() |
179 | { | 180 | { |
180 | } | 181 | } |
181 | 182 | ||
182 | void InputCategory::populate() | 183 | void InputCategory::populate() |
183 | { | 184 | { |
184 | odebug << "InputCategory::populate()" << oendl; | 185 | odebug << "InputCategory::populate()" << oendl; |
185 | OInputSystem* sys = OInputSystem::instance(); | 186 | OInputSystem* sys = OInputSystem::instance(); |
186 | OInputSystem::DeviceIterator it = sys->iterator(); | 187 | OInputSystem::DeviceIterator it = sys->iterator(); |
187 | while ( it.current() ) | 188 | while ( it.current() ) |
188 | { | 189 | { |
189 | new InputDevice( this, it.current()->identity() ); | 190 | InputDevice* dev = new InputDevice( this, it.current()->identity() ); |
191 | dev->setInfo( it.current() ); | ||
190 | ++it; | 192 | ++it; |
191 | } | 193 | } |
192 | } | 194 | } |
193 | 195 | ||
194 | //================================================================================================= | 196 | //================================================================================================= |
195 | CardsCategory::CardsCategory( DevicesView* parent ) | 197 | CardsCategory::CardsCategory( DevicesView* parent ) |
196 | :Category( parent, "3. Removable Cards" ) | 198 | :Category( parent, "3. Removable Cards" ) |
197 | { | 199 | { |
198 | } | 200 | } |
199 | 201 | ||
200 | CardsCategory::~CardsCategory() | 202 | CardsCategory::~CardsCategory() |
201 | { | 203 | { |
202 | } | 204 | } |
203 | 205 | ||
204 | void CardsCategory::populate() | 206 | void CardsCategory::populate() |
205 | { | 207 | { |
206 | odebug << "CardsCategory::populate()" << oendl; | 208 | odebug << "CardsCategory::populate()" << oendl; |
207 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 209 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
208 | OPcmciaSystem::CardIterator it = sys->iterator(); | 210 | OPcmciaSystem::CardIterator it = sys->iterator(); |
209 | while ( it.current() ) | 211 | while ( it.current() ) |
210 | { | 212 | { |
211 | new CardDevice( this, it.current()->identity() ); | 213 | CardDevice *dev = new CardDevice( this, it.current()->identity() ); |
214 | dev->setInfo( it.current() ); | ||
212 | ++it; | 215 | ++it; |
213 | } | 216 | } |
214 | } | 217 | } |
215 | 218 | ||
216 | //================================================================================================= | 219 | //================================================================================================= |
217 | UsbCategory::UsbCategory( DevicesView* parent ) | 220 | UsbCategory::UsbCategory( DevicesView* parent ) |
218 | :Category( parent, "4. Universal Serial Bus" ) | 221 | :Category( parent, "4. Universal Serial Bus" ) |
219 | { | 222 | { |
220 | } | 223 | } |
221 | 224 | ||
222 | UsbCategory::~UsbCategory() | 225 | UsbCategory::~UsbCategory() |
223 | { | 226 | { |
224 | } | 227 | } |
225 | 228 | ||
226 | void UsbCategory::populate() | 229 | void UsbCategory::populate() |
227 | { | 230 | { |
228 | odebug << "UsbCategory::populate()" << oendl; | 231 | odebug << "UsbCategory::populate()" << oendl; |
229 | QFile usbinfofile( "/proc/bus/usb/devices" ); | 232 | QFile usbinfofile( "/proc/bus/usb/devices" ); |
230 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) | 233 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) |
231 | { | 234 | { |
232 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); | 235 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); |
233 | return; | 236 | return; |
234 | } | 237 | } |
235 | QTextStream usbinfo( &usbinfofile ); | 238 | QTextStream usbinfo( &usbinfofile ); |
@@ -305,62 +308,124 @@ CpuDevice::CpuDevice( Category* parent, const QString& name ) | |||
305 | OListView* w = new OListView( devinfo ); | 308 | OListView* w = new OListView( devinfo ); |
306 | details = w; | 309 | details = w; |
307 | w->addColumn( "Info" ); | 310 | w->addColumn( "Info" ); |
308 | w->addColumn( "Value" ); | 311 | w->addColumn( "Value" ); |
309 | w->hide(); | 312 | w->hide(); |
310 | } | 313 | } |
311 | 314 | ||
312 | CpuDevice::~CpuDevice() | 315 | CpuDevice::~CpuDevice() |
313 | { | 316 | { |
314 | } | 317 | } |
315 | 318 | ||
316 | void CpuDevice::addInfo( const QString& info ) | 319 | void CpuDevice::addInfo( const QString& info ) |
317 | { | 320 | { |
318 | int dp = info.find( ':' ); | 321 | int dp = info.find( ':' ); |
319 | if ( dp != -1 ) | 322 | if ( dp != -1 ) |
320 | { | 323 | { |
321 | new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) ); | 324 | new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) ); |
322 | } | 325 | } |
323 | } | 326 | } |
324 | 327 | ||
325 | //================================================================================================= | 328 | //================================================================================================= |
326 | CardDevice::CardDevice( Category* parent, const QString& name ) | 329 | CardDevice::CardDevice( Category* parent, const QString& name ) |
327 | :Device( parent, name ) | 330 | :Device( parent, name ) |
328 | { | 331 | { |
329 | details = new QPushButton( name, devinfo ); | 332 | OListView* w = new OListView( devinfo ); |
330 | details->hide(); | 333 | details = w; |
334 | w->addColumn( "Info" ); | ||
335 | w->addColumn( "Value" ); | ||
336 | w->hide(); | ||
337 | } | ||
338 | |||
339 | void CardDevice::setInfo( const OPcmciaSocket* card ) | ||
340 | { | ||
341 | QStringList vendorlst = card->productIdentityVector(); | ||
342 | for( QStringList::Iterator it = vendorlst.begin(); it != vendorlst.end(); ++it ) | ||
343 | { | ||
344 | new OListViewItem( (OListView*) details, "VendorID", *it ); | ||
345 | } | ||
346 | new OListViewItem( (OListView*) details, "Manufacturer", card->manufacturerIdentity() ); | ||
347 | new OListViewItem( (OListView*) details, "Function", card->function() ); | ||
348 | |||
349 | QStringList text; | ||
350 | OPcmciaSocket::OPcmciaSocketCardStatus status = card->status(); | ||
351 | if ( status ) | ||
352 | { | ||
353 | if ( status & OPcmciaSocket::Occupied ) text += "Occupied"; | ||
354 | if ( status & OPcmciaSocket::OccupiedCardBus ) text += "CardBus"; | ||
355 | if ( status & OPcmciaSocket::WriteProtected ) text += "WriteProtected"; | ||
356 | if ( status & OPcmciaSocket::BatteryLow ) text += "BatteryLow"; | ||
357 | if ( status & OPcmciaSocket::BatteryDead ) text += "BatteryDead"; | ||
358 | if ( status & OPcmciaSocket::Ready ) text += "Ready"; | ||
359 | if ( status & OPcmciaSocket::Suspended ) text += "Suspended"; | ||
360 | if ( status & OPcmciaSocket::Attention ) text += "Attention"; | ||
361 | if ( status & OPcmciaSocket::InsertionInProgress ) text += "InsertionInProgress"; | ||
362 | if ( status & OPcmciaSocket::RemovalInProgress ) text += "RemovalInProgress"; | ||
363 | if ( status & OPcmciaSocket::ThreeVolts ) text += "3V"; | ||
364 | if ( status & OPcmciaSocket::SupportsVoltage ) text += "SupportsVoltage"; | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | text += "<unknown>"; | ||
369 | } | ||
370 | new OListViewItem( (OListView*) details, "Status", text.join( ", " ) ); | ||
331 | } | 371 | } |
332 | 372 | ||
333 | CardDevice::~CardDevice() | 373 | CardDevice::~CardDevice() |
334 | { | 374 | { |
335 | } | 375 | } |
336 | 376 | ||
337 | //================================================================================================= | 377 | //================================================================================================= |
338 | InputDevice::InputDevice( Category* parent, const QString& name ) | 378 | InputDevice::InputDevice( Category* parent, const QString& name ) |
339 | :Device( parent, name ) | 379 | :Device( parent, name ) |
340 | { | 380 | { |
341 | details = new QPushButton( name, devinfo ); | 381 | OListView* w = new OListView( devinfo ); |
342 | details->hide(); | 382 | details = w; |
383 | w->addColumn( "Info" ); | ||
384 | w->addColumn( "Value" ); | ||
385 | w->hide(); | ||
386 | } | ||
387 | |||
388 | void InputDevice::setInfo( const OInputDevice* dev ) | ||
389 | { | ||
390 | new OListViewItem( (OListView*) details, "Identity", dev->identity() ); | ||
391 | new OListViewItem( (OListView*) details, "Path", dev->path() ); | ||
392 | new OListViewItem( (OListView*) details, "Unique", dev->uniq() ); | ||
393 | |||
394 | QStringList text; | ||
395 | if ( dev->hasFeature( OInputDevice::Synchronous ) ) text += "Synchronous"; | ||
396 | if ( dev->hasFeature( OInputDevice::Keys ) ) text += "Keys"; | ||
397 | if ( dev->hasFeature( OInputDevice::Relative ) ) text += "Relative"; | ||
398 | if ( dev->hasFeature( OInputDevice::Absolute ) ) text += "Absolute"; | ||
399 | if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) text += "Miscellaneous"; | ||
400 | if ( dev->hasFeature( OInputDevice::Leds ) ) text += "Leds"; | ||
401 | if ( dev->hasFeature( OInputDevice::Sound ) ) text += "Sound"; | ||
402 | if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) text += "AutoRepeat"; | ||
403 | if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) text += "ForceFeedback"; | ||
404 | if ( dev->hasFeature( OInputDevice::PowerManagement ) ) text += "PowerManagement"; | ||
405 | if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) text += "ForceFeedbackStatus"; | ||
406 | new OListViewItem( (OListView*) details, "Features", text.join( ", " ) ); | ||
407 | |||
343 | } | 408 | } |
344 | 409 | ||
345 | InputDevice::~InputDevice() | 410 | InputDevice::~InputDevice() |
346 | { | 411 | { |
347 | } | 412 | } |
348 | 413 | ||
349 | //================================================================================================= | 414 | //================================================================================================= |
350 | UsbDevice::UsbDevice( Category* parent, const QString& name ) | 415 | UsbDevice::UsbDevice( Category* parent, const QString& name ) |
351 | :Device( parent, name ) | 416 | :Device( parent, name ) |
352 | { | 417 | { |
353 | details = new QPushButton( name, devinfo ); | 418 | details = new QPushButton( name, devinfo ); |
354 | details->hide(); | 419 | details->hide(); |
355 | } | 420 | } |
356 | 421 | ||
357 | //================================================================================================= | 422 | //================================================================================================= |
358 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) | 423 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) |
359 | :Device( parent, name ) | 424 | :Device( parent, name ) |
360 | { | 425 | { |
361 | details = new QPushButton( name, devinfo ); | 426 | details = new QPushButton( name, devinfo ); |
362 | details->hide(); | 427 | details->hide(); |
363 | } | 428 | } |
364 | 429 | ||
365 | UsbDevice::~UsbDevice() | 430 | UsbDevice::~UsbDevice() |
366 | { | 431 | { |
diff --git a/noncore/settings/sysinfo/devicesinfo.h b/noncore/settings/sysinfo/devicesinfo.h index c601a96..c4e3637 100644 --- a/noncore/settings/sysinfo/devicesinfo.h +++ b/noncore/settings/sysinfo/devicesinfo.h | |||
@@ -16,48 +16,50 @@ _;:, .> :=|. This program is free software; you can | |||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; General Public License for more | 18 | ..}^=.= = ; General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = General Public License along with | 22 | -_. . . )=. = General Public License along with |
23 | -- :-=` this application; see the file LICENSE.GPL. | 23 | -- :-=` this application; see the file LICENSE.GPL. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef DEVICESINFO_H | 29 | #ifndef DEVICESINFO_H |
30 | #define DEVICESINFO_H | 30 | #define DEVICESINFO_H |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/olistview.h> | 33 | #include <opie2/olistview.h> |
34 | #include <opie2/olayout.h> | 34 | #include <opie2/olayout.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qwidgetstack.h> | 38 | #include <qwidgetstack.h> |
39 | 39 | ||
40 | namespace Opie { namespace Core { class OPcmciaSocket; class OInputDevice; }; }; | ||
41 | |||
40 | //================================================================================================= | 42 | //================================================================================================= |
41 | class DevicesView : public Opie::Ui::OListView | 43 | class DevicesView : public Opie::Ui::OListView |
42 | { | 44 | { |
43 | Q_OBJECT | 45 | Q_OBJECT |
44 | public: | 46 | public: |
45 | DevicesView( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); | 47 | DevicesView( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); |
46 | ~DevicesView(); | 48 | ~DevicesView(); |
47 | public slots: | 49 | public slots: |
48 | void selectionChanged( QListViewItem* item ); | 50 | void selectionChanged( QListViewItem* item ); |
49 | }; | 51 | }; |
50 | 52 | ||
51 | //================================================================================================= | 53 | //================================================================================================= |
52 | class DevicesInfo : public QWidget | 54 | class DevicesInfo : public QWidget |
53 | { | 55 | { |
54 | Q_OBJECT | 56 | Q_OBJECT |
55 | public: | 57 | public: |
56 | DevicesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 58 | DevicesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
57 | ~DevicesInfo(); | 59 | ~DevicesInfo(); |
58 | 60 | ||
59 | void setDetailsWidget( QWidget* w = 0 ); | 61 | void setDetailsWidget( QWidget* w = 0 ); |
60 | 62 | ||
61 | private: | 63 | private: |
62 | Opie::Ui::OAutoBoxLayout* layout; | 64 | Opie::Ui::OAutoBoxLayout* layout; |
63 | Opie::Ui::OListView* view; | 65 | Opie::Ui::OListView* view; |
@@ -81,96 +83,98 @@ class CpuCategory : public Category | |||
81 | { | 83 | { |
82 | public: | 84 | public: |
83 | CpuCategory( DevicesView* parent ); | 85 | CpuCategory( DevicesView* parent ); |
84 | virtual ~CpuCategory(); | 86 | virtual ~CpuCategory(); |
85 | 87 | ||
86 | virtual void populate(); | 88 | virtual void populate(); |
87 | }; | 89 | }; |
88 | 90 | ||
89 | //================================================================================================= | 91 | //================================================================================================= |
90 | class InputCategory : public Category | 92 | class InputCategory : public Category |
91 | { | 93 | { |
92 | public: | 94 | public: |
93 | InputCategory( DevicesView* parent ); | 95 | InputCategory( DevicesView* parent ); |
94 | virtual ~InputCategory(); | 96 | virtual ~InputCategory(); |
95 | 97 | ||
96 | virtual void populate(); | 98 | virtual void populate(); |
97 | }; | 99 | }; |
98 | 100 | ||
99 | //================================================================================================= | 101 | //================================================================================================= |
100 | class CardsCategory : public Category | 102 | class CardsCategory : public Category |
101 | { | 103 | { |
102 | public: | 104 | public: |
103 | CardsCategory( DevicesView* parent ); | 105 | CardsCategory( DevicesView* parent ); |
104 | virtual ~CardsCategory(); | 106 | virtual ~CardsCategory(); |
105 | |||
106 | virtual void populate(); | 107 | virtual void populate(); |
107 | }; | 108 | }; |
108 | 109 | ||
109 | //================================================================================================= | 110 | //================================================================================================= |
110 | class UsbCategory : public Category | 111 | class UsbCategory : public Category |
111 | { | 112 | { |
112 | public: | 113 | public: |
113 | UsbCategory( DevicesView* parent ); | 114 | UsbCategory( DevicesView* parent ); |
114 | virtual ~UsbCategory(); | 115 | virtual ~UsbCategory(); |
115 | 116 | ||
116 | virtual void populate(); | 117 | virtual void populate(); |
117 | }; | 118 | }; |
118 | 119 | ||
119 | //================================================================================================= | 120 | //================================================================================================= |
120 | class Device : public Opie::Ui::OListViewItem | 121 | class Device : public Opie::Ui::OListViewItem |
121 | { | 122 | { |
122 | public: | 123 | public: |
123 | Device( Category* parent, const QString& name ); | 124 | Device( Category* parent, const QString& name ); |
124 | Device( Device* parent, const QString& name ); | 125 | Device( Device* parent, const QString& name ); |
125 | ~Device(); | 126 | ~Device(); |
126 | 127 | ||
127 | QWidget* devinfo; | 128 | QWidget* devinfo; |
128 | QWidget* details; | 129 | QWidget* details; |
129 | 130 | ||
130 | virtual QWidget* detailsWidget(); | 131 | virtual QWidget* detailsWidget(); |
131 | }; | 132 | }; |
132 | 133 | ||
133 | //================================================================================================= | 134 | //================================================================================================= |
134 | class CpuDevice : public Device | 135 | class CpuDevice : public Device |
135 | { | 136 | { |
136 | public: | 137 | public: |
137 | CpuDevice( Category* parent, const QString& name ); | 138 | CpuDevice( Category* parent, const QString& name ); |
138 | ~CpuDevice(); | 139 | ~CpuDevice(); |
139 | 140 | ||
140 | void addInfo( const QString& line ); | 141 | void addInfo( const QString& line ); |
141 | 142 | ||
142 | // virtual QWidget* detailsWidget(); | 143 | // virtual QWidget* detailsWidget(); |
143 | }; | 144 | }; |
144 | 145 | ||
145 | //================================================================================================= | 146 | //================================================================================================= |
146 | class InputDevice : public Device | 147 | class InputDevice : public Device |
147 | { | 148 | { |
148 | public: | 149 | public: |
149 | InputDevice( Category* parent, const QString& name ); | 150 | InputDevice( Category* parent, const QString& name ); |
150 | ~InputDevice(); | 151 | ~InputDevice(); |
151 | 152 | ||
153 | void setInfo( const Opie::Core::OInputDevice* dev ); | ||
154 | |||
152 | // virtual QWidget* detailsWidget(); | 155 | // virtual QWidget* detailsWidget(); |
153 | }; | 156 | }; |
154 | 157 | ||
155 | //================================================================================================= | 158 | //================================================================================================= |
156 | class CardDevice : public Device | 159 | class CardDevice : public Device |
157 | { | 160 | { |
158 | public: | 161 | public: |
159 | CardDevice( Category* parent, const QString& name ); | 162 | CardDevice( Category* parent, const QString& name ); |
160 | ~CardDevice(); | 163 | ~CardDevice(); |
164 | void setInfo( const Opie::Core::OPcmciaSocket* card ); | ||
161 | 165 | ||
162 | // virtual QWidget* detailsWidget(); | 166 | // virtual QWidget* detailsWidget(); |
163 | }; | 167 | }; |
164 | 168 | ||
165 | //================================================================================================= | 169 | //================================================================================================= |
166 | class UsbDevice : public Device | 170 | class UsbDevice : public Device |
167 | { | 171 | { |
168 | public: | 172 | public: |
169 | UsbDevice( Category* parent, const QString& name ); | 173 | UsbDevice( Category* parent, const QString& name ); |
170 | UsbDevice( UsbDevice* parent, const QString& name ); | 174 | UsbDevice( UsbDevice* parent, const QString& name ); |
171 | ~UsbDevice(); | 175 | ~UsbDevice(); |
172 | 176 | ||
173 | // virtual QWidget* detailsWidget(); | 177 | // virtual QWidget* detailsWidget(); |
174 | }; | 178 | }; |
175 | 179 | ||
176 | #endif | 180 | #endif |
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro index 8b23a57..ed9bc0e 100644 --- a/noncore/settings/sysinfo/sysinfo.pro +++ b/noncore/settings/sysinfo/sysinfo.pro | |||
@@ -13,27 +13,27 @@ HEADERS = \ | |||
13 | sysloginfo.h \ | 13 | sysloginfo.h \ |
14 | versioninfo.h \ | 14 | versioninfo.h \ |
15 | sysinfo.h | 15 | sysinfo.h |
16 | 16 | ||
17 | SOURCES = \ | 17 | SOURCES = \ |
18 | main.cpp \ | 18 | main.cpp \ |
19 | memory.cpp \ | 19 | memory.cpp \ |
20 | graph.cpp \ | 20 | graph.cpp \ |
21 | devicesinfo.cpp \ | 21 | devicesinfo.cpp \ |
22 | storage.cpp \ | 22 | storage.cpp \ |
23 | processinfo.cpp \ | 23 | processinfo.cpp \ |
24 | modulesinfo.cpp \ | 24 | modulesinfo.cpp \ |
25 | detail.cpp \ | 25 | detail.cpp \ |
26 | contrib/dhry.c contrib/fft.c \ | 26 | contrib/dhry.c contrib/fft.c \ |
27 | benchmarkinfo.cpp \ | 27 | benchmarkinfo.cpp \ |
28 | sysloginfo.cpp \ | 28 | sysloginfo.cpp \ |
29 | versioninfo.cpp \ | 29 | versioninfo.cpp \ |
30 | sysinfo.cpp | 30 | sysinfo.cpp |
31 | 31 | ||
32 | INCLUDEPATH += $(OPIEDIR)/include | 32 | INCLUDEPATH += $(OPIEDIR)/include |
33 | DEPENDPATH += $(OPIEDIR)/include | 33 | DEPENDPATH += $(OPIEDIR)/include |
34 | LIBS += -lqpe -lopiecore2 -lopieui2 | 34 | LIBS += -lqpe -lopiecore2 -lopieui2 |
35 | DEFINES += UNIX | 35 | DEFINES += UNIX |
36 | TARGET = sysinfo | 36 | TARGET = sysinfo |
37 | VERSION = 1.3.0 | 37 | VERSION = 1.3.1 |
38 | 38 | ||
39 | include( $(OPIEDIR)/include.pro ) | 39 | include( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/sysinfo/sysloginfo.cpp b/noncore/settings/sysinfo/sysloginfo.cpp index 21427f4..279c335 100644 --- a/noncore/settings/sysinfo/sysloginfo.cpp +++ b/noncore/settings/sysinfo/sysloginfo.cpp | |||
@@ -1,32 +1,30 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** SyslogInfo | 2 | ** SyslogInfo |
3 | ** | 3 | ** |
4 | ** Display Syslog information | 4 | ** Display Syslog information |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2004, Michael Lauer | 6 | ** Copyright (C) 2004-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
7 | ** mickey@tm.informatik.uni-frankfurt.de | ||
8 | ** http://www.Vanille.de | ||
9 | ** | 7 | ** |
10 | ** This file may be distributed and/or modified under the terms of the | 8 | ** 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 | 9 | ** GNU General Public License version 2 as published by the Free Software |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 10 | ** Foundation and appearing in the file LICENSE.GPL included in the |
13 | ** packaging of this file. | 11 | ** packaging of this file. |
14 | ** | 12 | ** |
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 13 | ** 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. | 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
17 | ** | 15 | ** |
18 | **********************************************************************/ | 16 | **********************************************************************/ |
19 | 17 | ||
20 | #include "sysloginfo.h" | 18 | #include "sysloginfo.h" |
21 | #include "detail.h" | 19 | #include "detail.h" |
22 | 20 | ||
23 | /* OPIE */ | 21 | /* OPIE */ |
24 | #include <opie2/olistview.h> | 22 | #include <opie2/olistview.h> |
25 | #include <opie2/oconfig.h> | 23 | #include <opie2/oconfig.h> |
26 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
27 | using namespace Opie::Ui; | 25 | using namespace Opie::Ui; |
28 | 26 | ||
29 | /* QT */ | 27 | /* QT */ |
30 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
31 | #include <qfile.h> | 29 | #include <qfile.h> |
32 | #include <qlayout.h> | 30 | #include <qlayout.h> |
@@ -48,49 +46,49 @@ using namespace Opie::Ui; | |||
48 | #include <string.h> | 46 | #include <string.h> |
49 | #include <errno.h> | 47 | #include <errno.h> |
50 | 48 | ||
51 | #define SYSLOG_READ 2 | 49 | #define SYSLOG_READ 2 |
52 | #define SYSLOG_READ_ALL 3 | 50 | #define SYSLOG_READ_ALL 3 |
53 | #define SYSLOG_READ_ALL_CLEAR 4 | 51 | #define SYSLOG_READ_ALL_CLEAR 4 |
54 | #define SYSLOG_UNREAD 9 | 52 | #define SYSLOG_UNREAD 9 |
55 | 53 | ||
56 | #undef APPEND | 54 | #undef APPEND |
57 | 55 | ||
58 | const unsigned int bufsize = 16384; | 56 | const unsigned int bufsize = 16384; |
59 | char buf[bufsize]; | 57 | char buf[bufsize]; |
60 | 58 | ||
61 | SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl ) | 59 | SyslogInfo::SyslogInfo( QWidget* parent, const char* name, WFlags fl ) |
62 | : QWidget( parent, name, fl ) | 60 | : QWidget( parent, name, fl ) |
63 | { | 61 | { |
64 | QGridLayout *layout = new QGridLayout( this ); | 62 | QGridLayout *layout = new QGridLayout( this ); |
65 | layout->setSpacing( 2 ); | 63 | layout->setSpacing( 2 ); |
66 | layout->setMargin( 0 ); | 64 | layout->setMargin( 0 ); |
67 | 65 | ||
68 | syslogview = new QTextView( this ); | 66 | syslogview = new QTextView( this ); |
69 | syslogview->setTextFormat( PlainText ); | 67 | syslogview->setTextFormat( PlainText ); |
70 | OConfig cfg( "qpe" ); | 68 | OConfig cfg( "qpe" ); |
71 | cfg.setGroup( "Appearance" ); | 69 | cfg.setGroup( "Appearance" ); |
72 | syslogview->setFont( QFont( "Fixed", cfg.readNumEntry( "FontSize", 10 ) ) ); | 70 | syslogview->setFont( QFont( cfg.readEntry( "FixedFontFamily", "Fixed" ), cfg.readNumEntry( "FixedFontSize", 10 ) ) ); |
73 | layout->addWidget( syslogview, 0, 0 ); | 71 | layout->addWidget( syslogview, 0, 0 ); |
74 | syslogview->setText( "..." ); | 72 | syslogview->setText( "..." ); |
75 | 73 | ||
76 | memset( buf, 0, bufsize ); | 74 | memset( buf, 0, bufsize ); |
77 | ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); | 75 | ::klogctl( SYSLOG_READ_ALL, buf, bufsize ); |
78 | syslogview->setText( buf ); | 76 | syslogview->setText( buf ); |
79 | 77 | ||
80 | #ifdef APPEND | 78 | #ifdef APPEND |
81 | fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC ); | 79 | fd = ::open( "/proc/kmsg", O_RDONLY|O_SYNC ); |
82 | if ( fd == -1 ) | 80 | if ( fd == -1 ) |
83 | { | 81 | { |
84 | syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) ); | 82 | syslogview->setText( "Couldn't open /proc/kmsg: " + QString( strerror( errno ) ) ); |
85 | return; | 83 | return; |
86 | } | 84 | } |
87 | QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this ); | 85 | QSocketNotifier *sn = new QSocketNotifier( fd, QSocketNotifier::Read, this ); |
88 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) ); | 86 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(updateData()) ); |
89 | #else | 87 | #else |
90 | QPushButton* pb = new QPushButton( "&Refresh", this ); | 88 | QPushButton* pb = new QPushButton( "&Refresh", this ); |
91 | layout->addWidget( pb, 1, 0 ); | 89 | layout->addWidget( pb, 1, 0 ); |
92 | QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) ); | 90 | QObject::connect( pb, SIGNAL(clicked()), this, SLOT(updateData()) ); |
93 | #endif | 91 | #endif |
94 | } | 92 | } |
95 | 93 | ||
96 | SyslogInfo::~SyslogInfo() | 94 | SyslogInfo::~SyslogInfo() |
diff --git a/noncore/settings/sysinfo/sysloginfo.h b/noncore/settings/sysinfo/sysloginfo.h index 7bf8d17..f9e522a 100644 --- a/noncore/settings/sysinfo/sysloginfo.h +++ b/noncore/settings/sysinfo/sysloginfo.h | |||
@@ -1,32 +1,30 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** SyslogInfo | 2 | ** SyslogInfo |
3 | ** | 3 | ** |
4 | ** Display Syslog information | 4 | ** Display Syslog information |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2004, Michael Lauer | 6 | ** Copyright (C) 2004-2005, Michael 'Mickey' Lauer <mickey@Vanille.de> |
7 | ** mickey@tm.informatik.uni-frankfurt.de | ||
8 | ** http://www.Vanille.de | ||
9 | ** | 7 | ** |
10 | ** This file may be distributed and/or modified under the terms of the | 8 | ** 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 | 9 | ** GNU General Public License version 2 as published by the Free Software |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 10 | ** Foundation and appearing in the file LICENSE.GPL included in the |
13 | ** packaging of this file. | 11 | ** packaging of this file. |
14 | ** | 12 | ** |
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 13 | ** 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. | 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
17 | ** | 15 | ** |
18 | **********************************************************************/ | 16 | **********************************************************************/ |
19 | 17 | ||
20 | #ifndef SYSLOGINFO_H | 18 | #ifndef SYSLOGINFO_H |
21 | #define SYSLOGINFO_H | 19 | #define SYSLOGINFO_H |
22 | 20 | ||
23 | #include <qwidget.h> | 21 | #include <qwidget.h> |
24 | 22 | ||
25 | class QTextView; | 23 | class QTextView; |
26 | 24 | ||
27 | class SyslogInfo : public QWidget | 25 | class SyslogInfo : public QWidget |
28 | { | 26 | { |
29 | Q_OBJECT | 27 | Q_OBJECT |
30 | public: | 28 | public: |
31 | SyslogInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 29 | SyslogInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
32 | ~SyslogInfo(); | 30 | ~SyslogInfo(); |