author | mickeyl <mickeyl> | 2003-02-23 15:14:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-23 15:14:18 (UTC) |
commit | 9b7faae2ec12eeb9a056ca6093ac6e0840b11717 (patch) (unidiff) | |
tree | fc4d9de4ee2fd5c502513ccf0fa592bfaaa87185 | |
parent | 791c7512c530cb373726f9c01e26229cb8ca992a (diff) | |
download | opie-9b7faae2ec12eeb9a056ca6093ac6e0840b11717.zip opie-9b7faae2ec12eeb9a056ca6093ac6e0840b11717.tar.gz opie-9b7faae2ec12eeb9a056ca6093ac6e0840b11717.tar.bz2 |
- revamped part of the gui
- configuration is now a seperate dialog
- orinoco_hopper is no longer needed
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c | 118 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro | 15 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 74 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/manufacturers.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 37 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 21 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 50 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 13 | ||||
-rw-r--r-- | noncore/net/wellenreiter/wellenreiter.pro | 2 |
13 files changed, 135 insertions, 229 deletions
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c deleted file mode 100644 index 78f0299..0000000 --- a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c +++ b/dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | /* orinoco_hopper.c | ||
2 | * orinoco wireless nic channel scanning utility | ||
3 | * | ||
4 | * By Snax <snax@shmoo.com> | ||
5 | * Copyright (c) 2002 Snax | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * For a copy of the GNU General Public License write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | #include <stdio.h> | ||
22 | #include <stdlib.h> | ||
23 | #include <sys/time.h> | ||
24 | #include <signal.h> | ||
25 | #include <string.h> | ||
26 | #include <sys/ioctl.h> | ||
27 | #include <sys/socket.h> | ||
28 | #include <linux/wireless.h> | ||
29 | #include <unistd.h> | ||
30 | #include <getopt.h> | ||
31 | |||
32 | #ifndef SIOCIWFIRSTPRIV | ||
33 | #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE | ||
34 | #endif | ||
35 | |||
36 | void changeChannel(int); | ||
37 | int setChannel( unsigned char channel ); | ||
38 | |||
39 | int max = 11; | ||
40 | int mode = 2; | ||
41 | char dev[32]; | ||
42 | |||
43 | void changeChannel(int x) { | ||
44 | static int chan = 0; | ||
45 | chan = (chan % max) + 1; | ||
46 | setChannel(chan); | ||
47 | } | ||
48 | |||
49 | int setChannel( unsigned char channel ) | ||
50 | { | ||
51 | int result = 0; | ||
52 | int fd; | ||
53 | struct iwreq ireq; //for Orinoco | ||
54 | int *ptr; | ||
55 | |||
56 | /* get a socket */ | ||
57 | fd = socket(AF_INET, SOCK_STREAM, 0); | ||
58 | |||
59 | if ( fd == -1 ) { | ||
60 | return -1; | ||
61 | } | ||
62 | ptr = (int *) ireq.u.name; | ||
63 | ptr[0] = mode; | ||
64 | ptr[1] = channel; | ||
65 | strcpy(ireq.ifr_ifrn.ifrn_name, dev); | ||
66 | result = ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq); | ||
67 | close(fd); | ||
68 | return result; | ||
69 | } | ||
70 | |||
71 | void usage(char *cmd) { | ||
72 | fprintf(stderr, | ||
73 | "Usage: %s <iface> [-p] [-i <interval millisec>] [-n]\n -n = international channels\n -p = keep prism headers\n", cmd); | ||
74 | exit(1); | ||
75 | } | ||
76 | |||
77 | int main (int argc, char *argv[]) | ||
78 | { | ||
79 | struct itimerval tval; | ||
80 | int ms, r; | ||
81 | |||
82 | //this will be the channel scanning interval, currently 0.2 sec | ||
83 | struct timeval interval = {0, 200000}; | ||
84 | |||
85 | if (argc < 2) usage(argv[0]); | ||
86 | strncpy(dev, argv[1], 32); | ||
87 | dev[31] = 0; | ||
88 | |||
89 | while (1) { | ||
90 | r = getopt(argc,argv,"i:np"); | ||
91 | if (r < 0) break; | ||
92 | switch (r) { | ||
93 | case 'n': | ||
94 | max = 14; | ||
95 | break; | ||
96 | case 'p': | ||
97 | mode = 1; | ||
98 | break; | ||
99 | case 'i': | ||
100 | ms = atoi(optarg); | ||
101 | interval.tv_sec = ms / 1000; | ||
102 | interval.tv_usec = (ms % 1000) * 1000; | ||
103 | break; | ||
104 | default: | ||
105 | usage(argv[0]); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | //this sets up the kchannel scanning stuff | ||
110 | signal(SIGALRM, changeChannel); | ||
111 | tval.it_interval = interval; | ||
112 | tval.it_value = interval; | ||
113 | setitimer(ITIMER_REAL, &tval, NULL); | ||
114 | while (1) pause(); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro deleted file mode 100644 index 30298d5..0000000 --- a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro +++ b/dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | ||
2 | TEMPLATE = app | ||
3 | CONFIG = warn_on debug | ||
4 | #CONFIG = warn_on release | ||
5 | HEADERS = | ||
6 | SOURCES = orinoco_hopper.c | ||
7 | INCLUDEPATH += | ||
8 | DEPENDPATH += | ||
9 | LIBS += | ||
10 | INTERFACES = | ||
11 | TARGET = orinoco_hopper | ||
12 | |||
13 | |||
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 7992e6b..398118f 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -1,7 +1,7 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WellenreiterConfigBase</class> | 2 | <class>WellenreiterConfigBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WellenreiterConfigBase</cstring> | 7 | <cstring>WellenreiterConfigBase</cstring> |
@@ -11,7 +11,7 @@ | |||
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>224</width> | 14 | <width>220</width> |
15 | <height>267</height> | 15 | <height>267</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 515d9b2..6ea6f02 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
20 | 20 | ||
21 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 21 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
22 | :WellenreiterConfigBase( parent, name, f ) | 22 | :WellenreiterConfigBase( parent, name, true, f ) |
23 | { | 23 | { |
24 | _devicetype[ "cisco" ] = 1; | 24 | _devicetype[ "cisco" ] = 1; |
25 | _devicetype[ "wlan-ng" ] = 2; | 25 | _devicetype[ "wlan-ng" ] = 2; |
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 4ee360d..95e9f22 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -1,9 +1,11 @@ | |||
1 | MOC_DIR = ./tmp | ||
2 | OBJECTS_DIR = ./tmp | ||
1 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE = app | 4 | TEMPLATE = app |
3 | CONFIG = qt warn_on debug | 5 | CONFIG = qt warn_on debug |
4 | #CONFIG = qt warn_on release | 6 | |
5 | HEADERS = mainwindow.h \ | 7 | HEADERS = wellenreiterbase.h \ |
6 | wellenreiterbase.h \ | 8 | mainwindow.h \ |
7 | wellenreiter.h \ | 9 | wellenreiter.h \ |
8 | scanlistitem.h \ | 10 | scanlistitem.h \ |
9 | scanlist.h \ | 11 | scanlist.h \ |
@@ -13,6 +15,7 @@ HEADERS = mainwindow.h \ | |||
13 | wlan.h \ | 15 | wlan.h \ |
14 | cardconfig.h \ | 16 | cardconfig.h \ |
15 | manufacturers.h | 17 | manufacturers.h |
18 | |||
16 | SOURCES = main.cpp \ | 19 | SOURCES = main.cpp \ |
17 | mainwindow.cpp \ | 20 | mainwindow.cpp \ |
18 | wellenreiterbase.cpp \ | 21 | wellenreiterbase.cpp \ |
@@ -24,7 +27,8 @@ SOURCES = main.cpp \ | |||
24 | configwindow.cpp \ | 27 | configwindow.cpp \ |
25 | wlan.cpp \ | 28 | wlan.cpp \ |
26 | cardconfig.cpp \ | 29 | cardconfig.cpp \ |
27 | manufacturers.h | 30 | manufacturers.cpp |
31 | |||
28 | INCLUDEPATH += $(OPIEDIR)/include ../ | 32 | INCLUDEPATH += $(OPIEDIR)/include ../ |
29 | DEPENDPATH += $(OPIEDIR)/include ../ | 33 | DEPENDPATH += $(OPIEDIR)/include ../ |
30 | LIBS += -lqpe -lopie -L. -lwellenreiter | 34 | LIBS += -lqpe -lopie -L. -lwellenreiter |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index d7326c0..b67376c 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -13,9 +13,11 @@ | |||
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | ||
16 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
17 | #include "wellenreiter.h" | 18 | #include "wellenreiter.h" |
18 | 19 | ||
20 | #include <qcombobox.h> | ||
19 | #include <qiconset.h> | 21 | #include <qiconset.h> |
20 | #include <qmenubar.h> | 22 | #include <qmenubar.h> |
21 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
@@ -31,7 +33,9 @@ | |||
31 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 33 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
32 | :QMainWindow( parent, name, f ) | 34 | :QMainWindow( parent, name, f ) |
33 | { | 35 | { |
36 | cw = new WellenreiterConfigWindow( this ); | ||
34 | mw = new Wellenreiter( this ); | 37 | mw = new Wellenreiter( this ); |
38 | mw->setConfigWindow( cw ); | ||
35 | setCentralWidget( mw ); | 39 | setCentralWidget( mw ); |
36 | 40 | ||
37 | // setup icon sets | 41 | // setup icon sets |
@@ -43,11 +47,13 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
43 | 47 | ||
44 | // setup tool buttons | 48 | // setup tool buttons |
45 | 49 | ||
46 | QToolButton* b = new QToolButton( 0 ); | 50 | startStopButton = new QToolButton( 0 ); |
47 | b->setAutoRaise( true ); | 51 | startStopButton->setAutoRaise( true ); |
48 | b->setOnIconSet( *cancelIconSet ); | 52 | startStopButton->setOnIconSet( *cancelIconSet ); |
49 | b->setOffIconSet( *searchIconSet ); | 53 | startStopButton->setOffIconSet( *searchIconSet ); |
50 | b->setToggleButton( true ); | 54 | startStopButton->setToggleButton( true ); |
55 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | ||
56 | startStopButton->setEnabled( false ); | ||
51 | 57 | ||
52 | QToolButton* c = new QToolButton( 0 ); | 58 | QToolButton* c = new QToolButton( 0 ); |
53 | c->setAutoRaise( true ); | 59 | c->setAutoRaise( true ); |
@@ -57,26 +63,68 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
57 | QToolButton* d = new QToolButton( 0 ); | 63 | QToolButton* d = new QToolButton( 0 ); |
58 | d->setAutoRaise( true ); | 64 | d->setAutoRaise( true ); |
59 | d->setIconSet( *settingsIconSet ); | 65 | d->setIconSet( *settingsIconSet ); |
66 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | ||
60 | 67 | ||
61 | // setup menu bar | 68 | // setup menu bar |
62 | 69 | ||
63 | QMenuBar* mb = menuBar(); | 70 | QMenuBar* mb = menuBar(); |
64 | 71 | ||
65 | QPopupMenu* p = new QPopupMenu( mb ); | 72 | QPopupMenu* file = new QPopupMenu( mb ); |
66 | p->insertItem( "&Load" ); | 73 | file->insertItem( "&Load" ); |
67 | p->insertItem( "&Save" ); | 74 | file->insertItem( "&Save" ); |
68 | 75 | ||
69 | mb->insertItem( "&File", p ); | 76 | QPopupMenu* view = new QPopupMenu( mb ); |
70 | mb->setItemEnabled( mb->insertItem( b ), false ); | 77 | view->insertItem( "&Configure" ); |
71 | mb->setItemEnabled( mb->insertItem( c ), false ); | 78 | |
79 | QPopupMenu* sniffer = new QPopupMenu( mb ); | ||
80 | sniffer->insertItem( "&Configure" ); | ||
81 | sniffer->insertSeparator(); | ||
82 | |||
83 | int id; | ||
84 | |||
85 | id = mb->insertItem( "&File", file ); | ||
86 | mb->setItemEnabled( id, false ); | ||
87 | id = mb->insertItem( "&View", view ); | ||
88 | mb->setItemEnabled( id, false ); | ||
89 | id = mb->insertItem( "&Sniffer", sniffer ); | ||
90 | mb->setItemEnabled( id, false ); | ||
91 | |||
92 | mb->insertItem( startStopButton ); | ||
93 | mb->insertItem( c ); | ||
72 | mb->insertItem( d ); | 94 | mb->insertItem( d ); |
73 | 95 | ||
74 | // setup status bar | 96 | // setup status bar (for now only on X11) |
75 | 97 | ||
76 | // statusBar()->message( "Ready." ); | 98 | #ifndef QWS |
99 | statusBar()->message( "Ready." ); | ||
100 | #endif | ||
77 | 101 | ||
78 | }; | 102 | }; |
79 | 103 | ||
104 | void WellenreiterMainWindow::showConfigure() | ||
105 | { | ||
106 | qDebug( "show configure..." ); | ||
107 | cw->setCaption( tr( "Configure" ) ); | ||
108 | cw->showMaximized(); | ||
109 | int result = cw->exec(); | ||
110 | |||
111 | if ( result ) | ||
112 | { | ||
113 | // check configuration from config window | ||
114 | |||
115 | const QString& interface = cw->interfaceName->currentText(); | ||
116 | const int cardtype = cw->daemonDeviceType(); | ||
117 | const int interval = cw->daemonHopInterval(); | ||
118 | |||
119 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | ||
120 | startStopButton->setEnabled( true ); | ||
121 | //TODO ... | ||
122 | else | ||
123 | startStopButton->setEnabled( false ); | ||
124 | //TODO ... | ||
125 | } | ||
126 | } | ||
127 | |||
80 | WellenreiterMainWindow::~WellenreiterMainWindow() | 128 | WellenreiterMainWindow::~WellenreiterMainWindow() |
81 | { | 129 | { |
82 | 130 | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index dcc79e6..7d772a8 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -19,10 +19,13 @@ | |||
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | 20 | ||
21 | class Wellenreiter; | 21 | class Wellenreiter; |
22 | class WellenreiterConfigWindow; | ||
22 | class QIconSet; | 23 | class QIconSet; |
24 | class QToolButton; | ||
23 | 25 | ||
24 | class WellenreiterMainWindow: public QMainWindow | 26 | class WellenreiterMainWindow: public QMainWindow |
25 | { | 27 | { |
28 | Q_OBJECT | ||
26 | 29 | ||
27 | public: | 30 | public: |
28 | WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); | 31 | WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); |
@@ -30,14 +33,17 @@ class WellenreiterMainWindow: public QMainWindow | |||
30 | 33 | ||
31 | protected: | 34 | protected: |
32 | Wellenreiter* mw; | 35 | Wellenreiter* mw; |
36 | WellenreiterConfigWindow* cw; | ||
33 | 37 | ||
34 | const QIconSet* searchIconSet; | 38 | const QIconSet* searchIconSet; |
35 | const QIconSet* infoIconSet; | 39 | const QIconSet* infoIconSet; |
36 | const QIconSet* settingsIconSet; | 40 | const QIconSet* settingsIconSet; |
37 | const QIconSet* cancelIconSet; | 41 | const QIconSet* cancelIconSet; |
38 | 42 | ||
43 | QToolButton* startStopButton; | ||
39 | 44 | ||
45 | public slots: | ||
46 | void showConfigure(); | ||
40 | }; | 47 | }; |
41 | 48 | ||
42 | #endif | 49 | #endif |
43 | |||
diff --git a/noncore/net/wellenreiter/gui/manufacturers.cpp b/noncore/net/wellenreiter/gui/manufacturers.cpp index dad2753..f9f8967 100644 --- a/noncore/net/wellenreiter/gui/manufacturers.cpp +++ b/noncore/net/wellenreiter/gui/manufacturers.cpp | |||
@@ -34,17 +34,17 @@ ManufacturerDB::ManufacturerDB( const QString& filename ) | |||
34 | QTextStream s( &file ); | 34 | QTextStream s( &file ); |
35 | QString addr; | 35 | QString addr; |
36 | QString manu; | 36 | QString manu; |
37 | 37 | ||
38 | while (!s.atEnd()) | 38 | while (!s.atEnd()) |
39 | { | 39 | { |
40 | s >> addr; | 40 | s >> addr; |
41 | s.skipWhiteSpace(); | 41 | s.skipWhiteSpace(); |
42 | manu = s.readLine(); | 42 | manu = s.readLine(); |
43 | #ifdef DEBUG | 43 | #ifdef DEBUG |
44 | qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); | 44 | //qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); |
45 | #endif | 45 | #endif |
46 | manufacturers.insert( addr, manu ); | 46 | manufacturers.insert( addr, manu ); |
47 | 47 | ||
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4c53028..db7063b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -61,8 +61,9 @@ using namespace Opie; | |||
61 | #include <libwellenreiter/source/wl_sock.hh> | 61 | #include <libwellenreiter/source/wl_sock.hh> |
62 | #include <libwellenreiter/source/wl_proto.hh> | 62 | #include <libwellenreiter/source/wl_proto.hh> |
63 | 63 | ||
64 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent ) |
65 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) | 65 | : WellenreiterBase( parent, 0, 0 ), |
66 | daemonRunning( false ), manufacturerdb( 0 ), configwindow( 0 ) | ||
66 | { | 67 | { |
67 | 68 | ||
68 | // | 69 | // |
@@ -78,11 +79,11 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
78 | manufacturerdb = new ManufacturerDB( manufile ); | 79 | manufacturerdb = new ManufacturerDB( manufile ); |
79 | 80 | ||
80 | logwindow->log( "(i) Wellenreiter has been started." ); | 81 | logwindow->log( "(i) Wellenreiter has been started." ); |
81 | 82 | ||
82 | // | 83 | // |
83 | // detect operating system | 84 | // detect operating system |
84 | // | 85 | // |
85 | 86 | ||
86 | #ifdef QWS | 87 | #ifdef QWS |
87 | QString sys; | 88 | QString sys; |
88 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
@@ -110,23 +111,25 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
110 | } | 111 | } |
111 | 112 | ||
112 | // setup GUI | 113 | // setup GUI |
113 | |||
114 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); | ||
115 | // button->setEnabled( false ); | ||
116 | netview->setColumnWidthMode( 1, QListView::Manual ); | 114 | netview->setColumnWidthMode( 1, QListView::Manual ); |
117 | 115 | ||
118 | if ( manufacturerdb ) | 116 | if ( manufacturerdb ) |
119 | netview->setManufacturerDB( manufacturerdb ); | 117 | netview->setManufacturerDB( manufacturerdb ); |
120 | 118 | ||
121 | } | 119 | } |
122 | 120 | ||
123 | Wellenreiter::~Wellenreiter() | 121 | Wellenreiter::~Wellenreiter() |
124 | { | 122 | { |
125 | // no need to delete child widgets, Qt does it all for us | 123 | // no need to delete child widgets, Qt does it all for us |
126 | 124 | ||
127 | delete manufacturerdb; | 125 | delete manufacturerdb; |
128 | } | 126 | } |
129 | 127 | ||
128 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | ||
129 | { | ||
130 | configwindow = cw; | ||
131 | } | ||
132 | |||
130 | void Wellenreiter::handleMessage() | 133 | void Wellenreiter::handleMessage() |
131 | { | 134 | { |
132 | // FIXME: receive message and handle it | 135 | // FIXME: receive message and handle it |
@@ -211,24 +214,13 @@ void Wellenreiter::dataReceived() | |||
211 | handleMessage(); | 214 | handleMessage(); |
212 | } | 215 | } |
213 | 216 | ||
214 | void Wellenreiter::buttonClicked() | 217 | void Wellenreiter::startStopClicked() |
215 | { | 218 | { |
216 | /* | ||
217 | // add some test stations, so that we can see if the GUI part works | ||
218 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); | ||
219 | addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); | ||
220 | addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); | ||
221 | addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); | ||
222 | addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); | ||
223 | */ | ||
224 | |||
225 | |||
226 | if ( daemonRunning ) | 219 | if ( daemonRunning ) |
227 | { | 220 | { |
228 | daemonRunning = false; | 221 | daemonRunning = false; |
229 | 222 | ||
230 | logwindow->log( "(i) Daemon has been stopped." ); | 223 | logwindow->log( "(i) Daemon has been stopped." ); |
231 | button->setText( tr( "Start Scanning" ) ); | ||
232 | setCaption( tr( "Wellenreiter/Opie" ) ); | 224 | setCaption( tr( "Wellenreiter/Opie" ) ); |
233 | 225 | ||
234 | // Stop daemon - ugly for now... later better | 226 | // Stop daemon - ugly for now... later better |
@@ -261,7 +253,7 @@ void Wellenreiter::buttonClicked() | |||
261 | 253 | ||
262 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) | 254 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) |
263 | { | 255 | { |
264 | QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); | 256 | QMessageBox::information( this, "Wellenreiter/Opie", "Your device is not\nptoperly configured. Please reconfigure!" ); |
265 | return; | 257 | return; |
266 | } | 258 | } |
267 | 259 | ||
@@ -276,7 +268,6 @@ void Wellenreiter::buttonClicked() | |||
276 | 268 | ||
277 | logwindow->log( "(i) Daemon has been started." ); | 269 | logwindow->log( "(i) Daemon has been started." ); |
278 | daemonRunning = true; | 270 | daemonRunning = true; |
279 | button->setText( tr( "Stop Scanning" ) ); | ||
280 | setCaption( tr( "Scanning ..." ) ); | 271 | setCaption( tr( "Scanning ..." ) ); |
281 | 272 | ||
282 | } | 273 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 0ddc72c..a55d6a1 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -38,28 +38,28 @@ using namespace Opie; | |||
38 | #include <libwellenreiter/source/wl_sock.hh> | 38 | #include <libwellenreiter/source/wl_sock.hh> |
39 | #include <libwellenreiter/source/wl_proto.hh> | 39 | #include <libwellenreiter/source/wl_proto.hh> |
40 | 40 | ||
41 | |||
42 | class QTimerEvent; | 41 | class QTimerEvent; |
43 | class QPixmap; | 42 | class QPixmap; |
44 | class ManufacturerDB; | 43 | class ManufacturerDB; |
44 | class WellenreiterConfigWindow; | ||
45 | 45 | ||
46 | class Wellenreiter : public WellenreiterBase { | 46 | class Wellenreiter : public WellenreiterBase { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | 48 | ||
49 | public: | 49 | public: |
50 | 50 | Wellenreiter( QWidget* parent = 0 ); | |
51 | Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
52 | ~Wellenreiter(); | 51 | ~Wellenreiter(); |
53 | 52 | ||
54 | protected: | 53 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
55 | 54 | ||
55 | protected: | ||
56 | bool daemonRunning; | 56 | bool daemonRunning; |
57 | 57 | ||
58 | public slots: | 58 | public slots: |
59 | void buttonClicked(); | ||
60 | void dataReceived(); | 59 | void dataReceived(); |
60 | void startStopClicked(); | ||
61 | 61 | ||
62 | private: | 62 | private: |
63 | int daemon_fd; // socket filedescriptor for udp communication socket | 63 | int daemon_fd; // socket filedescriptor for udp communication socket |
64 | #ifdef QWS | 64 | #ifdef QWS |
65 | OSystem _system; // Opie Operating System identifier | 65 | OSystem _system; // Opie Operating System identifier |
@@ -67,8 +67,9 @@ private: | |||
67 | void handleMessage(); | 67 | void handleMessage(); |
68 | 68 | ||
69 | ManufacturerDB* manufacturerdb; | 69 | ManufacturerDB* manufacturerdb; |
70 | WellenreiterConfigWindow* configwindow; | ||
70 | struct sockaddr_in sockaddr; | 71 | struct sockaddr_in sockaddr; |
71 | 72 | ||
72 | //void readConfig(); | 73 | //void readConfig(); |
73 | //void writeConfig(); | 74 | //void writeConfig(); |
74 | }; | 75 | }; |
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index da12f2b..3a703bc 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #include "logwindow.h" | 30 | #include "logwindow.h" |
31 | #include "hexwindow.h" | 31 | #include "hexwindow.h" |
32 | #include "configwindow.h" | ||
33 | #include "scanlist.h" | 32 | #include "scanlist.h" |
34 | 33 | ||
35 | #ifdef QWS | 34 | #ifdef QWS |
@@ -55,9 +54,13 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
55 | 54 | ||
56 | if ( !name ) | 55 | if ( !name ) |
57 | setName( "WellenreiterBase" ); | 56 | setName( "WellenreiterBase" ); |
58 | resize( 191, 294 ); | 57 | resize( 191, 294 ); |
59 | setCaption( tr( "Wellenreiter" ) ); | 58 | #ifdef QWS |
60 | WellenreiterBaseLayout = new QVBoxLayout( this ); | 59 | setCaption( tr( "Wellenreiter/Opie" ) ); |
60 | #else | ||
61 | setCaption( tr( "Wellenreiter/X11" ) ); | ||
62 | #endif | ||
63 | WellenreiterBaseLayout = new QVBoxLayout( this ); | ||
61 | WellenreiterBaseLayout->setSpacing( 2 ); | 64 | WellenreiterBaseLayout->setSpacing( 2 ); |
62 | WellenreiterBaseLayout->setMargin( 0 ); | 65 | WellenreiterBaseLayout->setMargin( 0 ); |
63 | #ifdef QWS | 66 | #ifdef QWS |
@@ -66,33 +69,29 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
66 | TabWidget = new QTabWidget( this, "TabWidget" ); | 69 | TabWidget = new QTabWidget( this, "TabWidget" ); |
67 | #endif | 70 | #endif |
68 | ap = new QWidget( TabWidget, "ap" ); | 71 | ap = new QWidget( TabWidget, "ap" ); |
69 | apLayout = new QVBoxLayout( ap ); | 72 | apLayout = new QVBoxLayout( ap ); |
70 | apLayout->setSpacing( 2 ); | 73 | apLayout->setSpacing( 2 ); |
71 | apLayout->setMargin( 2 ); | 74 | apLayout->setMargin( 2 ); |
72 | 75 | ||
73 | //--------- NETVIEW TAB -------------- | 76 | //--------- NETVIEW TAB -------------- |
74 | 77 | ||
75 | netview = new MScanListView( ap ); | 78 | netview = new MScanListView( ap ); |
76 | apLayout->addWidget( netview ); | 79 | apLayout->addWidget( netview ); |
77 | 80 | ||
78 | 81 | ||
79 | //--------- LOG TAB -------------- | 82 | //--------- LOG TAB -------------- |
80 | 83 | ||
81 | logwindow = new MLogWindow( TabWidget, "Log" ); | 84 | logwindow = new MLogWindow( TabWidget, "Log" ); |
82 | 85 | ||
83 | 86 | ||
84 | //--------- HEX TAB -------------- | 87 | //--------- HEX TAB -------------- |
85 | 88 | ||
86 | hexwindow = new MHexWindow( TabWidget, "Hex" ); | 89 | hexwindow = new MHexWindow( TabWidget, "Hex" ); |
87 | 90 | ||
88 | //--------- CONFIG TAB -------------- | ||
89 | |||
90 | configwindow = new WellenreiterConfigWindow( TabWidget, "Config" ); | ||
91 | |||
92 | //--------- ABOUT TAB -------------- | 91 | //--------- ABOUT TAB -------------- |
93 | 92 | ||
94 | about = new QWidget( TabWidget, "about" ); | 93 | about = new QWidget( TabWidget, "about" ); |
95 | aboutLayout = new QGridLayout( about ); | 94 | aboutLayout = new QGridLayout( about ); |
96 | aboutLayout->setSpacing( 6 ); | 95 | aboutLayout->setSpacing( 6 ); |
97 | aboutLayout->setMargin( 11 ); | 96 | aboutLayout->setMargin( 11 ); |
98 | 97 | ||
@@ -113,7 +112,7 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
113 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); | 112 | QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); |
114 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); | 113 | TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); |
115 | TextLabel1_4_2_font.setPointSize( 10 ); | 114 | TextLabel1_4_2_font.setPointSize( 10 ); |
116 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); | 115 | TextLabel1_4_2->setFont( TextLabel1_4_2_font ); |
117 | TextLabel1_4_2->setText( tr( "<p align=center>\n" | 116 | TextLabel1_4_2->setText( tr( "<p align=center>\n" |
118 | "<hr>\n" | 117 | "<hr>\n" |
119 | "Max Moser<br>\n" | 118 | "Max Moser<br>\n" |
@@ -124,28 +123,21 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f | |||
124 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); | 123 | TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); |
125 | 124 | ||
126 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); | 125 | aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); |
127 | |||
128 | button = new QPushButton( this, "button" ); | ||
129 | button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) ); | ||
130 | button->setText( tr( "Start Scanning" ) ); | ||
131 | 126 | ||
132 | #ifdef QWS | 127 | #ifdef QWS |
133 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); | 128 | TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); |
134 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); | 129 | TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); |
135 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); | 130 | TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); |
136 | TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) ); | ||
137 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); | 131 | TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); |
138 | #else | 132 | #else |
139 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); | 133 | TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); |
140 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); | 134 | TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); |
141 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); | 135 | TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); |
142 | TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) ); | ||
143 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); | 136 | TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); |
144 | #endif | 137 | #endif |
145 | WellenreiterBaseLayout->addWidget( TabWidget ); | 138 | WellenreiterBaseLayout->addWidget( TabWidget ); |
146 | WellenreiterBaseLayout->addWidget( button ); | ||
147 | 139 | ||
148 | #ifdef QWS | 140 | #ifdef QWS |
149 | TabWidget->setCurrentTab( tr( "Networks" ) ); | 141 | TabWidget->setCurrentTab( tr( "Networks" ) ); |
150 | #endif | 142 | #endif |
151 | 143 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h index edb2930..1fa1ea3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.h +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h | |||
@@ -18,16 +18,15 @@ | |||
18 | 18 | ||
19 | #include <qvariant.h> | 19 | #include <qvariant.h> |
20 | #include <qwidget.h> | 20 | #include <qwidget.h> |
21 | class QVBoxLayout; | 21 | class QVBoxLayout; |
22 | class QHBoxLayout; | 22 | class QHBoxLayout; |
23 | class QGridLayout; | 23 | class QGridLayout; |
24 | class QLabel; | 24 | class QLabel; |
25 | class MScanListView; | 25 | class MScanListView; |
26 | class MScanListItem; | 26 | class MScanListItem; |
27 | class QPushButton; | 27 | class QPushButton; |
28 | class MLogWindow; | 28 | class MLogWindow; |
29 | class MHexWindow; | 29 | class MHexWindow; |
30 | class WellenreiterConfigWindow; | ||
31 | 30 | ||
32 | #ifdef QWS | 31 | #ifdef QWS |
33 | class OTabWidget; | 32 | class OTabWidget; |
@@ -36,7 +35,7 @@ class QTabWidget; | |||
36 | #endif | 35 | #endif |
37 | 36 | ||
38 | class WellenreiterBase : public QWidget | 37 | class WellenreiterBase : public QWidget |
39 | { | 38 | { |
40 | Q_OBJECT | 39 | Q_OBJECT |
41 | 40 | ||
42 | public: | 41 | public: |
@@ -52,18 +51,16 @@ public: | |||
52 | MScanListView* netview; | 51 | MScanListView* netview; |
53 | MLogWindow* logwindow; | 52 | MLogWindow* logwindow; |
54 | MHexWindow* hexwindow; | 53 | MHexWindow* hexwindow; |
55 | WellenreiterConfigWindow* configwindow; | ||
56 | QWidget* about; | 54 | QWidget* about; |
57 | QLabel* PixmapLabel1_3_2; | 55 | QLabel* PixmapLabel1_3_2; |
58 | QLabel* TextLabel1_4_2; | 56 | QLabel* TextLabel1_4_2; |
59 | QPushButton* button; | ||
60 | 57 | ||
61 | protected: | 58 | protected: |
62 | QVBoxLayout* WellenreiterBaseLayout; | 59 | QVBoxLayout* WellenreiterBaseLayout; |
63 | QVBoxLayout* apLayout; | 60 | QVBoxLayout* apLayout; |
64 | QGridLayout* aboutLayout; | 61 | QGridLayout* aboutLayout; |
65 | bool event( QEvent* ); | 62 | bool event( QEvent* ); |
66 | 63 | ||
67 | QPixmap* ani1; | 64 | QPixmap* ani1; |
68 | QPixmap* ani2; | 65 | QPixmap* ani2; |
69 | QPixmap* ani3; | 66 | QPixmap* ani3; |
diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro index 6784af4..dd75c8c 100644 --- a/noncore/net/wellenreiter/wellenreiter.pro +++ b/noncore/net/wellenreiter/wellenreiter.pro | |||
@@ -1,5 +1,5 @@ | |||
1 | TEMPLATE = subdirs | 1 | TEMPLATE = subdirs |
2 | unix:SUBDIRS = libwellenreiter daemon gui contrib/orinoco_hopper | 2 | unix:SUBDIRS = libwellenreiter daemon gui |
3 | 3 | ||
4 | 4 | ||
5 | 5 | ||