summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-03-31 14:30:17 (UTC)
committer mickeyl <mickeyl>2003-03-31 14:30:17 (UTC)
commit13e8e8cbaede72948d3901a1a903eba43854d770 (patch) (unidiff)
tree672679ac87efdfecd4755f712cfd11c2d2abad43
parente609b9726786efe7cd5be0cd6d8d9f4d91703da5 (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui155
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp32
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h8
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp24
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h3
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp16
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
@@ -13,4 +13,4 @@
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>
@@ -30,3 +30,3 @@
30 <name>margin</name> 30 <name>margin</name>
31 <number>4</number> 31 <number>3</number>
32 </property> 32 </property>
@@ -327,2 +327,32 @@
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>
@@ -332,6 +362,3 @@
332 </property> 362 </property>
333 <property> 363 <grid>
334 <name>layoutSpacing</name>
335 </property>
336 <vbox>
337 <property stdset="1"> 364 <property stdset="1">
@@ -342,13 +369,9 @@
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>
@@ -356,29 +379,72 @@
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>
@@ -386,28 +452,7 @@
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>
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
@@ -19,7 +19,9 @@
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
@@ -28,2 +30,4 @@
28 30
31WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
32
29WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 33WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
@@ -47,2 +51,24 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
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
@@ -53,2 +79,4 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
53 #endif 79 #endif
80
81 WellenreiterConfigWindow::_instance = this;
54}; 82};
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
@@ -20,2 +20,6 @@
20#include <qmap.h> 20#include <qmap.h>
21#include <qcombobox.h>
22#include <qstring.h>
23
24class WellenreiterConfigWindow;
21 25
@@ -28,2 +32,5 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
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
@@ -31,2 +38,3 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
31 QMap<QString, int> _devicetype; 38 QMap<QString, int> _devicetype;
39 static WellenreiterConfigWindow* _instance;
32 40
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
@@ -16,2 +16,3 @@
16#include "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h"
17 18
@@ -22,2 +23,7 @@
22 23
24#ifdef QWS
25#include <opie/odevice.h>
26using namespace Opie;
27#endif
28
23MScanListView::MScanListView( QWidget* parent, const char* name ) 29MScanListView::MScanListView( QWidget* parent, const char* name )
@@ -144,3 +150,2 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
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 );
@@ -194,2 +199,4 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
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 );
@@ -273,2 +280,3 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
273 280
281
274void MScanListItem::setManufacturer( const QString& manufacturer ) 282void MScanListItem::setManufacturer( const QString& manufacturer )
@@ -278,2 +286,14 @@ void MScanListItem::setManufacturer( const QString& manufacturer )
278 286
287
288void 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
279void MScanListItem::receivedBeacon() 299void MScanListItem::receivedBeacon()
@@ -286,2 +306,4 @@ void MScanListItem::receivedBeacon()
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}
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
@@ -93,2 +93,5 @@ class MScanListItem: public OListViewItem
93 93
94 protected:
95 void playSound( const QString& ) const;
96
94 private: 97 private:
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
@@ -112,5 +112,2 @@ 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
@@ -165,15 +162,6 @@ void Wellenreiter::startStopClicked()
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 }