summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-09 15:31:42 (UTC)
committer mickeyl <mickeyl>2002-12-09 15:31:42 (UTC)
commitb0a600bf9dd32b908d79c2cf1f12b8088dc2590d (patch) (unidiff)
treea0555985d4cf10e135cb5e3bcf318ef359cf7936
parent159a3334ecd168f422afe81853998373457fefa0 (diff)
downloadopie-b0a600bf9dd32b908d79c2cf1f12b8088dc2590d.zip
opie-b0a600bf9dd32b908d79c2cf1f12b8088dc2590d.tar.gz
opie-b0a600bf9dd32b908d79c2cf1f12b8088dc2590d.tar.bz2
APs and adhoc stations are now grouped and displayed as belonging to a common
net.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp10
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.h4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp39
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp7
4 files changed, 45 insertions, 15 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index 9532a01..189a12d 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -1,65 +1,69 @@
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 "scanlistitem.h" 16#include "scanlistitem.h"
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <assert.h> 18#include <assert.h>
19#include <qpixmap.h> 19#include <qpixmap.h>
20 20
21const int col_type = 0; 21const int col_type = 0;
22const int col_essid = 0; 22const int col_essid = 0;
23const int col_sig = 1; 23const int col_sig = 1;
24const int col_ap = 2; 24const int col_ap = 2;
25const int col_channel = 3; 25const int col_channel = 3;
26const int col_wep = 4; 26const int col_wep = 4;
27const int col_traffic = 5; 27const int col_traffic = 5;
28 28
29MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 29MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
30 bool wep, int channel, int signal ) 30 bool wep, int channel, int signal )
31 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 31 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
32{ 32{
33 qDebug( "creating scanlist item" ); 33 qDebug( "creating scanlist item" );
34 decorateItem( type, essid, macaddr, wep, channel, signal ); 34 decorateItem( type, essid, macaddr, wep, channel, signal );
35} 35}
36 36
37MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, 37MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
38 bool wep, int channel, int signal ) 38 bool wep, int channel, int signal )
39 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 39 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
40{ 40{
41 qDebug( "creating scanlist item" ); 41 qDebug( "creating scanlist item" );
42 decorateItem( type, essid, macaddr, wep, channel, signal ); 42 decorateItem( type, essid, macaddr, wep, channel, signal );
43} 43}
44 44
45void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 45void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
46{ 46{
47 qDebug( "decorating scanlist item" ); 47 qDebug( "decorating scanlist item" );
48 48
49 // set icon for managed or adhoc mode 49 // set icon for managed or adhoc mode
50 QString name; 50 QString name;
51 name.sprintf( "wellenreiter/%s", (const char*) type ); 51 name.sprintf( "wellenreiter/%s", (const char*) type );
52 setPixmap( col_type, Resource::loadPixmap( name ) ); 52 setPixmap( col_type, Resource::loadPixmap( name ) );
53 53
54 // set icon for wep (wireless encryption protocol) 54 // set icon for wep (wireless encryption protocol)
55 if ( wep ) 55 if ( wep )
56 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap! 56 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap!
57 57
58 // set channel and signal text 58 // set channel and signal text
59 setText( col_sig, QString::number( signal ) ); 59
60 setText( col_channel, QString::number( channel ) ); 60 if ( signal != -1 )
61 //setText 61 setText( col_sig, QString::number( signal ) );
62 if ( channel != -1 )
63 setText( col_channel, QString::number( channel ) );
62 64
63 listView()->triggerUpdate(); 65 listView()->triggerUpdate();
66
67 this->type = type;
64 68
65} 69}
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h
index dd8219a..cd9d883 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.h
+++ b/noncore/net/wellenreiter/gui/scanlistitem.h
@@ -1,51 +1,55 @@
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 SCANLISTITEM_H 16#ifndef SCANLISTITEM_H
17#define SCANLISTITEM_H 17#define SCANLISTITEM_H
18 18
19#include <qlistview.h> 19#include <qlistview.h>
20 20
21class QString; 21class QString;
22 22
23class MScanListItem: public QListViewItem 23class MScanListItem: public QListViewItem
24{ 24{
25 public: 25 public:
26 26
27 MScanListItem::MScanListItem( QListView* parent, 27 MScanListItem::MScanListItem( QListView* parent,
28 QString type, 28 QString type,
29 QString essid, 29 QString essid,
30 QString macaddr, 30 QString macaddr,
31 bool wep, 31 bool wep,
32 int channel, 32 int channel,
33 int signal ); 33 int signal );
34 34
35 MScanListItem::MScanListItem( QListViewItem* parent, 35 MScanListItem::MScanListItem( QListViewItem* parent,
36 QString type, 36 QString type,
37 QString essid, 37 QString essid,
38 QString macaddr, 38 QString macaddr,
39 bool wep, 39 bool wep,
40 int channel, 40 int channel,
41 int signal ); 41 int signal );
42 42
43 43
44 protected: 44 protected:
45 45
46 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 46 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
47 47
48 public:
49
50 QString type;
51
48}; 52};
49 53
50#endif 54#endif
51 55
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index d1ace46..9c8630f 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,195 +1,210 @@
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// Qt 16// Qt
17 17
18#include <qpushbutton.h> 18#include <qpushbutton.h>
19 19
20// Standard 20// Standard
21 21
22#include <unistd.h> 22#include <unistd.h>
23#include <sys/types.h> 23#include <sys/types.h>
24 24
25// Local 25// Local
26 26
27#include "wellenreiter.h" 27#include "wellenreiter.h"
28#include "scanlistitem.h" 28#include "scanlistitem.h"
29#include "logwindow.h" 29#include "logwindow.h"
30#include "hexwindow.h" 30#include "hexwindow.h"
31 31
32#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! 32#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS!
33#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! 33#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS!
34#include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! 34#include "../daemon/source/config.hh" // <--- ugly path, FIX THIS!
35 35
36Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) 36Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
37 : WellenreiterBase( parent, name, fl ) 37 : WellenreiterBase( parent, name, fl )
38{ 38{
39 39
40 logwindow->log( "(i) Wellenreiter has been started." ); 40 logwindow->log( "(i) Wellenreiter has been started." );
41 41
42 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); 42 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
43 netview->setColumnWidthMode( 1, QListView::Manual ); 43 netview->setColumnWidthMode( 1, QListView::Manual );
44 44
45 // 45 //
46 // setup socket for daemon communication and start poller 46 // setup socket for daemon communication and start poller
47 // 47 //
48 48
49 daemon_fd = commsock( GUIADDR, GUIPORT ); 49 daemon_fd = commsock( GUIADDR, GUIPORT );
50 if ( daemon_fd == -1 ) 50 if ( daemon_fd == -1 )
51 { 51 {
52 logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); 52 logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
53 qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); 53 qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." );
54 } 54 }
55 else 55 else
56 startTimer( 700 ); 56 startTimer( 700 );
57 57
58} 58}
59 59
60Wellenreiter::~Wellenreiter() 60Wellenreiter::~Wellenreiter()
61{ 61{
62 // no need to delete child widgets, Qt does it all for us 62 // no need to delete child widgets, Qt does it all for us
63} 63}
64 64
65void Wellenreiter::handleMessage() 65void Wellenreiter::handleMessage()
66{ 66{
67 // FIXME: receive message and handle it 67 // FIXME: receive message and handle it
68 68
69 qDebug( "received message from daemon." ); 69 qDebug( "received message from daemon." );
70 70
71 char buffer[128]; 71 char buffer[128];
72 72
73 int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); 73 int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) );
74 qDebug( "received %d from recvcomm", result ); 74 qDebug( "received %d from recvcomm", result );
75 75
76/* 76/*
77typedef struct { 77typedef struct {
78 int net_type; 1 = Accesspoint ; 2 = Ad-Hoc 78 int net_type; 1 = Accesspoint ; 2 = Ad-Hoc
79 int ssid_len; Length of SSID 79 int ssid_len; Length of SSID
80 int channel; Channel 80 int channel; Channel
81 int wep; 1 = WEP enabled ; 0 = disabled 81 int wep; 1 = WEP enabled ; 0 = disabled
82 char mac[64]; MAC address of Accesspoint 82 char mac[64]; MAC address of Accesspoint
83 char bssid[128]; BSSID of Accesspoint 83 char bssid[128]; BSSID of Accesspoint
84} wl_network_t; 84} wl_network_t;
85*/ 85*/
86 86
87 qDebug( "Sniffer sent: '%s'", (const char*) &buffer ); 87 qDebug( "Sniffer sent: '%s'", (const char*) &buffer );
88 hexwindow->log( (const char*) &buffer ); 88 hexwindow->log( (const char*) &buffer );
89 89
90 if ( result == NETFOUND ) /* new network found */ 90 if ( result == NETFOUND ) /* new network found */
91 { 91 {
92 logwindow->log( "(i) found new network" ); 92 logwindow->log( "(i) found new network" );
93 qDebug( "Sniffer said: new network found." ); 93 qDebug( "Sniffer said: new network found." );
94 wl_network_t n; 94 wl_network_t n;
95 get_network_found( &n, (char*) &buffer ); 95 get_network_found( &n, (char*) &buffer );
96 96
97 qDebug( "Sniffer said: net_type is %d.", n.net_type ); 97 qDebug( "Sniffer said: net_type is %d.", n.net_type );
98 qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); 98 qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac );
99 99
100 //n.bssid[n.ssid_len] = "\0"; 100 //n.bssid[n.ssid_len] = "\0";
101 101
102 QString type; 102 QString type;
103 103
104 if ( n.net_type == 1 ) 104 if ( n.net_type == 1 )
105 type = "managed"; 105 type = "managed";
106 else 106 else
107 type = "adhoc"; 107 type = "adhoc";
108 108
109 addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); 109 addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 );
110 110
111 } 111 }
112 112
113 else 113 else
114 114
115 { 115 {
116 qDebug( "unknown sniffer command." ); 116 qDebug( "unknown sniffer command." );
117 } 117 }
118 118
119} 119}
120 120
121 121
122bool Wellenreiter::hasMessage() 122bool Wellenreiter::hasMessage()
123{ 123{
124 124
125 // FIXME: do this in libwellenreiter, not here!!! 125 // FIXME: do this in libwellenreiter, not here!!!
126 126
127 fd_set rfds; 127 fd_set rfds;
128 FD_ZERO( &rfds ); 128 FD_ZERO( &rfds );
129 FD_SET( daemon_fd, &rfds ); 129 FD_SET( daemon_fd, &rfds );
130 struct timeval tv; 130 struct timeval tv;
131 tv.tv_sec = 0; 131 tv.tv_sec = 0;
132 tv.tv_usec = 10; 132 tv.tv_usec = 10;
133 int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); 133 int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv );
134 return FD_ISSET( daemon_fd, &rfds ); 134 return FD_ISSET( daemon_fd, &rfds );
135} 135}
136 136
137void Wellenreiter::timerEvent( QTimerEvent* e ) 137void Wellenreiter::timerEvent( QTimerEvent* e )
138{ 138{
139 qDebug( "checking for message..." ); 139 qDebug( "checking for message..." );
140 140
141 if ( hasMessage() ) 141 if ( hasMessage() )
142 { 142 {
143 handleMessage(); 143 handleMessage();
144 } 144 }
145 else 145 else
146 { 146 {
147 qDebug( "no message :(" ); 147 qDebug( "no message :(" );
148 } 148 }
149} 149}
150 150
151void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 151void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
152{ 152{
153 // FIXME: this code belongs in customized QListView, not into this class 153 // FIXME: this code belongs in customized QListView, not into this class
154 154
155 // search, if we had an item with this essid once before 155 // search, if we had an item with this essid once before
156 156
157 QListViewItem* item = netview->firstChild(); 157 //MScanListItem* item = dynamic_cast<MScanListItem*>( netview->firstChild() );
158 MScanListItem* item = static_cast<MScanListItem*>( netview->firstChild() );
158 159
159 while ( item && ( item->text( 0 ) != essid ) ) 160 while ( item && ( item->text( 0 ) != essid ) )
160 { 161 {
161 qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); 162 qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
162 item = item->itemBelow(); 163 item = dynamic_cast<MScanListItem*>( item->itemBelow() );
163 } 164 }
164 if ( item ) 165 if ( item )
165 { 166 {
166 qDebug( "found!" ); 167 qDebug( "found!" );
167 168
168 if ( macaddr != item->text( 2 ) ) 169 // check, if it is the same item (based on MACaddr)
169 new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); 170
170 else 171 if ( macaddr == item->text( 2 ) )
171 qDebug( "already there. ignoring..." ); 172 {
173 qDebug( "already had item with mac %s", (const char*) item->text( 2 ) );
174 return;
175 }
176
177 // another item belonging to the same net, so: insert the new item as child
178
179 new MScanListItem( item, type, essid, macaddr, wep, channel, signal );
172 } 180 }
181
173 else 182 else
174 { 183 {
175 new MScanListItem( netview, type, essid, macaddr, wep, channel, signal ); 184 qDebug( "inserting new network" );
185 MScanListItem* network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 );
186
187 new MScanListItem( network, type, essid, macaddr, wep, channel, signal );
176 } 188 }
177} 189}
178 190
179void Wellenreiter::buttonClicked() 191void Wellenreiter::buttonClicked()
180{ 192{
181 193
182 // FIXME: communicate with daemon and set button text according to state 194 // FIXME: communicate with daemon and set button text according to state
183 195
184 button->setText( "Stop Scanning" ); 196 button->setText( "Stop Scanning" );
185 197
186 // add some icons, so that we can see if this works 198 // add some test stations, so that we can see if the GUI part works
187
188 addNewItem( "managed", "DummyNet", "04:00:20:EF:A6:43", true, 6, 80 );
189 addNewItem( "adhoc", "DummyNet", "40:03:A3:E7:56:22", false, 11, 30 );
190 199
200 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 );
201 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 );
202 addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 );
203 addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
204 addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
205
191 QString command ("98"); 206 QString command ("98");
192 207
193 sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); 208 //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command );
194 209
195} 210}
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index 9b6424d..b1845b9 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -1,163 +1,170 @@
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 <opie/otabwidget.h> 23#include <opie/otabwidget.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qvariant.h> 25#include <qvariant.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qimage.h> 28#include <qimage.h>
29#include <qpixmap.h> 29#include <qpixmap.h>
30 30
31#include "logwindow.h" 31#include "logwindow.h"
32#include "hexwindow.h" 32#include "hexwindow.h"
33 33
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35 35
36 36
37/* 37/*
38 * Constructs a WellenreiterBase which is a child of 'parent', with the 38 * Constructs a WellenreiterBase which is a child of 'parent', with the
39 * name 'name' and widget flags set to 'f' 39 * name 'name' and widget flags set to 'f'
40 */ 40 */
41WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) 41WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
42 : QWidget( parent, name, fl ) 42 : QWidget( parent, name, fl )
43{ 43{
44 if ( !name ) 44 if ( !name )
45 setName( "WellenreiterBase" ); 45 setName( "WellenreiterBase" );
46 resize( 191, 294 ); 46 resize( 191, 294 );
47 setCaption( tr( "Wellenreiter" ) ); 47 setCaption( tr( "Wellenreiter" ) );
48 WellenreiterBaseLayout = new QVBoxLayout( this ); 48 WellenreiterBaseLayout = new QVBoxLayout( this );
49 WellenreiterBaseLayout->setSpacing( 2 ); 49 WellenreiterBaseLayout->setSpacing( 2 );
50 WellenreiterBaseLayout->setMargin( 0 ); 50 WellenreiterBaseLayout->setMargin( 0 );
51 51
52 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); 52 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
53 53
54 ap = new QWidget( TabWidget, "ap" ); 54 ap = new QWidget( TabWidget, "ap" );
55 apLayout = new QVBoxLayout( ap ); 55 apLayout = new QVBoxLayout( ap );
56 apLayout->setSpacing( 2 ); 56 apLayout->setSpacing( 2 );
57 apLayout->setMargin( 2 ); 57 apLayout->setMargin( 2 );
58 58
59 //--------- NETVIEW TAB -------------- 59 //--------- NETVIEW TAB --------------
60 60
61 netview = new QListView( ap, "netview" ); 61 netview = new QListView( ap, "netview" );
62 netview->addColumn( tr( "SSID" ) ); 62 netview->addColumn( tr( "SSID" ) );
63 netview->setColumnAlignment( 0, AlignLeft || AlignVCenter );
63 netview->addColumn( tr( "Sig" ) ); 64 netview->addColumn( tr( "Sig" ) );
65 netview->setColumnAlignment( 1, AlignCenter );
64 netview->addColumn( tr( "AP" ) ); 66 netview->addColumn( tr( "AP" ) );
67 netview->setColumnAlignment( 2, AlignCenter );
65 netview->addColumn( tr( "Chn" ) ); 68 netview->addColumn( tr( "Chn" ) );
69 netview->setColumnAlignment( 3, AlignCenter );
66 netview->addColumn( tr( "W" ) ); 70 netview->addColumn( tr( "W" ) );
71 netview->setColumnAlignment( 4, AlignCenter );
67 netview->addColumn( tr( "T" ) ); 72 netview->addColumn( tr( "T" ) );
73 netview->setColumnAlignment( 5, AlignCenter );
74
68 netview->setFrameShape( QListView::StyledPanel ); 75 netview->setFrameShape( QListView::StyledPanel );
69 netview->setFrameShadow( QListView::Sunken ); 76 netview->setFrameShadow( QListView::Sunken );
70 netview->setRootIsDecorated( TRUE ); 77 netview->setRootIsDecorated( TRUE );
71 apLayout->addWidget( netview ); 78 apLayout->addWidget( netview );
72 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); 79 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
73 80
74 //--------- LOG TAB -------------- 81 //--------- LOG TAB --------------
75 82
76 logwindow = new MLogWindow( TabWidget, "Log" ); 83 logwindow = new MLogWindow( TabWidget, "Log" );
77 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 84 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
78 85
79 //--------- HEX TAB -------------- 86 //--------- HEX TAB --------------
80 87
81 hexwindow = new MHexWindow( TabWidget, "Hex" ); 88 hexwindow = new MHexWindow( TabWidget, "Hex" );
82 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 89 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
83 90
84 //--------- CONFIG TAB -------------- 91 //--------- CONFIG TAB --------------
85 92
86 QPushButton* dummy = new QPushButton( "under construction", TabWidget ); 93 QPushButton* dummy = new QPushButton( "under construction", TabWidget );
87 TabWidget->addTab( dummy, "wellenreiter/config", tr( "Config" ) ); 94 TabWidget->addTab( dummy, "wellenreiter/config", tr( "Config" ) );
88 95
89 //--------- ABOUT TAB -------------- 96 //--------- ABOUT TAB --------------
90 97
91 about = new QWidget( TabWidget, "about" ); 98 about = new QWidget( TabWidget, "about" );
92 aboutLayout = new QGridLayout( about ); 99 aboutLayout = new QGridLayout( about );
93 aboutLayout->setSpacing( 6 ); 100 aboutLayout->setSpacing( 6 );
94 aboutLayout->setMargin( 11 ); 101 aboutLayout->setMargin( 11 );
95 102
96 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); 103 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
97 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); 104 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
98 PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); 105 PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
99 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); 106 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
100 PixmapLabel1_3_2->setLineWidth( 2 ); 107 PixmapLabel1_3_2->setLineWidth( 2 );
101 PixmapLabel1_3_2->setMargin( 0 ); 108 PixmapLabel1_3_2->setMargin( 0 );
102 PixmapLabel1_3_2->setMidLineWidth( 0 ); 109 PixmapLabel1_3_2->setMidLineWidth( 0 );
103 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); 110 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
104 PixmapLabel1_3_2->setScaledContents( TRUE ); 111 PixmapLabel1_3_2->setScaledContents( TRUE );
105 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 112 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
106 113
107 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 114 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
108 115
109 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 116 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
110 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 117 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
111 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 118 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
112 TextLabel1_4_2_font.setPointSize( 10 ); 119 TextLabel1_4_2_font.setPointSize( 10 );
113 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 120 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
114 TextLabel1_4_2->setText( tr( "<p align=center>\n" 121 TextLabel1_4_2->setText( tr( "<p align=center>\n"
115"<hr>\n" 122"<hr>\n"
116"Max Moser<br>\n" 123"Max Moser<br>\n"
117"Martin J. Muench<br>\n" 124"Martin J. Muench<br>\n"
118"Michael Lauer<br><hr>\n" 125"Michael Lauer<br><hr>\n"
119"<b>www.remote-exploit.org</b>\n" 126"<b>www.remote-exploit.org</b>\n"
120"</p>" ) ); 127"</p>" ) );
121 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 128 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
122 129
123 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 130 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
124 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 131 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
125 WellenreiterBaseLayout->addWidget( TabWidget ); 132 WellenreiterBaseLayout->addWidget( TabWidget );
126 133
127 button = new QPushButton( this, "button" ); 134 button = new QPushButton( this, "button" );
128 button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) ); 135 button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) );
129 button->setText( tr( "Start Scanning" ) ); 136 button->setText( tr( "Start Scanning" ) );
130 WellenreiterBaseLayout->addWidget( button ); 137 WellenreiterBaseLayout->addWidget( button );
131 138
132 TabWidget->setCurrentTab( tr( "Networks" ) ); 139 TabWidget->setCurrentTab( tr( "Networks" ) );
133 140
134} 141}
135 142
136/* 143/*
137 * Destroys the object and frees any allocated resources 144 * Destroys the object and frees any allocated resources
138 */ 145 */
139WellenreiterBase::~WellenreiterBase() 146WellenreiterBase::~WellenreiterBase()
140{ 147{
141 // no need to delete child widgets, Qt does it all for us 148 // no need to delete child widgets, Qt does it all for us
142} 149}
143 150
144/* 151/*
145 * Main event handler. Reimplemented to handle application 152 * Main event handler. Reimplemented to handle application
146 * font changes 153 * font changes
147 */ 154 */
148bool WellenreiterBase::event( QEvent* ev ) 155bool WellenreiterBase::event( QEvent* ev )
149{ 156{
150 bool ret = QWidget::event( ev ); 157 bool ret = QWidget::event( ev );
151 if ( ev->type() == QEvent::ApplicationFontChange ) { 158 if ( ev->type() == QEvent::ApplicationFontChange ) {
152 //QFont Log_2_font( Log_2->font() ); 159 //QFont Log_2_font( Log_2->font() );
153 //Log_2_font.setFamily( "adobe-courier" ); 160 //Log_2_font.setFamily( "adobe-courier" );
154 //Log_2_font.setPointSize( 8 ); 161 //Log_2_font.setPointSize( 8 );
155 //Log_2->setFont( Log_2_font ); 162 //Log_2->setFont( Log_2_font );
156 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 163 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
157 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 164 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
158 TextLabel1_4_2_font.setPointSize( 10 ); 165 TextLabel1_4_2_font.setPointSize( 10 );
159 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 166 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
160 } 167 }
161 return ret; 168 return ret;
162} 169}
163 170