author | mickeyl <mickeyl> | 2004-02-07 20:20:24 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-07 20:20:24 (UTC) |
commit | 9212a1715e5092ce143043770c5f2ff86db907ee (patch) (unidiff) | |
tree | bb1058f0ea85d0bc4556ac0efebdf00ffa113975 | |
parent | b2ddc28220478b9f60201c06629db744db461d68 (diff) | |
download | opie-9212a1715e5092ce143043770c5f2ff86db907ee.zip opie-9212a1715e5092ce143043770c5f2ff86db907ee.tar.gz opie-9212a1715e5092ce143043770c5f2ff86db907ee.tar.bz2 |
no longer link against libopie1 since libopie2 provides everything
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 13 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 3 |
8 files changed, 15 insertions, 18 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 9358866..ca53471 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -1,217 +1,217 @@ | |||
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 | /* LOCAL */ | 16 | /* LOCAL */ |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "mainwindow.h" | 18 | #include "mainwindow.h" |
19 | 19 | ||
20 | /* OPIE */ | 20 | /* OPIE */ |
21 | #include <opie2/onetwork.h> | 21 | #include <opie2/onetwork.h> |
22 | #ifdef QWS | 22 | #ifdef QWS |
23 | #include <opie2/oapplication.h> | 23 | #include <opie2/oapplication.h> |
24 | #include <opie2/oconfig.h> | 24 | #include <opie2/oconfig.h> |
25 | #include <opie/odevice.h> | 25 | #include <opie2/odevice.h> |
26 | using namespace Opie; | 26 | using namespace Opie; |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | /* QT */ | 29 | /* QT */ |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | #include <qcheckbox.h> | 31 | #include <qcheckbox.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
39 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
40 | #include <qspinbox.h> | 40 | #include <qspinbox.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | 42 | ||
43 | /* POSIX */ | 43 | /* POSIX */ |
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | 45 | ||
46 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | 46 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; |
47 | 47 | ||
48 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 48 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
49 | :WellenreiterConfigBase( parent, name, true, f ) | 49 | :WellenreiterConfigBase( parent, name, true, f ) |
50 | { | 50 | { |
51 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; | 51 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; |
52 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; | 52 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; |
53 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; | 53 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; |
54 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; | 54 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; |
55 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; | 55 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; |
56 | _devicetype[ "<file>" ] = DEVTYPE_FILE; | 56 | _devicetype[ "<file>" ] = DEVTYPE_FILE; |
57 | 57 | ||
58 | // gather possible interface names from ONetwork | 58 | // gather possible interface names from ONetwork |
59 | ONetwork* net = ONetwork::instance(); | 59 | ONetwork* net = ONetwork::instance(); |
60 | ONetwork::InterfaceIterator it = net->iterator(); | 60 | ONetwork::InterfaceIterator it = net->iterator(); |
61 | while ( it.current() ) | 61 | while ( it.current() ) |
62 | { | 62 | { |
63 | if ( it.current()->isWireless() ) | 63 | if ( it.current()->isWireless() ) |
64 | interfaceName->insertItem( it.current()->name() ); | 64 | interfaceName->insertItem( it.current()->name() ); |
65 | ++it; | 65 | ++it; |
66 | } | 66 | } |
67 | 67 | ||
68 | load(); | 68 | load(); |
69 | 69 | ||
70 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | 70 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here |
71 | QPushButton* okButton = new QPushButton( "ok", this ); | 71 | QPushButton* okButton = new QPushButton( "ok", this ); |
72 | okButton->show(); | 72 | okButton->show(); |
73 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui | 73 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui |
74 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 74 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | WellenreiterConfigWindow::_instance = this; | 77 | WellenreiterConfigWindow::_instance = this; |
78 | 78 | ||
79 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); | 79 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); |
80 | connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); | 80 | connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); |
81 | connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); | 81 | connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); |
82 | connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); | 82 | connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); |
83 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); | 83 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); |
84 | 84 | ||
85 | // make the checkbox 'channelAll' control all other channels | 85 | // make the checkbox 'channelAll' control all other channels |
86 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); | 86 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); |
87 | 87 | ||
88 | connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); | 88 | connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); |
89 | 89 | ||
90 | // hide tab4 (parse) until Wellenreiter 1.2 | 90 | // hide tab4 (parse) until Wellenreiter 1.2 |
91 | tab->removePage( tab_4 ); | 91 | tab->removePage( tab_4 ); |
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | void WellenreiterConfigWindow::accept() | 95 | void WellenreiterConfigWindow::accept() |
96 | { | 96 | { |
97 | save(); | 97 | save(); |
98 | QDialog::accept(); | 98 | QDialog::accept(); |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | 102 | WellenreiterConfigWindow::~WellenreiterConfigWindow() |
103 | { | 103 | { |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | void WellenreiterConfigWindow::performAutodetection() | 107 | void WellenreiterConfigWindow::performAutodetection() |
108 | { | 108 | { |
109 | //TODO: insert modal splash screen here | 109 | //TODO: insert modal splash screen here |
110 | // and sleep a second, so that it looks | 110 | // and sleep a second, so that it looks |
111 | // like we're actually doing something fancy... ;-) | 111 | // like we're actually doing something fancy... ;-) |
112 | 112 | ||
113 | qDebug( "WellenreiterConfigWindow::performAutodetection()" ); | 113 | qDebug( "WellenreiterConfigWindow::performAutodetection()" ); |
114 | 114 | ||
115 | // try to guess device type | 115 | // try to guess device type |
116 | QFile m( "/proc/modules" ); | 116 | QFile m( "/proc/modules" ); |
117 | if ( m.open( IO_ReadOnly ) ) | 117 | if ( m.open( IO_ReadOnly ) ) |
118 | { | 118 | { |
119 | int devicetype(0); | 119 | int devicetype(0); |
120 | QString line; | 120 | QString line; |
121 | QTextStream modules( &m ); | 121 | QTextStream modules( &m ); |
122 | while( !modules.atEnd() && !devicetype ) | 122 | while( !modules.atEnd() && !devicetype ) |
123 | { | 123 | { |
124 | modules >> line; | 124 | modules >> line; |
125 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; | 125 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; |
126 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; | 126 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; |
127 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; | 127 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; |
128 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; | 128 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; |
129 | } | 129 | } |
130 | if ( devicetype ) | 130 | if ( devicetype ) |
131 | { | 131 | { |
132 | deviceType->setCurrentItem( devicetype ); | 132 | deviceType->setCurrentItem( devicetype ); |
133 | _guess = devicetype; | 133 | _guess = devicetype; |
134 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | 134 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | int WellenreiterConfigWindow::driverType() const | 140 | int WellenreiterConfigWindow::driverType() const |
141 | { | 141 | { |
142 | QString name = deviceType->currentText(); | 142 | QString name = deviceType->currentText(); |
143 | if ( _devicetype.contains( name ) ) | 143 | if ( _devicetype.contains( name ) ) |
144 | { | 144 | { |
145 | return _devicetype[name]; | 145 | return _devicetype[name]; |
146 | } | 146 | } |
147 | else | 147 | else |
148 | { | 148 | { |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | }; | 151 | }; |
152 | 152 | ||
153 | 153 | ||
154 | int WellenreiterConfigWindow::hoppingInterval() const | 154 | int WellenreiterConfigWindow::hoppingInterval() const |
155 | { | 155 | { |
156 | return hopInterval->cleanText().toInt(); | 156 | return hopInterval->cleanText().toInt(); |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | bool WellenreiterConfigWindow::usePrismHeader() const | 160 | bool WellenreiterConfigWindow::usePrismHeader() const |
161 | { | 161 | { |
162 | return prismHeader->isChecked(); | 162 | return prismHeader->isChecked(); |
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const | 166 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const |
167 | { | 167 | { |
168 | switch ( channel ) | 168 | switch ( channel ) |
169 | { | 169 | { |
170 | case 1: return channel1->isOn(); | 170 | case 1: return channel1->isOn(); |
171 | case 2: return channel2->isOn(); | 171 | case 2: return channel2->isOn(); |
172 | case 3: return channel3->isOn(); | 172 | case 3: return channel3->isOn(); |
173 | case 4: return channel4->isOn(); | 173 | case 4: return channel4->isOn(); |
174 | case 5: return channel5->isOn(); | 174 | case 5: return channel5->isOn(); |
175 | case 6: return channel6->isOn(); | 175 | case 6: return channel6->isOn(); |
176 | case 7: return channel7->isOn(); | 176 | case 7: return channel7->isOn(); |
177 | case 8: return channel8->isOn(); | 177 | case 8: return channel8->isOn(); |
178 | case 9: return channel9->isOn(); | 178 | case 9: return channel9->isOn(); |
179 | case 10: return channel10->isOn(); | 179 | case 10: return channel10->isOn(); |
180 | case 11: return channel11->isOn(); | 180 | case 11: return channel11->isOn(); |
181 | case 12: return channel12->isOn(); | 181 | case 12: return channel12->isOn(); |
182 | case 13: return channel13->isOn(); | 182 | case 13: return channel13->isOn(); |
183 | case 14: return channel14->isOn(); | 183 | case 14: return channel14->isOn(); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | 187 | ||
188 | void WellenreiterConfigWindow::changedDeviceType(int t) | 188 | void WellenreiterConfigWindow::changedDeviceType(int t) |
189 | { | 189 | { |
190 | if ( t != DEVTYPE_FILE ) return; | 190 | if ( t != DEVTYPE_FILE ) return; |
191 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); | 191 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); |
192 | if ( !name.isEmpty() && QFile::exists( name ) ) | 192 | if ( !name.isEmpty() && QFile::exists( name ) ) |
193 | { | 193 | { |
194 | interfaceName->insertItem( name ); | 194 | interfaceName->insertItem( name ); |
195 | interfaceName->setCurrentItem( interfaceName->count()-1 ); | 195 | interfaceName->setCurrentItem( interfaceName->count()-1 ); |
196 | } | 196 | } |
197 | else | 197 | else |
198 | { | 198 | { |
199 | deviceType->setCurrentItem( _guess ); | 199 | deviceType->setCurrentItem( _guess ); |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | void WellenreiterConfigWindow::synchronizeActionsAndScripts() | 205 | void WellenreiterConfigWindow::synchronizeActionsAndScripts() |
206 | { | 206 | { |
207 | if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); | 207 | if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); |
208 | if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); | 208 | if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); |
209 | if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); | 209 | if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); |
210 | 210 | ||
211 | //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); | 211 | //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); |
212 | //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); | 212 | //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); |
213 | //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); | 213 | //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | void WellenreiterConfigWindow::changedNetworkAction(int t) | 217 | void WellenreiterConfigWindow::changedNetworkAction(int t) |
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 188d96a..7957d4c 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -1,47 +1,47 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE = app | 2 | TEMPLATE = app |
3 | CONFIG = qt warn_on debug | 3 | CONFIG = qt warn_on debug |
4 | 4 | ||
5 | HEADERS = wellenreiterbase.h \ | 5 | HEADERS = wellenreiterbase.h \ |
6 | mainwindow.h \ | 6 | mainwindow.h \ |
7 | wellenreiter.h \ | 7 | wellenreiter.h \ |
8 | scanlist.h \ | 8 | scanlist.h \ |
9 | logwindow.h \ | 9 | logwindow.h \ |
10 | hexwindow.h \ | 10 | hexwindow.h \ |
11 | statwindow.h \ | 11 | statwindow.h \ |
12 | configwindow.h \ | 12 | configwindow.h \ |
13 | graphwindow.h \ | 13 | graphwindow.h \ |
14 | protolistview.h \ | 14 | protolistview.h \ |
15 | gps.h | 15 | gps.h |
16 | 16 | ||
17 | SOURCES = main.cpp \ | 17 | SOURCES = main.cpp \ |
18 | mainwindow.cpp \ | 18 | mainwindow.cpp \ |
19 | wellenreiterbase.cpp \ | 19 | wellenreiterbase.cpp \ |
20 | wellenreiter.cpp \ | 20 | wellenreiter.cpp \ |
21 | scanlist.cpp \ | 21 | scanlist.cpp \ |
22 | logwindow.cpp \ | 22 | logwindow.cpp \ |
23 | hexwindow.cpp \ | 23 | hexwindow.cpp \ |
24 | statwindow.cpp \ | 24 | statwindow.cpp \ |
25 | configwindow.cpp \ | 25 | configwindow.cpp \ |
26 | graphwindow.cpp \ | 26 | graphwindow.cpp \ |
27 | protolistview.cpp \ | 27 | protolistview.cpp \ |
28 | gps.cpp | 28 | gps.cpp |
29 | 29 | ||
30 | INCLUDEPATH += $(OPIEDIR)/include | 30 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH += $(OPIEDIR)/include | 31 | DEPENDPATH += $(OPIEDIR)/include |
32 | INTERFACES = configbase.ui | 32 | INTERFACES = configbase.ui |
33 | TARGET = wellenreiter | 33 | TARGET = wellenreiter |
34 | 34 | ||
35 | !contains( platform, x11 ) { | 35 | !contains( platform, x11 ) { |
36 | message( qws ) | 36 | message( qws ) |
37 | include ( $(OPIEDIR)/include.pro ) | 37 | include ( $(OPIEDIR)/include.pro ) |
38 | LIBS += -lqpe -lopie -lopiecore2 -lopieui2 -lopienet2 | 38 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2 |
39 | } | 39 | } |
40 | 40 | ||
41 | contains( platform, x11 ) { | 41 | contains( platform, x11 ) { |
42 | LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter | 42 | LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter |
43 | SOURCES += resource.cpp | 43 | SOURCES += resource.cpp |
44 | HEADERS += resource.h | 44 | HEADERS += resource.h |
45 | DESTDIR = $(OPIEDIR)/output/bin | 45 | DESTDIR = $(OPIEDIR)/output/bin |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index d4e3279..05a8913 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,234 +1,235 @@ | |||
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 "gps.h" | 17 | #include "gps.h" |
18 | #include "logwindow.h" | 18 | #include "logwindow.h" |
19 | #include "hexwindow.h" | 19 | #include "hexwindow.h" |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "wellenreiter.h" | 21 | #include "wellenreiter.h" |
22 | #include "scanlist.h" | 22 | #include "scanlist.h" |
23 | 23 | ||
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qdatastream.h> | 25 | #include <qdatastream.h> |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #include <qfileinfo.h> | 27 | #include <qfileinfo.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qiconset.h> | 31 | #include <qiconset.h> |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qstatusbar.h> | 36 | #include <qstatusbar.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | 39 | ||
40 | #ifdef QWS | 40 | #ifdef QWS |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | #include <opie/ofiledialog.h> | 42 | #include <opie2/ofiledialog.h> |
43 | using namespace Opie; | ||
43 | #else | 44 | #else |
44 | #include "resource.h" | 45 | #include "resource.h" |
45 | #include <qapplication.h> | 46 | #include <qapplication.h> |
46 | #include <qfiledialog.h> | 47 | #include <qfiledialog.h> |
47 | #endif | 48 | #endif |
48 | 49 | ||
49 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 50 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
50 | :QMainWindow( parent, name, f ) | 51 | :QMainWindow( parent, name, f ) |
51 | { | 52 | { |
52 | cw = new WellenreiterConfigWindow( this ); | 53 | cw = new WellenreiterConfigWindow( this ); |
53 | mw = new Wellenreiter( this ); | 54 | mw = new Wellenreiter( this ); |
54 | mw->setConfigWindow( cw ); | 55 | mw->setConfigWindow( cw ); |
55 | setCentralWidget( mw ); | 56 | setCentralWidget( mw ); |
56 | 57 | ||
57 | // setup application icon | 58 | // setup application icon |
58 | 59 | ||
59 | #ifndef QWS | 60 | #ifndef QWS |
60 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 61 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
61 | setIconText( "Wellenreiter/X11" ); | 62 | setIconText( "Wellenreiter/X11" ); |
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | // setup tool buttons | 65 | // setup tool buttons |
65 | 66 | ||
66 | startButton = new QToolButton( 0 ); | 67 | startButton = new QToolButton( 0 ); |
67 | #ifdef QWS | 68 | #ifdef QWS |
68 | startButton->setAutoRaise( true ); | 69 | startButton->setAutoRaise( true ); |
69 | #endif | 70 | #endif |
70 | startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); | 71 | startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) ); |
71 | startButton->setEnabled( false ); | 72 | startButton->setEnabled( false ); |
72 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | 73 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); |
73 | 74 | ||
74 | stopButton = new QToolButton( 0 ); | 75 | stopButton = new QToolButton( 0 ); |
75 | #ifdef QWS | 76 | #ifdef QWS |
76 | stopButton->setAutoRaise( true ); | 77 | stopButton->setAutoRaise( true ); |
77 | #endif | 78 | #endif |
78 | stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); | 79 | stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) ); |
79 | stopButton->setEnabled( false ); | 80 | stopButton->setEnabled( false ); |
80 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); | 81 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
81 | 82 | ||
82 | QToolButton* d = new QToolButton( 0 ); | 83 | QToolButton* d = new QToolButton( 0 ); |
83 | #ifdef QWS | 84 | #ifdef QWS |
84 | d->setAutoRaise( true ); | 85 | d->setAutoRaise( true ); |
85 | #endif | 86 | #endif |
86 | d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); | 87 | d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) ); |
87 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 88 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
88 | 89 | ||
89 | uploadButton = new QToolButton( 0 ); | 90 | uploadButton = new QToolButton( 0 ); |
90 | #ifdef QWS | 91 | #ifdef QWS |
91 | uploadButton->setAutoRaise( true ); | 92 | uploadButton->setAutoRaise( true ); |
92 | #endif | 93 | #endif |
93 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); | 94 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); |
94 | uploadButton->setEnabled( false ); | 95 | uploadButton->setEnabled( false ); |
95 | //uploadButton->setEnabled( true ); // DEBUGGING | 96 | //uploadButton->setEnabled( true ); // DEBUGGING |
96 | connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); | 97 | connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); |
97 | 98 | ||
98 | // setup menu bar | 99 | // setup menu bar |
99 | 100 | ||
100 | int id; | 101 | int id; |
101 | 102 | ||
102 | QMenuBar* mb = menuBar(); | 103 | QMenuBar* mb = menuBar(); |
103 | 104 | ||
104 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 105 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
105 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); | 106 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); |
106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); | 107 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); |
107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); | 108 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); |
108 | 109 | ||
109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 110 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
110 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); | 111 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); |
111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 112 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
112 | 113 | ||
113 | QPopupMenu* file = new QPopupMenu( mb ); | 114 | QPopupMenu* file = new QPopupMenu( mb ); |
114 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); | 115 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
115 | id = file->insertItem( tr( "&Load" ), fileLoad ); | 116 | id = file->insertItem( tr( "&Load" ), fileLoad ); |
116 | file->insertItem( tr( "&Save" ), fileSave ); | 117 | file->insertItem( tr( "&Save" ), fileSave ); |
117 | file->insertSeparator(); | 118 | file->insertSeparator(); |
118 | uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); | 119 | uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) ); |
119 | file->insertSeparator(); | 120 | file->insertSeparator(); |
120 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); | 121 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
121 | 122 | ||
122 | QPopupMenu* view = new QPopupMenu( mb ); | 123 | QPopupMenu* view = new QPopupMenu( mb ); |
123 | view->insertItem( tr( "&Configure..." ) ); | 124 | view->insertItem( tr( "&Configure..." ) ); |
124 | 125 | ||
125 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 126 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
126 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); | 127 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
127 | sniffer->insertSeparator(); | 128 | sniffer->insertSeparator(); |
128 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); | 129 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
129 | sniffer->setItemEnabled( startID, false ); | 130 | sniffer->setItemEnabled( startID, false ); |
130 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); | 131 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
131 | sniffer->setItemEnabled( stopID, false ); | 132 | sniffer->setItemEnabled( stopID, false ); |
132 | 133 | ||
133 | QPopupMenu* demo = new QPopupMenu( mb ); | 134 | QPopupMenu* demo = new QPopupMenu( mb ); |
134 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); | 135 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
135 | 136 | ||
136 | id = mb->insertItem( tr( "&File" ), file ); | 137 | id = mb->insertItem( tr( "&File" ), file ); |
137 | //id = mb->insertItem( tr( "&View" ), view ); | 138 | //id = mb->insertItem( tr( "&View" ), view ); |
138 | //mb->setItemEnabled( id, false ); | 139 | //mb->setItemEnabled( id, false ); |
139 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 140 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
140 | 141 | ||
141 | id = mb->insertItem( tr( "&Demo" ), demo ); | 142 | id = mb->insertItem( tr( "&Demo" ), demo ); |
142 | mb->setItemEnabled( id, true ); | 143 | mb->setItemEnabled( id, true ); |
143 | mb->setItemEnabled( uploadID, false ); | 144 | mb->setItemEnabled( uploadID, false ); |
144 | 145 | ||
145 | #ifdef QWS | 146 | #ifdef QWS |
146 | mb->insertItem( startButton ); | 147 | mb->insertItem( startButton ); |
147 | mb->insertItem( stopButton ); | 148 | mb->insertItem( stopButton ); |
148 | mb->insertItem( uploadButton ); | 149 | mb->insertItem( uploadButton ); |
149 | mb->insertItem( d ); | 150 | mb->insertItem( d ); |
150 | #else // Qt3 changed the insertion order. It's now totally random :( | 151 | #else // Qt3 changed the insertion order. It's now totally random :( |
151 | mb->insertItem( d ); | 152 | mb->insertItem( d ); |
152 | mb->insertItem( uploadButton ); | 153 | mb->insertItem( uploadButton ); |
153 | mb->insertItem( stopButton ); | 154 | mb->insertItem( stopButton ); |
154 | mb->insertItem( startButton ); | 155 | mb->insertItem( startButton ); |
155 | #endif | 156 | #endif |
156 | 157 | ||
157 | updateToolButtonState(); | 158 | updateToolButtonState(); |
158 | 159 | ||
159 | // setup status bar (for now only on X11) | 160 | // setup status bar (for now only on X11) |
160 | 161 | ||
161 | #ifndef QWS | 162 | #ifndef QWS |
162 | statusBar()->message( tr( "Ready." ) ); | 163 | statusBar()->message( tr( "Ready." ) ); |
163 | #endif | 164 | #endif |
164 | 165 | ||
165 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 166 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
166 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 167 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
167 | }; | 168 | }; |
168 | 169 | ||
169 | 170 | ||
170 | 171 | ||
171 | void WellenreiterMainWindow::showConfigure() | 172 | void WellenreiterMainWindow::showConfigure() |
172 | { | 173 | { |
173 | qDebug( "show configure..." ); | 174 | qDebug( "show configure..." ); |
174 | cw->setCaption( tr( "Configure" ) ); | 175 | cw->setCaption( tr( "Configure" ) ); |
175 | #ifdef QWS | 176 | #ifdef QWS |
176 | cw->showMaximized(); | 177 | cw->showMaximized(); |
177 | #endif | 178 | #endif |
178 | int result = cw->exec(); | 179 | int result = cw->exec(); |
179 | 180 | ||
180 | if ( result ) updateToolButtonState(); | 181 | if ( result ) updateToolButtonState(); |
181 | } | 182 | } |
182 | 183 | ||
183 | 184 | ||
184 | void WellenreiterMainWindow::updateToolButtonState() | 185 | void WellenreiterMainWindow::updateToolButtonState() |
185 | { | 186 | { |
186 | const QString& interface = cw->interfaceName->currentText(); | 187 | const QString& interface = cw->interfaceName->currentText(); |
187 | const int cardtype = cw->driverType(); | 188 | const int cardtype = cw->driverType(); |
188 | 189 | ||
189 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 190 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
190 | { | 191 | { |
191 | startButton->setEnabled( true ); | 192 | startButton->setEnabled( true ); |
192 | menuBar()->setItemEnabled( startID, true ); | 193 | menuBar()->setItemEnabled( startID, true ); |
193 | } | 194 | } |
194 | else | 195 | else |
195 | { | 196 | { |
196 | startButton->setEnabled( false ); | 197 | startButton->setEnabled( false ); |
197 | menuBar()->setItemEnabled( startID, false ); | 198 | menuBar()->setItemEnabled( startID, false ); |
198 | } | 199 | } |
199 | } | 200 | } |
200 | 201 | ||
201 | 202 | ||
202 | void WellenreiterMainWindow::changedSniffingState() | 203 | void WellenreiterMainWindow::changedSniffingState() |
203 | { | 204 | { |
204 | startButton->setEnabled( !mw->sniffing ); | 205 | startButton->setEnabled( !mw->sniffing ); |
205 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 206 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
206 | stopButton->setEnabled( mw->sniffing ); | 207 | stopButton->setEnabled( mw->sniffing ); |
207 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 208 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
208 | 209 | ||
209 | if ( !mw->sniffing ) | 210 | if ( !mw->sniffing ) |
210 | { | 211 | { |
211 | menuBar()->setItemEnabled( uploadID, true ); | 212 | menuBar()->setItemEnabled( uploadID, true ); |
212 | uploadButton->setEnabled( true ); | 213 | uploadButton->setEnabled( true ); |
213 | } | 214 | } |
214 | } | 215 | } |
215 | 216 | ||
216 | 217 | ||
217 | WellenreiterMainWindow::~WellenreiterMainWindow() | 218 | WellenreiterMainWindow::~WellenreiterMainWindow() |
218 | { | 219 | { |
219 | qDebug( "Wellenreiter:: bye." ); | 220 | qDebug( "Wellenreiter:: bye." ); |
220 | }; | 221 | }; |
221 | 222 | ||
222 | 223 | ||
223 | void WellenreiterMainWindow::demoAddStations() | 224 | void WellenreiterMainWindow::demoAddStations() |
224 | { | 225 | { |
225 | //mw = 0; // test SIGSGV handling | 226 | //mw = 0; // test SIGSGV handling |
226 | 227 | ||
227 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); | 228 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); |
228 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); | 229 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); |
229 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); | 230 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); |
230 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); | 231 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); |
231 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); | 232 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); |
232 | } | 233 | } |
233 | 234 | ||
234 | 235 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 10ead53..b42f1df 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -53,384 +53,385 @@ MScanListView::MScanListView( QWidget* parent, const char* name ) | |||
53 | 53 | ||
54 | setFrameShape( QListView::StyledPanel ); | 54 | setFrameShape( QListView::StyledPanel ); |
55 | setFrameShadow( QListView::Sunken ); | 55 | setFrameShadow( QListView::Sunken ); |
56 | 56 | ||
57 | addColumn( tr( "Net/Station" ) ); | 57 | addColumn( tr( "Net/Station" ) ); |
58 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); | 58 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
59 | addColumn( tr( "#" ) ); | 59 | addColumn( tr( "#" ) ); |
60 | setColumnAlignment( col_sig, AlignCenter ); | 60 | setColumnAlignment( col_sig, AlignCenter ); |
61 | addColumn( tr( "MAC" ) ); | 61 | addColumn( tr( "MAC" ) ); |
62 | setColumnAlignment( col_ap, AlignCenter ); | 62 | setColumnAlignment( col_ap, AlignCenter ); |
63 | addColumn( tr( "Chn" ) ); | 63 | addColumn( tr( "Chn" ) ); |
64 | setColumnAlignment( col_channel, AlignCenter ); | 64 | setColumnAlignment( col_channel, AlignCenter ); |
65 | addColumn( tr( "W" ) ); | 65 | addColumn( tr( "W" ) ); |
66 | setColumnAlignment( col_wep, AlignCenter ); | 66 | setColumnAlignment( col_wep, AlignCenter ); |
67 | addColumn( tr( "T" ) ); | 67 | addColumn( tr( "T" ) ); |
68 | setColumnAlignment( col_traffic, AlignCenter ); | 68 | setColumnAlignment( col_traffic, AlignCenter ); |
69 | addColumn( tr( "IP" ) ); | 69 | addColumn( tr( "IP" ) ); |
70 | setColumnAlignment( col_ip, AlignCenter ); | 70 | setColumnAlignment( col_ip, AlignCenter ); |
71 | addColumn( tr( "Manufacturer" ) ); | 71 | addColumn( tr( "Manufacturer" ) ); |
72 | setColumnAlignment( col_manuf, AlignCenter ); | 72 | setColumnAlignment( col_manuf, AlignCenter ); |
73 | addColumn( tr( "First Seen" ) ); | 73 | addColumn( tr( "First Seen" ) ); |
74 | setColumnAlignment( col_firstseen, AlignCenter ); | 74 | setColumnAlignment( col_firstseen, AlignCenter ); |
75 | addColumn( tr( "Last Seen" ) ); | 75 | addColumn( tr( "Last Seen" ) ); |
76 | setColumnAlignment( col_lastseen, AlignCenter ); | 76 | setColumnAlignment( col_lastseen, AlignCenter ); |
77 | addColumn( tr( "Location" ) ); | 77 | addColumn( tr( "Location" ) ); |
78 | setColumnAlignment( col_location, AlignCenter ); | 78 | setColumnAlignment( col_location, AlignCenter ); |
79 | setRootIsDecorated( true ); | 79 | setRootIsDecorated( true ); |
80 | setAllColumnsShowFocus( true ); | 80 | setAllColumnsShowFocus( true ); |
81 | 81 | ||
82 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 82 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
83 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 83 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
84 | 84 | ||
85 | #ifdef QWS | 85 | #ifdef QWS |
86 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 86 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | 91 | ||
92 | MScanListView::~MScanListView() | 92 | MScanListView::~MScanListView() |
93 | { | 93 | { |
94 | }; | 94 | }; |
95 | 95 | ||
96 | 96 | ||
97 | OListViewItem* MScanListView::childFactory() | 97 | OListViewItem* MScanListView::childFactory() |
98 | { | 98 | { |
99 | return new MScanListItem( this ); | 99 | return new MScanListItem( this ); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void MScanListView::serializeTo( QDataStream& s) const | 103 | void MScanListView::serializeTo( QDataStream& s) const |
104 | { | 104 | { |
105 | qDebug( "serializing MScanListView" ); | 105 | qDebug( "serializing MScanListView" ); |
106 | OListView::serializeTo( s ); | 106 | OListView::serializeTo( s ); |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void MScanListView::serializeFrom( QDataStream& s) | 110 | void MScanListView::serializeFrom( QDataStream& s) |
111 | { | 111 | { |
112 | qDebug( "serializing MScanListView" ); | 112 | qDebug( "serializing MScanListView" ); |
113 | OListView::serializeFrom( s ); | 113 | OListView::serializeFrom( s ); |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | void MScanListView::addNewItem( const QString& type, | 117 | void MScanListView::addNewItem( const QString& type, |
118 | const QString& essid, | 118 | const QString& essid, |
119 | const OMacAddress& mac, | 119 | const OMacAddress& mac, |
120 | bool wep, | 120 | bool wep, |
121 | int channel, | 121 | int channel, |
122 | int signal, | 122 | int signal, |
123 | const GpsLocation& loc, | 123 | const GpsLocation& loc, |
124 | bool probe ) | 124 | bool probe ) |
125 | { | 125 | { |
126 | QString macaddr = mac.toString(true); | 126 | QString macaddr = mac.toString(true); |
127 | 127 | ||
128 | #ifdef DEBUG | 128 | #ifdef DEBUG |
129 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, | 129 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, |
130 | (const char*) essid, (const char*) macaddr, channel ); | 130 | (const char*) essid, (const char*) macaddr, channel ); |
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | // search, if we already have seen this net | 133 | // search, if we already have seen this net |
134 | 134 | ||
135 | QString s; | 135 | QString s; |
136 | MScanListItem* network; | 136 | MScanListItem* network; |
137 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 137 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
138 | 138 | ||
139 | while ( item && ( item->text( col_essid ) != essid ) ) | 139 | while ( item && ( item->text( col_essid ) != essid ) ) |
140 | { | 140 | { |
141 | #ifdef DEBUG | 141 | #ifdef DEBUG |
142 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); | 142 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); |
143 | #endif | 143 | #endif |
144 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 144 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
145 | } | 145 | } |
146 | if ( item ) | 146 | if ( item ) |
147 | { | 147 | { |
148 | // we have already seen this net, check all childs if MAC exists | 148 | // we have already seen this net, check all childs if MAC exists |
149 | 149 | ||
150 | network = item; | 150 | network = item; |
151 | 151 | ||
152 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 152 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
153 | assert( item ); // this shouldn't fail | 153 | assert( item ); // this shouldn't fail |
154 | 154 | ||
155 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 155 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
156 | { | 156 | { |
157 | #ifdef DEBUG | 157 | #ifdef DEBUG |
158 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); | 158 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); |
159 | #endif | 159 | #endif |
160 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 160 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
161 | } | 161 | } |
162 | 162 | ||
163 | if ( item ) | 163 | if ( item ) |
164 | { | 164 | { |
165 | // we have already seen this item, it's a dupe | 165 | // we have already seen this item, it's a dupe |
166 | #ifdef DEBUG | 166 | #ifdef DEBUG |
167 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 167 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
168 | #endif | 168 | #endif |
169 | item->receivedBeacon(); | 169 | item->receivedBeacon(); |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | else | 173 | else |
174 | { | 174 | { |
175 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 175 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
176 | MLogWindow::logwindow()->log( s ); | 176 | MLogWindow::logwindow()->log( s ); |
177 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); | 177 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | // insert new station as child from network | 181 | // insert new station as child from network |
182 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 182 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
183 | 183 | ||
184 | #ifdef DEBUG | 184 | #ifdef DEBUG |
185 | qDebug( "inserting new station %s", (const char*) macaddr ); | 185 | qDebug( "inserting new station %s", (const char*) macaddr ); |
186 | #endif | 186 | #endif |
187 | 187 | ||
188 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 188 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
189 | station->setManufacturer( mac.manufacturer() ); | 189 | station->setManufacturer( mac.manufacturer() ); |
190 | station->setLocation( loc.dmsPosition() ); | 190 | station->setLocation( loc.dmsPosition() ); |
191 | 191 | ||
192 | if ( type == "managed" ) | 192 | if ( type == "managed" ) |
193 | { | 193 | { |
194 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 194 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
195 | } | 195 | } |
196 | else | 196 | else |
197 | { | 197 | { |
198 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 198 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
199 | } | 199 | } |
200 | MLogWindow::logwindow()->log( s ); | 200 | MLogWindow::logwindow()->log( s ); |
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 204 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
205 | { | 205 | { |
206 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 206 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
207 | 207 | ||
208 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 208 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
209 | { | 209 | { |
210 | #ifdef DEBUG | 210 | #ifdef DEBUG |
211 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 211 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
212 | #endif | 212 | #endif |
213 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 213 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
214 | } | 214 | } |
215 | 215 | ||
216 | if ( subitem ) | 216 | if ( subitem ) |
217 | { | 217 | { |
218 | // we have already seen this item, it's a dupe | 218 | // we have already seen this item, it's a dupe |
219 | #ifdef DEBUG | 219 | #ifdef DEBUG |
220 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); | 220 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); |
221 | #endif | 221 | #endif |
222 | subitem->receivedBeacon(); //FIXME: sent data bit | 222 | subitem->receivedBeacon(); //FIXME: sent data bit |
223 | return; | 223 | return; |
224 | } | 224 | } |
225 | 225 | ||
226 | // Hey, it seems to be a new item :-D | 226 | // Hey, it seems to be a new item :-D |
227 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); | 227 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); |
228 | station->setManufacturer( addr.manufacturer() ); | 228 | station->setManufacturer( addr.manufacturer() ); |
229 | 229 | ||
230 | QString s; | 230 | QString s; |
231 | if ( type == "station" ) | 231 | if ( type == "station" ) |
232 | { | 232 | { |
233 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 233 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
234 | } | 234 | } |
235 | else | 235 | else |
236 | { | 236 | { |
237 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 237 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
238 | } | 238 | } |
239 | MLogWindow::logwindow()->log( s ); | 239 | MLogWindow::logwindow()->log( s ); |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 243 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) |
244 | { | 244 | { |
245 | qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); | ||
245 | QString s; | 246 | QString s; |
246 | MScanListItem* network; | 247 | MScanListItem* network; |
247 | 248 | ||
248 | QListViewItemIterator it( this ); | 249 | QListViewItemIterator it( this ); |
249 | while ( it.current() && | 250 | while ( it.current() && |
250 | it.current()->text( col_ap ) != viaFrom.toString(true) && | 251 | it.current()->text( col_ap ) != viaFrom.toString(true) && |
251 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; | 252 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; |
252 | 253 | ||
253 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 254 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
254 | 255 | ||
255 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 256 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
256 | { | 257 | { |
257 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 258 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
258 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | 259 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); |
259 | } | 260 | } |
260 | else | 261 | else |
261 | { | 262 | { |
262 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); | 263 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
263 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); | 264 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); |
264 | } | 265 | } |
265 | } | 266 | } |
266 | 267 | ||
267 | 268 | ||
268 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 269 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
269 | { | 270 | { |
270 | QString s; | 271 | QString s; |
271 | MScanListItem* network; | 272 | MScanListItem* network; |
272 | 273 | ||
273 | QListViewItemIterator it( this ); | 274 | QListViewItemIterator it( this ); |
274 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 275 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
275 | 276 | ||
276 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 277 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
277 | 278 | ||
278 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 279 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
279 | { | 280 | { |
280 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); | 281 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
281 | } | 282 | } |
282 | else | 283 | else |
283 | { | 284 | { |
284 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 285 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
285 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); | 286 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); |
286 | 287 | ||
287 | } | 288 | } |
288 | } | 289 | } |
289 | 290 | ||
290 | 291 | ||
291 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 292 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
292 | { | 293 | { |
293 | QString s; | 294 | QString s; |
294 | MScanListItem* network; | 295 | MScanListItem* network; |
295 | 296 | ||
296 | QListViewItemIterator it( this ); | 297 | QListViewItemIterator it( this ); |
297 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 298 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
298 | 299 | ||
299 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 300 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
300 | 301 | ||
301 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 302 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
302 | { | 303 | { |
303 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | 304 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); |
304 | } | 305 | } |
305 | else | 306 | else |
306 | { | 307 | { |
307 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 308 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
308 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); | 309 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); |
309 | } | 310 | } |
310 | } | 311 | } |
311 | 312 | ||
312 | 313 | ||
313 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 314 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
314 | { | 315 | { |
315 | qWarning( "D'oh! Not yet implemented..." ); | 316 | qWarning( "D'oh! Not yet implemented..." ); |
316 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); | 317 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); |
317 | } | 318 | } |
318 | 319 | ||
319 | 320 | ||
320 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | 321 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) |
321 | { | 322 | { |
322 | qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); | 323 | qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); |
323 | 324 | ||
324 | QListViewItemIterator it( this ); | 325 | QListViewItemIterator it( this ); |
325 | for ( ; it.current(); ++it ) | 326 | for ( ; it.current(); ++it ) |
326 | { | 327 | { |
327 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 328 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
328 | { | 329 | { |
329 | it.current()->setText( col_ip, ip ); | 330 | it.current()->setText( col_ip, ip ); |
330 | return; | 331 | return; |
331 | } | 332 | } |
332 | } | 333 | } |
333 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 334 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
334 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", | 335 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", |
335 | (const char*) macaddr.toString(), (const char*) ip ) ); | 336 | (const char*) macaddr.toString(), (const char*) ip ) ); |
336 | } | 337 | } |
337 | 338 | ||
338 | 339 | ||
339 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) | 340 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) |
340 | { | 341 | { |
341 | qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); | 342 | qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); |
342 | 343 | ||
343 | //TODO: Refactor that out, we need it all over the place. | 344 | //TODO: Refactor that out, we need it all over the place. |
344 | // Best to do it in a more comfortable abstraction in OListView | 345 | // Best to do it in a more comfortable abstraction in OListView |
345 | // (Hmm, didn't I already start something in this direction?) | 346 | // (Hmm, didn't I already start something in this direction?) |
346 | 347 | ||
347 | QListViewItemIterator it( this ); | 348 | QListViewItemIterator it( this ); |
348 | for ( ; it.current(); ++it ) | 349 | for ( ; it.current(); ++it ) |
349 | { | 350 | { |
350 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 351 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
351 | { | 352 | { |
352 | 353 | ||
353 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); | 354 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); |
354 | 355 | ||
355 | while ( subitem && ( subitem->text( col_essid ) != name ) ) | 356 | while ( subitem && ( subitem->text( col_essid ) != name ) ) |
356 | { | 357 | { |
357 | #ifdef DEBUG | 358 | #ifdef DEBUG |
358 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); | 359 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); |
359 | #endif | 360 | #endif |
360 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 361 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
361 | } | 362 | } |
362 | 363 | ||
363 | if ( subitem ) | 364 | if ( subitem ) |
364 | { | 365 | { |
365 | // we have already seen this item, it's a dupe | 366 | // we have already seen this item, it's a dupe |
366 | #ifdef DEBUG | 367 | #ifdef DEBUG |
367 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); | 368 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); |
368 | #endif | 369 | #endif |
369 | subitem->receivedBeacon(); //FIXME: sent data bit | 370 | subitem->receivedBeacon(); //FIXME: sent data bit |
370 | return; | 371 | return; |
371 | } | 372 | } |
372 | 373 | ||
373 | // never seen that - add new item | 374 | // never seen that - add new item |
374 | 375 | ||
375 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); | 376 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
376 | item->setText( col_essid, name ); | 377 | item->setText( col_essid, name ); |
377 | 378 | ||
378 | return; | 379 | return; |
379 | } | 380 | } |
380 | } | 381 | } |
381 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 382 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
382 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 383 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
383 | (const char*) macaddr.toString(), (const char*) ip ) ); | 384 | (const char*) macaddr.toString(), (const char*) ip ) ); |
384 | } | 385 | } |
385 | 386 | ||
386 | 387 | ||
387 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 388 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
388 | { | 389 | { |
389 | if ( !item ) return; | 390 | if ( !item ) return; |
390 | 391 | ||
391 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 392 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
392 | 393 | ||
393 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 394 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", |
394 | (const char*) itm->text(0), (const char*) itm->type, col ); | 395 | (const char*) itm->text(0), (const char*) itm->type, col ); |
395 | 396 | ||
396 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 397 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
397 | { | 398 | { |
398 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 399 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |
399 | 400 | ||
400 | QPopupMenu m( this ); | 401 | QPopupMenu m( this ); |
401 | m.insertItem( entry, 37773, 0 ); | 402 | m.insertItem( entry, 37773, 0 ); |
402 | int result = m.exec( QCursor::pos() ); | 403 | int result = m.exec( QCursor::pos() ); |
403 | if ( result == 37773 ) | 404 | if ( result == 37773 ) |
404 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | 405 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); |
405 | } | 406 | } |
406 | } | 407 | } |
407 | 408 | ||
408 | //============================================================ | 409 | //============================================================ |
409 | // MScanListItem | 410 | // MScanListItem |
410 | //============================================================ | 411 | //============================================================ |
411 | 412 | ||
412 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, | 413 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, |
413 | bool wep, int channel, int signal, bool probed ) | 414 | bool wep, int channel, int signal, bool probed ) |
414 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 415 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
415 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 416 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
416 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 417 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
417 | { | 418 | { |
418 | #ifdef DEBUG | 419 | #ifdef DEBUG |
419 | qDebug( "creating scanlist item" ); | 420 | qDebug( "creating scanlist item" ); |
420 | #endif | 421 | #endif |
421 | 422 | ||
422 | if ( WellenreiterConfigWindow::instance() ) | 423 | if ( WellenreiterConfigWindow::instance() ) |
423 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 424 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
424 | 425 | ||
425 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); | 426 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); |
426 | } | 427 | } |
427 | 428 | ||
428 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, | 429 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, |
429 | bool wep, int channel, int signal ) | 430 | bool wep, int channel, int signal ) |
430 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 431 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
431 | { | 432 | { |
432 | #ifdef DEBUG | 433 | #ifdef DEBUG |
433 | qDebug( "creating scanlist item" ); | 434 | qDebug( "creating scanlist item" ); |
434 | #endif | 435 | #endif |
435 | if ( WellenreiterConfigWindow::instance() ) | 436 | if ( WellenreiterConfigWindow::instance() ) |
436 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 437 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index cd74bed..43a04e3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,235 +1,230 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | 3 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 4 | ** 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 | 5 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 6 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 7 | ** packaging of this file. |
10 | ** | 8 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 9 | ** 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. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 11 | ** |
14 | ***********************************************************************/ | 12 | ***********************************************************************/ |
15 | 13 | ||
16 | // Local | 14 | // Local |
17 | 15 | ||
18 | #include "gps.h" | 16 | #include "gps.h" |
19 | #include "wellenreiter.h" | 17 | #include "wellenreiter.h" |
20 | #include "scanlist.h" | 18 | #include "scanlist.h" |
21 | #include "logwindow.h" | 19 | #include "logwindow.h" |
22 | #include "hexwindow.h" | 20 | #include "hexwindow.h" |
23 | #include "configwindow.h" | 21 | #include "configwindow.h" |
24 | #include "statwindow.h" | 22 | #include "statwindow.h" |
25 | #include "graphwindow.h" | 23 | #include "graphwindow.h" |
26 | #include "protolistview.h" | 24 | #include "protolistview.h" |
27 | 25 | ||
28 | // Opie | 26 | // Opie |
29 | 27 | ||
30 | #ifdef QWS | 28 | #ifdef QWS |
31 | #include <opie/odevice.h> | ||
32 | #include <qpe/qcopenvelope_qws.h> | ||
33 | using namespace Opie; | ||
34 | #endif | ||
35 | |||
36 | #ifdef QWS | ||
37 | #include <opie2/oapplication.h> | 29 | #include <opie2/oapplication.h> |
30 | #include <opie2/odevice.h> | ||
38 | #else | 31 | #else |
39 | #include <qapplication.h> | 32 | #include <qapplication.h> |
40 | #endif | 33 | #endif |
41 | #include <opie2/omanufacturerdb.h> | 34 | #include <opie2/omanufacturerdb.h> |
42 | #include <opie2/onetwork.h> | 35 | #include <opie2/onetwork.h> |
43 | #include <opie2/opcap.h> | 36 | #include <opie2/opcap.h> |
37 | #include <qpe/qcopenvelope_qws.h> | ||
38 | using namespace Opie; | ||
44 | 39 | ||
45 | // Qt | 40 | // Qt |
46 | 41 | ||
47 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
48 | #include <qcombobox.h> | 43 | #include <qcombobox.h> |
49 | #include <qdatetime.h> | 44 | #include <qdatetime.h> |
50 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
51 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
52 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
53 | #include <qobjectlist.h> | 48 | #include <qobjectlist.h> |
54 | #include <qregexp.h> | 49 | #include <qregexp.h> |
55 | #include <qspinbox.h> | 50 | #include <qspinbox.h> |
56 | #include <qtimer.h> | 51 | #include <qtimer.h> |
57 | #include <qtoolbutton.h> | 52 | #include <qtoolbutton.h> |
58 | #include <qmainwindow.h> | 53 | #include <qmainwindow.h> |
59 | 54 | ||
60 | // Standard | 55 | // Standard |
61 | 56 | ||
62 | #include <assert.h> | 57 | #include <assert.h> |
63 | #include <errno.h> | 58 | #include <errno.h> |
64 | #include <unistd.h> | 59 | #include <unistd.h> |
65 | #include <string.h> | 60 | #include <string.h> |
66 | #include <sys/types.h> | 61 | #include <sys/types.h> |
67 | #include <stdlib.h> | 62 | #include <stdlib.h> |
68 | 63 | ||
69 | Wellenreiter::Wellenreiter( QWidget* parent ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent ) |
70 | : WellenreiterBase( parent, 0, 0 ), | 65 | : WellenreiterBase( parent, 0, 0 ), |
71 | sniffing( false ), iface( 0 ), configwindow( 0 ) | 66 | sniffing( false ), iface( 0 ), configwindow( 0 ) |
72 | { | 67 | { |
73 | 68 | ||
74 | logwindow->log( "(i) Wellenreiter has been started." ); | 69 | logwindow->log( "(i) Wellenreiter has been started." ); |
75 | 70 | ||
76 | // | 71 | // |
77 | // detect operating system | 72 | // detect operating system |
78 | // | 73 | // |
79 | 74 | ||
80 | #ifdef QWS | 75 | #ifdef QWS |
81 | QString sys; | 76 | QString sys; |
82 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 77 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
83 | _system = ODevice::inst()->system(); | 78 | _system = ODevice::inst()->system(); |
84 | logwindow->log( sys ); | 79 | logwindow->log( sys ); |
85 | #endif | 80 | #endif |
86 | 81 | ||
87 | netview->setColumnWidthMode( 1, QListView::Manual ); | 82 | netview->setColumnWidthMode( 1, QListView::Manual ); |
88 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), | 83 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), |
89 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); | 84 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); |
90 | pcap = new OPacketCapturer(); | 85 | pcap = new OPacketCapturer(); |
91 | 86 | ||
92 | gps = new GPS( this ); | 87 | gps = new GPS( this ); |
93 | 88 | ||
94 | QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); | 89 | QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); |
95 | 90 | ||
96 | } | 91 | } |
97 | 92 | ||
98 | 93 | ||
99 | Wellenreiter::~Wellenreiter() | 94 | Wellenreiter::~Wellenreiter() |
100 | { | 95 | { |
101 | delete pcap; | 96 | delete pcap; |
102 | } | 97 | } |
103 | 98 | ||
104 | 99 | ||
105 | void Wellenreiter::initialTimer() | 100 | void Wellenreiter::initialTimer() |
106 | { | 101 | { |
107 | qDebug( "Wellenreiter::preloading manufacturer database..." ); | 102 | qDebug( "Wellenreiter::preloading manufacturer database..." ); |
108 | OManufacturerDB::instance(); | 103 | OManufacturerDB::instance(); |
109 | } | 104 | } |
110 | 105 | ||
111 | 106 | ||
112 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 107 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
113 | { | 108 | { |
114 | configwindow = cw; | 109 | configwindow = cw; |
115 | } | 110 | } |
116 | 111 | ||
117 | 112 | ||
118 | void Wellenreiter::channelHopped(int c) | 113 | void Wellenreiter::channelHopped(int c) |
119 | { | 114 | { |
120 | QString title = "Wellenreiter II -scan- ["; | 115 | QString title = "Wellenreiter II -scan- ["; |
121 | QString left; | 116 | QString left; |
122 | if ( c > 1 ) left.fill( '.', c-1 ); | 117 | if ( c > 1 ) left.fill( '.', c-1 ); |
123 | title.append( left ); | 118 | title.append( left ); |
124 | title.append( '|' ); | 119 | title.append( '|' ); |
125 | if ( c < iface->channels() ) | 120 | if ( c < iface->channels() ) |
126 | { | 121 | { |
127 | QString right; | 122 | QString right; |
128 | right.fill( '.', iface->channels()-c ); | 123 | right.fill( '.', iface->channels()-c ); |
129 | title.append( right ); | 124 | title.append( right ); |
130 | } | 125 | } |
131 | title.append( "]" ); | 126 | title.append( "]" ); |
132 | //title.append( QString().sprintf( " %02d", c ) ); | 127 | //title.append( QString().sprintf( " %02d", c ) ); |
133 | assert( parent() ); | 128 | assert( parent() ); |
134 | ( (QMainWindow*) parent() )->setCaption( title ); | 129 | ( (QMainWindow*) parent() )->setCaption( title ); |
135 | } | 130 | } |
136 | 131 | ||
137 | 132 | ||
138 | void Wellenreiter::handleNotification( OPacket* p ) | 133 | void Wellenreiter::handleNotification( OPacket* p ) |
139 | { | 134 | { |
140 | QObjectList* l = p->queryList(); | 135 | QObjectList* l = p->queryList(); |
141 | QObjectListIt it( *l ); | 136 | QObjectListIt it( *l ); |
142 | QObject* o; | 137 | QObject* o; |
143 | 138 | ||
144 | while ( (o = it.current()) != 0 ) | 139 | while ( (o = it.current()) != 0 ) |
145 | { | 140 | { |
146 | QString name = it.current()->name(); | 141 | QString name = it.current()->name(); |
147 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 142 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
148 | { | 143 | { |
149 | QString action = configwindow->parsePackets->protocolAction( name ); | 144 | QString action = configwindow->parsePackets->protocolAction( name ); |
150 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 145 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); |
151 | doAction( action, name, p ); | 146 | doAction( action, name, p ); |
152 | } | 147 | } |
153 | else | 148 | else |
154 | { | 149 | { |
155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 150 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); |
156 | } | 151 | } |
157 | ++it; | 152 | ++it; |
158 | } | 153 | } |
159 | } | 154 | } |
160 | 155 | ||
161 | 156 | ||
162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) | 157 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
163 | { | 158 | { |
164 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); | 159 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); |
165 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); | 160 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); |
166 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); | 161 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); |
167 | else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); | 162 | else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); |
168 | } | 163 | } |
169 | 164 | ||
170 | 165 | ||
171 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) | 166 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) |
172 | { | 167 | { |
173 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 168 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
174 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 169 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
175 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 170 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
176 | int channel = ds ? ds->channel() : -1; | 171 | int channel = ds ? ds->channel() : -1; |
177 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 172 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
178 | 173 | ||
179 | GpsLocation loc( -111, -111 ); | 174 | GpsLocation loc( -111, -111 ); |
180 | if ( configwindow->enableGPS->isChecked() ) | 175 | if ( configwindow->enableGPS->isChecked() ) |
181 | { | 176 | { |
182 | // TODO: add check if GPS is working!? | 177 | // TODO: add check if GPS is working!? |
183 | qDebug( "Wellenreiter::gathering GPS data..." ); | 178 | qDebug( "Wellenreiter::gathering GPS data..." ); |
184 | loc = gps->position(); | 179 | loc = gps->position(); |
185 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 180 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
186 | } | 181 | } |
187 | 182 | ||
188 | if ( essid.length() ) | 183 | if ( essid.length() ) |
189 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); | 184 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); |
190 | qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 185 | qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
191 | } | 186 | } |
192 | 187 | ||
193 | 188 | ||
194 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) | 189 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) |
195 | { | 190 | { |
196 | } | 191 | } |
197 | 192 | ||
198 | 193 | ||
199 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 194 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
200 | { | 195 | { |
201 | QString type; | 196 | QString type; |
202 | if ( beacon->canIBSS() ) | 197 | if ( beacon->canIBSS() ) |
203 | { | 198 | { |
204 | type = "adhoc"; | 199 | type = "adhoc"; |
205 | } | 200 | } |
206 | else if ( beacon->canESS() ) | 201 | else if ( beacon->canESS() ) |
207 | { | 202 | { |
208 | type = "managed"; | 203 | type = "managed"; |
209 | } | 204 | } |
210 | else | 205 | else |
211 | { | 206 | { |
212 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 207 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
213 | return; | 208 | return; |
214 | } | 209 | } |
215 | 210 | ||
216 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 211 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
217 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 212 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
218 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 213 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
219 | int channel = ds ? ds->channel() : -1; | 214 | int channel = ds ? ds->channel() : -1; |
220 | 215 | ||
221 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 216 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
222 | 217 | ||
223 | GpsLocation loc( -111, -111 ); | 218 | GpsLocation loc( -111, -111 ); |
224 | if ( configwindow->enableGPS->isChecked() ) | 219 | if ( configwindow->enableGPS->isChecked() ) |
225 | { | 220 | { |
226 | // TODO: add check if GPS is working!? | 221 | // TODO: add check if GPS is working!? |
227 | qDebug( "Wellenreiter::gathering GPS data..." ); | 222 | qDebug( "Wellenreiter::gathering GPS data..." ); |
228 | loc = gps->position(); | 223 | loc = gps->position(); |
229 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 224 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
230 | } | 225 | } |
231 | 226 | ||
232 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 227 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
233 | 228 | ||
234 | // update graph window | 229 | // update graph window |
235 | if ( ds ) | 230 | if ( ds ) |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index a28740b..745486f 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -1,109 +1,107 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | 3 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 4 | ** 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 | 5 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 6 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 7 | ** packaging of this file. |
10 | ** | 8 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 9 | ** 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. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 11 | ** |
14 | **********************************************************************/ | 12 | **********************************************************************/ |
15 | 13 | ||
16 | #ifndef WELLENREITER_H | 14 | #ifndef WELLENREITER_H |
17 | #define WELLENREITER_H | 15 | #define WELLENREITER_H |
18 | 16 | ||
19 | #include "wellenreiterbase.h" | 17 | #include "wellenreiterbase.h" |
20 | 18 | ||
21 | #ifdef QWS | 19 | #ifdef QWS |
22 | #include <opie/odevice.h> | 20 | #include <opie2/odevice.h> |
23 | using namespace Opie; | 21 | using namespace Opie; |
24 | #endif | 22 | #endif |
25 | 23 | ||
26 | class QTimerEvent; | 24 | class QTimerEvent; |
27 | class QPixmap; | 25 | class QPixmap; |
28 | class OPacket; | 26 | class OPacket; |
29 | class OWaveLanManagementPacket; | 27 | class OWaveLanManagementPacket; |
30 | class OWaveLanControlPacket; | 28 | class OWaveLanControlPacket; |
31 | class OWaveLanDataPacket; | 29 | class OWaveLanDataPacket; |
32 | class OEthernetPacket; | 30 | class OEthernetPacket; |
33 | class OARPPacket; | 31 | class OARPPacket; |
34 | class OMacAddress; | 32 | class OMacAddress; |
35 | class OIPPacket; | 33 | class OIPPacket; |
36 | class OPacketCapturer; | 34 | class OPacketCapturer; |
37 | class OWirelessNetworkInterface; | 35 | class OWirelessNetworkInterface; |
38 | class WellenreiterConfigWindow; | 36 | class WellenreiterConfigWindow; |
39 | class MLogWindow; | 37 | class MLogWindow; |
40 | class MHexWindow; | 38 | class MHexWindow; |
41 | class GPS; | 39 | class GPS; |
42 | 40 | ||
43 | class Wellenreiter : public WellenreiterBase { | 41 | class Wellenreiter : public WellenreiterBase { |
44 | Q_OBJECT | 42 | Q_OBJECT |
45 | 43 | ||
46 | public: | 44 | public: |
47 | Wellenreiter( QWidget* parent = 0 ); | 45 | Wellenreiter( QWidget* parent = 0 ); |
48 | ~Wellenreiter(); | 46 | ~Wellenreiter(); |
49 | 47 | ||
50 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 48 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
51 | MScanListView* netView() const { return netview; }; | 49 | MScanListView* netView() const { return netview; }; |
52 | MLogWindow* logWindow() const { return logwindow; }; | 50 | MLogWindow* logWindow() const { return logwindow; }; |
53 | MHexWindow* hexWindow() const { return hexwindow; }; | 51 | MHexWindow* hexWindow() const { return hexwindow; }; |
54 | bool isDaemonRunning() const { return sniffing; }; | 52 | bool isDaemonRunning() const { return sniffing; }; |
55 | QString captureFileName() const { return dumpname; }; | 53 | QString captureFileName() const { return dumpname; }; |
56 | 54 | ||
57 | public: | 55 | public: |
58 | bool sniffing; | 56 | bool sniffing; |
59 | 57 | ||
60 | protected: | 58 | protected: |
61 | virtual void timerEvent( QTimerEvent* ); | 59 | virtual void timerEvent( QTimerEvent* ); |
62 | 60 | ||
63 | public slots: | 61 | public slots: |
64 | void initialTimer(); | 62 | void initialTimer(); |
65 | 63 | ||
66 | void channelHopped(int); | 64 | void channelHopped(int); |
67 | void receivePacket(OPacket*); | 65 | void receivePacket(OPacket*); |
68 | void startClicked(); | 66 | void startClicked(); |
69 | void stopClicked(); | 67 | void stopClicked(); |
70 | 68 | ||
71 | void joinNetwork(const QString&,const QString&,int,const QString&); | 69 | void joinNetwork(const QString&,const QString&,int,const QString&); |
72 | 70 | ||
73 | signals: | 71 | signals: |
74 | void startedSniffing(); | 72 | void startedSniffing(); |
75 | void stoppedSniffing(); | 73 | void stoppedSniffing(); |
76 | 74 | ||
77 | private: | 75 | private: |
78 | void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* ); | 76 | void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* ); |
79 | void handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* ); | 77 | void handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* ); |
80 | void handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* ); | 78 | void handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* ); |
81 | void handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* ); | 79 | void handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* ); |
82 | void handleControlFrame( OPacket* p, OWaveLanControlPacket* control ); | 80 | void handleControlFrame( OPacket* p, OWaveLanControlPacket* control ); |
83 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); | 81 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); |
84 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); | 82 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); |
85 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); | 83 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); |
86 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); | 84 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); |
87 | void handleNotification( OPacket* p ); | 85 | void handleNotification( OPacket* p ); |
88 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | 86 | void doAction( const QString& action, const QString& protocol, OPacket* p ); |
89 | QObject* childIfToParse( OPacket* p, const QString& protocol ); | 87 | QObject* childIfToParse( OPacket* p, const QString& protocol ); |
90 | bool checkDumpPacket( OPacket* p ); | 88 | bool checkDumpPacket( OPacket* p ); |
91 | 89 | ||
92 | private: | 90 | private: |
93 | #ifdef QWS | 91 | #ifdef QWS |
94 | OSystem _system; // Opie Operating System identifier | 92 | OSystem _system; // Opie Operating System identifier |
95 | #endif | 93 | #endif |
96 | 94 | ||
97 | QString dumpname; | 95 | QString dumpname; |
98 | OWirelessNetworkInterface* iface; | 96 | OWirelessNetworkInterface* iface; |
99 | OPacketCapturer* pcap; | 97 | OPacketCapturer* pcap; |
100 | WellenreiterConfigWindow* configwindow; | 98 | WellenreiterConfigWindow* configwindow; |
101 | GPS* gps; | 99 | GPS* gps; |
102 | 100 | ||
103 | //void readConfig(); | 101 | //void readConfig(); |
104 | //void writeConfig(); | 102 | //void writeConfig(); |
105 | }; | 103 | }; |
106 | 104 | ||
107 | 105 | ||
108 | 106 | ||
109 | #endif | 107 | #endif |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index eac5d89..c2413dc 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp | |||
@@ -1,185 +1,186 @@ | |||
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 | #include "statwindow.h" |
34 | #include "graphwindow.h" | 34 | #include "graphwindow.h" |
35 | 35 | ||
36 | #ifdef QWS | 36 | #ifdef QWS |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | #include <opie/otabwidget.h> | 38 | #include <opie2/otabwidget.h> |
39 | using namespace Opie; | ||
39 | #else | 40 | #else |
40 | #include "resource.h" | 41 | #include "resource.h" |
41 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
42 | #endif | 43 | #endif |
43 | 44 | ||
44 | 45 | ||
45 | /* | 46 | /* |
46 | * Constructs a WellenreiterBase which is a child of 'parent', with the | 47 | * Constructs a WellenreiterBase which is a child of 'parent', with the |
47 | * name 'name' and widget flags set to 'f' | 48 | * name 'name' and widget flags set to 'f' |
48 | */ | 49 | */ |
49 | WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) | 50 | WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) |
50 | : QWidget( parent, name, fl ) | 51 | : QWidget( parent, name, fl ) |
51 | { | 52 | { |
52 | //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); | 53 | //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); |
53 | //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); | 54 | //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); |
54 | //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); | 55 | //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); |
55 | //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); | 56 | //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); |
56 | 57 | ||
57 | if ( !name ) | 58 | if ( !name ) |
58 | setName( "WellenreiterBase" ); | 59 | setName( "WellenreiterBase" ); |
59 | resize( 191, 294 ); | 60 | resize( 191, 294 ); |
60 | #ifdef QWS | 61 | #ifdef QWS |
61 | setCaption( tr( "Wellenreiter/Opie" ) ); | 62 | setCaption( tr( "Wellenreiter/Opie" ) ); |
62 | #else | 63 | #else |
63 | setCaption( tr( "Wellenreiter/X11" ) ); | 64 | setCaption( tr( "Wellenreiter/X11" ) ); |
64 | #endif | 65 | #endif |
65 | WellenreiterBaseLayout = new QVBoxLayout( this ); | 66 | WellenreiterBaseLayout = new QVBoxLayout( this ); |
66 | WellenreiterBaseLayout->setSpacing( 2 ); | 67 | WellenreiterBaseLayout->setSpacing( 2 ); |
67 | WellenreiterBaseLayout->setMargin( 0 ); | 68 | WellenreiterBaseLayout->setMargin( 0 ); |
68 | #ifdef QWS | 69 | #ifdef QWS |
69 | TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); | 70 | TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); |
70 | #else | 71 | #else |
71 | TabWidget = new QTabWidget( this, "TabWidget" ); | 72 | TabWidget = new QTabWidget( this, "TabWidget" ); |
72 | #endif | 73 | #endif |
73 | ap = new QWidget( TabWidget, "ap" ); | 74 | ap = new QWidget( TabWidget, "ap" ); |
74 | apLayout = new QVBoxLayout( ap ); | 75 | apLayout = new QVBoxLayout( ap ); |
75 | apLayout->setSpacing( 2 ); | 76 | apLayout->setSpacing( 2 ); |
76 | apLayout->setMargin( 2 ); | 77 | apLayout->setMargin( 2 ); |
77 | 78 | ||
78 | //--------- NETVIEW TAB -------------- | 79 | //--------- NETVIEW TAB -------------- |
79 | 80 | ||
80 | netview = new MScanListView( ap ); | 81 | netview = new MScanListView( ap ); |
81 | apLayout->addWidget( netview ); | 82 | apLayout->addWidget( netview ); |
82 | 83 | ||
83 | //--------- GRAPH TAB -------------- | 84 | //--------- GRAPH TAB -------------- |
84 | 85 | ||
85 | graphwindow = new MGraphWindow( TabWidget, "Graph" ); | 86 | graphwindow = new MGraphWindow( TabWidget, "Graph" ); |
86 | 87 | ||
87 | //--------- LOG TAB -------------- | 88 | //--------- LOG TAB -------------- |
88 | 89 | ||
89 | logwindow = new MLogWindow( TabWidget, "Log" ); | 90 | logwindow = new MLogWindow( TabWidget, "Log" ); |
90 | 91 | ||
91 | //--------- HEX TAB -------------- | 92 | //--------- HEX TAB -------------- |
92 | 93 | ||
93 | hexwindow = new MHexWindow( TabWidget, "Hex" ); | 94 | hexwindow = new MHexWindow( TabWidget, "Hex" ); |
94 | 95 | ||
95 | //--------- STAT TAB -------------- | 96 | //--------- STAT TAB -------------- |
96 | 97 | ||
97 | statwindow = new MStatWindow( TabWidget, "Stat" ); | 98 | statwindow = new MStatWindow( TabWidget, "Stat" ); |
98 | 99 | ||
99 | //--------- ABOUT TAB -------------- | 100 | //--------- ABOUT TAB -------------- |
100 | 101 | ||
101 | about = new QWidget( TabWidget, "about" ); | 102 | about = new QWidget( TabWidget, "about" ); |
102 | aboutLayout = new QGridLayout( about ); | 103 | aboutLayout = new QGridLayout( about ); |
103 | aboutLayout->setSpacing( 6 ); | 104 | aboutLayout->setSpacing( 6 ); |
104 | aboutLayout->setMargin( 11 ); | 105 | aboutLayout->setMargin( 11 ); |
105 | 106 | ||
106 | PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); | 107 | PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); |
107 | PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); | 108 | PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); |
108 | PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); | 109 | PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); |
109 | PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); | 110 | PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); |
110 | PixmapLabel1_3_2->setLineWidth( 2 ); | 111 | PixmapLabel1_3_2->setLineWidth( 2 ); |
111 | PixmapLabel1_3_2->setMargin( 0 ); | 112 | PixmapLabel1_3_2->setMargin( 0 ); |
112 | PixmapLabel1_3_2->setMidLineWidth( 0 ); | 113 | PixmapLabel1_3_2->setMidLineWidth( 0 ); |
113 | PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); | 114 | PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); |
114 | PixmapLabel1_3_2->setScaledContents( TRUE ); | 115 | PixmapLabel1_3_2->setScaledContents( TRUE ); |
115 | PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); | 116 | PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); |
116 | 117 | ||
117 | aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); | 118 | aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); |
118 | 119 | ||
119 | TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); | 120 | TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); |
120 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); | 121 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); |
121 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); | 122 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); |
122 | TextLabel1_4_2_font.setPointSize( 10 ); | 123 | TextLabel1_4_2_font.setPointSize( 10 ); |
123 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); | 124 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); |
124 | TextLabel1_4_2->setText( tr( "<p align=center>\n" | 125 | TextLabel1_4_2->setText( tr( "<p align=center>\n" |
125 | "<hr>\n" | 126 | "<hr>\n" |
126 | "Michael 'Mickey' Lauer<br><hr>\n" | 127 | "Michael 'Mickey' Lauer<br><hr>\n" |
127 | "Max Moser<br>\n" | 128 | "Max Moser<br>\n" |
128 | "Martin J. Muench<br>\n" | 129 | "Martin J. Muench<br>\n" |
129 | "<b>www.wellenreiter.net</b>\n" | 130 | "<b>www.wellenreiter.net</b>\n" |
130 | "</p>" ) ); | 131 | "</p>" ) ); |
131 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); | 132 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); |
132 | 133 | ||
133 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); | 134 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); |
134 | 135 | ||
135 | #ifdef QWS | 136 | #ifdef QWS |
136 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); | 137 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); |
137 | TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); | 138 | TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); |
138 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); | 139 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); |
139 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); | 140 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); |
140 | TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); | 141 | TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); |
141 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); | 142 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); |
142 | #else | 143 | #else |
143 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); | 144 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); |
144 | TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); | 145 | TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); |
145 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); | 146 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); |
146 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); | 147 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); |
147 | TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); | 148 | TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); |
148 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); | 149 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); |
149 | #endif | 150 | #endif |
150 | WellenreiterBaseLayout->addWidget( TabWidget ); | 151 | WellenreiterBaseLayout->addWidget( TabWidget ); |
151 | 152 | ||
152 | #ifdef QWS | 153 | #ifdef QWS |
153 | TabWidget->setCurrentTab( tr( "Nets" ) ); | 154 | TabWidget->setCurrentTab( tr( "Nets" ) ); |
154 | #endif | 155 | #endif |
155 | 156 | ||
156 | } | 157 | } |
157 | 158 | ||
158 | /* | 159 | /* |
159 | * Destroys the object and frees any allocated resources | 160 | * Destroys the object and frees any allocated resources |
160 | */ | 161 | */ |
161 | WellenreiterBase::~WellenreiterBase() | 162 | WellenreiterBase::~WellenreiterBase() |
162 | { | 163 | { |
163 | // no need to delete child widgets, Qt does it all for us | 164 | // no need to delete child widgets, Qt does it all for us |
164 | } | 165 | } |
165 | 166 | ||
166 | /* | 167 | /* |
167 | * Main event handler. Reimplemented to handle application | 168 | * Main event handler. Reimplemented to handle application |
168 | * font changes | 169 | * font changes |
169 | */ | 170 | */ |
170 | bool WellenreiterBase::event( QEvent* ev ) | 171 | bool WellenreiterBase::event( QEvent* ev ) |
171 | { | 172 | { |
172 | bool ret = QWidget::event( ev ); | 173 | bool ret = QWidget::event( ev ); |
173 | if ( ev->type() == QEvent::ApplicationFontChange ) { | 174 | if ( ev->type() == QEvent::ApplicationFontChange ) { |
174 | //QFont Log_2_font( Log_2->font() ); | 175 | //QFont Log_2_font( Log_2->font() ); |
175 | //Log_2_font.setFamily( "adobe-courier" ); | 176 | //Log_2_font.setFamily( "adobe-courier" ); |
176 | //Log_2_font.setPointSize( 8 ); | 177 | //Log_2_font.setPointSize( 8 ); |
177 | //Log_2->setFont( Log_2_font ); | 178 | //Log_2->setFont( Log_2_font ); |
178 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); | 179 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); |
179 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); | 180 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); |
180 | TextLabel1_4_2_font.setPointSize( 10 ); | 181 | TextLabel1_4_2_font.setPointSize( 10 ); |
181 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); | 182 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); |
182 | } | 183 | } |
183 | return ret; | 184 | return ret; |
184 | } | 185 | } |
185 | 186 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h index e8dc924..2cc273e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.h +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h | |||
@@ -1,76 +1,77 @@ | |||
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> |
21 | class QVBoxLayout; | 21 | class QVBoxLayout; |
22 | class QHBoxLayout; | 22 | class QHBoxLayout; |
23 | class QGridLayout; | 23 | 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 | class MStatWindow; |
31 | class MGraphWindow; | 31 | class MGraphWindow; |
32 | 32 | ||
33 | #ifdef QWS | 33 | #ifdef QWS |
34 | class OTabWidget; | 34 | #include <opie2/otabwidget.h> |
35 | using namespace Opie; | ||
35 | #else | 36 | #else |
36 | class QTabWidget; | 37 | class QTabWidget; |
37 | #endif | 38 | #endif |
38 | 39 | ||
39 | class WellenreiterBase : public QWidget | 40 | class WellenreiterBase : public QWidget |
40 | { | 41 | { |
41 | Q_OBJECT | 42 | Q_OBJECT |
42 | 43 | ||
43 | public: | 44 | public: |
44 | WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 45 | WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
45 | ~WellenreiterBase(); | 46 | ~WellenreiterBase(); |
46 | 47 | ||
47 | #ifdef QWS | 48 | #ifdef QWS |
48 | OTabWidget* TabWidget; | 49 | OTabWidget* TabWidget; |
49 | #else | 50 | #else |
50 | QTabWidget* TabWidget; | 51 | QTabWidget* TabWidget; |
51 | #endif | 52 | #endif |
52 | QWidget* ap; | 53 | QWidget* ap; |
53 | MScanListView* netview; | 54 | MScanListView* netview; |
54 | MLogWindow* logwindow; | 55 | MLogWindow* logwindow; |
55 | MHexWindow* hexwindow; | 56 | MHexWindow* hexwindow; |
56 | MStatWindow* statwindow; | 57 | MStatWindow* statwindow; |
57 | MGraphWindow* graphwindow; | 58 | MGraphWindow* graphwindow; |
58 | QWidget* about; | 59 | QWidget* about; |
59 | QLabel* PixmapLabel1_3_2; | 60 | QLabel* PixmapLabel1_3_2; |
60 | QLabel* TextLabel1_4_2; | 61 | QLabel* TextLabel1_4_2; |
61 | 62 | ||
62 | protected: | 63 | protected: |
63 | QVBoxLayout* WellenreiterBaseLayout; | 64 | QVBoxLayout* WellenreiterBaseLayout; |
64 | QVBoxLayout* apLayout; | 65 | QVBoxLayout* apLayout; |
65 | QGridLayout* aboutLayout; | 66 | QGridLayout* aboutLayout; |
66 | bool event( QEvent* ); | 67 | bool event( QEvent* ); |
67 | 68 | ||
68 | QPixmap* ani1; | 69 | QPixmap* ani1; |
69 | QPixmap* ani2; | 70 | QPixmap* ani2; |
70 | QPixmap* ani3; | 71 | QPixmap* ani3; |
71 | QPixmap* ani4; | 72 | QPixmap* ani4; |
72 | 73 | ||
73 | 74 | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | #endif // WELLENREITERBASE_H | 77 | #endif // WELLENREITERBASE_H |