-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 99 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.cpp | 45 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.h | 40 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 178 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 21 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 4 |
9 files changed, 278 insertions, 133 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 5970b01..08eb18a 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -7,22 +7,24 @@ CONFIG = qt warn_on debug | |||
7 | HEADERS = wellenreiterbase.h \ | 7 | HEADERS = wellenreiterbase.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | wellenreiter.h \ | 9 | wellenreiter.h \ |
10 | scanlist.h \ | 10 | scanlist.h \ |
11 | logwindow.h \ | 11 | logwindow.h \ |
12 | hexwindow.h \ | 12 | hexwindow.h \ |
13 | statwindow.h \ | ||
13 | configwindow.h \ | 14 | configwindow.h \ |
14 | manufacturers.h | 15 | manufacturers.h |
15 | 16 | ||
16 | SOURCES = main.cpp \ | 17 | SOURCES = main.cpp \ |
17 | mainwindow.cpp \ | 18 | mainwindow.cpp \ |
18 | wellenreiterbase.cpp \ | 19 | wellenreiterbase.cpp \ |
19 | wellenreiter.cpp \ | 20 | wellenreiter.cpp \ |
20 | scanlist.cpp \ | 21 | scanlist.cpp \ |
21 | logwindow.cpp \ | 22 | logwindow.cpp \ |
22 | hexwindow.cpp \ | 23 | hexwindow.cpp \ |
24 | statwindow.cpp \ | ||
23 | configwindow.cpp \ | 25 | configwindow.cpp \ |
24 | manufacturers.cpp | 26 | manufacturers.cpp |
25 | 27 | ||
26 | INCLUDEPATH += $(OPIEDIR)/include | 28 | INCLUDEPATH += $(OPIEDIR)/include |
27 | DEPENDPATH += $(OPIEDIR)/include | 29 | DEPENDPATH += $(OPIEDIR)/include |
28 | INTERFACES = configbase.ui | 30 | INTERFACES = configbase.ui |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 69d2b3a..94e3f28 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -57,36 +57,32 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | // setup icon sets | 59 | // setup icon sets |
60 | 60 | ||
61 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 61 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
63 | #ifdef QWS | 63 | startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
64 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 64 | stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
65 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | ||
66 | #else | ||
67 | startStopIconSet = new QIconSet(); | ||
68 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); | ||
69 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); | ||
70 | #endif | ||
71 | 65 | ||
72 | // setup tool buttons | 66 | // setup tool buttons |
73 | 67 | ||
74 | startStopButton = new QToolButton( 0 ); | 68 | startButton = new QToolButton( 0 ); |
75 | #ifdef QWS | 69 | #ifdef QWS |
76 | startStopButton->setAutoRaise( true ); | 70 | startButton->setAutoRaise( true ); |
77 | #endif | 71 | #endif |
72 | startButton->setIconSet( *startIconSet ); | ||
73 | startButton->setEnabled( false ); | ||
74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | ||
75 | |||
76 | stopButton = new QToolButton( 0 ); | ||
78 | #ifdef QWS | 77 | #ifdef QWS |
79 | startStopButton->setOnIconSet( *cancelIconSet ); | 78 | stopButton->setAutoRaise( true ); |
80 | startStopButton->setOffIconSet( *searchIconSet ); | ||
81 | #else | ||
82 | startStopButton->setIconSet( *startStopIconSet ); | ||
83 | #endif | 79 | #endif |
84 | startStopButton->setToggleButton( true ); | 80 | stopButton->setIconSet( *stopIconSet ); |
85 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | 81 | stopButton->setEnabled( false ); |
86 | startStopButton->setEnabled( false ); | 82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
87 | 83 | ||
88 | QToolButton* c = new QToolButton( 0 ); | 84 | QToolButton* c = new QToolButton( 0 ); |
89 | #ifdef QWS | 85 | #ifdef QWS |
90 | c->setAutoRaise( true ); | 86 | c->setAutoRaise( true ); |
91 | #endif | 87 | #endif |
92 | c->setIconSet( *infoIconSet ); | 88 | c->setIconSet( *infoIconSet ); |
@@ -122,82 +118,103 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
122 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); | 118 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); |
123 | 119 | ||
124 | QPopupMenu* view = new QPopupMenu( mb ); | 120 | QPopupMenu* view = new QPopupMenu( mb ); |
125 | view->insertItem( "&Configure..." ); | 121 | view->insertItem( "&Configure..." ); |
126 | 122 | ||
127 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 123 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
128 | sniffer->insertItem( "&Configure..." ); | 124 | sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) ); |
129 | sniffer->insertSeparator(); | 125 | sniffer->insertSeparator(); |
126 | startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) ); | ||
127 | sniffer->setItemEnabled( startID, false ); | ||
128 | stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) ); | ||
129 | sniffer->setItemEnabled( stopID, false ); | ||
130 | 130 | ||
131 | QPopupMenu* demo = new QPopupMenu( mb ); | 131 | QPopupMenu* demo = new QPopupMenu( mb ); |
132 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 132 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); |
133 | 133 | ||
134 | id = mb->insertItem( "&File", file ); | 134 | id = mb->insertItem( "&File", file ); |
135 | id = mb->insertItem( "&View", view ); | 135 | id = mb->insertItem( "&View", view ); |
136 | mb->setItemEnabled( id, false ); | 136 | mb->setItemEnabled( id, false ); |
137 | id = mb->insertItem( "&Sniffer", sniffer ); | 137 | id = mb->insertItem( "&Sniffer", sniffer ); |
138 | mb->setItemEnabled( id, false ); | ||
139 | id = mb->insertItem( "&Demo", demo ); | 138 | id = mb->insertItem( "&Demo", demo ); |
140 | mb->setItemEnabled( id, true ); | 139 | mb->setItemEnabled( id, true ); |
141 | 140 | ||
142 | #ifdef QWS | 141 | #ifdef QWS |
143 | mb->insertItem( startStopButton ); | 142 | mb->insertItem( startButton ); |
143 | mb->insertItem( stopButton ); | ||
144 | mb->insertItem( c ); | 144 | mb->insertItem( c ); |
145 | mb->insertItem( d ); | 145 | mb->insertItem( d ); |
146 | #else // Qt3 changed the insertion order. It's now totally random :( | 146 | #else // Qt3 changed the insertion order. It's now totally random :( |
147 | mb->insertItem( d ); | 147 | mb->insertItem( d ); |
148 | mb->insertItem( c ); | 148 | mb->insertItem( c ); |
149 | mb->insertItem( startStopButton ); | 149 | mb->insertItem( stopButton ); |
150 | mb->insertItem( startButton ); | ||
150 | #endif | 151 | #endif |
151 | 152 | ||
153 | updateToolButtonState(); | ||
154 | |||
152 | // setup status bar (for now only on X11) | 155 | // setup status bar (for now only on X11) |
153 | 156 | ||
154 | #ifndef QWS | 157 | #ifndef QWS |
155 | statusBar()->message( "Ready." ); | 158 | statusBar()->message( "Ready." ); |
156 | #endif | 159 | #endif |
157 | 160 | ||
161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | ||
162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | ||
158 | }; | 163 | }; |
159 | 164 | ||
165 | |||
166 | |||
160 | void WellenreiterMainWindow::showConfigure() | 167 | void WellenreiterMainWindow::showConfigure() |
161 | { | 168 | { |
162 | qDebug( "show configure..." ); | 169 | qDebug( "show configure..." ); |
163 | cw->setCaption( tr( "Configure" ) ); | 170 | cw->setCaption( tr( "Configure" ) ); |
164 | #ifdef QWS | 171 | #ifdef QWS |
165 | cw->showMaximized(); | 172 | cw->showMaximized(); |
166 | #endif | 173 | #endif |
167 | int result = cw->exec(); | 174 | int result = cw->exec(); |
168 | 175 | ||
169 | if ( result ) | 176 | if ( result ) updateToolButtonState(); |
170 | { | 177 | } |
171 | // check configuration from config window | ||
172 | 178 | ||
173 | const QString& interface = cw->interfaceName->currentText(); | ||
174 | const int cardtype = cw->daemonDeviceType(); | ||
175 | const int interval = cw->daemonHopInterval(); | ||
176 | 179 | ||
177 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 180 | |
178 | startStopButton->setEnabled( true ); | 181 | void WellenreiterMainWindow::updateToolButtonState() |
179 | //TODO ... | 182 | { |
180 | else | 183 | const QString& interface = cw->interfaceName->currentText(); |
181 | startStopButton->setEnabled( false ); | 184 | const int cardtype = cw->daemonDeviceType(); |
182 | //TODO ... | 185 | const int interval = cw->daemonHopInterval(); |
186 | |||
187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | ||
188 | { | ||
189 | startButton->setEnabled( true ); | ||
190 | menuBar()->setItemEnabled( startID, true ); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | startButton->setEnabled( false ); | ||
195 | menuBar()->setItemEnabled( startID, false ); | ||
183 | } | 196 | } |
184 | } | 197 | } |
185 | 198 | ||
186 | WellenreiterMainWindow::~WellenreiterMainWindow() | 199 | |
200 | void WellenreiterMainWindow::changedSniffingState() | ||
187 | { | 201 | { |
202 | startButton->setEnabled( !mw->sniffing ); | ||
203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | ||
204 | stopButton->setEnabled( mw->sniffing ); | ||
205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | ||
206 | } | ||
188 | 207 | ||
208 | |||
209 | WellenreiterMainWindow::~WellenreiterMainWindow() | ||
210 | { | ||
189 | delete infoIconSet; | 211 | delete infoIconSet; |
190 | delete settingsIconSet; | 212 | delete settingsIconSet; |
191 | #ifdef QWS | 213 | delete startIconSet; |
192 | delete searchIconSet; | 214 | delete stopIconSet; |
193 | delete cancelIconSet; | ||
194 | #else | ||
195 | delete startStopIconSet; | ||
196 | #endif | ||
197 | |||
198 | }; | 215 | }; |
199 | 216 | ||
200 | void WellenreiterMainWindow::demoAddStations() | 217 | void WellenreiterMainWindow::demoAddStations() |
201 | { | 218 | { |
202 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
203 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); | 220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 1b08c5b..1e191e5 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -32,31 +32,35 @@ class WellenreiterMainWindow: public QMainWindow | |||
32 | ~WellenreiterMainWindow(); | 32 | ~WellenreiterMainWindow(); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | Wellenreiter* mw; | 35 | Wellenreiter* mw; |
36 | WellenreiterConfigWindow* cw; | 36 | WellenreiterConfigWindow* cw; |
37 | 37 | ||
38 | QIconSet* startStopIconSet; | 38 | const QIconSet* startIconSet; |
39 | const QIconSet* searchIconSet; | 39 | const QIconSet* stopIconSet; |
40 | const QIconSet* infoIconSet; | 40 | const QIconSet* infoIconSet; |
41 | const QIconSet* settingsIconSet; | 41 | const QIconSet* settingsIconSet; |
42 | const QIconSet* cancelIconSet; | ||
43 | 42 | ||
44 | QToolButton* startStopButton; | 43 | QToolButton* startButton; |
44 | QToolButton* stopButton; | ||
45 | int startID; | ||
46 | int stopID; | ||
45 | 47 | ||
46 | protected: | 48 | protected: |
47 | virtual void closeEvent( QCloseEvent* ); | 49 | virtual void closeEvent( QCloseEvent* ); |
50 | void updateToolButtonState(); | ||
48 | 51 | ||
49 | private: | 52 | private: |
50 | QString getFileName( bool save ); | 53 | QString getFileName( bool save ); |
51 | 54 | ||
52 | public slots: | 55 | public slots: |
53 | void showConfigure(); | 56 | void showConfigure(); |
54 | void demoAddStations(); | 57 | void demoAddStations(); |
55 | void fileSaveLog(); | 58 | void fileSaveLog(); |
56 | void fileSaveHex(); | 59 | void fileSaveHex(); |
57 | void fileSaveSession(); | 60 | void fileSaveSession(); |
58 | void fileLoadSession(); | 61 | void fileLoadSession(); |
59 | void fileNew(); | 62 | void fileNew(); |
63 | void changedSniffingState(); | ||
60 | }; | 64 | }; |
61 | 65 | ||
62 | #endif | 66 | #endif |
diff --git a/noncore/net/wellenreiter/gui/statwindow.cpp b/noncore/net/wellenreiter/gui/statwindow.cpp new file mode 100644 index 0000000..07d34ef --- a/dev/null +++ b/noncore/net/wellenreiter/gui/statwindow.cpp | |||
@@ -0,0 +1,45 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "statwindow.h" | ||
17 | #include <qmultilineedit.h> | ||
18 | |||
19 | MStatWindow::MStatWindow( QWidget * parent, const char * name, WFlags f ) | ||
20 | :QVBox( parent, name, f ) | ||
21 | { | ||
22 | ledit = new QMultiLineEdit( this ); | ||
23 | ledit->setFont( QFont( "fixed", 10 ) ); | ||
24 | |||
25 | // FIXME: Set properties( font, read-only, etc...) | ||
26 | |||
27 | }; | ||
28 | |||
29 | void MStatWindow::log( QString text ) | ||
30 | { | ||
31 | |||
32 | ledit->append( text ); | ||
33 | |||
34 | }; | ||
35 | |||
36 | const QString MStatWindow::getLog() const | ||
37 | { | ||
38 | return ledit->text(); | ||
39 | } | ||
40 | |||
41 | void MStatWindow::clear() | ||
42 | { | ||
43 | ledit->clear(); | ||
44 | } | ||
45 | |||
diff --git a/noncore/net/wellenreiter/gui/statwindow.h b/noncore/net/wellenreiter/gui/statwindow.h new file mode 100644 index 0000000..bbdf777 --- a/dev/null +++ b/noncore/net/wellenreiter/gui/statwindow.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef STATWINDOW_H | ||
17 | #define STATWINDOW_H | ||
18 | |||
19 | #include <qvbox.h> | ||
20 | |||
21 | class QString; | ||
22 | class QMultiLineEdit; | ||
23 | |||
24 | class MStatWindow: public QVBox | ||
25 | { | ||
26 | |||
27 | public: | ||
28 | MStatWindow( QWidget * parent = 0, const char * name = "MStatWindow", WFlags f = 0 ); | ||
29 | |||
30 | void log( QString text ); | ||
31 | const QString getLog() const; | ||
32 | void clear(); | ||
33 | |||
34 | protected: | ||
35 | QMultiLineEdit* ledit; | ||
36 | |||
37 | }; | ||
38 | |||
39 | #endif | ||
40 | |||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 0bfc8e9..3372883 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -31,12 +31,13 @@ using namespace Opie; | |||
31 | // Qt | 31 | // Qt |
32 | 32 | ||
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
37 | #include <qtoolbutton.h> | ||
37 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
38 | 39 | ||
39 | // Standard | 40 | // Standard |
40 | 41 | ||
41 | #include <assert.h> | 42 | #include <assert.h> |
42 | #include <errno.h> | 43 | #include <errno.h> |
@@ -49,13 +50,13 @@ using namespace Opie; | |||
49 | 50 | ||
50 | #include "wellenreiter.h" | 51 | #include "wellenreiter.h" |
51 | #include "scanlist.h" | 52 | #include "scanlist.h" |
52 | #include "logwindow.h" | 53 | #include "logwindow.h" |
53 | #include "hexwindow.h" | 54 | #include "hexwindow.h" |
54 | #include "configwindow.h" | 55 | #include "configwindow.h" |
55 | 56 | #include "statwindow.h" | |
56 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
57 | 58 | ||
58 | Wellenreiter::Wellenreiter( QWidget* parent ) | 59 | Wellenreiter::Wellenreiter( QWidget* parent ) |
59 | : WellenreiterBase( parent, 0, 0 ), | 60 | : WellenreiterBase( parent, 0, 0 ), |
60 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) | 61 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) |
61 | { | 62 | { |
@@ -214,102 +215,125 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
214 | wlan->macAddress3().toString() ); | 215 | wlan->macAddress3().toString() ); |
215 | } | 216 | } |
216 | return; | 217 | return; |
217 | } | 218 | } |
218 | } | 219 | } |
219 | 220 | ||
220 | void Wellenreiter::startStopClicked() | 221 | |
222 | void Wellenreiter::stopClicked() | ||
221 | { | 223 | { |
222 | if ( sniffing ) | 224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | ||
226 | iface->setChannelHopping(); // stop hopping channels | ||
227 | pcap->close(); | ||
228 | sniffing = false; | ||
229 | #ifdef QWS | ||
230 | oApp->setTitle(); | ||
231 | #else | ||
232 | qApp->mainWidget()->setCaption( "Wellenreiter II" ); | ||
233 | #endif | ||
234 | |||
235 | // get interface name from config window | ||
236 | const QString& interface = configwindow->interfaceName->currentText(); | ||
237 | ONetwork* net = ONetwork::instance(); | ||
238 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | ||
239 | |||
240 | // switch off monitor mode | ||
241 | iface->setMonitorMode( false ); | ||
242 | // switch off promisc flag | ||
243 | iface->setPromiscuousMode( false ); | ||
244 | |||
245 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | ||
246 | logwindow->log( "(i) Stopped Scanning." ); | ||
247 | assert( parent() ); | ||
248 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | ||
249 | |||
250 | // message the user | ||
251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | ||
252 | |||
253 | sniffing = false; | ||
254 | emit( stoppedSniffing() ); | ||
255 | |||
256 | // print out statistics | ||
257 | statwindow->log( "-----------------------------------------" ); | ||
258 | statwindow->log( "- Wellenreiter II Capturing Statistic -" ); | ||
259 | statwindow->log( "-----------------------------------------" ); | ||
260 | statwindow->log( "Packet Type | Receive Count" ); | ||
261 | |||
262 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | ||
223 | { | 263 | { |
224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 264 | QString left; |
225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 265 | left.sprintf( "%s", (const char*) it.key() ); |
226 | iface->setChannelHopping(); // stop hopping channels | 266 | left = left.leftJustify( 20 ); |
227 | pcap->close(); | 267 | left.append( '|' ); |
228 | sniffing = false; | 268 | QString right; |
229 | #ifdef QWS | 269 | right.sprintf( "%d", it.data() ); |
230 | oApp->setTitle(); | 270 | right = right.rightJustify( 7 ); |
231 | #else | 271 | statwindow->log( left + right ); |
232 | qApp->mainWidget()->setCaption( "Wellenreiter II" ); | ||
233 | #endif | ||
234 | |||
235 | // get interface name from config window | ||
236 | const QString& interface = configwindow->interfaceName->currentText(); | ||
237 | ONetwork* net = ONetwork::instance(); | ||
238 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | ||
239 | |||
240 | // switch off monitor mode | ||
241 | iface->setMonitorMode( false ); | ||
242 | // switch off promisc flag | ||
243 | iface->setPromiscuousMode( false ); | ||
244 | |||
245 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | ||
246 | logwindow->log( "(i) Stopped Scanning." ); | ||
247 | assert( parent() ); | ||
248 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | ||
249 | |||
250 | // message the user | ||
251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | ||
252 | } | 272 | } |
253 | 273 | ||
254 | else | 274 | } |
255 | { | ||
256 | // get configuration from config window | ||
257 | 275 | ||
258 | const QString& interface = configwindow->interfaceName->currentText(); | ||
259 | const int cardtype = configwindow->daemonDeviceType(); | ||
260 | const int interval = configwindow->daemonHopInterval(); | ||
261 | 276 | ||
262 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 277 | void Wellenreiter::startClicked() |
263 | { | 278 | { |
264 | QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); | 279 | // get configuration from config window |
265 | return; | ||
266 | } | ||
267 | 280 | ||
268 | // configure device | 281 | const QString& interface = configwindow->interfaceName->currentText(); |
282 | const int cardtype = configwindow->daemonDeviceType(); | ||
283 | const int interval = configwindow->daemonHopInterval(); | ||
269 | 284 | ||
270 | ONetwork* net = ONetwork::instance(); | 285 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
271 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 286 | { |
287 | QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); | ||
288 | return; | ||
289 | } | ||
272 | 290 | ||
273 | // set monitor mode | 291 | // configure device |
274 | 292 | ||
275 | switch ( cardtype ) | 293 | ONetwork* net = ONetwork::instance(); |
276 | { | 294 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
277 | case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; | ||
278 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | ||
279 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | ||
280 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | ||
281 | default: assert( 0 ); // shouldn't happen | ||
282 | } | ||
283 | 295 | ||
284 | iface->setMonitorMode( true ); | 296 | // set monitor mode |
285 | 297 | ||
286 | if ( !iface->monitorMode() ) | 298 | switch ( cardtype ) |
287 | { | 299 | { |
288 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); | 300 | case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; |
289 | return; | 301 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
290 | } | 302 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
303 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | ||
304 | default: | ||
305 | QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); | ||
306 | } | ||
291 | 307 | ||
292 | // open pcap and start sniffing | 308 | if ( cardtype > 0 && cardtype < 5 ) |
293 | pcap->open( interface ); | 309 | iface->setMonitorMode( true ); |
294 | 310 | ||
295 | if ( !pcap->isOpen() ) | 311 | if ( !iface->monitorMode() ) |
296 | { | 312 | { |
297 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | 313 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); |
298 | return; | 314 | return; |
299 | } | 315 | } |
300 | 316 | ||
301 | // set capturer to non-blocking mode | 317 | // open pcap and start sniffing |
302 | pcap->setBlocking( false ); | 318 | pcap->open( interface ); |
303 | 319 | ||
304 | // start channel hopper | 320 | if ( !pcap->isOpen() ) |
305 | iface->setChannelHopping( 1000 ); //use interval from config window | 321 | { |
322 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | ||
323 | return; | ||
324 | } | ||
306 | 325 | ||
307 | // connect | 326 | // set capturer to non-blocking mode |
308 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 327 | pcap->setBlocking( false ); |
309 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | ||
310 | 328 | ||
311 | logwindow->log( "(i) Started Scanning." ); | 329 | // start channel hopper |
312 | sniffing = true; | 330 | iface->setChannelHopping( 1000 ); //use interval from config window |
313 | 331 | ||
314 | } | 332 | // connect |
333 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | ||
334 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | ||
335 | |||
336 | logwindow->log( "(i) Started Scanning." ); | ||
337 | sniffing = true; | ||
338 | emit( startedSniffing() ); | ||
315 | } | 339 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 85f889b..839c77e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -44,23 +44,29 @@ class Wellenreiter : public WellenreiterBase { | |||
44 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 44 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
45 | MScanListView* netView() const { return netview; }; | 45 | MScanListView* netView() const { return netview; }; |
46 | MLogWindow* logWindow() const { return logwindow; }; | 46 | MLogWindow* logWindow() const { return logwindow; }; |
47 | MHexWindow* hexWindow() const { return hexwindow; }; | 47 | MHexWindow* hexWindow() const { return hexwindow; }; |
48 | bool isDaemonRunning() const { return sniffing; }; | 48 | bool isDaemonRunning() const { return sniffing; }; |
49 | 49 | ||
50 | bool sniffing; | ||
51 | |||
50 | public slots: | 52 | public slots: |
51 | void channelHopped(int); | 53 | void channelHopped(int); |
52 | void receivePacket(OPacket*); | 54 | void receivePacket(OPacket*); |
53 | void startStopClicked(); | 55 | void startClicked(); |
56 | void stopClicked(); | ||
57 | |||
58 | signals: | ||
59 | void startedSniffing(); | ||
60 | void stoppedSniffing(); | ||
54 | 61 | ||
55 | private: | 62 | private: |
56 | #ifdef QWS | 63 | #ifdef QWS |
57 | OSystem _system; // Opie Operating System identifier | 64 | OSystem _system; // Opie Operating System identifier |
58 | #endif | 65 | #endif |
59 | 66 | ||
60 | bool sniffing; | ||
61 | OWirelessNetworkInterface* iface; | 67 | OWirelessNetworkInterface* iface; |
62 | OPacketCapturer* pcap; | 68 | OPacketCapturer* pcap; |
63 | ManufacturerDB* manufacturerdb; | 69 | ManufacturerDB* manufacturerdb; |
64 | WellenreiterConfigWindow* configwindow; | 70 | WellenreiterConfigWindow* configwindow; |
65 | 71 | ||
66 | //void readConfig(); | 72 | //void readConfig(); |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index 3a703bc..245b9fc 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp | |||
@@ -27,24 +27,25 @@ | |||
27 | #include <qimage.h> | 27 | #include <qimage.h> |
28 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
29 | 29 | ||
30 | #include "logwindow.h" | 30 | #include "logwindow.h" |
31 | #include "hexwindow.h" | 31 | #include "hexwindow.h" |
32 | #include "scanlist.h" | 32 | #include "scanlist.h" |
33 | #include "statwindow.h" | ||
33 | 34 | ||
34 | #ifdef QWS | 35 | #ifdef QWS |
35 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
36 | #include <opie/otabwidget.h> | 37 | #include <opie/otabwidget.h> |
37 | #else | 38 | #else |
38 | #include "resource.h" | 39 | #include "resource.h" |
39 | #include <qtabwidget.h> | 40 | #include <qtabwidget.h> |
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | 43 | ||
43 | /* | 44 | /* |
44 | * Constructs a WellenreiterBase which is a child of 'parent', with the | 45 | * Constructs a WellenreiterBase which is a child of 'parent', with the |
45 | * name 'name' and widget flags set to 'f' | 46 | * name 'name' and widget flags set to 'f' |
46 | */ | 47 | */ |
47 | WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) | 48 | WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) |
48 | : QWidget( parent, name, fl ) | 49 | : QWidget( parent, name, fl ) |
49 | { | 50 | { |
50 | //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); | 51 | //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); |
@@ -75,22 +76,24 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
75 | 76 | ||
76 | //--------- NETVIEW TAB -------------- | 77 | //--------- NETVIEW TAB -------------- |
77 | 78 | ||
78 | netview = new MScanListView( ap ); | 79 | netview = new MScanListView( ap ); |
79 | apLayout->addWidget( netview ); | 80 | apLayout->addWidget( netview ); |
80 | 81 | ||
81 | |||
82 | //--------- LOG TAB -------------- | 82 | //--------- LOG TAB -------------- |
83 | 83 | ||
84 | logwindow = new MLogWindow( TabWidget, "Log" ); | 84 | logwindow = new MLogWindow( TabWidget, "Log" ); |
85 | 85 | ||
86 | |||
87 | //--------- HEX TAB -------------- | 86 | //--------- HEX TAB -------------- |
88 | 87 | ||
89 | hexwindow = new MHexWindow( TabWidget, "Hex" ); | 88 | hexwindow = new MHexWindow( TabWidget, "Hex" ); |
90 | 89 | ||
90 | //--------- STAT TAB -------------- | ||
91 | |||
92 | statwindow = new MStatWindow( TabWidget, "Stat" ); | ||
93 | |||
91 | //--------- ABOUT TAB -------------- | 94 | //--------- ABOUT TAB -------------- |
92 | 95 | ||
93 | about = new QWidget( TabWidget, "about" ); | 96 | about = new QWidget( TabWidget, "about" ); |
94 | aboutLayout = new QGridLayout( about ); | 97 | aboutLayout = new QGridLayout( about ); |
95 | aboutLayout->setSpacing( 6 ); | 98 | aboutLayout->setSpacing( 6 ); |
96 | aboutLayout->setMargin( 11 ); | 99 | aboutLayout->setMargin( 11 ); |
@@ -122,31 +125,33 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
122 | "</p>" ) ); | 125 | "</p>" ) ); |
123 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); | 126 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); |
124 | 127 | ||
125 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); | 128 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); |
126 | 129 | ||
127 | #ifdef QWS | 130 | #ifdef QWS |
128 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); | 131 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); |
129 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); | 132 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); |
130 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); | 133 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); |
134 | TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stats" ) ); | ||
131 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); | 135 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); |
132 | #else | 136 | #else |
133 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); | 137 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); |
134 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); | 138 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); |
135 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); | 139 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); |
140 | TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); | ||
136 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); | 141 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); |
137 | #endif | 142 | #endif |
138 | WellenreiterBaseLayout->addWidget( TabWidget ); | 143 | WellenreiterBaseLayout->addWidget( TabWidget ); |
139 | 144 | ||
140 | #ifdef QWS | 145 | #ifdef QWS |
141 | TabWidget->setCurrentTab( tr( "Networks" ) ); | 146 | TabWidget->setCurrentTab( tr( "Nets" ) ); |
142 | #endif | 147 | #endif |
143 | 148 | ||
144 | } | 149 | } |
145 | 150 | ||
146 | /* | 151 | /* |
147 | * Destroys the object and frees any allocated resources | 152 | * Destroys the object and frees any allocated resources |
148 | */ | 153 | */ |
149 | WellenreiterBase::~WellenreiterBase() | 154 | WellenreiterBase::~WellenreiterBase() |
150 | { | 155 | { |
151 | // no need to delete child widgets, Qt does it all for us | 156 | // no need to delete child widgets, Qt does it all for us |
152 | } | 157 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h index 1fa1ea3..ad2e96c 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.h +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h | |||
@@ -24,12 +24,13 @@ class QGridLayout; | |||
24 | class QLabel; | 24 | class QLabel; |
25 | class MScanListView; | 25 | class MScanListView; |
26 | class MScanListItem; | 26 | class MScanListItem; |
27 | class QPushButton; | 27 | class QPushButton; |
28 | class MLogWindow; | 28 | class MLogWindow; |
29 | class MHexWindow; | 29 | class MHexWindow; |
30 | class MStatWindow; | ||
30 | 31 | ||
31 | #ifdef QWS | 32 | #ifdef QWS |
32 | class OTabWidget; | 33 | class OTabWidget; |
33 | #else | 34 | #else |
34 | class QTabWidget; | 35 | class QTabWidget; |
35 | #endif | 36 | #endif |
@@ -48,12 +49,13 @@ public: | |||
48 | QTabWidget* TabWidget; | 49 | QTabWidget* TabWidget; |
49 | #endif | 50 | #endif |
50 | QWidget* ap; | 51 | QWidget* ap; |
51 | MScanListView* netview; | 52 | MScanListView* netview; |
52 | MLogWindow* logwindow; | 53 | MLogWindow* logwindow; |
53 | MHexWindow* hexwindow; | 54 | MHexWindow* hexwindow; |
55 | MStatWindow* statwindow; | ||
54 | QWidget* about; | 56 | QWidget* about; |
55 | QLabel* PixmapLabel1_3_2; | 57 | QLabel* PixmapLabel1_3_2; |
56 | QLabel* TextLabel1_4_2; | 58 | QLabel* TextLabel1_4_2; |
57 | 59 | ||
58 | protected: | 60 | protected: |
59 | QVBoxLayout* WellenreiterBaseLayout; | 61 | QVBoxLayout* WellenreiterBaseLayout; |
@@ -63,10 +65,10 @@ protected: | |||
63 | 65 | ||
64 | QPixmap* ani1; | 66 | QPixmap* ani1; |
65 | QPixmap* ani2; | 67 | QPixmap* ani2; |
66 | QPixmap* ani3; | 68 | QPixmap* ani3; |
67 | QPixmap* ani4; | 69 | QPixmap* ani4; |
68 | 70 | ||
69 | 71 | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | #endif // WELLENREITERBASE_H | 74 | #endif // WELLENREITERBASE_H |