summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 176d178..164d608 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -101,183 +101,183 @@ DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl )
101} 101}
102 102
103 103
104DevicesInfo::~DevicesInfo() 104DevicesInfo::~DevicesInfo()
105{ 105{
106} 106}
107 107
108 108
109void DevicesInfo::setDetailsWidget( QWidget* w ) 109void DevicesInfo::setDetailsWidget( QWidget* w )
110{ 110{
111 if ( details ) 111 if ( details )
112 { 112 {
113 qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() ); 113 qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() );
114 stack->removeWidget( w ); 114 stack->removeWidget( w );
115 } 115 }
116 116
117 stack->addWidget( details = w, 40 ); 117 stack->addWidget( details = w, 40 );
118 stack->raiseWidget( details ); 118 stack->raiseWidget( details );
119} 119}
120 120
121 121
122//================================================================================================= 122//=================================================================================================
123Category::Category( DevicesView* parent, const QString& name ) 123Category::Category( DevicesView* parent, const QString& name )
124 :OListViewItem( parent, name ) 124 :OListViewItem( parent, name )
125{ 125{
126 odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; 126 odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl;
127} 127}
128 128
129Category::~Category() 129Category::~Category()
130{ 130{
131} 131}
132 132
133//================================================================================================= 133//=================================================================================================
134CpuCategory::CpuCategory( DevicesView* parent ) 134CpuCategory::CpuCategory( DevicesView* parent )
135 :Category( parent, "1. Central Processing Unit" ) 135 :Category( parent, "1. Central Processing Unit" )
136{ 136{
137} 137}
138 138
139CpuCategory::~CpuCategory() 139CpuCategory::~CpuCategory()
140{ 140{
141} 141}
142 142
143void CpuCategory::populate() 143void CpuCategory::populate()
144{ 144{
145 odebug << "CpuCategory::populate()" << oendl; 145 odebug << "CpuCategory::populate()" << oendl;
146 QFile cpuinfofile( "/proc/cpuinfo" ); 146 QFile cpuinfofile( "/proc/cpuinfo" );
147 if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) ) 147 if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) )
148 { 148 {
149 new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" ); 149 new CpuDevice( this, "(no cpu found)" );
150 return; 150 return;
151 } 151 }
152 QTextStream cpuinfo( &cpuinfofile ); 152 QTextStream cpuinfo( &cpuinfofile );
153 153
154 int cpucount = 0; 154 int cpucount = 0;
155 CpuDevice* dev = 0; 155 CpuDevice* dev = 0;
156 156
157 while ( !cpuinfo.atEnd() ) 157 while ( !cpuinfo.atEnd() )
158 { 158 {
159 QString line = cpuinfo.readLine(); 159 QString line = cpuinfo.readLine();
160 odebug << "got line '" << line << "'" << oendl; 160 odebug << "got line '" << line << "'" << oendl;
161 if ( line.lower().startsWith( "processor" ) ) 161 if ( line.lower().startsWith( "processor" ) )
162 { 162 {
163 dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) ); 163 dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) );
164 dev->addInfo( line ); 164 dev->addInfo( line );
165 } 165 }
166 else 166 else
167 { 167 {
168 if ( dev ) dev->addInfo( line ); 168 if ( dev ) dev->addInfo( line );
169 } 169 }
170 } 170 }
171} 171}
172 172
173//================================================================================================= 173//=================================================================================================
174InputCategory::InputCategory( DevicesView* parent ) 174InputCategory::InputCategory( DevicesView* parent )
175 :Category( parent, "2. Input Subsystem" ) 175 :Category( parent, "2. Input Subsystem" )
176{ 176{
177} 177}
178 178
179InputCategory::~InputCategory() 179InputCategory::~InputCategory()
180{ 180{
181} 181}
182 182
183void InputCategory::populate() 183void InputCategory::populate()
184{ 184{
185 odebug << "InputCategory::populate()" << oendl; 185 odebug << "InputCategory::populate()" << oendl;
186 OInputSystem* sys = OInputSystem::instance(); 186 OInputSystem* sys = OInputSystem::instance();
187 OInputSystem::DeviceIterator it = sys->iterator(); 187 OInputSystem::DeviceIterator it = sys->iterator();
188 while ( it.current() ) 188 while ( it.current() )
189 { 189 {
190 InputDevice* dev = new InputDevice( this, it.current()->identity() ); 190 InputDevice* dev = new InputDevice( this, it.current()->identity() );
191 dev->setInfo( it.current() ); 191 dev->setInfo( it.current() );
192 ++it; 192 ++it;
193 } 193 }
194} 194}
195 195
196//================================================================================================= 196//=================================================================================================
197CardsCategory::CardsCategory( DevicesView* parent ) 197CardsCategory::CardsCategory( DevicesView* parent )
198 :Category( parent, "3. Removable Cards" ) 198 :Category( parent, "3. Removable Cards" )
199{ 199{
200} 200}
201 201
202CardsCategory::~CardsCategory() 202CardsCategory::~CardsCategory()
203{ 203{
204} 204}
205 205
206void CardsCategory::populate() 206void CardsCategory::populate()
207{ 207{
208 odebug << "CardsCategory::populate()" << oendl; 208 odebug << "CardsCategory::populate()" << oendl;
209 OPcmciaSystem* sys = OPcmciaSystem::instance(); 209 OPcmciaSystem* sys = OPcmciaSystem::instance();
210 OPcmciaSystem::CardIterator it = sys->iterator(); 210 OPcmciaSystem::CardIterator it = sys->iterator();
211 while ( it.current() ) 211 while ( it.current() )
212 { 212 {
213 CardDevice *dev = new CardDevice( this, it.current()->identity() ); 213 CardDevice *dev = new CardDevice( this, it.current()->identity() );
214 dev->setInfo( it.current() ); 214 dev->setInfo( it.current() );
215 ++it; 215 ++it;
216 } 216 }
217} 217}
218 218
219//================================================================================================= 219//=================================================================================================
220UsbCategory::UsbCategory( DevicesView* parent ) 220UsbCategory::UsbCategory( DevicesView* parent )
221 :Category( parent, "4. Universal Serial Bus" ) 221 :Category( parent, "4. Universal Serial Bus" )
222{ 222{
223} 223}
224 224
225UsbCategory::~UsbCategory() 225UsbCategory::~UsbCategory()
226{ 226{
227} 227}
228 228
229void UsbCategory::populate() 229void UsbCategory::populate()
230{ 230{
231 odebug << "UsbCategory::populate()" << oendl; 231 odebug << "UsbCategory::populate()" << oendl;
232 QFile usbinfofile( "/proc/bus/usb/devices" ); 232 QFile usbinfofile( "/proc/bus/usb/devices" );
233 if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) 233 if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) )
234 { 234 {
235 new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); 235 new UsbDevice( this, "(no USB found)" );
236 return; 236 return;
237 } 237 }
238 QTextStream usbinfo( &usbinfofile ); 238 QTextStream usbinfo( &usbinfofile );
239 239
240 int _bus, _level, _parent, _port, _count, _device, _channels, _power; 240 int _bus, _level, _parent, _port, _count, _device, _channels, _power;
241 float _speed; 241 float _speed;
242 QString _manufacturer, _product, _serial; 242 QString _manufacturer, _product, _serial;
243 243
244 int usbcount = 0; 244 int usbcount = 0;
245 UsbDevice* lastDev = 0; 245 UsbDevice* lastDev = 0;
246 UsbDevice* dev = 0; 246 UsbDevice* dev = 0;
247 while ( !usbinfo.atEnd() ) 247 while ( !usbinfo.atEnd() )
248 { 248 {
249 QString line = usbinfo.readLine(); 249 QString line = usbinfo.readLine();
250 odebug << "got line '" << line << "'" << oendl; 250 odebug << "got line '" << line << "'" << oendl;
251 if ( line.startsWith( "T:" ) ) 251 if ( line.startsWith( "T:" ) )
252 { 252 {
253 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); 253 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);
254 254
255 if ( !_level ) 255 if ( !_level )
256 { 256 {
257 odebug << "adding new bus" << oendl; 257 odebug << "adding new bus" << oendl;
258 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); 258 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) );
259 lastDev = dev; 259 lastDev = dev;
260 } 260 }
261 else 261 else
262 { 262 {
263 odebug << "adding new dev" << oendl; 263 odebug << "adding new dev" << oendl;
264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); 264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) );
265 lastDev = dev; 265 lastDev = dev;
266 } 266 }
267 } 267 }
268 else if ( line.startsWith( "S: Product" ) ) 268 else if ( line.startsWith( "S: Product" ) )
269 { 269 {
270 int dp = line.find( '=' ); 270 int dp = line.find( '=' );
271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); 271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" );
272 } 272 }
273 else 273 else
274 { 274 {
275 continue; 275 continue;
276 } 276 }
277 } 277 }
278} 278}
279 279
280 280
281//================================================================================================= 281//=================================================================================================
282Device::Device( Category* parent, const QString& name ) 282Device::Device( Category* parent, const QString& name )
283 :OListViewItem( parent, name ) 283 :OListViewItem( parent, name )