-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 56 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 24 |
3 files changed, 47 insertions, 41 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 868b0b0..ab7e0c7 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -57,20 +57,13 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n setIconText( "Wellenreiter/X11" ); #endif - // setup icon sets - - infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); - settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); - startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); - stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); - // setup tool buttons startButton = new QToolButton( 0 ); #ifdef QWS startButton->setAutoRaise( true ); #endif - startButton->setIconSet( *startIconSet ); + startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); startButton->setEnabled( false ); connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); @@ -78,24 +71,25 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n #ifdef QWS stopButton->setAutoRaise( true ); #endif - stopButton->setIconSet( *stopIconSet ); + stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); stopButton->setEnabled( false ); connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); - QToolButton* c = new QToolButton( 0 ); - #ifdef QWS - c->setAutoRaise( true ); - #endif - c->setIconSet( *infoIconSet ); - c->setEnabled( false ); - QToolButton* d = new QToolButton( 0 ); #ifdef QWS d->setAutoRaise( true ); #endif - d->setIconSet( *settingsIconSet ); + d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); + uploadButton = new QToolButton( 0 ); + #ifdef QWS + uploadButton->setAutoRaise( true ); + #endif + uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); + uploadButton->setEnabled( false ); + connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); + // setup menu bar int id; @@ -116,6 +110,8 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n id = file->insertItem( tr( "&Load" ), fileLoad ); file->insertItem( tr( "&Save" ), fileSave ); file->insertSeparator(); + uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); + file->insertSeparator(); file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); QPopupMenu* view = new QPopupMenu( mb ); @@ -139,15 +135,16 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n id = mb->insertItem( tr( "&Demo" ), demo ); mb->setItemEnabled( id, true ); + mb->setItemEnabled( uploadID, false ); #ifdef QWS mb->insertItem( startButton ); mb->insertItem( stopButton ); - mb->insertItem( c ); + mb->insertItem( uploadButton ); mb->insertItem( d ); #else // Qt3 changed the insertion order. It's now totally random :( mb->insertItem( d ); - mb->insertItem( c ); + mb->insertItem( uploadButton ); mb->insertItem( stopButton ); mb->insertItem( startButton ); #endif @@ -179,7 +176,6 @@ void WellenreiterMainWindow::showConfigure() } - void WellenreiterMainWindow::updateToolButtonState() { const QString& interface = cw->interfaceName->currentText(); @@ -204,17 +200,21 @@ void WellenreiterMainWindow::changedSniffingState() menuBar()->setItemEnabled( startID, !mw->sniffing ); stopButton->setEnabled( mw->sniffing ); menuBar()->setItemEnabled( stopID, mw->sniffing ); + + if ( !mw->sniffing ) + { + menuBar()->setItemEnabled( uploadID, true ); + uploadButton->setEnabled( true ); + } } WellenreiterMainWindow::~WellenreiterMainWindow() { - delete infoIconSet; - delete settingsIconSet; - delete startIconSet; - delete stopIconSet; + qDebug( "Wellenreiter:: bye." ); }; + void WellenreiterMainWindow::demoAddStations() { //mw = 0; // test SIGSGV handling @@ -343,6 +343,7 @@ void WellenreiterMainWindow::fileLoadSession() } } + void WellenreiterMainWindow::fileNew() { mw->netView()->clear(); @@ -350,6 +351,7 @@ void WellenreiterMainWindow::fileNew() mw->hexWindow()->clear(); } + void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) { if ( mw->isDaemonRunning() ) @@ -365,3 +367,9 @@ void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) } +void WellenreiterMainWindow::uploadSession() +{ + QMessageBox::warning( this, "Wellenreiter/Opie", + tr( "This feature is\nunder construction... ;-)" ) ); +} + diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 926bb0a..8d4e768 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h @@ -36,15 +36,12 @@ class WellenreiterMainWindow: public QMainWindow Wellenreiter* mw; WellenreiterConfigWindow* cw; - const QIconSet* startIconSet; - const QIconSet* stopIconSet; - const QIconSet* infoIconSet; - const QIconSet* settingsIconSet; - QToolButton* startButton; QToolButton* stopButton; + QToolButton* uploadButton; int startID; int stopID; + int uploadID; protected: virtual void closeEvent( QCloseEvent* ); @@ -58,6 +55,7 @@ class WellenreiterMainWindow: public QMainWindow void fileSaveSession(); void fileLoadSession(); void fileNew(); + void uploadSession(); void changedSniffingState(); }; diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 1d4a98b..ec89f1e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -302,7 +302,7 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) // go through all child packets and see if one is inside the child hierarchy for p // if so, do what the user requested (protocolAction), e.g. pass or discard if ( !configwindow->writeCaptureFile->isChecked() ) - return false; + return true; // semantic change - we're logging anyway now to /tmp/wellenreiter QObjectList* l = p->queryList(); QObjectListIt it( *l ); @@ -506,28 +506,28 @@ void Wellenreiter::startClicked() } // open pcap and start sniffing - if ( cardtype != DEVTYPE_FILE ) - { - pcap->open( interface ); - if ( configwindow->writeCaptureFile->isChecked() ) + QString dumpname; + if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? { - QString dumpname( configwindow->captureFileName->text() ); + dumpname = configwindow->captureFileName->text(); if ( dumpname.isEmpty() ) dumpname = "captureFile"; dumpname.append( '-' ); dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); dumpname.append( ".wellenreiter" ); - pcap->openDumpFile( dumpname ); } - else + else // write it anyway ;) { - pcap->open( interface ); - } + dumpname = "/var/log/dump.wellenreiter"; } + + if ( cardtype != DEVTYPE_FILE ) + pcap->open( interface ); else - { pcap->open( QFile( interface ) ); - } + + qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); + pcap->openDumpFile( dumpname ); if ( !pcap->isOpen() ) { |