author | mickeyl <mickeyl> | 2005-05-19 11:59:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-19 11:59:50 (UTC) |
commit | cdecf5d75233150cba06094262158fb218e9bf03 (patch) (unidiff) | |
tree | 7cd9a17fc2eb820638e73945454b02c07a927520 | |
parent | ed7ba8b228d3d0ffae9c9b68900b7f723d7ade4a (diff) | |
download | opie-cdecf5d75233150cba06094262158fb218e9bf03.zip opie-cdecf5d75233150cba06094262158fb218e9bf03.tar.gz opie-cdecf5d75233150cba06094262158fb218e9bf03.tar.bz2 |
use OPcmciaSystem
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 7e8aee8..945edea 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -1,384 +1,367 @@ | |||
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/olayout.h> | 34 | #include <opie2/olayout.h> |
34 | #include <opie2/olistview.h> | 35 | #include <opie2/olistview.h> |
35 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
36 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
37 | using namespace Opie::Ui; | 38 | using namespace Opie::Ui; |
38 | 39 | ||
39 | /* QT */ | 40 | /* QT */ |
40 | #include <qobjectlist.h> | 41 | #include <qobjectlist.h> |
41 | #include <qlistview.h> | 42 | #include <qlistview.h> |
42 | #include <qcombobox.h> | 43 | #include <qcombobox.h> |
43 | #include <qfile.h> | 44 | #include <qfile.h> |
44 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
45 | #include <qtextstream.h> | 46 | #include <qtextstream.h> |
46 | #include <qtextview.h> | 47 | #include <qtextview.h> |
47 | #include <qtimer.h> | 48 | #include <qtimer.h> |
48 | #include <qwhatsthis.h> | 49 | #include <qwhatsthis.h> |
49 | 50 | ||
50 | //================================================================================================= | 51 | //================================================================================================= |
51 | DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) | 52 | DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) |
52 | :Opie::Ui::OListView( parent, name, fl ) | 53 | :Opie::Ui::OListView( parent, name, fl ) |
53 | { | 54 | { |
54 | addColumn( tr( "My Computer" ) ); | 55 | addColumn( tr( "My Computer" ) ); |
55 | setAllColumnsShowFocus( true ); | 56 | setAllColumnsShowFocus( true ); |
56 | setRootIsDecorated( true ); | 57 | setRootIsDecorated( true ); |
57 | QWhatsThis::add( this, tr( "This is a list of all the devices currently recognized on this device." ) ); | 58 | QWhatsThis::add( this, tr( "This is a list of all the devices currently recognized on this device." ) ); |
58 | 59 | ||
59 | DevicesView* root = this; | 60 | DevicesView* root = this; |
60 | ( new CpuCategory( root ) )->populate(); | 61 | ( new CpuCategory( root ) )->populate(); |
61 | ( new InputCategory( root ) )->populate(); | 62 | ( new InputCategory( root ) )->populate(); |
62 | ( new CardsCategory( root ) )->populate(); | 63 | ( new CardsCategory( root ) )->populate(); |
63 | ( new UsbCategory( root ) )->populate(); | 64 | ( new UsbCategory( root ) )->populate(); |
64 | 65 | ||
65 | connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); | 66 | connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); |
66 | } | 67 | } |
67 | 68 | ||
68 | DevicesView::~DevicesView() | 69 | DevicesView::~DevicesView() |
69 | { | 70 | { |
70 | } | 71 | } |
71 | 72 | ||
72 | 73 | ||
73 | void DevicesView::selectionChanged( QListViewItem* item ) | 74 | void DevicesView::selectionChanged( QListViewItem* item ) |
74 | { | 75 | { |
75 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; | 76 | odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; |
76 | if ( item->parent() ) | 77 | if ( item->parent() ) |
77 | { | 78 | { |
78 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); | 79 | QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); |
79 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); | 80 | ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); |
80 | } | 81 | } |
81 | else | 82 | else |
82 | { | 83 | { |
83 | odebug << "DevicesView::not a device node." << oendl; | 84 | odebug << "DevicesView::not a device node." << oendl; |
84 | } | 85 | } |
85 | } | 86 | } |
86 | 87 | ||
87 | 88 | ||
88 | //================================================================================================= | 89 | //================================================================================================= |
89 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) | 90 | DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) |
90 | :QWidget( parent, name, fl ), details( 0 ) | 91 | :QWidget( parent, name, fl ), details( 0 ) |
91 | { | 92 | { |
92 | layout = new OAutoBoxLayout( this ); | 93 | layout = new OAutoBoxLayout( this ); |
93 | layout->setSpacing( 2 ); | 94 | layout->setSpacing( 2 ); |
94 | layout->setMargin( 2 ); | 95 | layout->setMargin( 2 ); |
95 | view = new DevicesView( this ); | 96 | view = new DevicesView( this ); |
96 | layout->addWidget( view, 100 ); | 97 | layout->addWidget( view, 100 ); |
97 | stack = new QWidgetStack( this ); | 98 | stack = new QWidgetStack( this ); |
98 | layout->addWidget( stack, 70 ); | 99 | layout->addWidget( stack, 70 ); |
99 | } | 100 | } |
100 | 101 | ||
101 | 102 | ||
102 | DevicesInfo::~DevicesInfo() | 103 | DevicesInfo::~DevicesInfo() |
103 | { | 104 | { |
104 | } | 105 | } |
105 | 106 | ||
106 | 107 | ||
107 | void DevicesInfo::setDetailsWidget( QWidget* w ) | 108 | void DevicesInfo::setDetailsWidget( QWidget* w ) |
108 | { | 109 | { |
109 | if ( details ) | 110 | if ( details ) |
110 | { | 111 | { |
111 | qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() ); | 112 | qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() ); |
112 | stack->removeWidget( w ); | 113 | stack->removeWidget( w ); |
113 | } | 114 | } |
114 | 115 | ||
115 | stack->addWidget( details = w, 40 ); | 116 | stack->addWidget( details = w, 40 ); |
116 | stack->raiseWidget( details ); | 117 | stack->raiseWidget( details ); |
117 | } | 118 | } |
118 | 119 | ||
119 | 120 | ||
120 | //================================================================================================= | 121 | //================================================================================================= |
121 | Category::Category( DevicesView* parent, const QString& name ) | 122 | Category::Category( DevicesView* parent, const QString& name ) |
122 | :OListViewItem( parent, name ) | 123 | :OListViewItem( parent, name ) |
123 | { | 124 | { |
124 | odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; | 125 | odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; |
125 | } | 126 | } |
126 | 127 | ||
127 | Category::~Category() | 128 | Category::~Category() |
128 | { | 129 | { |
129 | } | 130 | } |
130 | 131 | ||
131 | //================================================================================================= | 132 | //================================================================================================= |
132 | CpuCategory::CpuCategory( DevicesView* parent ) | 133 | CpuCategory::CpuCategory( DevicesView* parent ) |
133 | :Category( parent, "1. Central Processing Unit" ) | 134 | :Category( parent, "1. Central Processing Unit" ) |
134 | { | 135 | { |
135 | } | 136 | } |
136 | 137 | ||
137 | CpuCategory::~CpuCategory() | 138 | CpuCategory::~CpuCategory() |
138 | { | 139 | { |
139 | } | 140 | } |
140 | 141 | ||
141 | void CpuCategory::populate() | 142 | void CpuCategory::populate() |
142 | { | 143 | { |
143 | odebug << "CpuCategory::populate()" << oendl; | 144 | odebug << "CpuCategory::populate()" << oendl; |
144 | QFile cpuinfofile( "/proc/cpuinfo" ); | 145 | QFile cpuinfofile( "/proc/cpuinfo" ); |
145 | if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) ) | 146 | if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) ) |
146 | { | 147 | { |
147 | new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" ); | 148 | new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" ); |
148 | return; | 149 | return; |
149 | } | 150 | } |
150 | QTextStream cpuinfo( &cpuinfofile ); | 151 | QTextStream cpuinfo( &cpuinfofile ); |
151 | 152 | ||
152 | int cpucount = 0; | 153 | int cpucount = 0; |
153 | CpuDevice* dev = 0; | 154 | CpuDevice* dev = 0; |
154 | 155 | ||
155 | while ( !cpuinfo.atEnd() ) | 156 | while ( !cpuinfo.atEnd() ) |
156 | { | 157 | { |
157 | QString line = cpuinfo.readLine(); | 158 | QString line = cpuinfo.readLine(); |
158 | odebug << "got line '" << line << "'" << oendl; | 159 | odebug << "got line '" << line << "'" << oendl; |
159 | if ( line.lower().startsWith( "processor" ) ) | 160 | if ( line.lower().startsWith( "processor" ) ) |
160 | { | 161 | { |
161 | dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) ); | 162 | dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) ); |
162 | dev->addInfo( line ); | 163 | dev->addInfo( line ); |
163 | } | 164 | } |
164 | else | 165 | else |
165 | { | 166 | { |
166 | if ( dev ) dev->addInfo( line ); | 167 | if ( dev ) dev->addInfo( line ); |
167 | } | 168 | } |
168 | } | 169 | } |
169 | } | 170 | } |
170 | 171 | ||
171 | //================================================================================================= | 172 | //================================================================================================= |
172 | InputCategory::InputCategory( DevicesView* parent ) | 173 | InputCategory::InputCategory( DevicesView* parent ) |
173 | :Category( parent, "2. Input Subsystem" ) | 174 | :Category( parent, "2. Input Subsystem" ) |
174 | { | 175 | { |
175 | } | 176 | } |
176 | 177 | ||
177 | InputCategory::~InputCategory() | 178 | InputCategory::~InputCategory() |
178 | { | 179 | { |
179 | } | 180 | } |
180 | 181 | ||
181 | void InputCategory::populate() | 182 | void InputCategory::populate() |
182 | { | 183 | { |
183 | odebug << "InputCategory::populate()" << oendl; | 184 | odebug << "InputCategory::populate()" << oendl; |
184 | OInputSystem* sys = OInputSystem::instance(); | 185 | OInputSystem* sys = OInputSystem::instance(); |
185 | OInputSystem::DeviceIterator it = sys->iterator(); | 186 | OInputSystem::DeviceIterator it = sys->iterator(); |
186 | while ( it.current() ) | 187 | while ( it.current() ) |
187 | { | 188 | { |
188 | OInputDevice* dev = it.current(); | 189 | new InputDevice( this, it.current()->identity() ); |
189 | new InputDevice( this, dev->identity() ); | ||
190 | ++it; | 190 | ++it; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | //================================================================================================= | 194 | //================================================================================================= |
195 | CardsCategory::CardsCategory( DevicesView* parent ) | 195 | CardsCategory::CardsCategory( DevicesView* parent ) |
196 | :Category( parent, "3. Removable Cards" ) | 196 | :Category( parent, "3. Removable Cards" ) |
197 | { | 197 | { |
198 | } | 198 | } |
199 | 199 | ||
200 | CardsCategory::~CardsCategory() | 200 | CardsCategory::~CardsCategory() |
201 | { | 201 | { |
202 | } | 202 | } |
203 | 203 | ||
204 | void CardsCategory::populate() | 204 | void CardsCategory::populate() |
205 | { | 205 | { |
206 | odebug << "CardsCategory::populate()" << oendl; | 206 | odebug << "CardsCategory::populate()" << oendl; |
207 | QString fileName; | 207 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
208 | if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } | 208 | OPcmciaSystem::CardIterator it = sys->iterator(); |
209 | else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } | 209 | while ( it.current() ) |
210 | else { fileName = "/var/lib/pcmcia/stab"; } | ||
211 | QFile cardinfofile( fileName ); | ||
212 | if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) ) | ||
213 | { | ||
214 | new CardDevice( this, "ERROR: pcmcia info file not found or unaccessible" ); | ||
215 | return; | ||
216 | } | ||
217 | QTextStream cardinfo( &cardinfofile ); | ||
218 | while ( !cardinfo.atEnd() ) | ||
219 | { | 210 | { |
220 | QString line = cardinfo.readLine(); | 211 | new CardDevice( this, (const char*) it.currentKey() ); |
221 | odebug << "got line '" << line << "'" << oendl; | 212 | ++it; |
222 | if ( line.startsWith( "Socket" ) ) | ||
223 | { | ||
224 | new CardDevice( this, line ); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | continue; | ||
229 | } | ||
230 | } | 213 | } |
231 | } | 214 | } |
232 | 215 | ||
233 | //================================================================================================= | 216 | //================================================================================================= |
234 | UsbCategory::UsbCategory( DevicesView* parent ) | 217 | UsbCategory::UsbCategory( DevicesView* parent ) |
235 | :Category( parent, "4. Universal Serial Bus" ) | 218 | :Category( parent, "4. Universal Serial Bus" ) |
236 | { | 219 | { |
237 | } | 220 | } |
238 | 221 | ||
239 | UsbCategory::~UsbCategory() | 222 | UsbCategory::~UsbCategory() |
240 | { | 223 | { |
241 | } | 224 | } |
242 | 225 | ||
243 | void UsbCategory::populate() | 226 | void UsbCategory::populate() |
244 | { | 227 | { |
245 | odebug << "UsbCategory::populate()" << oendl; | 228 | odebug << "UsbCategory::populate()" << oendl; |
246 | QFile usbinfofile( "/proc/bus/usb/devices" ); | 229 | QFile usbinfofile( "/proc/bus/usb/devices" ); |
247 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) | 230 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) |
248 | { | 231 | { |
249 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); | 232 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); |
250 | return; | 233 | return; |
251 | } | 234 | } |
252 | QTextStream usbinfo( &usbinfofile ); | 235 | QTextStream usbinfo( &usbinfofile ); |
253 | 236 | ||
254 | int _bus, _level, _parent, _port, _count, _device, _channels, _power; | 237 | int _bus, _level, _parent, _port, _count, _device, _channels, _power; |
255 | float _speed; | 238 | float _speed; |
256 | QString _manufacturer, _product, _serial; | 239 | QString _manufacturer, _product, _serial; |
257 | 240 | ||
258 | int usbcount = 0; | 241 | int usbcount = 0; |
259 | UsbDevice* lastDev = 0; | 242 | UsbDevice* lastDev = 0; |
260 | UsbDevice* dev = 0; | 243 | UsbDevice* dev = 0; |
261 | while ( !usbinfo.atEnd() ) | 244 | while ( !usbinfo.atEnd() ) |
262 | { | 245 | { |
263 | QString line = usbinfo.readLine(); | 246 | QString line = usbinfo.readLine(); |
264 | odebug << "got line '" << line << "'" << oendl; | 247 | odebug << "got line '" << line << "'" << oendl; |
265 | if ( line.startsWith( "T:" ) ) | 248 | if ( line.startsWith( "T:" ) ) |
266 | { | 249 | { |
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); | 250 | 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); |
268 | 251 | ||
269 | if ( !_level ) | 252 | if ( !_level ) |
270 | { | 253 | { |
271 | odebug << "adding new bus" << oendl; | 254 | odebug << "adding new bus" << oendl; |
272 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); | 255 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); |
273 | lastDev = dev; | 256 | lastDev = dev; |
274 | } | 257 | } |
275 | else | 258 | else |
276 | { | 259 | { |
277 | odebug << "adding new dev" << oendl; | 260 | odebug << "adding new dev" << oendl; |
278 | dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); | 261 | dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); |
279 | lastDev = dev; | 262 | lastDev = dev; |
280 | } | 263 | } |
281 | } | 264 | } |
282 | else if ( line.startsWith( "S: Product" ) ) | 265 | else if ( line.startsWith( "S: Product" ) ) |
283 | { | 266 | { |
284 | int dp = line.find( '=' ); | 267 | int dp = line.find( '=' ); |
285 | dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); | 268 | dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); |
286 | } | 269 | } |
287 | else | 270 | else |
288 | { | 271 | { |
289 | continue; | 272 | continue; |
290 | } | 273 | } |
291 | } | 274 | } |
292 | } | 275 | } |
293 | 276 | ||
294 | 277 | ||
295 | //================================================================================================= | 278 | //================================================================================================= |
296 | Device::Device( Category* parent, const QString& name ) | 279 | Device::Device( Category* parent, const QString& name ) |
297 | :OListViewItem( parent, name ) | 280 | :OListViewItem( parent, name ) |
298 | { | 281 | { |
299 | devinfo = static_cast<QWidget*>( listView()->parent() ); | 282 | devinfo = static_cast<QWidget*>( listView()->parent() ); |
300 | } | 283 | } |
301 | 284 | ||
302 | Device::Device( Device* parent, const QString& name ) | 285 | Device::Device( Device* parent, const QString& name ) |
303 | :OListViewItem( parent, name ) | 286 | :OListViewItem( parent, name ) |
304 | { | 287 | { |
305 | devinfo = static_cast<QWidget*>( listView()->parent() ); | 288 | devinfo = static_cast<QWidget*>( listView()->parent() ); |
306 | } | 289 | } |
307 | 290 | ||
308 | Device::~Device() | 291 | Device::~Device() |
309 | { | 292 | { |
310 | } | 293 | } |
311 | 294 | ||
312 | 295 | ||
313 | QWidget* Device::detailsWidget() | 296 | QWidget* Device::detailsWidget() |
314 | { | 297 | { |
315 | return details; | 298 | return details; |
316 | } | 299 | } |
317 | 300 | ||
318 | //================================================================================================= | 301 | //================================================================================================= |
319 | CpuDevice::CpuDevice( Category* parent, const QString& name ) | 302 | CpuDevice::CpuDevice( Category* parent, const QString& name ) |
320 | :Device( parent, name ) | 303 | :Device( parent, name ) |
321 | { | 304 | { |
322 | OListView* w = new OListView( devinfo ); | 305 | OListView* w = new OListView( devinfo ); |
323 | details = w; | 306 | details = w; |
324 | w->addColumn( "Info" ); | 307 | w->addColumn( "Info" ); |
325 | w->addColumn( "Value" ); | 308 | w->addColumn( "Value" ); |
326 | w->hide(); | 309 | w->hide(); |
327 | } | 310 | } |
328 | 311 | ||
329 | CpuDevice::~CpuDevice() | 312 | CpuDevice::~CpuDevice() |
330 | { | 313 | { |
331 | } | 314 | } |
332 | 315 | ||
333 | void CpuDevice::addInfo( const QString& info ) | 316 | void CpuDevice::addInfo( const QString& info ) |
334 | { | 317 | { |
335 | int dp = info.find( ':' ); | 318 | int dp = info.find( ':' ); |
336 | if ( dp != -1 ) | 319 | if ( dp != -1 ) |
337 | { | 320 | { |
338 | new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) ); | 321 | new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) ); |
339 | } | 322 | } |
340 | } | 323 | } |
341 | 324 | ||
342 | //================================================================================================= | 325 | //================================================================================================= |
343 | CardDevice::CardDevice( Category* parent, const QString& name ) | 326 | CardDevice::CardDevice( Category* parent, const QString& name ) |
344 | :Device( parent, name ) | 327 | :Device( parent, name ) |
345 | { | 328 | { |
346 | details = new QPushButton( name, devinfo ); | 329 | details = new QPushButton( name, devinfo ); |
347 | details->hide(); | 330 | details->hide(); |
348 | } | 331 | } |
349 | 332 | ||
350 | CardDevice::~CardDevice() | 333 | CardDevice::~CardDevice() |
351 | { | 334 | { |
352 | } | 335 | } |
353 | 336 | ||
354 | //================================================================================================= | 337 | //================================================================================================= |
355 | InputDevice::InputDevice( Category* parent, const QString& name ) | 338 | InputDevice::InputDevice( Category* parent, const QString& name ) |
356 | :Device( parent, name ) | 339 | :Device( parent, name ) |
357 | { | 340 | { |
358 | details = new QPushButton( name, devinfo ); | 341 | details = new QPushButton( name, devinfo ); |
359 | details->hide(); | 342 | details->hide(); |
360 | } | 343 | } |
361 | 344 | ||
362 | InputDevice::~InputDevice() | 345 | InputDevice::~InputDevice() |
363 | { | 346 | { |
364 | } | 347 | } |
365 | 348 | ||
366 | //================================================================================================= | 349 | //================================================================================================= |
367 | UsbDevice::UsbDevice( Category* parent, const QString& name ) | 350 | UsbDevice::UsbDevice( Category* parent, const QString& name ) |
368 | :Device( parent, name ) | 351 | :Device( parent, name ) |
369 | { | 352 | { |
370 | details = new QPushButton( name, devinfo ); | 353 | details = new QPushButton( name, devinfo ); |
371 | details->hide(); | 354 | details->hide(); |
372 | } | 355 | } |
373 | 356 | ||
374 | //================================================================================================= | 357 | //================================================================================================= |
375 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) | 358 | UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) |
376 | :Device( parent, name ) | 359 | :Device( parent, name ) |
377 | { | 360 | { |
378 | details = new QPushButton( name, devinfo ); | 361 | details = new QPushButton( name, devinfo ); |
379 | details->hide(); | 362 | details->hide(); |
380 | } | 363 | } |
381 | 364 | ||
382 | UsbDevice::~UsbDevice() | 365 | UsbDevice::~UsbDevice() |
383 | { | 366 | { |
384 | } | 367 | } |