author | mickeyl <mickeyl> | 2003-12-09 21:33:48 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-09 21:33:48 (UTC) |
commit | 0a1f6405780b18c9f3d953adcfd072de8fd4dc18 (patch) (unidiff) | |
tree | b155d2ee3c7766155b028f4e8ee92599fd50e8a9 /noncore/net/wellenreiter/gui/mainwindow.cpp | |
parent | dc1fc74ee3988fb3a89f6fc46cbcfe8b74416647 (diff) | |
download | opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.zip opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.tar.gz opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.tar.bz2 |
misc. fixes and preparations for uploading dumps
Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 56 |
1 files changed, 32 insertions, 24 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 | |||
@@ -54,51 +54,45 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
54 | 54 | ||
55 | #ifndef QWS | 55 | #ifndef QWS |
56 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 56 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
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 | ||
77 | stopButton = new QToolButton( 0 ); | 70 | stopButton = new QToolButton( 0 ); |
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; |
102 | 96 | ||
103 | QMenuBar* mb = menuBar(); | 97 | QMenuBar* mb = menuBar(); |
104 | 98 | ||
@@ -113,12 +107,14 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
113 | 107 | ||
114 | QPopupMenu* file = new QPopupMenu( mb ); | 108 | QPopupMenu* file = new QPopupMenu( mb ); |
115 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); | 109 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
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 ); |
122 | view->insertItem( tr( "&Configure..." ) ); | 118 | view->insertItem( tr( "&Configure..." ) ); |
123 | 119 | ||
124 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 120 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
@@ -136,21 +132,22 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
136 | //id = mb->insertItem( tr( "&View" ), view ); | 132 | //id = mb->insertItem( tr( "&View" ), view ); |
137 | //mb->setItemEnabled( id, false ); | 133 | //mb->setItemEnabled( id, false ); |
138 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 134 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
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 |
154 | 151 | ||
155 | updateToolButtonState(); | 152 | updateToolButtonState(); |
156 | 153 | ||
@@ -176,13 +173,12 @@ void WellenreiterMainWindow::showConfigure() | |||
176 | int result = cw->exec(); | 173 | int result = cw->exec(); |
177 | 174 | ||
178 | if ( result ) updateToolButtonState(); | 175 | if ( result ) updateToolButtonState(); |
179 | } | 176 | } |
180 | 177 | ||
181 | 178 | ||
182 | |||
183 | void WellenreiterMainWindow::updateToolButtonState() | 179 | void WellenreiterMainWindow::updateToolButtonState() |
184 | { | 180 | { |
185 | const QString& interface = cw->interfaceName->currentText(); | 181 | const QString& interface = cw->interfaceName->currentText(); |
186 | const int cardtype = cw->driverType(); | 182 | const int cardtype = cw->driverType(); |
187 | 183 | ||
188 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 184 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
@@ -201,23 +197,27 @@ void WellenreiterMainWindow::updateToolButtonState() | |||
201 | void WellenreiterMainWindow::changedSniffingState() | 197 | void WellenreiterMainWindow::changedSniffingState() |
202 | { | 198 | { |
203 | startButton->setEnabled( !mw->sniffing ); | 199 | startButton->setEnabled( !mw->sniffing ); |
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 | ||
210 | WellenreiterMainWindow::~WellenreiterMainWindow() | 212 | WellenreiterMainWindow::~WellenreiterMainWindow() |
211 | { | 213 | { |
212 | delete infoIconSet; | 214 | qDebug( "Wellenreiter:: bye." ); |
213 | delete settingsIconSet; | ||
214 | delete startIconSet; | ||
215 | delete stopIconSet; | ||
216 | }; | 215 | }; |
217 | 216 | ||
217 | |||
218 | void WellenreiterMainWindow::demoAddStations() | 218 | void WellenreiterMainWindow::demoAddStations() |
219 | { | 219 | { |
220 | //mw = 0; // test SIGSGV handling | 220 | //mw = 0; // test SIGSGV handling |
221 | 221 | ||
222 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) ); | 222 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) ); |
223 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); | 223 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); |
@@ -340,19 +340,21 @@ void WellenreiterMainWindow::fileLoadSession() | |||
340 | { | 340 | { |
341 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 341 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
342 | } | 342 | } |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | |||
346 | void WellenreiterMainWindow::fileNew() | 347 | void WellenreiterMainWindow::fileNew() |
347 | { | 348 | { |
348 | mw->netView()->clear(); | 349 | mw->netView()->clear(); |
349 | mw->logWindow()->clear(); | 350 | mw->logWindow()->clear(); |
350 | mw->hexWindow()->clear(); | 351 | mw->hexWindow()->clear(); |
351 | } | 352 | } |
352 | 353 | ||
354 | |||
353 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 355 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
354 | { | 356 | { |
355 | if ( mw->isDaemonRunning() ) | 357 | if ( mw->isDaemonRunning() ) |
356 | { | 358 | { |
357 | QMessageBox::warning( this, "Wellenreiter/Opie", | 359 | QMessageBox::warning( this, "Wellenreiter/Opie", |
358 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); | 360 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); |
@@ -362,6 +364,12 @@ void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | |||
362 | { | 364 | { |
363 | QMainWindow::closeEvent( e ); | 365 | QMainWindow::closeEvent( e ); |
364 | } | 366 | } |
365 | } | 367 | } |
366 | 368 | ||
367 | 369 | ||
370 | void WellenreiterMainWindow::uploadSession() | ||
371 | { | ||
372 | QMessageBox::warning( this, "Wellenreiter/Opie", | ||
373 | tr( "This feature is\nunder construction... ;-)" ) ); | ||
374 | } | ||
375 | |||