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 | |||
@@ -1,427 +1,427 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. Copyright (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. Copyright (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
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 | #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 <qstringlist.h> |
47 | #include <qtextstream.h> | 47 | #include <qtextstream.h> |
48 | #include <qtextview.h> | 48 | #include <qtextview.h> |
49 | #include <qtimer.h> | 49 | #include <qtimer.h> |
50 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
51 | 51 | ||
52 | //================================================================================================= | 52 | //================================================================================================= |
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 | { |
332 | OListView* w = new OListView( devinfo ); | 332 | OListView* w = new OListView( devinfo ); |
333 | details = w; | 333 | details = w; |
334 | w->addColumn( "Info" ); | 334 | w->addColumn( "Info" ); |
335 | w->addColumn( "Value" ); | 335 | w->addColumn( "Value" ); |
336 | w->hide(); | 336 | w->hide(); |
337 | } | 337 | } |
338 | 338 | ||
339 | void CardDevice::setInfo( const OPcmciaSocket* card ) | 339 | void CardDevice::setInfo( const OPcmciaSocket* card ) |
340 | { | 340 | { |
341 | QStringList vendorlst = card->productIdentityVector(); | 341 | QStringList vendorlst = card->productIdentityVector(); |
342 | for( QStringList::Iterator it = vendorlst.begin(); it != vendorlst.end(); ++it ) | 342 | for( QStringList::Iterator it = vendorlst.begin(); it != vendorlst.end(); ++it ) |
343 | { | 343 | { |
344 | new OListViewItem( (OListView*) details, "VendorID", *it ); | 344 | new OListViewItem( (OListView*) details, "VendorID", *it ); |
345 | } | 345 | } |
346 | new OListViewItem( (OListView*) details, "Manufacturer", card->manufacturerIdentity() ); | 346 | new OListViewItem( (OListView*) details, "Manufacturer", card->manufacturerIdentity() ); |
347 | new OListViewItem( (OListView*) details, "Function", card->function() ); | 347 | new OListViewItem( (OListView*) details, "Function", card->function() ); |
348 | 348 | ||
349 | QStringList text; | 349 | QStringList text; |
350 | OPcmciaSocket::OPcmciaSocketCardStatus status = card->status(); | 350 | OPcmciaSocket::OPcmciaSocketCardStatus status = card->status(); |
351 | if ( status ) | 351 | if ( status ) |
352 | { | 352 | { |
353 | if ( status & OPcmciaSocket::Occupied ) text += "Occupied"; | 353 | if ( status & OPcmciaSocket::Occupied ) text += "Occupied"; |
354 | if ( status & OPcmciaSocket::OccupiedCardBus ) text += "CardBus"; | 354 | if ( status & OPcmciaSocket::OccupiedCardBus ) text += "CardBus"; |
355 | if ( status & OPcmciaSocket::WriteProtected ) text += "WriteProtected"; | 355 | if ( status & OPcmciaSocket::WriteProtected ) text += "WriteProtected"; |
356 | if ( status & OPcmciaSocket::BatteryLow ) text += "BatteryLow"; | 356 | if ( status & OPcmciaSocket::BatteryLow ) text += "BatteryLow"; |
357 | if ( status & OPcmciaSocket::BatteryDead ) text += "BatteryDead"; | 357 | if ( status & OPcmciaSocket::BatteryDead ) text += "BatteryDead"; |
358 | if ( status & OPcmciaSocket::Ready ) text += "Ready"; | 358 | if ( status & OPcmciaSocket::Ready ) text += "Ready"; |
359 | if ( status & OPcmciaSocket::Suspended ) text += "Suspended"; | 359 | if ( status & OPcmciaSocket::Suspended ) text += "Suspended"; |
360 | if ( status & OPcmciaSocket::Attention ) text += "Attention"; | 360 | if ( status & OPcmciaSocket::Attention ) text += "Attention"; |
361 | if ( status & OPcmciaSocket::InsertionInProgress ) text += "InsertionInProgress"; | 361 | if ( status & OPcmciaSocket::InsertionInProgress ) text += "InsertionInProgress"; |
362 | if ( status & OPcmciaSocket::RemovalInProgress ) text += "RemovalInProgress"; | 362 | if ( status & OPcmciaSocket::RemovalInProgress ) text += "RemovalInProgress"; |
363 | if ( status & OPcmciaSocket::ThreeVolts ) text += "3V"; | 363 | if ( status & OPcmciaSocket::ThreeVolts ) text += "3V"; |
364 | if ( status & OPcmciaSocket::SupportsVoltage ) text += "SupportsVoltage"; | 364 | if ( status & OPcmciaSocket::SupportsVoltage ) text += "SupportsVoltage"; |
365 | } | 365 | } |
366 | else | 366 | else |
367 | { | 367 | { |
368 | text += "<unknown>"; | 368 | text += "<unknown>"; |
369 | } | 369 | } |
370 | new OListViewItem( (OListView*) details, "Status", text.join( ", " ) ); | 370 | new OListViewItem( (OListView*) details, "Status", text.join( ", " ) ); |
371 | } | 371 | } |
372 | 372 | ||
373 | CardDevice::~CardDevice() | 373 | CardDevice::~CardDevice() |
374 | { | 374 | { |
375 | } | 375 | } |
376 | 376 | ||
377 | //================================================================================================= | 377 | //================================================================================================= |
378 | InputDevice::InputDevice( Category* parent, const QString& name ) | 378 | InputDevice::InputDevice( Category* parent, const QString& name ) |
379 | :Device( parent, name ) | 379 | :Device( parent, name ) |
380 | { | 380 | { |
381 | OListView* w = new OListView( devinfo ); | 381 | OListView* w = new OListView( devinfo ); |
382 | details = w; | 382 | details = w; |
383 | w->addColumn( "Info" ); | 383 | w->addColumn( "Info" ); |
384 | w->addColumn( "Value" ); | 384 | w->addColumn( "Value" ); |
385 | w->hide(); | 385 | w->hide(); |
386 | } | 386 | } |
387 | 387 | ||
388 | void InputDevice::setInfo( const OInputDevice* dev ) | 388 | void InputDevice::setInfo( const OInputDevice* dev ) |
389 | { | 389 | { |
390 | new OListViewItem( (OListView*) details, "Identity", dev->identity() ); | 390 | new OListViewItem( (OListView*) details, "Identity", dev->identity() ); |
391 | new OListViewItem( (OListView*) details, "Path", dev->path() ); | 391 | new OListViewItem( (OListView*) details, "Path", dev->path() ); |
392 | new OListViewItem( (OListView*) details, "Unique", dev->uniq() ); | 392 | new OListViewItem( (OListView*) details, "Unique", dev->uniq() ); |
393 | 393 | ||
394 | QStringList text; | 394 | QStringList text; |
395 | if ( dev->hasFeature( OInputDevice::Synchronous ) ) text += "Synchronous"; | 395 | if ( dev->hasFeature( OInputDevice::Synchronous ) ) text += "Synchronous"; |
396 | if ( dev->hasFeature( OInputDevice::Keys ) ) text += "Keys"; | 396 | if ( dev->hasFeature( OInputDevice::Keys ) ) text += "Keys"; |
397 | if ( dev->hasFeature( OInputDevice::Relative ) ) text += "Relative"; | 397 | if ( dev->hasFeature( OInputDevice::Relative ) ) text += "Relative"; |
398 | if ( dev->hasFeature( OInputDevice::Absolute ) ) text += "Absolute"; | 398 | if ( dev->hasFeature( OInputDevice::Absolute ) ) text += "Absolute"; |
399 | if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) text += "Miscellaneous"; | 399 | if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) text += "Miscellaneous"; |
400 | if ( dev->hasFeature( OInputDevice::Switches ) ) text += "Switches"; | 400 | if ( dev->hasFeature( OInputDevice::Switches ) ) text += "Switches"; |
401 | if ( dev->hasFeature( OInputDevice::Leds ) ) text += "Leds"; | 401 | if ( dev->hasFeature( OInputDevice::Leds ) ) text += "Leds"; |
402 | if ( dev->hasFeature( OInputDevice::Sound ) ) text += "Sound"; | 402 | if ( dev->hasFeature( OInputDevice::Sound ) ) text += "Sound"; |
403 | if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) text += "AutoRepeat"; | 403 | if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) text += "AutoRepeat"; |
404 | if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) text += "ForceFeedback"; | 404 | if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) text += "ForceFeedback"; |
405 | if ( dev->hasFeature( OInputDevice::PowerManagement ) ) text += "PowerManagement"; | 405 | if ( dev->hasFeature( OInputDevice::PowerManagement ) ) text += "PowerManagement"; |
406 | if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) text += "ForceFeedbackStatus"; | 406 | if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) text += "ForceFeedbackStatus"; |
407 | new OListViewItem( (OListView*) details, "Features", text.join( ", " ) ); | 407 | new OListViewItem( (OListView*) details, "Features", text.join( ", " ) ); |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | InputDevice::~InputDevice() | 411 | InputDevice::~InputDevice() |
412 | { | 412 | { |
413 | } | 413 | } |
414 | 414 | ||
415 | //================================================================================================= | 415 | //================================================================================================= |
416 | UsbDevice::UsbDevice( Category* parent, const QString& name ) | 416 | UsbDevice::UsbDevice( Category* parent, const QString& name ) |
417 | :Device( parent, name ) | 417 | :Device( parent, name ) |
418 | { | 418 | { |
419 | details = new QPushButton( name, devinfo ); | 419 | details = new QPushButton( name, devinfo ); |
420 | details->hide(); | 420 | details->hide(); |
421 | } | 421 | } |
422 | 422 | ||
423 | //================================================================================================= | 423 | //================================================================================================= |
424 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) | 424 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) |
425 | :Device( parent, name ) | 425 | :Device( parent, name ) |
426 | { | 426 | { |
427 | details = new QPushButton( name, devinfo ); | 427 | details = new QPushButton( name, devinfo ); |