author | mickeyl <mickeyl> | 2005-04-18 21:51:57 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-04-18 21:51:57 (UTC) |
commit | 0421a65ca6c21715b7268ef52679bdc14ab25c89 (patch) (unidiff) | |
tree | 243a5a4d9c390a349ebe5bd8ad69ac987c9a75a8 | |
parent | 9e685cedc4425dd5ae60170e3f59a899c9e2bf36 (diff) | |
download | opie-0421a65ca6c21715b7268ef52679bdc14ab25c89.zip opie-0421a65ca6c21715b7268ef52679bdc14ab25c89.tar.gz opie-0421a65ca6c21715b7268ef52679bdc14ab25c89.tar.bz2 |
relax WE matching test
set VERSION in .pro
define WELLENREITER_VERSION through .pro
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 4ebac84..faedd1b 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -1,55 +1,58 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE = app | 2 | TEMPLATE = app |
3 | CONFIG = qt warn_on | 3 | CONFIG = qt warn_on |
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 | packetview.h \ | 14 | packetview.h \ |
15 | protolistview.h \ | 15 | protolistview.h \ |
16 | gps.h | 16 | gps.h |
17 | 17 | ||
18 | SOURCES = main.cpp \ | 18 | SOURCES = main.cpp \ |
19 | mainwindow.cpp \ | 19 | mainwindow.cpp \ |
20 | wellenreiterbase.cpp \ | 20 | wellenreiterbase.cpp \ |
21 | wellenreiter.cpp \ | 21 | wellenreiter.cpp \ |
22 | scanlist.cpp \ | 22 | scanlist.cpp \ |
23 | logwindow.cpp \ | 23 | logwindow.cpp \ |
24 | hexwindow.cpp \ | 24 | hexwindow.cpp \ |
25 | statwindow.cpp \ | 25 | statwindow.cpp \ |
26 | configwindow.cpp \ | 26 | configwindow.cpp \ |
27 | graphwindow.cpp \ | 27 | graphwindow.cpp \ |
28 | packetview.cpp \ | 28 | packetview.cpp \ |
29 | protolistview.cpp \ | 29 | protolistview.cpp \ |
30 | gps.cpp | 30 | gps.cpp |
31 | 31 | ||
32 | INCLUDEPATH += $(OPIEDIR)/include | 32 | INCLUDEPATH += $(OPIEDIR)/include |
33 | DEPENDPATH += $(OPIEDIR)/include | 33 | DEPENDPATH += $(OPIEDIR)/include |
34 | INTERFACES = configbase.ui | 34 | INTERFACES = configbase.ui |
35 | TARGET = wellenreiter | 35 | TARGET = wellenreiter |
36 | VERSION = 1.0.5 | ||
37 | |||
38 | DEFINES += WELLENREITER_VERSION='"$$VERSION (GPL) Opie"' | ||
36 | 39 | ||
37 | !contains( platform, x11 ) { | 40 | !contains( platform, x11 ) { |
38 | message( qws ) | 41 | message( qws ) |
39 | include( $(OPIEDIR)/include.pro ) | 42 | include( $(OPIEDIR)/include.pro ) |
40 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2 | 43 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2 |
41 | } | 44 | } |
42 | 45 | ||
43 | contains( platform, x11 ) { | 46 | contains( platform, x11 ) { |
44 | LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter | 47 | LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter |
45 | SOURCES += resource.cpp | 48 | SOURCES += resource.cpp |
46 | HEADERS += resource.h | 49 | HEADERS += resource.h |
47 | DESTDIR = $(OPIEDIR)/output/bin | 50 | DESTDIR = $(OPIEDIR)/output/bin |
48 | } | 51 | } |
49 | 52 | ||
50 | !isEmpty( LIBPCAP_INC_DIR ) { | 53 | !isEmpty( LIBPCAP_INC_DIR ) { |
51 | INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH | 54 | INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH |
52 | } | 55 | } |
53 | !isEmpty( LIBPCAP_LIB_DIR ) { | 56 | !isEmpty( LIBPCAP_LIB_DIR ) { |
54 | LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS | 57 | LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS |
55 | } | 58 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 9fe463a..8cabf0d 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -188,591 +188,592 @@ void Wellenreiter::handleNotification( OPacket* p ) | |||
188 | ++it; | 188 | ++it; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
193 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) | 193 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
194 | { | 194 | { |
195 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); | 195 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); |
196 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); | 196 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); |
197 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); | 197 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); |
198 | else owarn << "Wellenreiter::handleManagementFrame(): '" << manage->managementType() << "' - please handle me!" << oendl; | 198 | else owarn << "Wellenreiter::handleManagementFrame(): '" << manage->managementType() << "' - please handle me!" << oendl; |
199 | } | 199 | } |
200 | 200 | ||
201 | 201 | ||
202 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ ) | 202 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ ) |
203 | { | 203 | { |
204 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 204 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
205 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 205 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
206 | // OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 206 | // OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
207 | // int channel = ds ? ds->channel() : -1; | 207 | // int channel = ds ? ds->channel() : -1; |
208 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 208 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
209 | 209 | ||
210 | GpsLocation loc( -111, -111 ); | 210 | GpsLocation loc( -111, -111 ); |
211 | if ( configwindow->enableGPS->isChecked() ) | 211 | if ( configwindow->enableGPS->isChecked() ) |
212 | { | 212 | { |
213 | // TODO: add check if GPS is working!? | 213 | // TODO: add check if GPS is working!? |
214 | odebug << "Wellenreiter::gathering GPS data..." << oendl; | 214 | odebug << "Wellenreiter::gathering GPS data..." << oendl; |
215 | loc = gps->position(); | 215 | loc = gps->position(); |
216 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; | 216 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; |
217 | } | 217 | } |
218 | 218 | ||
219 | if ( essid.length() ) | 219 | if ( essid.length() ) |
220 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); | 220 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); |
221 | odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; | 221 | odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ ) | 225 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ ) |
226 | { | 226 | { |
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
230 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 230 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
231 | { | 231 | { |
232 | QString type; | 232 | QString type; |
233 | if ( beacon->canIBSS() ) | 233 | if ( beacon->canIBSS() ) |
234 | { | 234 | { |
235 | type = "adhoc"; | 235 | type = "adhoc"; |
236 | } | 236 | } |
237 | else if ( beacon->canESS() ) | 237 | else if ( beacon->canESS() ) |
238 | { | 238 | { |
239 | type = "managed"; | 239 | type = "managed"; |
240 | } | 240 | } |
241 | else | 241 | else |
242 | { | 242 | { |
243 | owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; | 243 | owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; |
244 | return; | 244 | return; |
245 | } | 245 | } |
246 | 246 | ||
247 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 247 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
248 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 248 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
249 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 249 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
250 | int channel = ds ? ds->channel() : -1; | 250 | int channel = ds ? ds->channel() : -1; |
251 | 251 | ||
252 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 252 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
253 | 253 | ||
254 | GpsLocation loc( -111, -111 ); | 254 | GpsLocation loc( -111, -111 ); |
255 | if ( configwindow->enableGPS->isChecked() ) | 255 | if ( configwindow->enableGPS->isChecked() ) |
256 | { | 256 | { |
257 | // TODO: add check if GPS is working!? | 257 | // TODO: add check if GPS is working!? |
258 | odebug << "Wellenreiter::gathering GPS data..." << oendl; | 258 | odebug << "Wellenreiter::gathering GPS data..." << oendl; |
259 | loc = gps->position(); | 259 | loc = gps->position(); |
260 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; | 260 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; |
261 | } | 261 | } |
262 | 262 | ||
263 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 263 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
264 | 264 | ||
265 | // update graph window | 265 | // update graph window |
266 | if ( ds ) | 266 | if ( ds ) |
267 | { | 267 | { |
268 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 268 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
269 | if ( prism ) | 269 | if ( prism ) |
270 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 270 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
271 | else | 271 | else |
272 | graphwindow->traffic( ds->channel(), 95 ); | 272 | graphwindow->traffic( ds->channel(), 95 ); |
273 | } | 273 | } |
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | 277 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) |
278 | { | 278 | { |
279 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 279 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
280 | 280 | ||
281 | if ( control->controlType() == "Acknowledge" ) | 281 | if ( control->controlType() == "Acknowledge" ) |
282 | { | 282 | { |
283 | netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); | 283 | netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); |
284 | } | 284 | } |
285 | else | 285 | else |
286 | { | 286 | { |
287 | odebug << "Wellenreiter::handleControlFrame - please handle " << control->controlType() << " in a future version! :D" << oendl; | 287 | odebug << "Wellenreiter::handleControlFrame - please handle " << control->controlType() << " in a future version! :D" << oendl; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | 291 | ||
292 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to ) | 292 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to ) |
293 | { | 293 | { |
294 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 294 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
295 | if ( wlan->fromDS() && !wlan->toDS() ) | 295 | if ( wlan->fromDS() && !wlan->toDS() ) |
296 | { | 296 | { |
297 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 297 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
298 | from = wlan->macAddress3(); | 298 | from = wlan->macAddress3(); |
299 | to = wlan->macAddress2(); | 299 | to = wlan->macAddress2(); |
300 | } | 300 | } |
301 | else if ( !wlan->fromDS() && wlan->toDS() ) | 301 | else if ( !wlan->fromDS() && wlan->toDS() ) |
302 | { | 302 | { |
303 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 303 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
304 | from = wlan->macAddress2(); | 304 | from = wlan->macAddress2(); |
305 | to = wlan->macAddress3(); | 305 | to = wlan->macAddress3(); |
306 | } | 306 | } |
307 | else if ( wlan->fromDS() && wlan->toDS() ) | 307 | else if ( wlan->fromDS() && wlan->toDS() ) |
308 | { | 308 | { |
309 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 309 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
310 | from = wlan->macAddress4(); | 310 | from = wlan->macAddress4(); |
311 | to = wlan->macAddress3(); | 311 | to = wlan->macAddress3(); |
312 | } | 312 | } |
313 | else | 313 | else |
314 | { | 314 | { |
315 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 315 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
316 | from = wlan->macAddress2(); | 316 | from = wlan->macAddress2(); |
317 | to = wlan->macAddress1(); | 317 | to = wlan->macAddress1(); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | 322 | void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) |
323 | { | 323 | { |
324 | from = data->sourceAddress(); | 324 | from = data->sourceAddress(); |
325 | to = data->destinationAddress(); | 325 | to = data->destinationAddress(); |
326 | 326 | ||
327 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); | 327 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); |
328 | } | 328 | } |
329 | 329 | ||
330 | 330 | ||
331 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ ) | 331 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ ) |
332 | { | 332 | { |
333 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 333 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
334 | if ( arp ) | 334 | if ( arp ) |
335 | { | 335 | { |
336 | odebug << "Received ARP traffic (type '" << arp->type() << "'): " << oendl; | 336 | odebug << "Received ARP traffic (type '" << arp->type() << "'): " << oendl; |
337 | if ( arp->type() == "REQUEST" ) | 337 | if ( arp->type() == "REQUEST" ) |
338 | { | 338 | { |
339 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 339 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
340 | } | 340 | } |
341 | else if ( arp->type() == "REPLY" ) | 341 | else if ( arp->type() == "REPLY" ) |
342 | { | 342 | { |
343 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 343 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
344 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 344 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
345 | } | 345 | } |
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | 349 | ||
350 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ ) | 350 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ ) |
351 | { | 351 | { |
352 | //TODO: Implement more IP based protocols | 352 | //TODO: Implement more IP based protocols |
353 | 353 | ||
354 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); | 354 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); |
355 | if ( dhcp ) | 355 | if ( dhcp ) |
356 | { | 356 | { |
357 | odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; | 357 | odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; |
358 | if ( dhcp->type() == "OFFER" ) | 358 | if ( dhcp->type() == "OFFER" ) |
359 | { | 359 | { |
360 | odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; | 360 | odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; |
361 | netView()->identify( source, dhcp->serverAddress().toString() ); | 361 | netView()->identify( source, dhcp->serverAddress().toString() ); |
362 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 362 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
363 | } | 363 | } |
364 | else if ( dhcp->type() == "ACK" ) | 364 | else if ( dhcp->type() == "ACK" ) |
365 | { | 365 | { |
366 | odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; | 366 | odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; |
367 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | 367 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 373 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
374 | { | 374 | { |
375 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 375 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |
376 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) | 376 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) |
377 | return 0; | 377 | return 0; |
378 | 378 | ||
379 | return p->child( protocol ); | 379 | return p->child( protocol ); |
380 | } | 380 | } |
381 | 381 | ||
382 | 382 | ||
383 | bool Wellenreiter::checkDumpPacket( OPacket* p ) | 383 | bool Wellenreiter::checkDumpPacket( OPacket* p ) |
384 | { | 384 | { |
385 | // go through all child packets and see if one is inside the child hierarchy for p | 385 | // go through all child packets and see if one is inside the child hierarchy for p |
386 | // if so, do what the user requested (protocolAction), e.g. pass or discard | 386 | // if so, do what the user requested (protocolAction), e.g. pass or discard |
387 | if ( !configwindow->writeCaptureFile->isChecked() ) | 387 | if ( !configwindow->writeCaptureFile->isChecked() ) |
388 | return true; // semantic change - we're logging anyway now to /tmp/wellenreiter | 388 | return true; // semantic change - we're logging anyway now to /tmp/wellenreiter |
389 | 389 | ||
390 | QObjectList* l = p->queryList(); | 390 | QObjectList* l = p->queryList(); |
391 | QObjectListIt it( *l ); | 391 | QObjectListIt it( *l ); |
392 | QObject* o; | 392 | QObject* o; |
393 | 393 | ||
394 | while ( (o = it.current()) != 0 ) | 394 | while ( (o = it.current()) != 0 ) |
395 | { | 395 | { |
396 | QString name = it.current()->name(); | 396 | QString name = it.current()->name(); |
397 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) | 397 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) |
398 | { | 398 | { |
399 | QString action = configwindow->capturePackets->protocolAction( name ); | 399 | QString action = configwindow->capturePackets->protocolAction( name ); |
400 | odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; | 400 | odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; |
401 | if ( action == "Discard" ) | 401 | if ( action == "Discard" ) |
402 | { | 402 | { |
403 | logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); | 403 | logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); |
404 | return false; | 404 | return false; |
405 | } | 405 | } |
406 | } | 406 | } |
407 | else | 407 | else |
408 | { | 408 | { |
409 | odebug << "protocol '" << name << "' not checked in capturePackets." << oendl; | 409 | odebug << "protocol '" << name << "' not checked in capturePackets." << oendl; |
410 | } | 410 | } |
411 | ++it; | 411 | ++it; |
412 | } | 412 | } |
413 | return true; | 413 | return true; |
414 | } | 414 | } |
415 | 415 | ||
416 | 416 | ||
417 | void Wellenreiter::receivePacket( OPacket* p ) | 417 | void Wellenreiter::receivePacket( OPacket* p ) |
418 | { | 418 | { |
419 | hexWindow()->add( p, configwindow->hexViewBuffer() ); | 419 | hexWindow()->add( p, configwindow->hexViewBuffer() ); |
420 | 420 | ||
421 | if ( checkDumpPacket( p ) ) | 421 | if ( checkDumpPacket( p ) ) |
422 | { | 422 | { |
423 | pcap->dump( p ); | 423 | pcap->dump( p ); |
424 | } | 424 | } |
425 | 425 | ||
426 | // check for a management frame | 426 | // check for a management frame |
427 | OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); | 427 | OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); |
428 | if ( manage ) | 428 | if ( manage ) |
429 | { | 429 | { |
430 | handleManagementFrame( p, manage ); | 430 | handleManagementFrame( p, manage ); |
431 | return; | 431 | return; |
432 | } | 432 | } |
433 | 433 | ||
434 | // check for a control frame | 434 | // check for a control frame |
435 | OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) ); | 435 | OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) ); |
436 | if ( control ) | 436 | if ( control ) |
437 | { | 437 | { |
438 | handleControlFrame( p, control ); | 438 | handleControlFrame( p, control ); |
439 | return; | 439 | return; |
440 | } | 440 | } |
441 | 441 | ||
442 | OMacAddress source; | 442 | OMacAddress source; |
443 | OMacAddress dest; | 443 | OMacAddress dest; |
444 | 444 | ||
445 | //TODO: WEP check here | 445 | //TODO: WEP check here |
446 | 446 | ||
447 | // check for a wireless data frame | 447 | // check for a wireless data frame |
448 | OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); | 448 | OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); |
449 | if ( wlan ) | 449 | if ( wlan ) |
450 | { | 450 | { |
451 | handleWlanData( p, wlan, source, dest ); | 451 | handleWlanData( p, wlan, source, dest ); |
452 | } | 452 | } |
453 | 453 | ||
454 | // check for a wired data frame | 454 | // check for a wired data frame |
455 | OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); | 455 | OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); |
456 | if ( eth ) | 456 | if ( eth ) |
457 | { | 457 | { |
458 | handleEthernetData( p, eth, source, dest ); | 458 | handleEthernetData( p, eth, source, dest ); |
459 | } | 459 | } |
460 | 460 | ||
461 | // check for an arp frame since arp frames come in two flavours: | 461 | // check for an arp frame since arp frames come in two flavours: |
462 | // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. | 462 | // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. |
463 | OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); | 463 | OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); |
464 | if ( arp ) | 464 | if ( arp ) |
465 | { | 465 | { |
466 | handleARPData( p, arp, source, dest ); | 466 | handleARPData( p, arp, source, dest ); |
467 | } | 467 | } |
468 | 468 | ||
469 | // check for a ip frame | 469 | // check for a ip frame |
470 | OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); | 470 | OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); |
471 | if ( ip ) | 471 | if ( ip ) |
472 | { | 472 | { |
473 | handleIPData( p, ip, source, dest ); | 473 | handleIPData( p, ip, source, dest ); |
474 | } | 474 | } |
475 | 475 | ||
476 | //handleNotification( p ); | 476 | //handleNotification( p ); |
477 | 477 | ||
478 | } | 478 | } |
479 | 479 | ||
480 | 480 | ||
481 | void Wellenreiter::stopClicked() | 481 | void Wellenreiter::stopClicked() |
482 | { | 482 | { |
483 | if ( iface ) | 483 | if ( iface ) |
484 | { | 484 | { |
485 | disconnect( SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); | 485 | disconnect( SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); |
486 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 486 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
487 | iface->setChannelHopping(); // stop hopping channels | 487 | iface->setChannelHopping(); // stop hopping channels |
488 | } | 488 | } |
489 | else | 489 | else |
490 | killTimers(); | 490 | killTimers(); |
491 | 491 | ||
492 | pcap->close(); | 492 | pcap->close(); |
493 | sniffing = false; | 493 | sniffing = false; |
494 | 494 | ||
495 | if ( iface ) | 495 | if ( iface ) |
496 | { | 496 | { |
497 | // switch off monitor mode | 497 | // switch off monitor mode |
498 | iface->setMode( "managed" ); | 498 | iface->setMode( "managed" ); |
499 | // switch off promisc flag | 499 | // switch off promisc flag |
500 | iface->setPromiscuousMode( false ); | 500 | iface->setPromiscuousMode( false ); |
501 | 501 | ||
502 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 502 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
503 | } | 503 | } |
504 | 504 | ||
505 | logwindow->log( "(i) Stopped Scanning." ); | 505 | logwindow->log( "(i) Stopped Scanning." ); |
506 | assert( parent() ); | 506 | assert( parent() ); |
507 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 507 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
508 | 508 | ||
509 | // message the user | 509 | // message the user |
510 | QMessageBox::information( this, "Wellenreiter II", | 510 | QMessageBox::information( this, "Wellenreiter II", |
511 | tr( "Your wireless card\nshould now be usable again." ) ); | 511 | tr( "Your wireless card\nshould now be usable again." ) ); |
512 | 512 | ||
513 | sniffing = false; | 513 | sniffing = false; |
514 | emit( stoppedSniffing() ); | 514 | emit( stoppedSniffing() ); |
515 | 515 | ||
516 | #ifdef QWS | 516 | #ifdef QWS |
517 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) | 517 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) |
518 | { | 518 | { |
519 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 519 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
520 | } | 520 | } |
521 | #else | 521 | #else |
522 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 522 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
523 | #endif | 523 | #endif |
524 | 524 | ||
525 | updateStatistics(); | 525 | updateStatistics(); |
526 | } | 526 | } |
527 | 527 | ||
528 | 528 | ||
529 | void Wellenreiter::startClicked() | 529 | void Wellenreiter::startClicked() |
530 | { | 530 | { |
531 | // get configuration from config window | 531 | // get configuration from config window |
532 | 532 | ||
533 | const QString& interface = configwindow->interfaceName->currentText(); | 533 | const QString& interface = configwindow->interfaceName->currentText(); |
534 | const int cardtype = configwindow->driverType(); | 534 | const int cardtype = configwindow->driverType(); |
535 | // const int interval = configwindow->hoppingInterval(); | 535 | // const int interval = configwindow->hoppingInterval(); |
536 | 536 | ||
537 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 537 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
538 | { | 538 | { |
539 | QMessageBox::information( this, "Wellenreiter II", | 539 | QMessageBox::information( this, "Wellenreiter II", |
540 | tr( "No device configured.\nPlease reconfigure!" ) ); | 540 | tr( "No device configured.\nPlease reconfigure!" ) ); |
541 | return; | 541 | return; |
542 | } | 542 | } |
543 | 543 | ||
544 | // configure device | 544 | // configure device |
545 | ONetwork* net = ONetwork::instance(); | 545 | ONetwork* net = ONetwork::instance(); |
546 | 546 | ||
547 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 547 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
548 | 548 | ||
549 | if ( cardtype != DEVTYPE_FILE ) | 549 | if ( cardtype != DEVTYPE_FILE ) |
550 | { | 550 | { |
551 | 551 | ||
552 | if ( !net->isPresent( interface ) ) | 552 | if ( !net->isPresent( interface ) ) |
553 | { | 553 | { |
554 | QMessageBox::information( this, "Wellenreiter II", | 554 | QMessageBox::information( this, "Wellenreiter II", |
555 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); | 555 | tr( "The configured device (%1)\nis not available on this system\n. Please reconfigure!" ).arg( interface ) ); |
556 | return; | 556 | return; |
557 | } | 557 | } |
558 | 558 | ||
559 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | 559 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! |
560 | assert( iface ); | 560 | assert( iface ); |
561 | 561 | ||
562 | // bring device UP | 562 | // bring device UP |
563 | iface->setUp( true ); | 563 | iface->setUp( true ); |
564 | if ( !iface->isUp() ) | 564 | if ( !iface->isUp() ) |
565 | { | 565 | { |
566 | QMessageBox::warning( this, "Wellenreiter II", | 566 | QMessageBox::warning( this, "Wellenreiter II", |
567 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 567 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
568 | return; | 568 | return; |
569 | } | 569 | } |
570 | 570 | ||
571 | // check if wireless extension version matches | 571 | // check if wireless extension version matches |
572 | if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() ) | 572 | if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() |
573 | && ( ONetwork::wirelessExtensionCompileVersion() <= 15 || iface->wirelessExtensionDriverVersion() <= 15 ) ) | ||
573 | { | 574 | { |
574 | QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>do not match!<p>" | 575 | QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>do not match!<p>" |
575 | " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" ) | 576 | " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" ) |
576 | .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) ) | 577 | .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) ) |
577 | .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) ); | 578 | .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) ); |
578 | return; | 579 | return; |
579 | } | 580 | } |
580 | } | 581 | } |
581 | // set monitor mode | 582 | // set monitor mode |
582 | bool usePrism = configwindow->usePrismHeader(); | 583 | bool usePrism = configwindow->usePrismHeader(); |
583 | 584 | ||
584 | switch ( cardtype ) | 585 | switch ( cardtype ) |
585 | { | 586 | { |
586 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 587 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
587 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 588 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
588 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 589 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
589 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 590 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
590 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 591 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
591 | case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break; | 592 | case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break; |
592 | default: assert( 0 ); // shouldn't reach this | 593 | default: assert( 0 ); // shouldn't reach this |
593 | } | 594 | } |
594 | 595 | ||
595 | // switch device into monitor mode | 596 | // switch device into monitor mode |
596 | if ( cardtype < DEVTYPE_FILE ) | 597 | if ( cardtype < DEVTYPE_FILE ) |
597 | { | 598 | { |
598 | if ( cardtype != DEVTYPE_MANUAL ) | 599 | if ( cardtype != DEVTYPE_MANUAL ) |
599 | iface->setMode( "monitor" ); | 600 | iface->setMode( "monitor" ); |
600 | if ( iface->mode() != "monitor" ) | 601 | if ( iface->mode() != "monitor" ) |
601 | { | 602 | { |
602 | if ( QMessageBox::warning( this, "Wellenreiter II", | 603 | if ( QMessageBox::warning( this, "Wellenreiter II", |
603 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + | 604 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + |
604 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 605 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
605 | return; | 606 | return; |
606 | } | 607 | } |
607 | } | 608 | } |
608 | 609 | ||
609 | // open GPS device | 610 | // open GPS device |
610 | if ( configwindow->enableGPS->isChecked() ) | 611 | if ( configwindow->enableGPS->isChecked() ) |
611 | { | 612 | { |
612 | odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; | 613 | odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; |
613 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 614 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
614 | } | 615 | } |
615 | 616 | ||
616 | // open pcap and start sniffing | 617 | // open pcap and start sniffing |
617 | 618 | ||
618 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? | 619 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? |
619 | { | 620 | { |
620 | dumpname = configwindow->captureFileName->text(); | 621 | dumpname = configwindow->captureFileName->text(); |
621 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | 622 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; |
622 | dumpname.append( '-' ); | 623 | dumpname.append( '-' ); |
623 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 624 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
624 | dumpname.append( ".wellenreiter" ); | 625 | dumpname.append( ".wellenreiter" ); |
625 | } | 626 | } |
626 | 627 | ||
627 | if ( cardtype != DEVTYPE_FILE ) | 628 | if ( cardtype != DEVTYPE_FILE ) |
628 | pcap->open( interface ); | 629 | pcap->open( interface ); |
629 | else | 630 | else |
630 | pcap->openCaptureFile( interface ); | 631 | pcap->openCaptureFile( interface ); |
631 | 632 | ||
632 | if ( configwindow->writeCaptureFile->isChecked() ) | 633 | if ( configwindow->writeCaptureFile->isChecked() ) |
633 | { | 634 | { |
634 | odebug << "Wellenreiter:: dumping to " << dumpname << oendl; | 635 | odebug << "Wellenreiter:: dumping to " << dumpname << oendl; |
635 | pcap->openDumpFile( dumpname ); | 636 | pcap->openDumpFile( dumpname ); |
636 | } | 637 | } |
637 | 638 | ||
638 | if ( !pcap->isOpen() ) | 639 | if ( !pcap->isOpen() ) |
639 | { | 640 | { |
640 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( | 641 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( |
641 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); | 642 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); |
642 | return; | 643 | return; |
643 | } | 644 | } |
644 | 645 | ||
645 | // set capturer to non-blocking mode | 646 | // set capturer to non-blocking mode |
646 | pcap->setBlocking( false ); | 647 | pcap->setBlocking( false ); |
647 | 648 | ||
648 | // start channel hopper | 649 | // start channel hopper |
649 | if ( cardtype != DEVTYPE_FILE ) | 650 | if ( cardtype != DEVTYPE_FILE ) |
650 | { | 651 | { |
651 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | 652 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); |
652 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | 653 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window |
653 | } | 654 | } |
654 | 655 | ||
655 | if ( cardtype != DEVTYPE_FILE ) | 656 | if ( cardtype != DEVTYPE_FILE ) |
656 | { | 657 | { |
657 | // connect socket notifier and start channel hopper | 658 | // connect socket notifier and start channel hopper |
658 | connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); | 659 | connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); |
659 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 660 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
660 | } | 661 | } |
661 | else | 662 | else |
662 | { | 663 | { |
663 | // start timer for reading packets | 664 | // start timer for reading packets |
664 | startTimer( 100 ); | 665 | startTimer( 100 ); |
665 | } | 666 | } |
666 | 667 | ||
667 | logwindow->log( "(i) Started Scanning." ); | 668 | logwindow->log( "(i) Started Scanning." ); |
668 | sniffing = true; | 669 | sniffing = true; |
669 | 670 | ||
670 | #ifdef QWS | 671 | #ifdef QWS |
671 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) | 672 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) |
672 | { | 673 | { |
673 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; | 674 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; |
674 | } | 675 | } |
675 | #else | 676 | #else |
676 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 677 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
677 | #endif | 678 | #endif |
678 | 679 | ||
679 | emit( startedSniffing() ); | 680 | emit( startedSniffing() ); |
680 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 681 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
681 | else | 682 | else |
682 | { | 683 | { |
683 | assert( parent() ); | 684 | assert( parent() ); |
684 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 685 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
685 | } | 686 | } |
686 | } | 687 | } |
687 | 688 | ||
688 | 689 | ||
689 | void Wellenreiter::timerEvent( QTimerEvent* ) | 690 | void Wellenreiter::timerEvent( QTimerEvent* ) |
690 | { | 691 | { |
691 | odebug << "Wellenreiter::timerEvent()" << oendl; | 692 | odebug << "Wellenreiter::timerEvent()" << oendl; |
692 | OPacket* p = pcap->next(); | 693 | OPacket* p = pcap->next(); |
693 | if ( !p ) // no more packets available | 694 | if ( !p ) // no more packets available |
694 | { | 695 | { |
695 | stopClicked(); | 696 | stopClicked(); |
696 | } | 697 | } |
697 | else | 698 | else |
698 | { | 699 | { |
699 | receivePacket( p ); | 700 | receivePacket( p ); |
700 | // We no longer delete packets here. Ownership of the packets is | 701 | // We no longer delete packets here. Ownership of the packets is |
701 | // transferred to the PacketView. | 702 | // transferred to the PacketView. |
702 | //delete p; | 703 | //delete p; |
703 | } | 704 | } |
704 | } | 705 | } |
705 | 706 | ||
706 | 707 | ||
707 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) | 708 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) |
708 | { | 709 | { |
709 | #ifdef QWS | 710 | #ifdef QWS |
710 | if ( action == "TouchSound" ) | 711 | if ( action == "TouchSound" ) |
711 | ODevice::inst()->playTouchSound(); | 712 | ODevice::inst()->playTouchSound(); |
712 | else if ( action == "AlarmSound" ) | 713 | else if ( action == "AlarmSound" ) |
713 | ODevice::inst()->playAlarmSound(); | 714 | ODevice::inst()->playAlarmSound(); |
714 | else if ( action == "KeySound" ) | 715 | else if ( action == "KeySound" ) |
715 | ODevice::inst()->playKeySound(); | 716 | ODevice::inst()->playKeySound(); |
716 | else if ( action == "LedOn" ) | 717 | else if ( action == "LedOn" ) |
717 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | 718 | ODevice::inst()->setLedState( Led_Mail, Led_On ); |
718 | else if ( action == "LedOff" ) | 719 | else if ( action == "LedOff" ) |
719 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 720 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |
720 | else if ( action == "LogMessage" ) | 721 | else if ( action == "LogMessage" ) |
721 | logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); | 722 | logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); |
722 | else if ( action == "MessageBox" ) | 723 | else if ( action == "MessageBox" ) |
723 | QMessageBox::information( this, "Notification!", | 724 | QMessageBox::information( this, "Notification!", |
724 | QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); | 725 | QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); |
725 | #else | 726 | #else |
726 | #warning Actions do not work with Qt/X11 yet | 727 | #warning Actions do not work with Qt/X11 yet |
727 | #endif | 728 | #endif |
728 | } | 729 | } |
729 | 730 | ||
730 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) | 731 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) |
731 | { | 732 | { |
732 | #ifdef QWS | 733 | #ifdef QWS |
733 | if ( !iface ) | 734 | if ( !iface ) |
734 | { | 735 | { |
735 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); | 736 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); |
736 | return; | 737 | return; |
737 | } | 738 | } |
738 | 739 | ||
739 | if ( sniffing ) | 740 | if ( sniffing ) |
740 | { | 741 | { |
741 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); | 742 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); |
742 | return; | 743 | return; |
743 | } | 744 | } |
744 | 745 | ||
745 | odebug << "joinNetwork() with Interface " << iface->name() | 746 | odebug << "joinNetwork() with Interface " << iface->name() |
746 | << ": " << type << ", " << essid | 747 | << ": " << type << ", " << essid |
747 | << ", " << channel << ", " << macaddr << oendl; | 748 | << ", " << channel << ", " << macaddr << oendl; |
748 | 749 | ||
749 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 750 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
750 | int count = 3; | 751 | int count = 3; |
751 | odebug << "sending " << count << " messages" << oendl; | 752 | odebug << "sending " << count << " messages" << oendl; |
752 | msg << QString("count") << QString::number(count); | 753 | msg << QString("count") << QString::number(count); |
753 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; | 754 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; |
754 | msg << QString(iface->name()) << QString("Mode") << type; | 755 | msg << QString(iface->name()) << QString("Mode") << type; |
755 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; | 756 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; |
756 | msg << QString(iface->name()) << QString("ESSID") << essid; | 757 | msg << QString(iface->name()) << QString("ESSID") << essid; |
757 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; | 758 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; |
758 | msg << QString(iface->name()) << QString("Channel") << channel; | 759 | msg << QString(iface->name()) << QString("Channel") << channel; |
759 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; | 760 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; |
760 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 761 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
761 | #else | 762 | #else |
762 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); | 763 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); |
763 | #endif | 764 | #endif |
764 | 765 | ||
765 | } | 766 | } |
766 | 767 | ||
767 | void Wellenreiter::updateStatistics() | 768 | void Wellenreiter::updateStatistics() |
768 | { | 769 | { |
769 | // print out statistics | 770 | // print out statistics |
770 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 771 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
771 | statwindow->updateCounter( it.key(), it.data() ); | 772 | statwindow->updateCounter( it.key(), it.data() ); |
772 | } | 773 | } |
773 | 774 | ||
774 | void Wellenreiter::slotTabChanged( QWidget* wid ) | 775 | void Wellenreiter::slotTabChanged( QWidget* wid ) |
775 | { | 776 | { |
776 | if ( wid == statwindow ) | 777 | if ( wid == statwindow ) |
777 | updateStatistics(); | 778 | updateStatistics(); |
778 | } | 779 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index 0ca0bd7..1d5bd1b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp | |||
@@ -1,192 +1,190 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Wellenreiter II. | 4 | ** This file is part of Wellenreiter II. |
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 <qlabel.h> | 18 | #include <qlabel.h> |
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | 20 | ||
21 | #include "logwindow.h" | 21 | #include "logwindow.h" |
22 | #include "packetview.h" | 22 | #include "packetview.h" |
23 | #include "scanlist.h" | 23 | #include "scanlist.h" |
24 | #include "statwindow.h" | 24 | #include "statwindow.h" |
25 | #include "graphwindow.h" | 25 | #include "graphwindow.h" |
26 | 26 | ||
27 | #ifdef QWS | 27 | #ifdef QWS |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <opie2/otabwidget.h> | 29 | #include <opie2/otabwidget.h> |
30 | using namespace Opie; | 30 | using namespace Opie; |
31 | #else | 31 | #else |
32 | #include "resource.h" | 32 | #include "resource.h" |
33 | #include <qtabwidget.h> | 33 | #include <qtabwidget.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #define WELLENREITER_VERSION "V1.0.3 (unofficial)" | ||
37 | |||
38 | /* | 36 | /* |
39 | * Constructs a WellenreiterBase which is a child of 'parent', with the | 37 | * Constructs a WellenreiterBase which is a child of 'parent', with the |
40 | * name 'name' and widget flags set to 'f' | 38 | * name 'name' and widget flags set to 'f' |
41 | */ | 39 | */ |
42 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
43 | using namespace Opie::Ui; | 41 | using namespace Opie::Ui; |
44 | using namespace Opie::Ui; | 42 | using namespace Opie::Ui; |
45 | WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) | 43 | WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) |
46 | : QWidget( parent, name, fl ) | 44 | : QWidget( parent, name, fl ) |
47 | { | 45 | { |
48 | //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); | 46 | //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); |
49 | //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); | 47 | //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); |
50 | //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); | 48 | //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); |
51 | //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); | 49 | //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); |
52 | 50 | ||
53 | if ( !name ) | 51 | if ( !name ) |
54 | setName( "WellenreiterBase" ); | 52 | setName( "WellenreiterBase" ); |
55 | resize( 191, 294 ); | 53 | resize( 191, 294 ); |
56 | #ifdef QWS | 54 | #ifdef QWS |
57 | setCaption( tr( "Wellenreiter/Opie" ) ); | 55 | setCaption( tr( "Wellenreiter/Opie" ) ); |
58 | #else | 56 | #else |
59 | setCaption( tr( "Wellenreiter/X11" ) ); | 57 | setCaption( tr( "Wellenreiter/X11" ) ); |
60 | #endif | 58 | #endif |
61 | WellenreiterBaseLayout = new QVBoxLayout( this ); | 59 | WellenreiterBaseLayout = new QVBoxLayout( this ); |
62 | WellenreiterBaseLayout->setSpacing( 2 ); | 60 | WellenreiterBaseLayout->setSpacing( 2 ); |
63 | WellenreiterBaseLayout->setMargin( 0 ); | 61 | WellenreiterBaseLayout->setMargin( 0 ); |
64 | #ifdef QWS | 62 | #ifdef QWS |
65 | TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); | 63 | TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); |
66 | #else | 64 | #else |
67 | TabWidget = new QTabWidget( this, "TabWidget" ); | 65 | TabWidget = new QTabWidget( this, "TabWidget" ); |
68 | #endif | 66 | #endif |
69 | ap = new QWidget( TabWidget, "ap" ); | 67 | ap = new QWidget( TabWidget, "ap" ); |
70 | apLayout = new QVBoxLayout( ap ); | 68 | apLayout = new QVBoxLayout( ap ); |
71 | apLayout->setSpacing( 2 ); | 69 | apLayout->setSpacing( 2 ); |
72 | apLayout->setMargin( 2 ); | 70 | apLayout->setMargin( 2 ); |
73 | 71 | ||
74 | //--------- NETVIEW TAB -------------- | 72 | //--------- NETVIEW TAB -------------- |
75 | 73 | ||
76 | netview = new MScanListView( ap ); | 74 | netview = new MScanListView( ap ); |
77 | apLayout->addWidget( netview ); | 75 | apLayout->addWidget( netview ); |
78 | 76 | ||
79 | //--------- GRAPH TAB -------------- | 77 | //--------- GRAPH TAB -------------- |
80 | 78 | ||
81 | graphwindow = new MGraphWindow( TabWidget, "Graph" ); | 79 | graphwindow = new MGraphWindow( TabWidget, "Graph" ); |
82 | 80 | ||
83 | //--------- LOG TAB -------------- | 81 | //--------- LOG TAB -------------- |
84 | 82 | ||
85 | logwindow = new MLogWindow( TabWidget, "Log" ); | 83 | logwindow = new MLogWindow( TabWidget, "Log" ); |
86 | 84 | ||
87 | //--------- HEX TAB -------------- | 85 | //--------- HEX TAB -------------- |
88 | 86 | ||
89 | hexwindow = new PacketView( TabWidget, "Hex" ); | 87 | hexwindow = new PacketView( TabWidget, "Hex" ); |
90 | 88 | ||
91 | //--------- STAT TAB -------------- | 89 | //--------- STAT TAB -------------- |
92 | 90 | ||
93 | statwindow = new MStatWindow( TabWidget, "Stat" ); | 91 | statwindow = new MStatWindow( TabWidget, "Stat" ); |
94 | 92 | ||
95 | //--------- ABOUT TAB -------------- | 93 | //--------- ABOUT TAB -------------- |
96 | 94 | ||
97 | about = new QWidget( TabWidget, "about" ); | 95 | about = new QWidget( TabWidget, "about" ); |
98 | aboutLayout = new QGridLayout( about ); | 96 | aboutLayout = new QGridLayout( about ); |
99 | aboutLayout->setSpacing( 6 ); | 97 | aboutLayout->setSpacing( 6 ); |
100 | aboutLayout->setMargin( 11 ); | 98 | aboutLayout->setMargin( 11 ); |
101 | 99 | ||
102 | PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); | 100 | PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); |
103 | PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); | 101 | PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); |
104 | PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); | 102 | PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); |
105 | PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); | 103 | PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); |
106 | PixmapLabel1_3_2->setLineWidth( 2 ); | 104 | PixmapLabel1_3_2->setLineWidth( 2 ); |
107 | PixmapLabel1_3_2->setMargin( 0 ); | 105 | PixmapLabel1_3_2->setMargin( 0 ); |
108 | PixmapLabel1_3_2->setMidLineWidth( 0 ); | 106 | PixmapLabel1_3_2->setMidLineWidth( 0 ); |
109 | 107 | ||
110 | QPixmap logo = Resource::loadPixmap( "wellenreiter/logo" ); | 108 | QPixmap logo = Resource::loadPixmap( "wellenreiter/logo" ); |
111 | QPainter draw( &logo ); | 109 | QPainter draw( &logo ); |
112 | draw.setPen( Qt::black ); | 110 | draw.setPen( Qt::black ); |
113 | draw.setFont( QFont( "Fixed", 8 ) ); | 111 | draw.setFont( QFont( "Fixed", 8 ) ); |
114 | draw.drawText( 30, 10, WELLENREITER_VERSION ); | 112 | draw.drawText( 5, 10, WELLENREITER_VERSION ); |
115 | 113 | ||
116 | PixmapLabel1_3_2->setPixmap( logo ); | 114 | PixmapLabel1_3_2->setPixmap( logo ); |
117 | PixmapLabel1_3_2->setScaledContents( TRUE ); | 115 | PixmapLabel1_3_2->setScaledContents( TRUE ); |
118 | PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); | 116 | PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); |
119 | 117 | ||
120 | aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); | 118 | aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); |
121 | 119 | ||
122 | TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); | 120 | TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); |
123 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); | 121 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); |
124 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); | 122 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); |
125 | TextLabel1_4_2_font.setPointSize( 10 ); | 123 | TextLabel1_4_2_font.setPointSize( 10 ); |
126 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); | 124 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); |
127 | TextLabel1_4_2->setText( | 125 | TextLabel1_4_2->setText( |
128 | "<p align=center>" | 126 | "<p align=center>" |
129 | "<hr>" | 127 | "<hr>" |
130 | "<b>(C) Michael 'Mickey' Lauer</b><br>" | 128 | "<b>(C) Michael 'Mickey' Lauer</b><br>" |
131 | "<hr>" | 129 | "<hr>" |
132 | "mickey@Vanille.de<br>" | 130 | "mickey@Vanille.de<br>" |
133 | "www.Vanille.de/projects/wellenreiter.html<br>" | 131 | "www.Vanille.de/projects/wellenreiter.html<br>" |
134 | "www.wellenreiter.net" | 132 | "www.wellenreiter.net" |
135 | "</p>" ); | 133 | "</p>" ); |
136 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); | 134 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); |
137 | 135 | ||
138 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); | 136 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); |
139 | 137 | ||
140 | #ifdef QWS | 138 | #ifdef QWS |
141 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); | 139 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); |
142 | TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); | 140 | TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); |
143 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); | 141 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); |
144 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); | 142 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); |
145 | TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); | 143 | TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); |
146 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); | 144 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); |
147 | #else | 145 | #else |
148 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); | 146 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); |
149 | TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); | 147 | TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); |
150 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); | 148 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); |
151 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); | 149 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); |
152 | TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); | 150 | TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); |
153 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); | 151 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); |
154 | #endif | 152 | #endif |
155 | WellenreiterBaseLayout->addWidget( TabWidget ); | 153 | WellenreiterBaseLayout->addWidget( TabWidget ); |
156 | 154 | ||
157 | #ifdef QWS | 155 | #ifdef QWS |
158 | TabWidget->setCurrentTab( tr( "Nets" ) ); | 156 | TabWidget->setCurrentTab( tr( "Nets" ) ); |
159 | #endif | 157 | #endif |
160 | 158 | ||
161 | connect(TabWidget, SIGNAL(currentChanged(QWidget*)), | 159 | connect(TabWidget, SIGNAL(currentChanged(QWidget*)), |
162 | this, SLOT(slotTabChanged(QWidget*))); | 160 | this, SLOT(slotTabChanged(QWidget*))); |
163 | } | 161 | } |
164 | 162 | ||
165 | /* | 163 | /* |
166 | * Destroys the object and frees any allocated resources | 164 | * Destroys the object and frees any allocated resources |
167 | */ | 165 | */ |
168 | WellenreiterBase::~WellenreiterBase() | 166 | WellenreiterBase::~WellenreiterBase() |
169 | { | 167 | { |
170 | // no need to delete child widgets, Qt does it all for us | 168 | // no need to delete child widgets, Qt does it all for us |
171 | } | 169 | } |
172 | 170 | ||
173 | /* | 171 | /* |
174 | * Main event handler. Reimplemented to handle application | 172 | * Main event handler. Reimplemented to handle application |
175 | * font changes | 173 | * font changes |
176 | */ | 174 | */ |
177 | bool WellenreiterBase::event( QEvent* ev ) | 175 | bool WellenreiterBase::event( QEvent* ev ) |
178 | { | 176 | { |
179 | bool ret = QWidget::event( ev ); | 177 | bool ret = QWidget::event( ev ); |
180 | if ( ev->type() == QEvent::ApplicationFontChange ) { | 178 | if ( ev->type() == QEvent::ApplicationFontChange ) { |
181 | //QFont Log_2_font( Log_2->font() ); | 179 | //QFont Log_2_font( Log_2->font() ); |
182 | //Log_2_font.setFamily( "adobe-courier" ); | 180 | //Log_2_font.setFamily( "adobe-courier" ); |
183 | //Log_2_font.setPointSize( 8 ); | 181 | //Log_2_font.setPointSize( 8 ); |
184 | //Log_2->setFont( Log_2_font ); | 182 | //Log_2->setFont( Log_2_font ); |
185 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); | 183 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); |
186 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); | 184 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); |
187 | TextLabel1_4_2_font.setPointSize( 10 ); | 185 | TextLabel1_4_2_font.setPointSize( 10 ); |
188 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); | 186 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); |
189 | } | 187 | } |
190 | return ret; | 188 | return ret; |
191 | } | 189 | } |
192 | 190 | ||