-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 | 38 |
3 files changed, 54 insertions, 48 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 @@ -59,9 +59,2 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n - // 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 @@ -72,3 +65,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n #endif - startButton->setIconSet( *startIconSet ); + startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); startButton->setEnabled( false ); @@ -80,3 +73,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n #endif - stopButton->setIconSet( *stopIconSet ); + stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); stopButton->setEnabled( false ); @@ -84,9 +77,2 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n - QToolButton* c = new QToolButton( 0 ); - #ifdef QWS - c->setAutoRaise( true ); - #endif - c->setIconSet( *infoIconSet ); - c->setEnabled( false ); - QToolButton* d = new QToolButton( 0 ); @@ -95,5 +81,13 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n #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 @@ -118,2 +112,4 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n file->insertSeparator(); + uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); + file->insertSeparator(); file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); @@ -141,2 +137,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n mb->setItemEnabled( id, true ); + mb->setItemEnabled( uploadID, false ); @@ -145,3 +142,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n mb->insertItem( stopButton ); - mb->insertItem( c ); + mb->insertItem( uploadButton ); mb->insertItem( d ); @@ -149,3 +146,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n mb->insertItem( d ); - mb->insertItem( c ); + mb->insertItem( uploadButton ); mb->insertItem( stopButton ); @@ -181,3 +178,2 @@ void WellenreiterMainWindow::showConfigure() - void WellenreiterMainWindow::updateToolButtonState() @@ -206,2 +202,8 @@ void WellenreiterMainWindow::changedSniffingState() menuBar()->setItemEnabled( stopID, mw->sniffing ); + + if ( !mw->sniffing ) + { + menuBar()->setItemEnabled( uploadID, true ); + uploadButton->setEnabled( true ); + } } @@ -211,8 +213,6 @@ WellenreiterMainWindow::~WellenreiterMainWindow() { - delete infoIconSet; - delete settingsIconSet; - delete startIconSet; - delete stopIconSet; + qDebug( "Wellenreiter:: bye." ); }; + void WellenreiterMainWindow::demoAddStations() @@ -345,2 +345,3 @@ void WellenreiterMainWindow::fileLoadSession() + void WellenreiterMainWindow::fileNew() @@ -352,2 +353,3 @@ void WellenreiterMainWindow::fileNew() + void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) @@ -367 +369,7 @@ 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 @@ -38,11 +38,8 @@ class WellenreiterMainWindow: public QMainWindow - const QIconSet* startIconSet; - const QIconSet* stopIconSet; - const QIconSet* infoIconSet; - const QIconSet* settingsIconSet; - QToolButton* startButton; QToolButton* stopButton; + QToolButton* uploadButton; int startID; int stopID; + int uploadID; @@ -60,2 +57,3 @@ class WellenreiterMainWindow: public QMainWindow 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 @@ -304,3 +304,3 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) if ( !configwindow->writeCaptureFile->isChecked() ) - return false; + return true; // semantic change - we're logging anyway now to /tmp/wellenreiter @@ -508,25 +508,25 @@ void Wellenreiter::startClicked() // open pcap and start sniffing - if ( cardtype != DEVTYPE_FILE ) - { - pcap->open( interface ); - if ( configwindow->writeCaptureFile->isChecked() ) - { - QString 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 - { - pcap->open( interface ); - } + QString dumpname; + if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? + { + dumpname = configwindow->captureFileName->text(); + if ( dumpname.isEmpty() ) dumpname = "captureFile"; + dumpname.append( '-' ); + dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); + dumpname.append( ".wellenreiter" ); } - else + else // write it anyway ;) { - pcap->open( QFile( 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() ) |