summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-03-31 14:30:17 (UTC)
committer mickeyl <mickeyl>2003-03-31 14:30:17 (UTC)
commit13e8e8cbaede72948d3901a1a903eba43854d770 (patch) (side-by-side diff)
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
@@ -12,6 +12,6 @@
<x>0</x>
<y>0</y>
- <width>212</width>
- <height>267</height>
+ <width>220</width>
+ <height>306</height>
</rect>
</property>
@@ -29,5 +29,5 @@
<property stdset="1">
<name>margin</name>
- <number>4</number>
+ <number>3</number>
</property>
<property stdset="1">
@@ -326,4 +326,34 @@
</widget>
<widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>groupNetworks</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Group Detected Networks</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>enableActivity</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable Activity Display</string>
+ </property>
+ </widget>
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
@@ -331,8 +361,5 @@
<cstring>Layout5</cstring>
</property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
@@ -341,74 +368,92 @@
<property stdset="1">
<name>spacing</name>
- <number>-1</number>
+ <number>6</number>
</property>
- <widget>
- <class>QCheckBox</class>
+ <widget row="0" column="1" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>groupNetworks</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
+ <cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Group Detected Networks</string>
+ <string>sound on new net</string>
</property>
</widget>
- <widget>
- <class>QCheckBox</class>
+ <widget row="1" column="0" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Touch</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Key</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Alarm</string>
+ </property>
+ </item>
<property stdset="1">
<name>name</name>
- <cstring>enableActivity</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Enable Activity Display</string>
+ <cstring>beaconSound</cstring>
</property>
</widget>
- <widget>
- <class>QCheckBox</class>
+ <widget row="0" column="0" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Ignore</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Touch</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Key</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Alarm</string>
+ </property>
+ </item>
<property stdset="1">
<name>name</name>
- <cstring>beepOnFound</cstring>
+ <cstring>netSound</cstring>
</property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLabel</class>
<property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
+ <name>name</name>
+ <cstring>TextLabel1_3</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Beep on new network</string>
+ <string>sound on beacon</string>
</property>
</widget>
- </vbox>
+ </grid>
</widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer2</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
</vbox>
</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 @@
/* QT */
-#include <qmap.h>
#include <qcombobox.h>
+#include <qfile.h>
+#include <qlayout.h>
+#include <qmap.h>
#include <qpushbutton.h>
#include <qspinbox.h>
-#include <qlayout.h>
+#include <qtextstream.h>
/* OPIE */
#include <opie2/onetwork.h>
+WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
+
WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
:WellenreiterConfigBase( parent, name, true, f )
@@ -46,4 +50,26 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
}
+ // try to guess device type
+ QFile m( "/proc/modules" );
+ if ( m.open( IO_ReadOnly ) )
+ {
+ int devicetype(0);
+ QString line;
+ QTextStream modules( &m );
+ while( !modules.atEnd() && !devicetype )
+ {
+ modules >> line;
+ if ( line.contains( "cisco" ) ) devicetype = 1;
+ else if ( line.contains( "wlan" ) ) devicetype = 2;
+ else if ( line.contains( "hostap" ) ) devicetype = 3;
+ else if ( line.contains( "orinoco" ) ) devicetype = 4;
+ }
+ if ( devicetype )
+ {
+ deviceType->setCurrentItem( devicetype );
+ qDebug( "Wellenreiter: guessed device type to be %d", devicetype );
+ }
+ }
+
#ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
QPushButton* okButton = new QPushButton( "ok", this );
@@ -52,4 +78,6 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
#endif
+
+ WellenreiterConfigWindow::_instance = this;
};
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 @@
#include "configbase.h"
#include <qmap.h>
+#include <qcombobox.h>
+#include <qstring.h>
+
+class WellenreiterConfigWindow;
class WellenreiterConfigWindow : public WellenreiterConfigBase
@@ -27,7 +31,11 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
int daemonDeviceType();
int daemonHopInterval();
+ const QString soundOnNetwork() const { return netSound->currentText(); };
+ const QString soundOnBeacon() const { return beaconSound->currentText(); };
+ static WellenreiterConfigWindow* instance() { return _instance; };
protected:
QMap<QString, int> _devicetype;
+ static WellenreiterConfigWindow* _instance;
};
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 @@
#include "scanlist.h"
+#include "configwindow.h"
#include <assert.h>
@@ -21,4 +22,9 @@
#include <qtextstream.h>
+#ifdef QWS
+#include <opie/odevice.h>
+using namespace Opie;
+#endif
+
MScanListView::MScanListView( QWidget* parent, const char* name )
:OListView( parent, name ), _manufacturerdb( 0 )
@@ -143,5 +149,4 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
{
s.sprintf( "(i) new network: '%s'", (const char*) essid );
-
network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
}
@@ -193,4 +198,6 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
{
qDebug( "creating scanlist item" );
+ if ( WellenreiterConfigWindow::instance() && type == "networks" )
+ playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() );
decorateItem( type, essid, macaddr, wep, channel, signal );
}
@@ -272,4 +279,5 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
}
+
void MScanListItem::setManufacturer( const QString& manufacturer )
{
@@ -277,4 +285,16 @@ void MScanListItem::setManufacturer( const QString& manufacturer )
}
+
+void MScanListItem::playSound( const QString& sound ) const
+{
+ #ifdef QWS
+ if ( sound == "Ignore" ) return;
+ else if ( sound == "Touch" ) ODevice::inst()->touchSound();
+ else if ( sound == "Key" ) ODevice::inst()->keySound();
+ else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
+ #endif
+}
+
+
void MScanListItem::receivedBeacon()
{
@@ -285,4 +305,6 @@ void MScanListItem::receivedBeacon()
setText( col_sig, QString::number( _beacons ) );
setText( col_lastseen, QTime::currentTime().toString() );
+ if ( WellenreiterConfigWindow::instance() )
+ playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() );
}
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
virtual void serializeFrom( QDataStream& s );
+ protected:
+ void playSound( const QString& ) const;
+
private:
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 )
void Wellenreiter::receivePacket(OPacket* p)
{
- logwindow->log( "(d) Received data from daemon" );
- //TODO
-
// check if we received a beacon frame
// static_cast is justified here
@@ -164,17 +161,8 @@ void Wellenreiter::startStopClicked()
iface->setPromiscuousMode( false );
- //TODO: Display "please wait..." (use owait?)
-
- /*
-
- QString cmdline;
- cmdline.sprintf( "ifdown %s; sleep 1; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface );
- system( cmdline ); //FIXME: Use OProcess
-
- */
+ system( "cardctl reset; sleep 1; dhclient; udhcpc" ); //FIXME: Use OProcess
// message the user
-
- //QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
+ QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
}