Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index cb003dd..e388fc5 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -25,4 +25,5 @@ #include <qiconset.h> #include <qmenubar.h> +#include <qmessagebox.h> #include <qpopupmenu.h> #include <qstatusbar.h> @@ -60,5 +61,7 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n startStopButton = new QToolButton( 0 ); + #ifdef QWS startStopButton->setAutoRaise( true ); + #endif #ifdef QWS startStopButton->setOnIconSet( *cancelIconSet ); @@ -72,10 +75,14 @@ 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 ); + #ifdef QWS d->setAutoRaise( true ); + #endif d->setIconSet( *settingsIconSet ); connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); @@ -88,8 +95,13 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n QPopupMenu* fileSave = new QPopupMenu( mb ); + fileSave->insertItem( "&Session", this, SLOT( fileSaveSession() ) ); fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); + QPopupMenu* fileLoad = new QPopupMenu( mb ); + fileLoad->insertItem( "&Session", this, SLOT( fileLoadSession() ) ); + fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); + QPopupMenu* file = new QPopupMenu( mb ); - id = file->insertItem( "&Load" ); + id = file->insertItem( "&Load", fileLoad ); file->setItemEnabled( id, false ); file->insertItem( "&Save", fileSave ); @@ -173,9 +185,9 @@ WellenreiterMainWindow::~WellenreiterMainWindow() void WellenreiterMainWindow::demoAddStations() { - mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); - mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); - mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); - mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); - mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); + mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); + mw->netView()->addNewItem( "managed", "Vanille", "00:00:1c:EF:A6:23", true, 11, 10 ); + mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); + mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); + mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); } @@ -189,10 +201,40 @@ void WellenreiterMainWindow::fileSaveLog() t << mw->logWindow()->getLog(); f.close(); - qDebug( "saved log in file '%s'", (const char*) fname ); + qDebug( "Saved log to file '%s'", (const char*) fname ); } else { - qDebug( "Problem saving log in file '%s'", (const char*) fname ); + qDebug( "Problem saving log to file '%s'", (const char*) fname ); } }
\ No newline at end of file + +void WellenreiterMainWindow::fileSaveSession() +{ + const QString fname( "/tmp/session.xml" ); + QFile f( fname ); + if ( f.open(IO_WriteOnly) ) + { + QTextStream t( &f ); + mw->netView()->dump( t ); + f.close(); + qDebug( "Saved session to file '%s'", (const char*) fname ); + } + else + { + qDebug( "Problem saving session to file '%s'", (const char*) fname ); + } +} + +void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) +{ + if ( mw->isDaemonRunning() ) + { + QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); + e->ignore(); + } + else + { + QMainWindow::closeEvent( e ); + } +} |