-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 107 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 31 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 5 |
3 files changed, 95 insertions, 48 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index d9a0aea..d7ab3bb 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -1,39 +1,39 @@ <!DOCTYPE UI><UI> <class>WellenreiterConfigBase</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>WellenreiterConfigBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>286</width> - <height>280</height> + <width>303</width> + <height>287</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Wellenreiter II COnfiguration Dialog</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="0" > <class>QTabWidget</class> <property stdset="1"> @@ -606,58 +606,112 @@ <property stdset="1"> <name>name</name> <cstring>parsePackets</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>7</vsizetype> </sizepolicy> </property> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>UI</string> </attribute> - <grid> + <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> - <widget row="3" column="0" > + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>lookupVendor</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Lookup MAC vendor names</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>openTree</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Open Tree On New Station</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>disablePM</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Disable Power Management</string> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer3</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> + <widget> <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>GroupBox4_2</cstring> </property> <property stdset="1"> <name>title</name> <string>Action On Detecting</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> @@ -690,92 +744,49 @@ <name>name</name> <cstring>newWirelessStation</cstring> </property> </widget> <widget row="2" column="1" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>newStation</cstring> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>New Station</string> </property> </widget> </grid> </widget> - <spacer row="2" column="0" > - <property> - <name>name</name> - <cstring>Spacer3</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> - <widget row="0" column="0" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>lookupVendor</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Lookup MAC vendor names</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>openTree</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Open Tree On New Station</string> - </property> - </widget> - </grid> + </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Intrusion</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QGroupBox</class> <property stdset="1"> <name>name</name> diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index a331925..d255c6a 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -34,88 +34,97 @@ #include <opie2/onetwork.h> WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, true, f ) { _devicetype[ "cisco" ] = DEVTYPE_CISCO; _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; _devicetype[ "<file>" ] = DEVTYPE_FILE; // gather possible interface names from ONetwork ONetwork* net = ONetwork::instance(); ONetwork::InterfaceIterator it = net->iterator(); while ( it.current() ) { if ( it.current()->isWireless() ) interfaceName->insertItem( it.current()->name() ); ++it; } + if ( !load() ) // no configuration present + { // 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 = DEVTYPE_CISCO; else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; } if ( devicetype ) { deviceType->setCurrentItem( devicetype ); _guess = 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 ); okButton->show(); WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); #endif WellenreiterConfigWindow::_instance = this; connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); // make the checkbox 'channelAll' control all other channels connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); }; +WellenreiterConfigWindow::~WellenreiterConfigWindow() +{ + save(); +} + + int WellenreiterConfigWindow::driverType() const { QString name = deviceType->currentText(); if ( _devicetype.contains( name ) ) { return _devicetype[name]; } else { return 0; } }; int WellenreiterConfigWindow::hoppingInterval() const { return hopInterval->cleanText().toInt(); } bool WellenreiterConfigWindow::usePrismHeader() const { return prismHeader->isOn(); } @@ -187,24 +196,46 @@ void WellenreiterConfigWindow::channelAllClicked(int state) channel11->setChecked( b ); channel12->setChecked( b ); channel13->setChecked( b ); channel14->setChecked( b ); } bool WellenreiterConfigWindow::useGPS() const { return enableGPS->isChecked(); } const QString WellenreiterConfigWindow::gpsHost() const { return useGPS() ? gpsdHost->currentText() : QString::null; } int WellenreiterConfigWindow::gpsPort() const { bool ok; return useGPS() ? gpsdPort->value() : -1; } + + +bool WellenreiterConfigWindow::load() +{ +#ifdef Q_WS_X11 + #warning Persistent Configuration not yet implemented for standalone X11 build + return false; +#else + qDebug( "loading configuration settings..." ); + return true; +#endif +} + + +void WellenreiterConfigWindow::save() +{ +#ifdef Q_WS_X11 + #warning Persistent Configuration not yet implemented for standalone X11 build +#else + qDebug( "saving configuration settings..." ); +#endif +} diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 8f160b1..2986320 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h @@ -16,51 +16,56 @@ #ifndef WELLENREITERCONFIGWINDOW_H #define WELLENREITERCONFIGWINDOW_H #include "configbase.h" #include <qmap.h> #include <qcombobox.h> #include <qstring.h> const int DEVTYPE_SELECT = 0; const int DEVTYPE_CISCO = 1; const int DEVTYPE_WLAN_NG = 2; const int DEVTYPE_HOSTAP = 3; const int DEVTYPE_ORINOCO = 4; const int DEVTYPE_MANUAL = 5; const int DEVTYPE_FILE = 6; class WellenreiterConfigWindow; class WellenreiterConfigWindow : public WellenreiterConfigBase { Q_OBJECT public: WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); + ~WellenreiterConfigWindow(); + int driverType() const; const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; static WellenreiterConfigWindow* instance() { return _instance; }; int hoppingInterval() const; bool usePrismHeader() const; bool isChannelChecked( int ) const; bool useGPS() const; const QString gpsHost() const; int gpsPort() const; + void save(); + bool load(); + public slots: void changedDeviceType(int); void getCaptureFileNameClicked(); void channelAllClicked(int); protected: QMap<QString, int> _devicetype; static WellenreiterConfigWindow* _instance; int _guess; }; #endif |