summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-09 21:40:31 (UTC)
committer mickeyl <mickeyl>2003-04-09 21:40:31 (UTC)
commitcf029a4007ea344c530d8a71cd0b012393ebd7ba (patch) (unidiff)
treee9f584885299548b9316a6da05ad31845487e6d9
parentb055856776807f0a459a86b1e1f62902d2d3a9c3 (diff)
downloadopie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.zip
opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.tar.gz
opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.tar.bz2
- improve keyboard handling
- enable sniffer-menu - fix handling of start/stop button - add simple statistic window, fancy will follow ;-)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gui.pro2
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp99
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h12
-rw-r--r--noncore/net/wellenreiter/gui/statwindow.cpp45
-rw-r--r--noncore/net/wellenreiter/gui/statwindow.h40
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp178
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h10
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp21
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.h4
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
@@ -1,43 +1,45 @@
1MOC_DIR = ./tmp 1MOC_DIR = ./tmp
2OBJECTS_DIR = ./tmp 2OBJECTS_DIR = ./tmp
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4TEMPLATE = app 4TEMPLATE = app
5CONFIG = qt warn_on debug 5CONFIG = qt warn_on debug
6 6
7HEADERS = wellenreiterbase.h \ 7HEADERS = 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
16SOURCES = main.cpp \ 17SOURCES = 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
26INCLUDEPATH += $(OPIEDIR)/include 28INCLUDEPATH += $(OPIEDIR)/include
27DEPENDPATH += $(OPIEDIR)/include 29DEPENDPATH += $(OPIEDIR)/include
28INTERFACES = configbase.ui 30INTERFACES = configbase.ui
29TARGET = wellenreiter 31TARGET = wellenreiter
30 32
31!contains( platform, x11 ) { 33!contains( platform, x11 ) {
32 message( qws ) 34 message( qws )
33 include ( $(OPIEDIR)/include.pro ) 35 include ( $(OPIEDIR)/include.pro )
34 LIBS += -lqpe -lopie -lopiecore2 -lopieui2 -lopienet2 36 LIBS += -lqpe -lopie -lopiecore2 -lopieui2 -lopienet2
35} 37}
36 38
37contains( platform, x11 ) { 39contains( platform, x11 ) {
38 LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter 40 LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter
39 SOURCES += resource.cpp 41 SOURCES += resource.cpp
40 HEADERS += resource.h 42 HEADERS += resource.h
41 DESTDIR = $(OPIEDIR)/output/bin 43 DESTDIR = $(OPIEDIR)/output/bin
42} 44}
43 45
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
@@ -1,342 +1,359 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "configwindow.h" 16#include "configwindow.h"
17#include "logwindow.h" 17#include "logwindow.h"
18#include "hexwindow.h" 18#include "hexwindow.h"
19#include "mainwindow.h" 19#include "mainwindow.h"
20#include "wellenreiter.h" 20#include "wellenreiter.h"
21#include "scanlist.h" 21#include "scanlist.h"
22 22
23#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qdatastream.h> 24#include <qdatastream.h>
25#include <qfile.h> 25#include <qfile.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27#include <qiconset.h> 27#include <qiconset.h>
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qmessagebox.h> 29#include <qmessagebox.h>
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qstatusbar.h> 31#include <qstatusbar.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qtoolbutton.h> 33#include <qtoolbutton.h>
34 34
35#ifdef QWS 35#ifdef QWS
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <opie/ofiledialog.h> 37#include <opie/ofiledialog.h>
38#else 38#else
39#include "resource.h" 39#include "resource.h"
40#include <qapplication.h> 40#include <qapplication.h>
41#include <qfiledialog.h> 41#include <qfiledialog.h>
42#endif 42#endif
43 43
44WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) 44WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
45 :QMainWindow( parent, name, f ) 45 :QMainWindow( parent, name, f )
46{ 46{
47 cw = new WellenreiterConfigWindow( this ); 47 cw = new WellenreiterConfigWindow( this );
48 mw = new Wellenreiter( this ); 48 mw = new Wellenreiter( this );
49 mw->setConfigWindow( cw ); 49 mw->setConfigWindow( cw );
50 setCentralWidget( mw ); 50 setCentralWidget( mw );
51 51
52 // setup application icon 52 // setup application icon
53 53
54 #ifndef QWS 54 #ifndef QWS
55 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); 55 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
56 setIconText( "Wellenreiter/X11" ); 56 setIconText( "Wellenreiter/X11" );
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 );
93 c->setEnabled( false ); 89 c->setEnabled( false );
94 90
95 QToolButton* d = new QToolButton( 0 ); 91 QToolButton* d = new QToolButton( 0 );
96 #ifdef QWS 92 #ifdef QWS
97 d->setAutoRaise( true ); 93 d->setAutoRaise( true );
98 #endif 94 #endif
99 d->setIconSet( *settingsIconSet ); 95 d->setIconSet( *settingsIconSet );
100 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 96 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
101 97
102 // setup menu bar 98 // setup menu bar
103 99
104 int id; 100 int id;
105 101
106 QMenuBar* mb = menuBar(); 102 QMenuBar* mb = menuBar();
107 103
108 QPopupMenu* fileSave = new QPopupMenu( mb ); 104 QPopupMenu* fileSave = new QPopupMenu( mb );
109 fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); 105 fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) );
110 fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) ); 106 fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) );
111 fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) ); 107 fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) );
112 108
113 QPopupMenu* fileLoad = new QPopupMenu( mb ); 109 QPopupMenu* fileLoad = new QPopupMenu( mb );
114 fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); 110 fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) );
115 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); 111 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) );
116 112
117 QPopupMenu* file = new QPopupMenu( mb ); 113 QPopupMenu* file = new QPopupMenu( mb );
118 file->insertItem( "&New", this, SLOT( fileNew() ) ); 114 file->insertItem( "&New", this, SLOT( fileNew() ) );
119 id = file->insertItem( "&Load", fileLoad ); 115 id = file->insertItem( "&Load", fileLoad );
120 file->insertItem( "&Save", fileSave ); 116 file->insertItem( "&Save", fileSave );
121 file->insertSeparator(); 117 file->insertSeparator();
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
160void WellenreiterMainWindow::showConfigure() 167void 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 ); 181void 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
186WellenreiterMainWindow::~WellenreiterMainWindow() 199
200void 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
209WellenreiterMainWindow::~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
200void WellenreiterMainWindow::demoAddStations() 217void 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 );
204 mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); 221 mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 );
205 mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); 222 mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 );
206 mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); 223 mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 );
207} 224}
208 225
209QString WellenreiterMainWindow::getFileName( bool save ) 226QString WellenreiterMainWindow::getFileName( bool save )
210{ 227{
211 QMap<QString, QStringList> map; 228 QMap<QString, QStringList> map;
212 map.insert( tr("All"), QStringList() ); 229 map.insert( tr("All"), QStringList() );
213 QStringList text; 230 QStringList text;
214 text << "text/*"; 231 text << "text/*";
215 map.insert(tr("Text"), text ); 232 map.insert(tr("Text"), text );
216 text << "*"; 233 text << "*";
217 map.insert(tr("All"), text ); 234 map.insert(tr("All"), text );
218 235
219 QString str; 236 QString str;
220 if ( save ) 237 if ( save )
221 { 238 {
222 #ifdef QWS 239 #ifdef QWS
223 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); 240 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map );
224 #else 241 #else
225 str = QFileDialog::getSaveFileName(); 242 str = QFileDialog::getSaveFileName();
226 #endif 243 #endif
227 if ( str.isEmpty() || QFileInfo(str).isDir() ) 244 if ( str.isEmpty() || QFileInfo(str).isDir() )
228 return ""; 245 return "";
229 } 246 }
230 else 247 else
231 { 248 {
232 #ifdef QWS 249 #ifdef QWS
233 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); 250 str = OFileDialog::getOpenFileName( 2, "/", QString::null, map );
234 #else 251 #else
235 str = QFileDialog::getOpenFileName(); 252 str = QFileDialog::getOpenFileName();
236 #endif 253 #endif
237 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) 254 if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() )
238 return ""; 255 return "";
239 } 256 }
240 return str; 257 return str;
241} 258}
242 259
243void WellenreiterMainWindow::fileSaveLog() 260void WellenreiterMainWindow::fileSaveLog()
244{ 261{
245 QString fname = getFileName( true ); 262 QString fname = getFileName( true );
246 if ( !fname.isEmpty() ) 263 if ( !fname.isEmpty() )
247 { 264 {
248 QFile f( fname ); 265 QFile f( fname );
249 if ( f.open(IO_WriteOnly) ) 266 if ( f.open(IO_WriteOnly) )
250 { 267 {
251 QTextStream t( &f ); 268 QTextStream t( &f );
252 t << mw->logWindow()->getLog(); 269 t << mw->logWindow()->getLog();
253 f.close(); 270 f.close();
254 qDebug( "Saved log to file '%s'", (const char*) fname ); 271 qDebug( "Saved log to file '%s'", (const char*) fname );
255 } 272 }
256 else 273 else
257 { 274 {
258 qDebug( "Problem saving log to file '%s'", (const char*) fname ); 275 qDebug( "Problem saving log to file '%s'", (const char*) fname );
259 } 276 }
260 } 277 }
261} 278}
262 279
263void WellenreiterMainWindow::fileSaveSession() 280void WellenreiterMainWindow::fileSaveSession()
264{ 281{
265 QString fname = getFileName( true ); 282 QString fname = getFileName( true );
266 if ( !fname.isEmpty() ) 283 if ( !fname.isEmpty() )
267 { 284 {
268 285
269 QFile f( fname ); 286 QFile f( fname );
270 if ( f.open(IO_WriteOnly) ) 287 if ( f.open(IO_WriteOnly) )
271 { 288 {
272 QDataStream t( &f ); 289 QDataStream t( &f );
273 t << *mw->netView(); 290 t << *mw->netView();
274 f.close(); 291 f.close();
275 qDebug( "Saved session to file '%s'", (const char*) fname ); 292 qDebug( "Saved session to file '%s'", (const char*) fname );
276 } 293 }
277 else 294 else
278 { 295 {
279 qDebug( "Problem saving session to file '%s'", (const char*) fname ); 296 qDebug( "Problem saving session to file '%s'", (const char*) fname );
280 } 297 }
281 } 298 }
282} 299}
283 300
284void WellenreiterMainWindow::fileSaveHex() 301void WellenreiterMainWindow::fileSaveHex()
285{ 302{
286 QString fname = getFileName( true ); 303 QString fname = getFileName( true );
287 if ( !fname.isEmpty() ) 304 if ( !fname.isEmpty() )
288 { 305 {
289 QFile f( fname ); 306 QFile f( fname );
290 if ( f.open(IO_WriteOnly) ) 307 if ( f.open(IO_WriteOnly) )
291 { 308 {
292 QTextStream t( &f ); 309 QTextStream t( &f );
293 t << mw->hexWindow()->getLog(); 310 t << mw->hexWindow()->getLog();
294 f.close(); 311 f.close();
295 qDebug( "Saved hex log to file '%s'", (const char*) fname ); 312 qDebug( "Saved hex log to file '%s'", (const char*) fname );
296 } 313 }
297 else 314 else
298 { 315 {
299 qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); 316 qDebug( "Problem saving hex log to file '%s'", (const char*) fname );
300 } 317 }
301 } 318 }
302} 319}
303 320
304void WellenreiterMainWindow::fileLoadSession() 321void WellenreiterMainWindow::fileLoadSession()
305{ 322{
306 QString fname = getFileName( false ); 323 QString fname = getFileName( false );
307 if ( !fname.isEmpty() ) 324 if ( !fname.isEmpty() )
308 { 325 {
309 QFile f( fname ); 326 QFile f( fname );
310 if ( f.open(IO_ReadOnly) ) 327 if ( f.open(IO_ReadOnly) )
311 { 328 {
312 QDataStream t( &f ); 329 QDataStream t( &f );
313 t >> *mw->netView(); 330 t >> *mw->netView();
314 f.close(); 331 f.close();
315 qDebug( "Loaded session from file '%s'", (const char*) fname ); 332 qDebug( "Loaded session from file '%s'", (const char*) fname );
316 } 333 }
317 else 334 else
318 { 335 {
319 qDebug( "Problem loading session from file '%s'", (const char*) fname ); 336 qDebug( "Problem loading session from file '%s'", (const char*) fname );
320 } 337 }
321 } 338 }
322} 339}
323 340
324void WellenreiterMainWindow::fileNew() 341void WellenreiterMainWindow::fileNew()
325{ 342{
326 mw->netView()->clear(); 343 mw->netView()->clear();
327 mw->logWindow()->clear(); 344 mw->logWindow()->clear();
328 mw->hexWindow()->clear(); 345 mw->hexWindow()->clear();
329} 346}
330 347
331void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 348void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
332{ 349{
333 if ( mw->isDaemonRunning() ) 350 if ( mw->isDaemonRunning() )
334 { 351 {
335 QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); 352 QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." );
336 e->ignore(); 353 e->ignore();
337 } 354 }
338 else 355 else
339 { 356 {
340 QMainWindow::closeEvent( e ); 357 QMainWindow::closeEvent( e );
341 } 358 }
342} 359}
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
@@ -1,62 +1,66 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef MAINWINDOW_H 16#ifndef MAINWINDOW_H
17#define MAINWINDOW_H 17#define MAINWINDOW_H
18 18
19#include <qmainwindow.h> 19#include <qmainwindow.h>
20 20
21class Wellenreiter; 21class Wellenreiter;
22class WellenreiterConfigWindow; 22class WellenreiterConfigWindow;
23class QIconSet; 23class QIconSet;
24class QToolButton; 24class QToolButton;
25 25
26class WellenreiterMainWindow: public QMainWindow 26class WellenreiterMainWindow: public QMainWindow
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); 31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 );
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
19MStatWindow::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
29void MStatWindow::log( QString text )
30{
31
32 ledit->append( text );
33
34};
35
36const QString MStatWindow::getLog() const
37{
38 return ledit->text();
39}
40
41void 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
21class QString;
22class QMultiLineEdit;
23
24class 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
@@ -1,315 +1,339 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16// Opie 16// Opie
17 17
18#ifdef QWS 18#ifdef QWS
19#include <opie/odevice.h> 19#include <opie/odevice.h>
20using namespace Opie; 20using namespace Opie;
21#endif 21#endif
22 22
23#ifdef QWS 23#ifdef QWS
24#include <opie2/oapplication.h> 24#include <opie2/oapplication.h>
25#else 25#else
26#include <qapplication.h> 26#include <qapplication.h>
27#endif 27#endif
28#include <opie2/onetwork.h> 28#include <opie2/onetwork.h>
29#include <opie2/opcap.h> 29#include <opie2/opcap.h>
30 30
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>
43#include <unistd.h> 44#include <unistd.h>
44#include <string.h> 45#include <string.h>
45#include <sys/types.h> 46#include <sys/types.h>
46#include <stdlib.h> 47#include <stdlib.h>
47 48
48// Local 49// Local
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
58Wellenreiter::Wellenreiter( QWidget* parent ) 59Wellenreiter::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{
62 63
63 // 64 //
64 // construct manufacturer database 65 // construct manufacturer database
65 // 66 //
66 67
67 QString manufile; 68 QString manufile;
68 #ifdef QWS 69 #ifdef QWS
69 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); 70 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
70 #else 71 #else
71 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); 72 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" );
72 #endif 73 #endif
73 manufacturerdb = new ManufacturerDB( manufile ); 74 manufacturerdb = new ManufacturerDB( manufile );
74 75
75 logwindow->log( "(i) Wellenreiter has been started." ); 76 logwindow->log( "(i) Wellenreiter has been started." );
76 77
77 // 78 //
78 // detect operating system 79 // detect operating system
79 // 80 //
80 81
81 #ifdef QWS 82 #ifdef QWS
82 QString sys; 83 QString sys;
83 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); 84 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
84 _system = ODevice::inst()->system(); 85 _system = ODevice::inst()->system();
85 logwindow->log( sys ); 86 logwindow->log( sys );
86 #endif 87 #endif
87 88
88 // setup GUI 89 // setup GUI
89 netview->setColumnWidthMode( 1, QListView::Manual ); 90 netview->setColumnWidthMode( 1, QListView::Manual );
90 91
91 if ( manufacturerdb ) 92 if ( manufacturerdb )
92 netview->setManufacturerDB( manufacturerdb ); 93 netview->setManufacturerDB( manufacturerdb );
93 94
94 pcap = new OPacketCapturer(); 95 pcap = new OPacketCapturer();
95 96
96} 97}
97 98
98 99
99Wellenreiter::~Wellenreiter() 100Wellenreiter::~Wellenreiter()
100{ 101{
101 // no need to delete child widgets, Qt does it all for us 102 // no need to delete child widgets, Qt does it all for us
102 103
103 delete manufacturerdb; 104 delete manufacturerdb;
104 delete pcap; 105 delete pcap;
105} 106}
106 107
107 108
108void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 109void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
109{ 110{
110 configwindow = cw; 111 configwindow = cw;
111} 112}
112 113
113 114
114void Wellenreiter::channelHopped(int c) 115void Wellenreiter::channelHopped(int c)
115{ 116{
116 QString title = "Wellenreiter II -scan- ["; 117 QString title = "Wellenreiter II -scan- [";
117 QString left; 118 QString left;
118 if ( c > 1 ) left.fill( '.', c-1 ); 119 if ( c > 1 ) left.fill( '.', c-1 );
119 title.append( left ); 120 title.append( left );
120 title.append( '|' ); 121 title.append( '|' );
121 if ( c < iface->channels() ) 122 if ( c < iface->channels() )
122 { 123 {
123 QString right; 124 QString right;
124 right.fill( '.', iface->channels()-c ); 125 right.fill( '.', iface->channels()-c );
125 title.append( right ); 126 title.append( right );
126 } 127 }
127 title.append( "]" ); 128 title.append( "]" );
128 //title.append( QString().sprintf( " %02d", c ) ); 129 //title.append( QString().sprintf( " %02d", c ) );
129 assert( parent() ); 130 assert( parent() );
130 ( (QMainWindow*) parent() )->setCaption( title ); 131 ( (QMainWindow*) parent() )->setCaption( title );
131} 132}
132 133
133 134
134void Wellenreiter::receivePacket(OPacket* p) 135void Wellenreiter::receivePacket(OPacket* p)
135{ 136{
136 hexWindow()->log( p->dump( 8 ) ); 137 hexWindow()->log( p->dump( 8 ) );
137 138
138 // check if we received a beacon frame 139 // check if we received a beacon frame
139 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 140 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
140 if ( beacon && beacon->managementType() == "Beacon" ) 141 if ( beacon && beacon->managementType() == "Beacon" )
141 { 142 {
142 QString type; 143 QString type;
143 if ( beacon->canIBSS() ) 144 if ( beacon->canIBSS() )
144 { 145 {
145 type = "adhoc"; 146 type = "adhoc";
146 } 147 }
147 else if ( beacon->canESS() ) 148 else if ( beacon->canESS() )
148 { 149 {
149 type = "managed"; 150 type = "managed";
150 } 151 }
151 else 152 else
152 { 153 {
153 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); 154 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) );
154 return; 155 return;
155 } 156 }
156 157
157 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 158 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
158 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 159 QString essid = ssid ? ssid->ID() : QString("<unknown>");
159 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 160 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
160 int channel = ds ? ds->channel() : -1; 161 int channel = ds ? ds->channel() : -1;
161 162
162 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 163 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
163 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); 164 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 );
164 return; 165 return;
165 } 166 }
166 167
167 // check for a data frame 168 // check for a data frame
168 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); 169 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) );
169 if ( data ) 170 if ( data )
170 { 171 {
171 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 172 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
172 if ( wlan->fromDS() && !wlan->toDS() ) 173 if ( wlan->fromDS() && !wlan->toDS() )
173 { 174 {
174 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", 175 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'",
175 (const char*) wlan->macAddress3().toString(true), 176 (const char*) wlan->macAddress3().toString(true),
176 (const char*) wlan->macAddress1().toString(true), 177 (const char*) wlan->macAddress1().toString(true),
177 (const char*) wlan->macAddress2().toString(true) ); 178 (const char*) wlan->macAddress2().toString(true) );
178 netView()->traffic( "fromDS", wlan->macAddress3().toString(), 179 netView()->traffic( "fromDS", wlan->macAddress3().toString(),
179 wlan->macAddress1().toString(), 180 wlan->macAddress1().toString(),
180 wlan->macAddress2().toString() ); 181 wlan->macAddress2().toString() );
181 } 182 }
182 else 183 else
183 if ( !wlan->fromDS() && wlan->toDS() ) 184 if ( !wlan->fromDS() && wlan->toDS() )
184 { 185 {
185 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", 186 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'",
186 (const char*) wlan->macAddress2().toString(true), 187 (const char*) wlan->macAddress2().toString(true),
187 (const char*) wlan->macAddress3().toString(true), 188 (const char*) wlan->macAddress3().toString(true),
188 (const char*) wlan->macAddress1().toString(true) ); 189 (const char*) wlan->macAddress1().toString(true) );
189 netView()->traffic( "toDS", wlan->macAddress2().toString(), 190 netView()->traffic( "toDS", wlan->macAddress2().toString(),
190 wlan->macAddress3().toString(), 191 wlan->macAddress3().toString(),
191 wlan->macAddress1().toString() ); 192 wlan->macAddress1().toString() );
192 } 193 }
193 else 194 else
194 if ( wlan->fromDS() && wlan->toDS() ) 195 if ( wlan->fromDS() && wlan->toDS() )
195 { 196 {
196 qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", 197 qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'",
197 (const char*) wlan->macAddress4().toString(true), 198 (const char*) wlan->macAddress4().toString(true),
198 (const char*) wlan->macAddress3().toString(true), 199 (const char*) wlan->macAddress3().toString(true),
199 (const char*) wlan->macAddress1().toString(true), 200 (const char*) wlan->macAddress1().toString(true),
200 (const char*) wlan->macAddress2().toString(true) ); 201 (const char*) wlan->macAddress2().toString(true) );
201 netView()->traffic( "WSD", wlan->macAddress4().toString(), 202 netView()->traffic( "WSD", wlan->macAddress4().toString(),
202 wlan->macAddress3().toString(), 203 wlan->macAddress3().toString(),
203 wlan->macAddress1().toString(), 204 wlan->macAddress1().toString(),
204 wlan->macAddress2().toString() ); 205 wlan->macAddress2().toString() );
205 } 206 }
206 else 207 else
207 { 208 {
208 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", 209 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'",
209 (const char*) wlan->macAddress2().toString(true), 210 (const char*) wlan->macAddress2().toString(true),
210 (const char*) wlan->macAddress1().toString(true), 211 (const char*) wlan->macAddress1().toString(true),
211 (const char*) wlan->macAddress3().toString(true) ); 212 (const char*) wlan->macAddress3().toString(true) );
212 netView()->traffic( "IBSS", wlan->macAddress2().toString(), 213 netView()->traffic( "IBSS", wlan->macAddress2().toString(),
213 wlan->macAddress1().toString(), 214 wlan->macAddress1().toString(),
214 wlan->macAddress3().toString() ); 215 wlan->macAddress3().toString() );
215 } 216 }
216 return; 217 return;
217 } 218 }
218} 219}
219 220
220void Wellenreiter::startStopClicked() 221
222void 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 ) ) 277void 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
@@ -1,72 +1,78 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26class QTimerEvent; 26class QTimerEvent;
27class QPixmap; 27class QPixmap;
28class OPacket; 28class OPacket;
29class OPacketCapturer; 29class OPacketCapturer;
30class OWirelessNetworkInterface; 30class OWirelessNetworkInterface;
31 31
32class ManufacturerDB; 32class ManufacturerDB;
33class WellenreiterConfigWindow; 33class WellenreiterConfigWindow;
34class MLogWindow; 34class MLogWindow;
35class MHexWindow; 35class MHexWindow;
36 36
37class Wellenreiter : public WellenreiterBase { 37class Wellenreiter : public WellenreiterBase {
38 Q_OBJECT 38 Q_OBJECT
39 39
40 public: 40 public:
41 Wellenreiter( QWidget* parent = 0 ); 41 Wellenreiter( QWidget* parent = 0 );
42 ~Wellenreiter(); 42 ~Wellenreiter();
43 43
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();
67 //void writeConfig(); 73 //void writeConfig();
68}; 74};
69 75
70 76
71 77
72#endif 78#endif
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
@@ -1,173 +1,178 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16#include "wellenreiterbase.h" 16#include "wellenreiterbase.h"
17 17
18#include <qheader.h> 18#include <qheader.h>
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qlistview.h> 20#include <qlistview.h>
21#include <qmultilineedit.h> 21#include <qmultilineedit.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qvariant.h> 24#include <qvariant.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
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 */
47WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) 48WellenreiterBase::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" ) );
51 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); 52 //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) );
52 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); 53 //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) );
53 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); 54 //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) );
54 55
55 if ( !name ) 56 if ( !name )
56 setName( "WellenreiterBase" ); 57 setName( "WellenreiterBase" );
57 resize( 191, 294 ); 58 resize( 191, 294 );
58#ifdef QWS 59#ifdef QWS
59 setCaption( tr( "Wellenreiter/Opie" ) ); 60 setCaption( tr( "Wellenreiter/Opie" ) );
60#else 61#else
61 setCaption( tr( "Wellenreiter/X11" ) ); 62 setCaption( tr( "Wellenreiter/X11" ) );
62#endif 63#endif
63 WellenreiterBaseLayout = new QVBoxLayout( this ); 64 WellenreiterBaseLayout = new QVBoxLayout( this );
64 WellenreiterBaseLayout->setSpacing( 2 ); 65 WellenreiterBaseLayout->setSpacing( 2 );
65 WellenreiterBaseLayout->setMargin( 0 ); 66 WellenreiterBaseLayout->setMargin( 0 );
66#ifdef QWS 67#ifdef QWS
67 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); 68 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
68#else 69#else
69 TabWidget = new QTabWidget( this, "TabWidget" ); 70 TabWidget = new QTabWidget( this, "TabWidget" );
70#endif 71#endif
71 ap = new QWidget( TabWidget, "ap" ); 72 ap = new QWidget( TabWidget, "ap" );
72 apLayout = new QVBoxLayout( ap ); 73 apLayout = new QVBoxLayout( ap );
73 apLayout->setSpacing( 2 ); 74 apLayout->setSpacing( 2 );
74 apLayout->setMargin( 2 ); 75 apLayout->setMargin( 2 );
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 );
97 100
98 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); 101 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
99 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); 102 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
100 PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); 103 PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
101 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); 104 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
102 PixmapLabel1_3_2->setLineWidth( 2 ); 105 PixmapLabel1_3_2->setLineWidth( 2 );
103 PixmapLabel1_3_2->setMargin( 0 ); 106 PixmapLabel1_3_2->setMargin( 0 );
104 PixmapLabel1_3_2->setMidLineWidth( 0 ); 107 PixmapLabel1_3_2->setMidLineWidth( 0 );
105 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); 108 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
106 PixmapLabel1_3_2->setScaledContents( TRUE ); 109 PixmapLabel1_3_2->setScaledContents( TRUE );
107 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 110 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
108 111
109 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 112 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
110 113
111 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 114 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
112 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 115 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
113 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 116 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
114 TextLabel1_4_2_font.setPointSize( 10 ); 117 TextLabel1_4_2_font.setPointSize( 10 );
115 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 118 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
116 TextLabel1_4_2->setText( tr( "<p align=center>\n" 119 TextLabel1_4_2->setText( tr( "<p align=center>\n"
117"<hr>\n" 120"<hr>\n"
118"Max Moser<br>\n" 121"Max Moser<br>\n"
119"Martin J. Muench<br>\n" 122"Martin J. Muench<br>\n"
120"Michael Lauer<br><hr>\n" 123"Michael Lauer<br><hr>\n"
121"<b>www.remote-exploit.org</b>\n" 124"<b>www.remote-exploit.org</b>\n"
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 */
149WellenreiterBase::~WellenreiterBase() 154WellenreiterBase::~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}
153 158
154/* 159/*
155 * Main event handler. Reimplemented to handle application 160 * Main event handler. Reimplemented to handle application
156 * font changes 161 * font changes
157 */ 162 */
158bool WellenreiterBase::event( QEvent* ev ) 163bool WellenreiterBase::event( QEvent* ev )
159{ 164{
160 bool ret = QWidget::event( ev ); 165 bool ret = QWidget::event( ev );
161 if ( ev->type() == QEvent::ApplicationFontChange ) { 166 if ( ev->type() == QEvent::ApplicationFontChange ) {
162 //QFont Log_2_font( Log_2->font() ); 167 //QFont Log_2_font( Log_2->font() );
163 //Log_2_font.setFamily( "adobe-courier" ); 168 //Log_2_font.setFamily( "adobe-courier" );
164 //Log_2_font.setPointSize( 8 ); 169 //Log_2_font.setPointSize( 8 );
165 //Log_2->setFont( Log_2_font ); 170 //Log_2->setFont( Log_2_font );
166 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 171 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
167 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 172 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
168 TextLabel1_4_2_font.setPointSize( 10 ); 173 TextLabel1_4_2_font.setPointSize( 10 );
169 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 174 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
170 } 175 }
171 return ret; 176 return ret;
172} 177}
173 178
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
@@ -1,72 +1,74 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITERBASE_H 16#ifndef WELLENREITERBASE_H
17#define WELLENREITERBASE_H 17#define WELLENREITERBASE_H
18 18
19#include <qvariant.h> 19#include <qvariant.h>
20#include <qwidget.h> 20#include <qwidget.h>
21class QVBoxLayout; 21class QVBoxLayout;
22class QHBoxLayout; 22class QHBoxLayout;
23class QGridLayout; 23class QGridLayout;
24class QLabel; 24class QLabel;
25class MScanListView; 25class MScanListView;
26class MScanListItem; 26class MScanListItem;
27class QPushButton; 27class QPushButton;
28class MLogWindow; 28class MLogWindow;
29class MHexWindow; 29class MHexWindow;
30class MStatWindow;
30 31
31#ifdef QWS 32#ifdef QWS
32class OTabWidget; 33class OTabWidget;
33#else 34#else
34class QTabWidget; 35class QTabWidget;
35#endif 36#endif
36 37
37class WellenreiterBase : public QWidget 38class WellenreiterBase : public QWidget
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40 41
41public: 42public:
42 WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 43 WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
43 ~WellenreiterBase(); 44 ~WellenreiterBase();
44 45
45#ifdef QWS 46#ifdef QWS
46 OTabWidget* TabWidget; 47 OTabWidget* TabWidget;
47#else 48#else
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
58protected: 60protected:
59 QVBoxLayout* WellenreiterBaseLayout; 61 QVBoxLayout* WellenreiterBaseLayout;
60 QVBoxLayout* apLayout; 62 QVBoxLayout* apLayout;
61 QGridLayout* aboutLayout; 63 QGridLayout* aboutLayout;
62 bool event( QEvent* ); 64 bool event( QEvent* );
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