summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp34
-rw-r--r--noncore/settings/sysinfo/devicesinfo.h2
2 files changed, 35 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 6508d3c..b463e43 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -253,21 +253,39 @@ void UsbCategory::populate()
253 253
254 int _bus, _level, _parent, _port, _count, _device, _channels, _power; 254 int _bus, _level, _parent, _port, _count, _device, _channels, _power;
255 float _speed; 255 float _speed;
256 QString _manufacturer, _product, _serial; 256 QString _manufacturer, _product, _serial;
257 257
258 int usbcount = 0; 258 int usbcount = 0;
259 UsbDevice* lastDev = 0;
260 UsbDevice* dev = 0;
259 while ( !usbinfo.atEnd() ) 261 while ( !usbinfo.atEnd() )
260 { 262 {
261 QString line = usbinfo.readLine(); 263 QString line = usbinfo.readLine();
262 odebug << "got line '" << line << "'" << oendl; 264 odebug << "got line '" << line << "'" << oendl;
263 if ( line.startsWith( "T:" ) ) 265 if ( line.startsWith( "T:" ) )
264 { 266 {
265 sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); 267 sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels);
266 268
267 new UsbDevice( this, QString( "USB Device #%1" ).arg( usbcount++ ) ); 269 if ( !_level )
270 {
271 odebug << "adding new bus" << oendl;
272 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) );
273 lastDev = dev;
274 }
275 else
276 {
277 odebug << "adding new dev" << oendl;
278 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) );
279 lastDev = dev;
280 }
281 }
282 else if ( line.startsWith( "S: Product" ) )
283 {
284 int dp = line.find( '=' );
285 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" );
268 } 286 }
269 else 287 else
270 { 288 {
271 continue; 289 continue;
272 } 290 }
273 } 291 }
@@ -278,12 +296,18 @@ void UsbCategory::populate()
278Device::Device( Category* parent, const QString& name ) 296Device::Device( Category* parent, const QString& name )
279 :OListViewItem( parent, name ) 297 :OListViewItem( parent, name )
280{ 298{
281 devinfo = static_cast<QWidget*>( listView()->parent() ); 299 devinfo = static_cast<QWidget*>( listView()->parent() );
282} 300}
283 301
302Device::Device( Device* parent, const QString& name )
303 :OListViewItem( parent, name )
304{
305 devinfo = static_cast<QWidget*>( listView()->parent() );
306}
307
284Device::~Device() 308Device::~Device()
285{ 309{
286} 310}
287 311
288 312
289QWidget* Device::detailsWidget() 313QWidget* Device::detailsWidget()
@@ -344,9 +368,17 @@ UsbDevice::UsbDevice( Category* parent, const QString& name )
344 :Device( parent, name ) 368 :Device( parent, name )
345{ 369{
346 details = new QPushButton( name, devinfo ); 370 details = new QPushButton( name, devinfo );
347 details->hide(); 371 details->hide();
348} 372}
349 373
374//=================================================================================================
375UsbDevice::UsbDevice( UsbDevice* parent, const QString& name )
376 :Device( parent, name )
377{
378 details = new QPushButton( name, devinfo );
379 details->hide();
380}
381
350UsbDevice::~UsbDevice() 382UsbDevice::~UsbDevice()
351{ 383{
352} 384}
diff --git a/noncore/settings/sysinfo/devicesinfo.h b/noncore/settings/sysinfo/devicesinfo.h
index 586d204..c601a96 100644
--- a/noncore/settings/sysinfo/devicesinfo.h
+++ b/noncore/settings/sysinfo/devicesinfo.h
@@ -118,12 +118,13 @@ public:
118 118
119//================================================================================================= 119//=================================================================================================
120class Device : public Opie::Ui::OListViewItem 120class Device : public Opie::Ui::OListViewItem
121{ 121{
122public: 122public:
123 Device( Category* parent, const QString& name ); 123 Device( Category* parent, const QString& name );
124 Device( Device* parent, const QString& name );
124 ~Device(); 125 ~Device();
125 126
126 QWidget* devinfo; 127 QWidget* devinfo;
127 QWidget* details; 128 QWidget* details;
128 129
129 virtual QWidget* detailsWidget(); 130 virtual QWidget* detailsWidget();
@@ -163,12 +164,13 @@ public:
163 164
164//================================================================================================= 165//=================================================================================================
165class UsbDevice : public Device 166class UsbDevice : public Device
166{ 167{
167public: 168public:
168 UsbDevice( Category* parent, const QString& name ); 169 UsbDevice( Category* parent, const QString& name );
170 UsbDevice( UsbDevice* parent, const QString& name );
169 ~UsbDevice(); 171 ~UsbDevice();
170 172
171// virtual QWidget* detailsWidget(); 173// virtual QWidget* detailsWidget();
172}; 174};
173 175
174#endif 176#endif