author | mickeyl <mickeyl> | 2003-04-10 15:49:08 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-10 15:49:08 (UTC) |
commit | 4e8e3741dca909782e15bb197e5b6a78750536c2 (patch) (side-by-side diff) | |
tree | 37285f8d053b3995aee46487277b57248862848c /noncore/net/wellenreiter/gui/configwindow.cpp | |
parent | 3733471135ea180709fcf4695607cce0c5fc7fb5 (diff) | |
download | opie-4e8e3741dca909782e15bb197e5b6a78750536c2.zip opie-4e8e3741dca909782e15bb197e5b6a78750536c2.tar.gz opie-4e8e3741dca909782e15bb197e5b6a78750536c2.tar.bz2 |
Wellenreiter can now open and replay capture files as written by tcpdump, ethereal, etc.
Next task: writing capture files
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index ba1119e..4aca526 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -14,10 +14,12 @@ **********************************************************************/ /* LOCAL */ #include "configwindow.h" +#include "mainwindow.h" /* QT */ +#include <qapplication.h> #include <qcombobox.h> #include <qfile.h> #include <qlayout.h> #include <qmap.h> @@ -32,13 +34,14 @@ WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, true, f ) { - _devicetype[ "cisco" ] = 1; - _devicetype[ "wlan-ng" ] = 2; - _devicetype[ "hostap" ] = 3; - _devicetype[ "orinoco" ] = 4; - _devicetype[ "<manual>" ] = 5; + _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(); @@ -58,17 +61,18 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char QTextStream modules( &m ); while( !modules.atEnd() && !devicetype ) { modules >> line; - if ( line.contains( "cisco" ) ) devicetype = 1; - else if ( line.contains( "hostap" ) ) devicetype = 3; - else if ( line.contains( "prism" ) ) devicetype = 2; - else if ( line.contains( "orinoco" ) ) devicetype = 4; + 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 ); - qDebug( "Wellenreiter: guessed device type to be %d", 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 @@ -78,10 +82,13 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); #endif WellenreiterConfigWindow::_instance = this; + + connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); }; + int WellenreiterConfigWindow::daemonDeviceType() { QString name = deviceType->currentText(); if ( _devicetype.contains( name ) ) @@ -93,8 +100,27 @@ int WellenreiterConfigWindow::daemonDeviceType() return 0; } }; + int WellenreiterConfigWindow::daemonHopInterval() { return hopInterval->cleanText().toInt(); } + + +void WellenreiterConfigWindow::changedDeviceType(int t) +{ + if ( t != DEVTYPE_FILE ) return; + QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); + if ( !name.isNull() && QFile::exists( name ) ) + { + interfaceName->insertItem( name ); + interfaceName->setCurrentItem( interfaceName->count()-1 ); + } + else + { + deviceType->setCurrentItem( _guess ); + } + +} + |