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