Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 287 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 103 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 7 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 20 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 8 |
7 files changed, 347 insertions, 89 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 2c335df..de6abfc 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>303</width> - <height>343</height> + <width>250</width> + <height>371</height> </rect> </property> @@ -707,9 +707,9 @@ <property stdset="1"> <name>margin</name> - <number>6</number> + <number>5</number> </property> <property stdset="1"> <name>spacing</name> - <number>6</number> + <number>3</number> </property> <widget> @@ -775,72 +775,249 @@ <property stdset="1"> <name>enabled</name> - <bool>false</bool> + <bool>true</bool> </property> <property stdset="1"> <name>title</name> - <string>Action On Detecting</string> + <string>Action on detecting a new</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> - <number>11</number> + <number>3</number> </property> <property stdset="1"> <name>spacing</name> - <number>6</number> + <number>0</number> </property> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>New Wireless Station</string> - </property> - </widget> <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>New Network</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>newNetwork</cstring> - </property> - </widget> - <widget row="1" column="1" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>newWirelessStation</cstring> - </property> - </widget> - <widget row="2" column="1" > - <class>QComboBox</class> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>newStation</cstring> + <cstring>Layout6</cstring> </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> + <property> + <name>layoutMargin</name> </property> - <property stdset="1"> - <name>text</name> - <string>New Station</string> + <property> + <name>layoutSpacing</name> </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>2</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget row="4" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Wired Station:</string> + </property> + </widget> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1_3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Network:</string> + </property> + </widget> + <widget row="2" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><Ignore></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Alarm</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Click</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Blink LED</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Run Script</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>newClientAction</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="3" column="0" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>newClientScript</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + </widget> + <widget row="2" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Wireless Station:</string> + </property> + </widget> + <widget row="4" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><Ignore></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Alarm</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Click</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Blink LED</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Run Script</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>newStationAction</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="0" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><Ignore></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Alarm</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Click</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Blink LED</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Run Script</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>newNetworkAction</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>editable</name> + <bool>false</bool> + </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>newNetworkScript</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + </widget> + <widget row="5" column="0" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>newStationScript</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + </widget> + </grid> </widget> </grid> diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index f536f4e..1341d03 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -18,4 +18,11 @@ #include "mainwindow.h" +/* OPIE */ +#include <opie2/onetwork.h> +#ifdef QWS +#include <opie2/oapplication.h> +#include <opie2/oconfig.h> +#endif + /* QT */ #include <qapplication.h> @@ -27,15 +34,9 @@ #include <qmap.h> #include <qpushbutton.h> +#include <qtabwidget.h> #include <qtoolbutton.h> #include <qspinbox.h> #include <qtextstream.h> -/* OPIE */ -#include <opie2/onetwork.h> - -#ifdef QWS -#include <opie2/oapplication.h> -#include <opie2/oconfig.h> -#endif WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; @@ -73,4 +74,7 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); + connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); + connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); + connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); @@ -79,4 +83,7 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); + + // hide tab4 (parse) until Wellenreiter 1.2 + tab->removePage( tab_4 ); }; @@ -186,4 +193,34 @@ void WellenreiterConfigWindow::changedDeviceType(int t) +void WellenreiterConfigWindow::synchronizeActionsAndScripts() +{ + if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); + if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); + if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); + + //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); + //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); + //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); +} + + +void WellenreiterConfigWindow::changedNetworkAction(int t) +{ + synchronizeActionsAndScripts(); +} + + +void WellenreiterConfigWindow::changedClientAction(int t) +{ + synchronizeActionsAndScripts(); +} + + +void WellenreiterConfigWindow::changedStationAction(int t) +{ + synchronizeActionsAndScripts(); +} + + void WellenreiterConfigWindow::getCaptureFileNameClicked() { @@ -236,4 +273,43 @@ int WellenreiterConfigWindow::gpsPort() const +void WellenreiterConfigWindow::performAction( const QString& type ) +{ + int action; + QString script; + + if ( type == "network" ) + { + action = newNetworkAction->currentItem(); + script = newNetworkScript->text(); + } + else if ( type == "managed" || type == "adhoc" ) + { + action = newClientAction->currentItem(); + script = newClientScript->text(); + } + else if ( type == "station" ) + { + action = newStationAction->currentItem(); + script = newStationScript->text(); + } + else + { + qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); + return; + } + + qDebug( "going to perform action %d (script='%s')", action, (const char*) script ); + + /* + + 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(); + + */ +} + + void WellenreiterConfigWindow::load() { @@ -291,4 +367,11 @@ void WellenreiterConfigWindow::load() openTree->setChecked( c->readBoolEntry( "openTree", true ) ); disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); + newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 0 ) ); + newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) ); + newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 0 ) ); + newClientScript->setText( c->readEntry( "newClientScript", "" ) ); + newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 0 ) ); + newStationScript->setText( c->readEntry( "newStationScript", "" ) ); + synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand c->setGroup( "GPS" ); @@ -334,4 +417,10 @@ void WellenreiterConfigWindow::save() c->writeEntry( "openTree", openTree->isChecked() ); c->writeEntry( "disablePM", disablePM->isChecked() ); + c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() ); + c->writeEntry( "newNetworkScript", newNetworkScript->text() ); + c->writeEntry( "newClientAction", newClientAction->currentItem() ); + c->writeEntry( "newClientScript", newClientScript->text() ); + c->writeEntry( "newStationAction", newStationAction->currentItem() ); + c->writeEntry( "newStationScript", newStationScript->text() ); c->setGroup( "GPS" ); diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 80b4d2b..b082331 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h @@ -58,7 +58,14 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase public slots: void changedDeviceType(int); + void changedNetworkAction(int t); + void changedClientAction(int t); + void changedStationAction(int t); void getCaptureFileNameClicked(); void performAutodetection(); void channelAllClicked(int); + void performAction( const QString& ); + + protected: + void synchronizeActionsAndScripts(); protected: diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 31f95ce..b814427 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp @@ -59,8 +59,8 @@ GpsLocation GPS::position() const QString str; stream.readRawBytes( &buf[0], 7 ); - float lat = -111.111; + float lat = -111; stream >> lat; stream.skipWhiteSpace(); - float lon = -111.111; + float lon = -111; stream >> lon; stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF @@ -69,5 +69,5 @@ GpsLocation GPS::position() const } } - return GpsLocation( -111.111, -111.111 ); + return GpsLocation( -111, -111 ); } @@ -75,5 +75,5 @@ GpsLocation GPS::position() const QString GpsLocation::dmsPosition() const { - if ( _latitude == -111.111 || _longitude == -111.11 ) + if ( _latitude == -111 || _longitude == -111 ) return "N/A"; if ( _latitude == 0.0 && _longitude == 0.0 ) diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index d89c71f..470646d 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -27,9 +27,6 @@ #ifdef QWS #include <qpe/qpeapplication.h> -#include <opie/odevice.h> -using namespace Opie; #endif - #ifdef QWS #include <qpe/resource.h> @@ -422,6 +419,8 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS qDebug( "creating scanlist item" ); #endif - if ( WellenreiterConfigWindow::instance() && type == "network" ) - playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); + + if ( WellenreiterConfigWindow::instance() ) + WellenreiterConfigWindow::instance()->performAction( type ); // better use signal/slot combination here + decorateItem( type, essid, macaddr, wep, channel, signal ); } @@ -540,15 +539,4 @@ void MScanListItem::setLocation( const QString& location ) -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() { diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 6cd8fc0..42f35c2 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -110,7 +110,4 @@ 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 45d7142..25632f3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -182,5 +182,5 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); - QString essid = ssid ? ssid->ID() : QString("<unknown>"); + QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; @@ -188,5 +188,5 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); - GpsLocation loc( -111.111, -111.111 ); + GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) { @@ -217,5 +217,5 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro if ( control->controlType() == "Acknowledge" ) { - netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) ); + netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); } else @@ -261,5 +261,5 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd to = data->destinationAddress(); - netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) ); + netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); } |