summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/config.in3
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp148
-rw-r--r--noncore/settings/sysinfo/devicesinfo.h66
3 files changed, 172 insertions, 45 deletions
diff --git a/noncore/settings/sysinfo/config.in b/noncore/settings/sysinfo/config.in
index 349dbdc..0c558dd 100644
--- a/noncore/settings/sysinfo/config.in
+++ b/noncore/settings/sysinfo/config.in
@@ -4 +4,4 @@
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
5 comment "opie-sysinfo needs a libqpe, libopie2core, libopie2ui"
6 depends !( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI )
7
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index f1efb33..6508d3c 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -29,3 +29,2 @@ _;:,     .>    :=|. This program is free software; you can
29#include "devicesinfo.h" 29#include "devicesinfo.h"
30
31/* OPIE */ 30/* OPIE */
@@ -40,2 +39,3 @@ using namespace Opie::Ui;
40/* QT */ 39/* QT */
40#include <qobjectlist.h>
41#include <qlistview.h> 41#include <qlistview.h>
@@ -75,4 +75,11 @@ void DevicesView::selectionChanged( QListViewItem* item )
75 odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; 75 odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl;
76 QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); 76 if ( item->parent() )
77 ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); 77 {
78 QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget();
79 ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details );
80 }
81 else
82 {
83 odebug << "DevicesView::not a device node." << oendl;
84 }
78} 85}
@@ -85,6 +92,8 @@ DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl )
85 layout = new OAutoBoxLayout( this ); 92 layout = new OAutoBoxLayout( this );
86 layout->setSpacing( 4 ); 93 layout->setSpacing( 2 );
87 layout->setMargin( 4 ); 94 layout->setMargin( 2 );
88 view = new DevicesView( this ); 95 view = new DevicesView( this );
89 layout->addWidget( view ); 96 layout->addWidget( view, 100 );
97 stack = new QWidgetStack( this );
98 layout->addWidget( stack, 70 );
90} 99}
@@ -99,5 +108,10 @@ void DevicesInfo::setDetailsWidget( QWidget* w )
99{ 108{
100 if ( details ) delete( details ); 109 if ( details )
101 layout->addWidget( w ); 110 {
102 w->show(); 111 qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() );
112 stack->removeWidget( w );
113 }
114
115 stack->addWidget( details = w, 40 );
116 stack->raiseWidget( details );
103} 117}
@@ -117,18 +131,2 @@ Category::~Category()
117//================================================================================================= 131//=================================================================================================
118Device::Device( Category* parent, const QString& name )
119 :OListViewItem( parent, name )
120{
121}
122
123Device::~Device()
124{
125}
126
127QWidget* Device::detailsWidget()
128{
129 return new QPushButton( static_cast<QWidget*>( listView()->parent() ), "Press Button to self-destruct" );
130}
131
132
133//=================================================================================================
134CpuCategory::CpuCategory( DevicesView* parent ) 132CpuCategory::CpuCategory( DevicesView* parent )
@@ -148,3 +146,3 @@ void CpuCategory::populate()
148 { 146 {
149 new OListViewItem( this, "ERROR: /proc/cpuinfo not found or unaccessible" ); 147 new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" );
150 return; 148 return;
@@ -154,2 +152,4 @@ void CpuCategory::populate()
154 int cpucount = 0; 152 int cpucount = 0;
153 CpuDevice* dev = 0;
154
155 while ( !cpuinfo.atEnd() ) 155 while ( !cpuinfo.atEnd() )
@@ -160,3 +160,4 @@ void CpuCategory::populate()
160 { 160 {
161 new OListViewItem( this, QString( "CPU #%1" ).arg( cpucount++ ) ); 161 dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) );
162 dev->addInfo( line );
162 } 163 }
@@ -164,3 +165,3 @@ void CpuCategory::populate()
164 { 165 {
165 continue; 166 if ( dev ) dev->addInfo( line );
166 } 167 }
@@ -187,3 +188,3 @@ void InputCategory::populate()
187 OInputDevice* dev = it.current(); 188 OInputDevice* dev = it.current();
188 new OListViewItem( this, dev->identity() ); 189 new InputDevice( this, dev->identity() );
189 ++it; 190 ++it;
@@ -212,3 +213,3 @@ void CardsCategory::populate()
212 { 213 {
213 new OListViewItem( this, "ERROR: pcmcia info file not found or unaccessible" ); 214 new CardDevice( this, "ERROR: pcmcia info file not found or unaccessible" );
214 return; 215 return;
@@ -220,5 +221,5 @@ void CardsCategory::populate()
220 odebug << "got line '" << line << "'" << oendl; 221 odebug << "got line '" << line << "'" << oendl;
221 if ( line.startsWith("Socket") ) 222 if ( line.startsWith( "Socket" ) )
222 { 223 {
223 new OListViewItem( this, line ); 224 new CardDevice( this, line );
224 } 225 }
@@ -247,3 +248,3 @@ void UsbCategory::populate()
247 { 248 {
248 new OListViewItem( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); 249 new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" );
249 return; 250 return;
@@ -261,3 +262,3 @@ void UsbCategory::populate()
261 odebug << "got line '" << line << "'" << oendl; 262 odebug << "got line '" << line << "'" << oendl;
262 if ( line.startsWith("T:") ) 263 if ( line.startsWith( "T:" ) )
263 { 264 {
@@ -265,3 +266,3 @@ void UsbCategory::populate()
265 266
266 new OListViewItem( this, QString( "USB Device #%1" ).arg( usbcount++ ) ); 267 new UsbDevice( this, QString( "USB Device #%1" ).arg( usbcount++ ) );
267 } 268 }
@@ -274 +275,78 @@ void UsbCategory::populate()
274 275
276
277//=================================================================================================
278Device::Device( Category* parent, const QString& name )
279 :OListViewItem( parent, name )
280{
281 devinfo = static_cast<QWidget*>( listView()->parent() );
282}
283
284Device::~Device()
285{
286}
287
288
289QWidget* Device::detailsWidget()
290{
291 return details;
292}
293
294//=================================================================================================
295CpuDevice::CpuDevice( Category* parent, const QString& name )
296 :Device( parent, name )
297{
298 OListView* w = new OListView( devinfo );
299 details = w;
300 w->addColumn( "Info" );
301 w->addColumn( "Value" );
302 w->hide();
303}
304
305CpuDevice::~CpuDevice()
306{
307}
308
309void CpuDevice::addInfo( const QString& info )
310{
311 int dp = info.find( ':' );
312 if ( dp != -1 )
313 {
314 new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) );
315 }
316}
317
318//=================================================================================================
319CardDevice::CardDevice( Category* parent, const QString& name )
320 :Device( parent, name )
321{
322 details = new QPushButton( name, devinfo );
323 details->hide();
324}
325
326CardDevice::~CardDevice()
327{
328}
329
330//=================================================================================================
331InputDevice::InputDevice( Category* parent, const QString& name )
332 :Device( parent, name )
333{
334 details = new QPushButton( name, devinfo );
335 details->hide();
336}
337
338InputDevice::~InputDevice()
339{
340}
341
342//=================================================================================================
343UsbDevice::UsbDevice( Category* parent, const QString& name )
344 :Device( parent, name )
345{
346 details = new QPushButton( name, devinfo );
347 details->hide();
348}
349
350UsbDevice::~UsbDevice()
351{
352}
diff --git a/noncore/settings/sysinfo/devicesinfo.h b/noncore/settings/sysinfo/devicesinfo.h
index b065f40..586d204 100644
--- a/noncore/settings/sysinfo/devicesinfo.h
+++ b/noncore/settings/sysinfo/devicesinfo.h
@@ -37,2 +37,3 @@ _;:,     .>    :=|. This program is free software; you can
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qwidgetstack.h>
38 39
@@ -63,2 +64,3 @@ private:
63 QWidget* details; 64 QWidget* details;
65 QWidgetStack* stack;
64private slots: 66private slots:
@@ -77,12 +79,2 @@ public:
77//================================================================================================= 79//=================================================================================================
78class Device : public Opie::Ui::OListViewItem
79{
80public:
81 Device( Category* parent, const QString& name );
82 ~Device();
83
84 QWidget* detailsWidget();
85};
86
87//=================================================================================================
88class CpuCategory : public Category 80class CpuCategory : public Category
@@ -126,2 +118,56 @@ public:
126 118
119//=================================================================================================
120class Device : public Opie::Ui::OListViewItem
121{
122public:
123 Device( Category* parent, const QString& name );
124 ~Device();
125
126 QWidget* devinfo;
127 QWidget* details;
128
129 virtual QWidget* detailsWidget();
130};
131
132//=================================================================================================
133class CpuDevice : public Device
134{
135public:
136 CpuDevice( Category* parent, const QString& name );
137 ~CpuDevice();
138
139 void addInfo( const QString& line );
140
141// virtual QWidget* detailsWidget();
142};
143
144//=================================================================================================
145class InputDevice : public Device
146{
147public:
148 InputDevice( Category* parent, const QString& name );
149 ~InputDevice();
150
151// virtual QWidget* detailsWidget();
152};
153
154//=================================================================================================
155class CardDevice : public Device
156{
157public:
158 CardDevice( Category* parent, const QString& name );
159 ~CardDevice();
160
161// virtual QWidget* detailsWidget();
162};
163
164//=================================================================================================
165class UsbDevice : public Device
166{
167public:
168 UsbDevice( Category* parent, const QString& name );
169 ~UsbDevice();
170
171// virtual QWidget* detailsWidget();
172};
127 173