author | mickeyl <mickeyl> | 2005-08-31 10:47:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-08-31 10:47:03 (UTC) |
commit | 465eb3107bb32ad7ab2d726d8a510538fca56764 (patch) (unidiff) | |
tree | 8ab94dd3a9530edc08116207493b674660fc8788 | |
parent | cde931654d1966be6989e6c8f3cfacb23e6822a2 (diff) | |
download | opie-465eb3107bb32ad7ab2d726d8a510538fca56764.zip opie-465eb3107bb32ad7ab2d726d8a510538fca56764.tar.gz opie-465eb3107bb32ad7ab2d726d8a510538fca56764.tar.bz2 |
diminish error message
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 4 |
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 | |||
@@ -53,279 +53,279 @@ using namespace Opie::Ui; | |||
53 | DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) | 53 | DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) |
54 | :Opie::Ui::OListView( parent, name, fl ) | 54 | :Opie::Ui::OListView( parent, name, fl ) |
55 | { | 55 | { |
56 | addColumn( tr( "My Computer" ) ); | 56 | addColumn( tr( "My Computer" ) ); |
57 | setAllColumnsShowFocus( true ); | 57 | setAllColumnsShowFocus( true ); |
58 | setRootIsDecorated( true ); | 58 | setRootIsDecorated( true ); |
59 | 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." ) ); |
60 | 60 | ||
61 | DevicesView* root = this; | 61 | DevicesView* root = this; |
62 | ( new CpuCategory( root ) )->populate(); | 62 | ( new CpuCategory( root ) )->populate(); |
63 | ( new InputCategory( root ) )->populate(); | 63 | ( new InputCategory( root ) )->populate(); |
64 | ( new CardsCategory( root ) )->populate(); | 64 | ( new CardsCategory( root ) )->populate(); |
65 | ( new UsbCategory( root ) )->populate(); | 65 | ( new UsbCategory( root ) )->populate(); |
66 | 66 | ||
67 | connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); | 67 | connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); |
68 | } | 68 | } |
69 | 69 | ||
70 | DevicesView::~DevicesView() | 70 | DevicesView::~DevicesView() |
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | void DevicesView::selectionChanged( QListViewItem* item ) | 75 | void DevicesView::selectionChanged( QListViewItem* item ) |
76 | { | 76 | { |
77 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; | 77 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; |
78 | if ( item->parent() ) | 78 | if ( item->parent() ) |
79 | { | 79 | { |
80 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); | 80 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); |
81 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); | 81 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); |
82 | } | 82 | } |
83 | else | 83 | else |
84 | { | 84 | { |
85 | odebug << "DevicesView::not a device node." << oendl; | 85 | odebug << "DevicesView::not a device node." << oendl; |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | //================================================================================================= | 90 | //================================================================================================= |
91 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) | 91 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) |
92 | :QWidget( parent, name, fl ), details( 0 ) | 92 | :QWidget( parent, name, fl ), details( 0 ) |
93 | { | 93 | { |
94 | layout = new OAutoBoxLayout( this ); | 94 | layout = new OAutoBoxLayout( this ); |
95 | layout->setSpacing( 2 ); | 95 | layout->setSpacing( 2 ); |
96 | layout->setMargin( 2 ); | 96 | layout->setMargin( 2 ); |
97 | view = new DevicesView( this ); | 97 | view = new DevicesView( this ); |
98 | layout->addWidget( view, 100 ); | 98 | layout->addWidget( view, 100 ); |
99 | stack = new QWidgetStack( this ); | 99 | stack = new QWidgetStack( this ); |
100 | layout->addWidget( stack, 80 ); | 100 | layout->addWidget( stack, 80 ); |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | DevicesInfo::~DevicesInfo() | 104 | DevicesInfo::~DevicesInfo() |
105 | { | 105 | { |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | void DevicesInfo::setDetailsWidget( QWidget* w ) | 109 | void 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 | //================================================================================================= |
123 | Category::Category( DevicesView* parent, const QString& name ) | 123 | Category::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 | ||
129 | Category::~Category() | 129 | Category::~Category() |
130 | { | 130 | { |
131 | } | 131 | } |
132 | 132 | ||
133 | //================================================================================================= | 133 | //================================================================================================= |
134 | CpuCategory::CpuCategory( DevicesView* parent ) | 134 | CpuCategory::CpuCategory( DevicesView* parent ) |
135 | :Category( parent, "1. Central Processing Unit" ) | 135 | :Category( parent, "1. Central Processing Unit" ) |
136 | { | 136 | { |
137 | } | 137 | } |
138 | 138 | ||
139 | CpuCategory::~CpuCategory() | 139 | CpuCategory::~CpuCategory() |
140 | { | 140 | { |
141 | } | 141 | } |
142 | 142 | ||
143 | void CpuCategory::populate() | 143 | void 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 | //================================================================================================= |
174 | InputCategory::InputCategory( DevicesView* parent ) | 174 | InputCategory::InputCategory( DevicesView* parent ) |
175 | :Category( parent, "2. Input Subsystem" ) | 175 | :Category( parent, "2. Input Subsystem" ) |
176 | { | 176 | { |
177 | } | 177 | } |
178 | 178 | ||
179 | InputCategory::~InputCategory() | 179 | InputCategory::~InputCategory() |
180 | { | 180 | { |
181 | } | 181 | } |
182 | 182 | ||
183 | void InputCategory::populate() | 183 | void 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 | //================================================================================================= |
197 | CardsCategory::CardsCategory( DevicesView* parent ) | 197 | CardsCategory::CardsCategory( DevicesView* parent ) |
198 | :Category( parent, "3. Removable Cards" ) | 198 | :Category( parent, "3. Removable Cards" ) |
199 | { | 199 | { |
200 | } | 200 | } |
201 | 201 | ||
202 | CardsCategory::~CardsCategory() | 202 | CardsCategory::~CardsCategory() |
203 | { | 203 | { |
204 | } | 204 | } |
205 | 205 | ||
206 | void CardsCategory::populate() | 206 | void 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 | //================================================================================================= |
220 | UsbCategory::UsbCategory( DevicesView* parent ) | 220 | UsbCategory::UsbCategory( DevicesView* parent ) |
221 | :Category( parent, "4. Universal Serial Bus" ) | 221 | :Category( parent, "4. Universal Serial Bus" ) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | 224 | ||
225 | UsbCategory::~UsbCategory() | 225 | UsbCategory::~UsbCategory() |
226 | { | 226 | { |
227 | } | 227 | } |
228 | 228 | ||
229 | void UsbCategory::populate() | 229 | void 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 | //================================================================================================= |
282 | Device::Device( Category* parent, const QString& name ) | 282 | Device::Device( Category* parent, const QString& name ) |
283 | :OListViewItem( parent, name ) | 283 | :OListViewItem( parent, name ) |
284 | { | 284 | { |
285 | devinfo = static_cast<QWidget*>( listView()->parent() ); | 285 | devinfo = static_cast<QWidget*>( listView()->parent() ); |
286 | } | 286 | } |
287 | 287 | ||
288 | Device::Device( Device* parent, const QString& name ) | 288 | Device::Device( Device* parent, const QString& name ) |
289 | :OListViewItem( parent, name ) | 289 | :OListViewItem( parent, name ) |
290 | { | 290 | { |
291 | devinfo = static_cast<QWidget*>( listView()->parent() ); | 291 | devinfo = static_cast<QWidget*>( listView()->parent() ); |
292 | } | 292 | } |
293 | 293 | ||
294 | Device::~Device() | 294 | Device::~Device() |
295 | { | 295 | { |
296 | } | 296 | } |
297 | 297 | ||
298 | 298 | ||
299 | QWidget* Device::detailsWidget() | 299 | QWidget* Device::detailsWidget() |
300 | { | 300 | { |
301 | return details; | 301 | return details; |
302 | } | 302 | } |
303 | 303 | ||
304 | //================================================================================================= | 304 | //================================================================================================= |
305 | CpuDevice::CpuDevice( Category* parent, const QString& name ) | 305 | CpuDevice::CpuDevice( Category* parent, const QString& name ) |
306 | :Device( parent, name ) | 306 | :Device( parent, name ) |
307 | { | 307 | { |
308 | OListView* w = new OListView( devinfo ); | 308 | OListView* w = new OListView( devinfo ); |
309 | details = w; | 309 | details = w; |
310 | w->addColumn( "Info" ); | 310 | w->addColumn( "Info" ); |
311 | w->addColumn( "Value" ); | 311 | w->addColumn( "Value" ); |
312 | w->hide(); | 312 | w->hide(); |
313 | } | 313 | } |
314 | 314 | ||
315 | CpuDevice::~CpuDevice() | 315 | CpuDevice::~CpuDevice() |
316 | { | 316 | { |
317 | } | 317 | } |
318 | 318 | ||
319 | void CpuDevice::addInfo( const QString& info ) | 319 | void CpuDevice::addInfo( const QString& info ) |
320 | { | 320 | { |
321 | int dp = info.find( ':' ); | 321 | int dp = info.find( ':' ); |
322 | if ( dp != -1 ) | 322 | if ( dp != -1 ) |
323 | { | 323 | { |
324 | 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 ) ); |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | //================================================================================================= | 328 | //================================================================================================= |
329 | CardDevice::CardDevice( Category* parent, const QString& name ) | 329 | CardDevice::CardDevice( Category* parent, const QString& name ) |
330 | :Device( parent, name ) | 330 | :Device( parent, name ) |
331 | { | 331 | { |