summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp56
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h8
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp38
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
@@ -57,20 +57,13 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
57 setIconText( "Wellenreiter/X11" ); 57 setIconText( "Wellenreiter/X11" );
58 #endif 58 #endif
59 59
60 // setup icon sets
61
62 infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) );
63 settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) );
64 startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
65 stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
66
67 // setup tool buttons 60 // setup tool buttons
68 61
69 startButton = new QToolButton( 0 ); 62 startButton = new QToolButton( 0 );
70 #ifdef QWS 63 #ifdef QWS
71 startButton->setAutoRaise( true ); 64 startButton->setAutoRaise( true );
72 #endif 65 #endif
73 startButton->setIconSet( *startIconSet ); 66 startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) );
74 startButton->setEnabled( false ); 67 startButton->setEnabled( false );
75 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); 68 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) );
76 69
@@ -78,24 +71,25 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
78 #ifdef QWS 71 #ifdef QWS
79 stopButton->setAutoRaise( true ); 72 stopButton->setAutoRaise( true );
80 #endif 73 #endif
81 stopButton->setIconSet( *stopIconSet ); 74 stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) );
82 stopButton->setEnabled( false ); 75 stopButton->setEnabled( false );
83 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); 76 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) );
84 77
85 QToolButton* c = new QToolButton( 0 );
86 #ifdef QWS
87 c->setAutoRaise( true );
88 #endif
89 c->setIconSet( *infoIconSet );
90 c->setEnabled( false );
91
92 QToolButton* d = new QToolButton( 0 ); 78 QToolButton* d = new QToolButton( 0 );
93 #ifdef QWS 79 #ifdef QWS
94 d->setAutoRaise( true ); 80 d->setAutoRaise( true );
95 #endif 81 #endif
96 d->setIconSet( *settingsIconSet ); 82 d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) );
97 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 83 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
98 84
85 uploadButton = new QToolButton( 0 );
86 #ifdef QWS
87 uploadButton->setAutoRaise( true );
88 #endif
89 uploadButton->setIconSet( Resource::loadIconSet( "up" ) );
90 uploadButton->setEnabled( false );
91 connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) );
92
99 // setup menu bar 93 // setup menu bar
100 94
101 int id; 95 int id;
@@ -116,6 +110,8 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
116 id = file->insertItem( tr( "&Load" ), fileLoad ); 110 id = file->insertItem( tr( "&Load" ), fileLoad );
117 file->insertItem( tr( "&Save" ), fileSave ); 111 file->insertItem( tr( "&Save" ), fileSave );
118 file->insertSeparator(); 112 file->insertSeparator();
113 uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) );
114 file->insertSeparator();
119 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); 115 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) );
120 116
121 QPopupMenu* view = new QPopupMenu( mb ); 117 QPopupMenu* view = new QPopupMenu( mb );
@@ -139,15 +135,16 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
139 135
140 id = mb->insertItem( tr( "&Demo" ), demo ); 136 id = mb->insertItem( tr( "&Demo" ), demo );
141 mb->setItemEnabled( id, true ); 137 mb->setItemEnabled( id, true );
138 mb->setItemEnabled( uploadID, false );
142 139
143 #ifdef QWS 140 #ifdef QWS
144 mb->insertItem( startButton ); 141 mb->insertItem( startButton );
145 mb->insertItem( stopButton ); 142 mb->insertItem( stopButton );
146 mb->insertItem( c ); 143 mb->insertItem( uploadButton );
147 mb->insertItem( d ); 144 mb->insertItem( d );
148 #else // Qt3 changed the insertion order. It's now totally random :( 145 #else // Qt3 changed the insertion order. It's now totally random :(
149 mb->insertItem( d ); 146 mb->insertItem( d );
150 mb->insertItem( c ); 147 mb->insertItem( uploadButton );
151 mb->insertItem( stopButton ); 148 mb->insertItem( stopButton );
152 mb->insertItem( startButton ); 149 mb->insertItem( startButton );
153 #endif 150 #endif
@@ -179,7 +176,6 @@ void WellenreiterMainWindow::showConfigure()
179} 176}
180 177
181 178
182
183void WellenreiterMainWindow::updateToolButtonState() 179void WellenreiterMainWindow::updateToolButtonState()
184{ 180{
185 const QString& interface = cw->interfaceName->currentText(); 181 const QString& interface = cw->interfaceName->currentText();
@@ -204,17 +200,21 @@ void WellenreiterMainWindow::changedSniffingState()
204 menuBar()->setItemEnabled( startID, !mw->sniffing ); 200 menuBar()->setItemEnabled( startID, !mw->sniffing );
205 stopButton->setEnabled( mw->sniffing ); 201 stopButton->setEnabled( mw->sniffing );
206 menuBar()->setItemEnabled( stopID, mw->sniffing ); 202 menuBar()->setItemEnabled( stopID, mw->sniffing );
203
204 if ( !mw->sniffing )
205 {
206 menuBar()->setItemEnabled( uploadID, true );
207 uploadButton->setEnabled( true );
208 }
207} 209}
208 210
209 211
210WellenreiterMainWindow::~WellenreiterMainWindow() 212WellenreiterMainWindow::~WellenreiterMainWindow()
211{ 213{
212 delete infoIconSet; 214 qDebug( "Wellenreiter:: bye." );
213 delete settingsIconSet;
214 delete startIconSet;
215 delete stopIconSet;
216}; 215};
217 216
217
218void WellenreiterMainWindow::demoAddStations() 218void WellenreiterMainWindow::demoAddStations()
219{ 219{
220 //mw = 0; // test SIGSGV handling 220 //mw = 0; // test SIGSGV handling
@@ -343,6 +343,7 @@ void WellenreiterMainWindow::fileLoadSession()
343 } 343 }
344} 344}
345 345
346
346void WellenreiterMainWindow::fileNew() 347void WellenreiterMainWindow::fileNew()
347{ 348{
348 mw->netView()->clear(); 349 mw->netView()->clear();
@@ -350,6 +351,7 @@ void WellenreiterMainWindow::fileNew()
350 mw->hexWindow()->clear(); 351 mw->hexWindow()->clear();
351} 352}
352 353
354
353void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 355void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
354{ 356{
355 if ( mw->isDaemonRunning() ) 357 if ( mw->isDaemonRunning() )
@@ -365,3 +367,9 @@ void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
365} 367}
366 368
367 369
370void WellenreiterMainWindow::uploadSession()
371{
372 QMessageBox::warning( this, "Wellenreiter/Opie",
373 tr( "This feature is\nunder construction... ;-)" ) );
374}
375
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
36 Wellenreiter* mw; 36 Wellenreiter* mw;
37 WellenreiterConfigWindow* cw; 37 WellenreiterConfigWindow* cw;
38 38
39 const QIconSet* startIconSet;
40 const QIconSet* stopIconSet;
41 const QIconSet* infoIconSet;
42 const QIconSet* settingsIconSet;
43
44 QToolButton* startButton; 39 QToolButton* startButton;
45 QToolButton* stopButton; 40 QToolButton* stopButton;
41 QToolButton* uploadButton;
46 int startID; 42 int startID;
47 int stopID; 43 int stopID;
44 int uploadID;
48 45
49 protected: 46 protected:
50 virtual void closeEvent( QCloseEvent* ); 47 virtual void closeEvent( QCloseEvent* );
@@ -58,6 +55,7 @@ class WellenreiterMainWindow: public QMainWindow
58 void fileSaveSession(); 55 void fileSaveSession();
59 void fileLoadSession(); 56 void fileLoadSession();
60 void fileNew(); 57 void fileNew();
58 void uploadSession();
61 void changedSniffingState(); 59 void changedSniffingState();
62}; 60};
63 61
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 )
302 // go through all child packets and see if one is inside the child hierarchy for p 302 // go through all child packets and see if one is inside the child hierarchy for p
303 // if so, do what the user requested (protocolAction), e.g. pass or discard 303 // if so, do what the user requested (protocolAction), e.g. pass or discard
304 if ( !configwindow->writeCaptureFile->isChecked() ) 304 if ( !configwindow->writeCaptureFile->isChecked() )
305 return false; 305 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
306 306
307 QObjectList* l = p->queryList(); 307 QObjectList* l = p->queryList();
308 QObjectListIt it( *l ); 308 QObjectListIt it( *l );
@@ -506,29 +506,29 @@ void Wellenreiter::startClicked()
506 } 506 }
507 507
508 // open pcap and start sniffing 508 // open pcap and start sniffing
509 if ( cardtype != DEVTYPE_FILE )
510 {
511 pcap->open( interface );
512 509
513 if ( configwindow->writeCaptureFile->isChecked() ) 510 QString dumpname;
514 { 511 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
515 QString dumpname( configwindow->captureFileName->text() ); 512 {
516 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 513 dumpname = configwindow->captureFileName->text();
517 dumpname.append( '-' ); 514 if ( dumpname.isEmpty() ) dumpname = "captureFile";
518 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 515 dumpname.append( '-' );
519 dumpname.append( ".wellenreiter" ); 516 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
520 pcap->openDumpFile( dumpname ); 517 dumpname.append( ".wellenreiter" );
521 }
522 else
523 {
524 pcap->open( interface );
525 }
526 } 518 }
527 else 519 else // write it anyway ;)
528 { 520 {
529 pcap->open( QFile( interface ) ); 521 dumpname = "/var/log/dump.wellenreiter";
530 } 522 }
531 523
524 if ( cardtype != DEVTYPE_FILE )
525 pcap->open( interface );
526 else
527 pcap->open( QFile( interface ) );
528
529 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname );
530 pcap->openDumpFile( dumpname );
531
532 if ( !pcap->isOpen() ) 532 if ( !pcap->isOpen() )
533 { 533 {
534 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 534 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(