author | mickeyl <mickeyl> | 2003-03-31 14:30:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-31 14:30:17 (UTC) |
commit | 13e8e8cbaede72948d3901a1a903eba43854d770 (patch) (unidiff) | |
tree | 672679ac87efdfecd4755f712cfd11c2d2abad43 /noncore | |
parent | e609b9726786efe7cd5be0cd6d8d9f4d91703da5 (diff) | |
download | opie-13e8e8cbaede72948d3901a1a903eba43854d770.zip opie-13e8e8cbaede72948d3901a1a903eba43854d770.tar.gz opie-13e8e8cbaede72948d3901a1a903eba43854d770.tar.bz2 |
- initial attempt to autodetect driver
- add possibility to play sounds when receiving beacon and/or found a new network
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 155 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 32 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 24 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 16 |
6 files changed, 166 insertions, 72 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index fa727f9..dda7ba0 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -12,6 +12,6 @@ | |||
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>212</width> | 14 | <width>220</width> |
15 | <height>267</height> | 15 | <height>306</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
@@ -29,5 +29,5 @@ | |||
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>4</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
@@ -326,4 +326,34 @@ | |||
326 | </widget> | 326 | </widget> |
327 | <widget> | 327 | <widget> |
328 | <class>QCheckBox</class> | ||
329 | <property stdset="1"> | ||
330 | <name>name</name> | ||
331 | <cstring>groupNetworks</cstring> | ||
332 | </property> | ||
333 | <property stdset="1"> | ||
334 | <name>enabled</name> | ||
335 | <bool>false</bool> | ||
336 | </property> | ||
337 | <property stdset="1"> | ||
338 | <name>text</name> | ||
339 | <string>Group Detected Networks</string> | ||
340 | </property> | ||
341 | </widget> | ||
342 | <widget> | ||
343 | <class>QCheckBox</class> | ||
344 | <property stdset="1"> | ||
345 | <name>name</name> | ||
346 | <cstring>enableActivity</cstring> | ||
347 | </property> | ||
348 | <property stdset="1"> | ||
349 | <name>enabled</name> | ||
350 | <bool>false</bool> | ||
351 | </property> | ||
352 | <property stdset="1"> | ||
353 | <name>text</name> | ||
354 | <string>Enable Activity Display</string> | ||
355 | </property> | ||
356 | </widget> | ||
357 | <widget> | ||
328 | <class>QLayoutWidget</class> | 358 | <class>QLayoutWidget</class> |
329 | <property stdset="1"> | 359 | <property stdset="1"> |
@@ -331,8 +361,5 @@ | |||
331 | <cstring>Layout5</cstring> | 361 | <cstring>Layout5</cstring> |
332 | </property> | 362 | </property> |
333 | <property> | 363 | <grid> |
334 | <name>layoutSpacing</name> | ||
335 | </property> | ||
336 | <vbox> | ||
337 | <property stdset="1"> | 364 | <property stdset="1"> |
338 | <name>margin</name> | 365 | <name>margin</name> |
@@ -341,74 +368,92 @@ | |||
341 | <property stdset="1"> | 368 | <property stdset="1"> |
342 | <name>spacing</name> | 369 | <name>spacing</name> |
343 | <number>-1</number> | 370 | <number>6</number> |
344 | </property> | 371 | </property> |
345 | <widget> | 372 | <widget row="0" column="1" > |
346 | <class>QCheckBox</class> | 373 | <class>QLabel</class> |
347 | <property stdset="1"> | 374 | <property stdset="1"> |
348 | <name>name</name> | 375 | <name>name</name> |
349 | <cstring>groupNetworks</cstring> | 376 | <cstring>TextLabel1</cstring> |
350 | </property> | ||
351 | <property stdset="1"> | ||
352 | <name>enabled</name> | ||
353 | <bool>false</bool> | ||
354 | </property> | 377 | </property> |
355 | <property stdset="1"> | 378 | <property stdset="1"> |
356 | <name>text</name> | 379 | <name>text</name> |
357 | <string>Group Detected Networks</string> | 380 | <string>sound on new net</string> |
358 | </property> | 381 | </property> |
359 | </widget> | 382 | </widget> |
360 | <widget> | 383 | <widget row="1" column="0" > |
361 | <class>QCheckBox</class> | 384 | <class>QComboBox</class> |
385 | <item> | ||
386 | <property> | ||
387 | <name>text</name> | ||
388 | <string>Ignore</string> | ||
389 | </property> | ||
390 | </item> | ||
391 | <item> | ||
392 | <property> | ||
393 | <name>text</name> | ||
394 | <string>Touch</string> | ||
395 | </property> | ||
396 | </item> | ||
397 | <item> | ||
398 | <property> | ||
399 | <name>text</name> | ||
400 | <string>Key</string> | ||
401 | </property> | ||
402 | </item> | ||
403 | <item> | ||
404 | <property> | ||
405 | <name>text</name> | ||
406 | <string>Alarm</string> | ||
407 | </property> | ||
408 | </item> | ||
362 | <property stdset="1"> | 409 | <property stdset="1"> |
363 | <name>name</name> | 410 | <name>name</name> |
364 | <cstring>enableActivity</cstring> | 411 | <cstring>beaconSound</cstring> |
365 | </property> | ||
366 | <property stdset="1"> | ||
367 | <name>enabled</name> | ||
368 | <bool>false</bool> | ||
369 | </property> | ||
370 | <property stdset="1"> | ||
371 | <name>text</name> | ||
372 | <string>Enable Activity Display</string> | ||
373 | </property> | 412 | </property> |
374 | </widget> | 413 | </widget> |
375 | <widget> | 414 | <widget row="0" column="0" > |
376 | <class>QCheckBox</class> | 415 | <class>QComboBox</class> |
416 | <item> | ||
417 | <property> | ||
418 | <name>text</name> | ||
419 | <string>Ignore</string> | ||
420 | </property> | ||
421 | </item> | ||
422 | <item> | ||
423 | <property> | ||
424 | <name>text</name> | ||
425 | <string>Touch</string> | ||
426 | </property> | ||
427 | </item> | ||
428 | <item> | ||
429 | <property> | ||
430 | <name>text</name> | ||
431 | <string>Key</string> | ||
432 | </property> | ||
433 | </item> | ||
434 | <item> | ||
435 | <property> | ||
436 | <name>text</name> | ||
437 | <string>Alarm</string> | ||
438 | </property> | ||
439 | </item> | ||
377 | <property stdset="1"> | 440 | <property stdset="1"> |
378 | <name>name</name> | 441 | <name>name</name> |
379 | <cstring>beepOnFound</cstring> | 442 | <cstring>netSound</cstring> |
380 | </property> | 443 | </property> |
444 | </widget> | ||
445 | <widget row="1" column="1" > | ||
446 | <class>QLabel</class> | ||
381 | <property stdset="1"> | 447 | <property stdset="1"> |
382 | <name>enabled</name> | 448 | <name>name</name> |
383 | <bool>false</bool> | 449 | <cstring>TextLabel1_3</cstring> |
384 | </property> | 450 | </property> |
385 | <property stdset="1"> | 451 | <property stdset="1"> |
386 | <name>text</name> | 452 | <name>text</name> |
387 | <string>Beep on new network</string> | 453 | <string>sound on beacon</string> |
388 | </property> | 454 | </property> |
389 | </widget> | 455 | </widget> |
390 | </vbox> | 456 | </grid> |
391 | </widget> | 457 | </widget> |
392 | <spacer> | ||
393 | <property> | ||
394 | <name>name</name> | ||
395 | <cstring>Spacer2</cstring> | ||
396 | </property> | ||
397 | <property stdset="1"> | ||
398 | <name>orientation</name> | ||
399 | <enum>Vertical</enum> | ||
400 | </property> | ||
401 | <property stdset="1"> | ||
402 | <name>sizeType</name> | ||
403 | <enum>Expanding</enum> | ||
404 | </property> | ||
405 | <property> | ||
406 | <name>sizeHint</name> | ||
407 | <size> | ||
408 | <width>20</width> | ||
409 | <height>20</height> | ||
410 | </size> | ||
411 | </property> | ||
412 | </spacer> | ||
413 | </vbox> | 458 | </vbox> |
414 | </widget> | 459 | </widget> |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 6dd862f..e287b47 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -18,13 +18,17 @@ | |||
18 | 18 | ||
19 | /* QT */ | 19 | /* QT */ |
20 | #include <qmap.h> | ||
21 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qfile.h> | ||
22 | #include <qlayout.h> | ||
23 | #include <qmap.h> | ||
22 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
23 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
24 | #include <qlayout.h> | 26 | #include <qtextstream.h> |
25 | 27 | ||
26 | /* OPIE */ | 28 | /* OPIE */ |
27 | #include <opie2/onetwork.h> | 29 | #include <opie2/onetwork.h> |
28 | 30 | ||
31 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | ||
32 | |||
29 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 33 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
30 | :WellenreiterConfigBase( parent, name, true, f ) | 34 | :WellenreiterConfigBase( parent, name, true, f ) |
@@ -46,4 +50,26 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
46 | } | 50 | } |
47 | 51 | ||
52 | // try to guess device type | ||
53 | QFile m( "/proc/modules" ); | ||
54 | if ( m.open( IO_ReadOnly ) ) | ||
55 | { | ||
56 | int devicetype(0); | ||
57 | QString line; | ||
58 | QTextStream modules( &m ); | ||
59 | while( !modules.atEnd() && !devicetype ) | ||
60 | { | ||
61 | modules >> line; | ||
62 | if ( line.contains( "cisco" ) ) devicetype = 1; | ||
63 | else if ( line.contains( "wlan" ) ) devicetype = 2; | ||
64 | else if ( line.contains( "hostap" ) ) devicetype = 3; | ||
65 | else if ( line.contains( "orinoco" ) ) devicetype = 4; | ||
66 | } | ||
67 | if ( devicetype ) | ||
68 | { | ||
69 | deviceType->setCurrentItem( devicetype ); | ||
70 | qDebug( "Wellenreiter: guessed device type to be %d", devicetype ); | ||
71 | } | ||
72 | } | ||
73 | |||
48 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | 74 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here |
49 | QPushButton* okButton = new QPushButton( "ok", this ); | 75 | QPushButton* okButton = new QPushButton( "ok", this ); |
@@ -52,4 +78,6 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
52 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 78 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
53 | #endif | 79 | #endif |
80 | |||
81 | WellenreiterConfigWindow::_instance = this; | ||
54 | }; | 82 | }; |
55 | 83 | ||
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index c627901..5fd0327 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h | |||
@@ -19,4 +19,8 @@ | |||
19 | #include "configbase.h" | 19 | #include "configbase.h" |
20 | #include <qmap.h> | 20 | #include <qmap.h> |
21 | #include <qcombobox.h> | ||
22 | #include <qstring.h> | ||
23 | |||
24 | class WellenreiterConfigWindow; | ||
21 | 25 | ||
22 | class WellenreiterConfigWindow : public WellenreiterConfigBase | 26 | class WellenreiterConfigWindow : public WellenreiterConfigBase |
@@ -27,7 +31,11 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase | |||
27 | int daemonDeviceType(); | 31 | int daemonDeviceType(); |
28 | int daemonHopInterval(); | 32 | int daemonHopInterval(); |
33 | const QString soundOnNetwork() const { return netSound->currentText(); }; | ||
34 | const QString soundOnBeacon() const { return beaconSound->currentText(); }; | ||
35 | static WellenreiterConfigWindow* instance() { return _instance; }; | ||
29 | 36 | ||
30 | protected: | 37 | protected: |
31 | QMap<QString, int> _devicetype; | 38 | QMap<QString, int> _devicetype; |
39 | static WellenreiterConfigWindow* _instance; | ||
32 | 40 | ||
33 | }; | 41 | }; |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index be1245e..a006a3c 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -15,4 +15,5 @@ | |||
15 | 15 | ||
16 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "configwindow.h" | ||
17 | 18 | ||
18 | #include <assert.h> | 19 | #include <assert.h> |
@@ -21,4 +22,9 @@ | |||
21 | #include <qtextstream.h> | 22 | #include <qtextstream.h> |
22 | 23 | ||
24 | #ifdef QWS | ||
25 | #include <opie/odevice.h> | ||
26 | using namespace Opie; | ||
27 | #endif | ||
28 | |||
23 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 29 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
24 | :OListView( parent, name ), _manufacturerdb( 0 ) | 30 | :OListView( parent, name ), _manufacturerdb( 0 ) |
@@ -143,5 +149,4 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
143 | { | 149 | { |
144 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 150 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); |
145 | |||
146 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); | 151 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); |
147 | } | 152 | } |
@@ -193,4 +198,6 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS | |||
193 | { | 198 | { |
194 | qDebug( "creating scanlist item" ); | 199 | qDebug( "creating scanlist item" ); |
200 | if ( WellenreiterConfigWindow::instance() && type == "networks" ) | ||
201 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | ||
195 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 202 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
196 | } | 203 | } |
@@ -272,4 +279,5 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
272 | } | 279 | } |
273 | 280 | ||
281 | |||
274 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 282 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
275 | { | 283 | { |
@@ -277,4 +285,16 @@ void MScanListItem::setManufacturer( const QString& manufacturer ) | |||
277 | } | 285 | } |
278 | 286 | ||
287 | |||
288 | void MScanListItem::playSound( const QString& sound ) const | ||
289 | { | ||
290 | #ifdef QWS | ||
291 | if ( sound == "Ignore" ) return; | ||
292 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | ||
293 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | ||
294 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | ||
295 | #endif | ||
296 | } | ||
297 | |||
298 | |||
279 | void MScanListItem::receivedBeacon() | 299 | void MScanListItem::receivedBeacon() |
280 | { | 300 | { |
@@ -285,4 +305,6 @@ void MScanListItem::receivedBeacon() | |||
285 | setText( col_sig, QString::number( _beacons ) ); | 305 | setText( col_sig, QString::number( _beacons ) ); |
286 | setText( col_lastseen, QTime::currentTime().toString() ); | 306 | setText( col_lastseen, QTime::currentTime().toString() ); |
307 | if ( WellenreiterConfigWindow::instance() ) | ||
308 | playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); | ||
287 | } | 309 | } |
288 | 310 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index da9369f..01db172 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -92,4 +92,7 @@ class MScanListItem: public OListViewItem | |||
92 | virtual void serializeFrom( QDataStream& s ); | 92 | virtual void serializeFrom( QDataStream& s ); |
93 | 93 | ||
94 | protected: | ||
95 | void playSound( const QString& ) const; | ||
96 | |||
94 | private: | 97 | private: |
95 | QString _type; | 98 | QString _type; |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 41ffdcc..d1dd73a 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -111,7 +111,4 @@ void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | |||
111 | void Wellenreiter::receivePacket(OPacket* p) | 111 | void Wellenreiter::receivePacket(OPacket* p) |
112 | { | 112 | { |
113 | logwindow->log( "(d) Received data from daemon" ); | ||
114 | //TODO | ||
115 | |||
116 | // check if we received a beacon frame | 113 | // check if we received a beacon frame |
117 | // static_cast is justified here | 114 | // static_cast is justified here |
@@ -164,17 +161,8 @@ void Wellenreiter::startStopClicked() | |||
164 | iface->setPromiscuousMode( false ); | 161 | iface->setPromiscuousMode( false ); |
165 | 162 | ||
166 | //TODO: Display "please wait..." (use owait?) | 163 | system( "cardctl reset; sleep 1; dhclient; udhcpc" ); //FIXME: Use OProcess |
167 | |||
168 | /* | ||
169 | |||
170 | QString cmdline; | ||
171 | cmdline.sprintf( "ifdown %s; sleep 1; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface ); | ||
172 | system( cmdline ); //FIXME: Use OProcess | ||
173 | |||
174 | */ | ||
175 | 164 | ||
176 | // message the user | 165 | // message the user |
177 | 166 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | |
178 | //QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | ||
179 | } | 167 | } |
180 | 168 | ||