author | mickeyl <mickeyl> | 2003-02-23 15:14:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-23 15:14:18 (UTC) |
commit | 9b7faae2ec12eeb9a056ca6093ac6e0840b11717 (patch) (side-by-side diff) | |
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 | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 29 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 11 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 18 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/wellenreiter.pro | 2 |
13 files changed, 102 insertions, 196 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 @@ -/* orinoco_hopper.c - * orinoco wireless nic channel scanning utility - * - * By Snax <snax@shmoo.com> - * Copyright (c) 2002 Snax - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a copy of the GNU General Public License write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> -#include <signal.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <linux/wireless.h> -#include <unistd.h> -#include <getopt.h> - -#ifndef SIOCIWFIRSTPRIV -#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE -#endif - -void changeChannel(int); -int setChannel( unsigned char channel ); - -int max = 11; -int mode = 2; -char dev[32]; - -void changeChannel(int x) { - static int chan = 0; - chan = (chan % max) + 1; - setChannel(chan); -} - -int setChannel( unsigned char channel ) -{ - int result = 0; - int fd; - struct iwreq ireq; //for Orinoco - int *ptr; - - /* get a socket */ - fd = socket(AF_INET, SOCK_STREAM, 0); - - if ( fd == -1 ) { - return -1; - } - ptr = (int *) ireq.u.name; - ptr[0] = mode; - ptr[1] = channel; - strcpy(ireq.ifr_ifrn.ifrn_name, dev); - result = ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq); - close(fd); - return result; -} - -void usage(char *cmd) { - fprintf(stderr, - "Usage: %s <iface> [-p] [-i <interval millisec>] [-n]\n -n = international channels\n -p = keep prism headers\n", cmd); - exit(1); -} - -int main (int argc, char *argv[]) -{ - struct itimerval tval; - int ms, r; - - //this will be the channel scanning interval, currently 0.2 sec - struct timeval interval = {0, 200000}; - - if (argc < 2) usage(argv[0]); - strncpy(dev, argv[1], 32); - dev[31] = 0; - - while (1) { - r = getopt(argc,argv,"i:np"); - if (r < 0) break; - switch (r) { - case 'n': - max = 14; - break; - case 'p': - mode = 1; - break; - case 'i': - ms = atoi(optarg); - interval.tv_sec = ms / 1000; - interval.tv_usec = (ms % 1000) * 1000; - break; - default: - usage(argv[0]); - } - } - - //this sets up the kchannel scanning stuff - signal(SIGALRM, changeChannel); - tval.it_interval = interval; - tval.it_value = interval; - setitimer(ITIMER_REAL, &tval, NULL); - while (1) pause(); - - return 0; -} - 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 @@ -DESTDIR = $(OPIEDIR)/bin -TEMPLATE = app -CONFIG = warn_on debug -#CONFIG = warn_on release -HEADERS = -SOURCES = orinoco_hopper.c -INCLUDEPATH += -DEPENDPATH += -LIBS += -INTERFACES = -TARGET = orinoco_hopper - - - -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 @@ -2,5 +2,5 @@ <class>WellenreiterConfigBase</class> <widget> - <class>QWidget</class> + <class>QDialog</class> <property stdset="1"> <name>name</name> @@ -12,5 +12,5 @@ <x>0</x> <y>0</y> - <width>224</width> + <width>220</width> <height>267</height> </rect> 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 @@ -20,5 +20,5 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) - :WellenreiterConfigBase( parent, name, f ) + :WellenreiterConfigBase( parent, name, true, f ) { _devicetype[ "cisco" ] = 1; 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,8 +1,10 @@ +MOC_DIR = ./tmp +OBJECTS_DIR = ./tmp DESTDIR = $(OPIEDIR)/bin TEMPLATE = app CONFIG = qt warn_on debug -#CONFIG = qt warn_on release -HEADERS = mainwindow.h \ - wellenreiterbase.h \ + +HEADERS = wellenreiterbase.h \ + mainwindow.h \ wellenreiter.h \ scanlistitem.h \ @@ -14,4 +16,5 @@ HEADERS = mainwindow.h \ cardconfig.h \ manufacturers.h + SOURCES = main.cpp \ mainwindow.cpp \ @@ -25,5 +28,6 @@ SOURCES = main.cpp \ wlan.cpp \ cardconfig.cpp \ - manufacturers.h + manufacturers.cpp + INCLUDEPATH += $(OPIEDIR)/include ../ DEPENDPATH += $(OPIEDIR)/include ../ 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 @@ -14,7 +14,9 @@ **********************************************************************/ +#include "configwindow.h" #include "mainwindow.h" #include "wellenreiter.h" +#include <qcombobox.h> #include <qiconset.h> #include <qmenubar.h> @@ -32,5 +34,7 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n :QMainWindow( parent, name, f ) { + cw = new WellenreiterConfigWindow( this ); mw = new Wellenreiter( this ); + mw->setConfigWindow( cw ); setCentralWidget( mw ); @@ -44,9 +48,11 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n // setup tool buttons - QToolButton* b = new QToolButton( 0 ); - b->setAutoRaise( true ); - b->setOnIconSet( *cancelIconSet ); - b->setOffIconSet( *searchIconSet ); - b->setToggleButton( true ); + startStopButton = new QToolButton( 0 ); + startStopButton->setAutoRaise( true ); + startStopButton->setOnIconSet( *cancelIconSet ); + startStopButton->setOffIconSet( *searchIconSet ); + startStopButton->setToggleButton( true ); + connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); + startStopButton->setEnabled( false ); QToolButton* c = new QToolButton( 0 ); @@ -58,4 +64,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n d->setAutoRaise( true ); d->setIconSet( *settingsIconSet ); + connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); // setup menu bar @@ -63,19 +70,60 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n QMenuBar* mb = menuBar(); - QPopupMenu* p = new QPopupMenu( mb ); - p->insertItem( "&Load" ); - p->insertItem( "&Save" ); + QPopupMenu* file = new QPopupMenu( mb ); + file->insertItem( "&Load" ); + file->insertItem( "&Save" ); - mb->insertItem( "&File", p ); - mb->setItemEnabled( mb->insertItem( b ), false ); - mb->setItemEnabled( mb->insertItem( c ), false ); + QPopupMenu* view = new QPopupMenu( mb ); + view->insertItem( "&Configure" ); + + QPopupMenu* sniffer = new QPopupMenu( mb ); + sniffer->insertItem( "&Configure" ); + sniffer->insertSeparator(); + + int id; + + id = mb->insertItem( "&File", file ); + mb->setItemEnabled( id, false ); + id = mb->insertItem( "&View", view ); + mb->setItemEnabled( id, false ); + id = mb->insertItem( "&Sniffer", sniffer ); + mb->setItemEnabled( id, false ); + + mb->insertItem( startStopButton ); + mb->insertItem( c ); mb->insertItem( d ); - // setup status bar + // setup status bar (for now only on X11) - // statusBar()->message( "Ready." ); + #ifndef QWS + statusBar()->message( "Ready." ); + #endif }; +void WellenreiterMainWindow::showConfigure() +{ + qDebug( "show configure..." ); + cw->setCaption( tr( "Configure" ) ); + cw->showMaximized(); + int result = cw->exec(); + + if ( result ) + { + // check configuration from config window + + const QString& interface = cw->interfaceName->currentText(); + const int cardtype = cw->daemonDeviceType(); + const int interval = cw->daemonHopInterval(); + + if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) + startStopButton->setEnabled( true ); + //TODO ... + else + startStopButton->setEnabled( false ); + //TODO ... + } +} + WellenreiterMainWindow::~WellenreiterMainWindow() { 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 @@ -20,8 +20,11 @@ class Wellenreiter; +class WellenreiterConfigWindow; class QIconSet; +class QToolButton; class WellenreiterMainWindow: public QMainWindow { + Q_OBJECT public: @@ -31,4 +34,5 @@ class WellenreiterMainWindow: public QMainWindow protected: Wellenreiter* mw; + WellenreiterConfigWindow* cw; const QIconSet* searchIconSet; @@ -37,7 +41,9 @@ class WellenreiterMainWindow: public QMainWindow const QIconSet* cancelIconSet; + QToolButton* startStopButton; + public slots: + void showConfigure(); }; #endif - 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 @@ -42,5 +42,5 @@ ManufacturerDB::ManufacturerDB( const QString& filename ) manu = s.readLine(); #ifdef DEBUG - qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); + //qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); #endif manufacturers.insert( addr, manu ); 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 @@ -62,6 +62,7 @@ using namespace Opie; #include <libwellenreiter/source/wl_proto.hh> -Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) - : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) +Wellenreiter::Wellenreiter( QWidget* parent ) + : WellenreiterBase( parent, 0, 0 ), + daemonRunning( false ), manufacturerdb( 0 ), configwindow( 0 ) { @@ -111,7 +112,4 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) // setup GUI - - connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); - // button->setEnabled( false ); netview->setColumnWidthMode( 1, QListView::Manual ); @@ -128,4 +126,9 @@ Wellenreiter::~Wellenreiter() } +void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) +{ + configwindow = cw; +} + void Wellenreiter::handleMessage() { @@ -212,16 +215,6 @@ void Wellenreiter::dataReceived() } -void Wellenreiter::buttonClicked() +void Wellenreiter::startStopClicked() { - /* - // add some test stations, so that we can see if the GUI part works - addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); - addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); - addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); - addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); - addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); - */ - - if ( daemonRunning ) { @@ -229,5 +222,4 @@ void Wellenreiter::buttonClicked() logwindow->log( "(i) Daemon has been stopped." ); - button->setText( tr( "Start Scanning" ) ); setCaption( tr( "Wellenreiter/Opie" ) ); @@ -262,5 +254,5 @@ void Wellenreiter::buttonClicked() if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) { - QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); + QMessageBox::information( this, "Wellenreiter/Opie", "Your device is not\nptoperly configured. Please reconfigure!" ); return; } @@ -277,5 +269,4 @@ void Wellenreiter::buttonClicked() logwindow->log( "(i) Daemon has been started." ); daemonRunning = true; - button->setText( tr( "Stop Scanning" ) ); setCaption( tr( "Scanning ..." ) ); 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 @@ -39,8 +39,8 @@ using namespace Opie; #include <libwellenreiter/source/wl_proto.hh> - class QTimerEvent; class QPixmap; class ManufacturerDB; +class WellenreiterConfigWindow; class Wellenreiter : public WellenreiterBase { @@ -48,15 +48,15 @@ class Wellenreiter : public WellenreiterBase { public: - - Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + Wellenreiter( QWidget* parent = 0 ); ~Wellenreiter(); -protected: + void setConfigWindow( WellenreiterConfigWindow* cw ); + protected: bool daemonRunning; public slots: - void buttonClicked(); void dataReceived(); + void startStopClicked(); private: @@ -68,4 +68,5 @@ private: ManufacturerDB* manufacturerdb; + WellenreiterConfigWindow* configwindow; struct sockaddr_in sockaddr; 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 @@ -30,5 +30,4 @@ #include "logwindow.h" #include "hexwindow.h" -#include "configwindow.h" #include "scanlist.h" @@ -57,5 +56,9 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f setName( "WellenreiterBase" ); resize( 191, 294 ); - setCaption( tr( "Wellenreiter" ) ); +#ifdef QWS + setCaption( tr( "Wellenreiter/Opie" ) ); +#else + setCaption( tr( "Wellenreiter/X11" ) ); +#endif WellenreiterBaseLayout = new QVBoxLayout( this ); WellenreiterBaseLayout->setSpacing( 2 ); @@ -86,8 +89,4 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f hexwindow = new MHexWindow( TabWidget, "Hex" ); - //--------- CONFIG TAB -------------- - - configwindow = new WellenreiterConfigWindow( TabWidget, "Config" ); - //--------- ABOUT TAB -------------- @@ -126,13 +125,8 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); - button = new QPushButton( this, "button" ); - button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) ); - button->setText( tr( "Start Scanning" ) ); - #ifdef QWS TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); - TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) ); TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); #else @@ -140,9 +134,7 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); - TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) ); TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); #endif WellenreiterBaseLayout->addWidget( TabWidget ); - WellenreiterBaseLayout->addWidget( button ); #ifdef QWS 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 @@ -28,5 +28,4 @@ class QPushButton; class MLogWindow; class MHexWindow; -class WellenreiterConfigWindow; #ifdef QWS @@ -53,9 +52,7 @@ public: MLogWindow* logwindow; MHexWindow* hexwindow; - WellenreiterConfigWindow* configwindow; QWidget* about; QLabel* PixmapLabel1_3_2; QLabel* TextLabel1_4_2; - QPushButton* button; protected: 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,4 +1,4 @@ TEMPLATE = subdirs -unix:SUBDIRS = libwellenreiter daemon gui contrib/orinoco_hopper +unix:SUBDIRS = libwellenreiter daemon gui |