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 | |||
@@ -26,2 +26,3 @@ | |||
26 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
27 | #include <qmessagebox.h> | ||
27 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
@@ -61,3 +62,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
61 | startStopButton = new QToolButton( 0 ); | 62 | startStopButton = new QToolButton( 0 ); |
63 | #ifdef QWS | ||
62 | startStopButton->setAutoRaise( true ); | 64 | startStopButton->setAutoRaise( true ); |
65 | #endif | ||
63 | #ifdef QWS | 66 | #ifdef QWS |
@@ -73,3 +76,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
73 | QToolButton* c = new QToolButton( 0 ); | 76 | QToolButton* c = new QToolButton( 0 ); |
77 | #ifdef QWS | ||
74 | c->setAutoRaise( true ); | 78 | c->setAutoRaise( true ); |
79 | #endif | ||
75 | c->setIconSet( *infoIconSet ); | 80 | c->setIconSet( *infoIconSet ); |
@@ -78,3 +83,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
78 | QToolButton* d = new QToolButton( 0 ); | 83 | QToolButton* d = new QToolButton( 0 ); |
84 | #ifdef QWS | ||
79 | d->setAutoRaise( true ); | 85 | d->setAutoRaise( true ); |
86 | #endif | ||
80 | d->setIconSet( *settingsIconSet ); | 87 | d->setIconSet( *settingsIconSet ); |
@@ -89,6 +96,11 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
89 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 96 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
97 | fileSave->insertItem( "&Session", this, SLOT( fileSaveSession() ) ); | ||
90 | fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); | 98 | fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); |
91 | 99 | ||
100 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | ||
101 | fileLoad->insertItem( "&Session", this, SLOT( fileLoadSession() ) ); | ||
102 | fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | ||
103 | |||
92 | QPopupMenu* file = new QPopupMenu( mb ); | 104 | QPopupMenu* file = new QPopupMenu( mb ); |
93 | id = file->insertItem( "&Load" ); | 105 | id = file->insertItem( "&Load", fileLoad ); |
94 | file->setItemEnabled( id, false ); | 106 | file->setItemEnabled( id, false ); |
@@ -174,7 +186,7 @@ void WellenreiterMainWindow::demoAddStations() | |||
174 | { | 186 | { |
175 | mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | 187 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
176 | mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | 188 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:1c:EF:A6:23", true, 11, 10 ); |
177 | mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | 189 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
178 | mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | 190 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
179 | mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | 191 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
180 | } | 192 | } |
@@ -190,3 +202,3 @@ void WellenreiterMainWindow::fileSaveLog() | |||
190 | f.close(); | 202 | f.close(); |
191 | qDebug( "saved log in file '%s'", (const char*) fname ); | 203 | qDebug( "Saved log to file '%s'", (const char*) fname ); |
192 | } | 204 | } |
@@ -194,3 +206,3 @@ void WellenreiterMainWindow::fileSaveLog() | |||
194 | { | 206 | { |
195 | qDebug( "Problem saving log in file '%s'", (const char*) fname ); | 207 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); |
196 | } | 208 | } |
@@ -198 +210,31 @@ void WellenreiterMainWindow::fileSaveLog() | |||
198 | } \ No newline at end of file | 210 | } \ No newline at end of file |
211 | |||
212 | void WellenreiterMainWindow::fileSaveSession() | ||
213 | { | ||
214 | const QString fname( "/tmp/session.xml" ); | ||
215 | QFile f( fname ); | ||
216 | if ( f.open(IO_WriteOnly) ) | ||
217 | { | ||
218 | QTextStream t( &f ); | ||
219 | mw->netView()->dump( t ); | ||
220 | f.close(); | ||
221 | qDebug( "Saved session to file '%s'", (const char*) fname ); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | ||
230 | { | ||
231 | if ( mw->isDaemonRunning() ) | ||
232 | { | ||
233 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); | ||
234 | e->ignore(); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | QMainWindow::closeEvent( e ); | ||
239 | } | ||
240 | } | ||