-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 37 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 1 |
2 files changed, 30 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 8c2c315..0bfc8e9 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -33,9 +33,9 @@ using namespace Opie; #include <qpushbutton.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qspinbox.h> -#include <qsocketnotifier.h> +#include <qmainwindow.h> // Standard #include <assert.h> @@ -94,21 +94,44 @@ Wellenreiter::Wellenreiter( QWidget* parent ) pcap = new OPacketCapturer(); } + Wellenreiter::~Wellenreiter() { // no need to delete child widgets, Qt does it all for us delete manufacturerdb; delete pcap; } + void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } + +void Wellenreiter::channelHopped(int c) +{ + QString title = "Wellenreiter II -scan- ["; + QString left; + if ( c > 1 ) left.fill( '.', c-1 ); + title.append( left ); + title.append( '|' ); + if ( c < iface->channels() ) + { + QString right; + right.fill( '.', iface->channels()-c ); + title.append( right ); + } + title.append( "]" ); + //title.append( QString().sprintf( " %02d", c ) ); + assert( parent() ); + ( (QMainWindow*) parent() )->setCaption( title ); +} + + void Wellenreiter::receivePacket(OPacket* p) { hexWindow()->log( p->dump( 8 ) ); @@ -185,9 +208,9 @@ void Wellenreiter::receivePacket(OPacket* p) qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", (const char*) wlan->macAddress2().toString(true), (const char*) wlan->macAddress1().toString(true), (const char*) wlan->macAddress3().toString(true) ); - netView()->traffic( "fromDS", wlan->macAddress2().toString(), + netView()->traffic( "IBSS", wlan->macAddress2().toString(), wlan->macAddress1().toString(), wlan->macAddress3().toString() ); } return; @@ -198,9 +221,9 @@ void Wellenreiter::startStopClicked() { if ( sniffing ) { disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); - + disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); iface->setChannelHopping(); // stop hopping channels pcap->close(); sniffing = false; #ifdef QWS @@ -220,8 +243,10 @@ void Wellenreiter::startStopClicked() iface->setPromiscuousMode( false ); system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess logwindow->log( "(i) Stopped Scanning." ); + assert( parent() ); + ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); // message the user QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); } @@ -280,15 +305,11 @@ void Wellenreiter::startStopClicked() iface->setChannelHopping( 1000 ); //use interval from config window // connect connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); + connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); logwindow->log( "(i) Started Scanning." ); - #ifdef QWS - oApp->setTitle( "Scanning ..." ); - #else - qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); - #endif sniffing = true; } } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index ff73dd4..85f889b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -47,8 +47,9 @@ class Wellenreiter : public WellenreiterBase { MHexWindow* hexWindow() const { return hexwindow; }; bool isDaemonRunning() const { return sniffing; }; public slots: + void channelHopped(int); void receivePacket(OPacket*); void startStopClicked(); private: |