author | mickeyl <mickeyl> | 2003-04-09 21:40:31 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-09 21:40:31 (UTC) |
commit | cf029a4007ea344c530d8a71cd0b012393ebd7ba (patch) (side-by-side diff) | |
tree | e9f584885299548b9316a6da05ad31845487e6d9 | |
parent | b055856776807f0a459a86b1e1f62902d2d3a9c3 (diff) | |
download | opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.zip opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.tar.gz opie-cf029a4007ea344c530d8a71cd0b012393ebd7ba.tar.bz2 |
- improve keyboard handling
- enable sniffer-menu
- fix handling of start/stop button
- add simple statistic window, fancy will follow ;-)
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 99 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.cpp | 45 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.h | 40 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 178 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 21 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 4 |
9 files changed, 278 insertions, 133 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 5970b01..08eb18a 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro @@ -1,34 +1,36 @@ MOC_DIR = ./tmp OBJECTS_DIR = ./tmp DESTDIR = $(OPIEDIR)/bin TEMPLATE = app CONFIG = qt warn_on debug HEADERS = wellenreiterbase.h \ mainwindow.h \ wellenreiter.h \ scanlist.h \ logwindow.h \ hexwindow.h \ + statwindow.h \ configwindow.h \ manufacturers.h SOURCES = main.cpp \ mainwindow.cpp \ wellenreiterbase.cpp \ wellenreiter.cpp \ scanlist.cpp \ logwindow.cpp \ hexwindow.cpp \ + statwindow.cpp \ configwindow.cpp \ manufacturers.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include INTERFACES = configbase.ui TARGET = wellenreiter !contains( platform, x11 ) { message( qws ) include ( $(OPIEDIR)/include.pro ) LIBS += -lqpe -lopie -lopiecore2 -lopieui2 -lopienet2 diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 69d2b3a..94e3f28 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -51,48 +51,44 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n // setup application icon #ifndef QWS setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); setIconText( "Wellenreiter/X11" ); #endif // setup icon sets infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); - #ifdef QWS - searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); - cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); - #else - startStopIconSet = new QIconSet(); - startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); - startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); - #endif + startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); + stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); // setup tool buttons - startStopButton = new QToolButton( 0 ); + startButton = new QToolButton( 0 ); #ifdef QWS - startStopButton->setAutoRaise( true ); + startButton->setAutoRaise( true ); #endif + startButton->setIconSet( *startIconSet ); + startButton->setEnabled( false ); + connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); + + stopButton = new QToolButton( 0 ); #ifdef QWS - startStopButton->setOnIconSet( *cancelIconSet ); - startStopButton->setOffIconSet( *searchIconSet ); - #else - startStopButton->setIconSet( *startStopIconSet ); + stopButton->setAutoRaise( true ); #endif - startStopButton->setToggleButton( true ); - connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); - startStopButton->setEnabled( false ); + stopButton->setIconSet( *stopIconSet ); + stopButton->setEnabled( false ); + connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); QToolButton* c = new QToolButton( 0 ); #ifdef QWS c->setAutoRaise( true ); #endif c->setIconSet( *infoIconSet ); c->setEnabled( false ); QToolButton* d = new QToolButton( 0 ); #ifdef QWS d->setAutoRaise( true ); #endif @@ -116,94 +112,115 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n QPopupMenu* file = new QPopupMenu( mb ); file->insertItem( "&New", this, SLOT( fileNew() ) ); id = file->insertItem( "&Load", fileLoad ); file->insertItem( "&Save", fileSave ); file->insertSeparator(); file->insertItem( "&Exit", qApp, SLOT( quit() ) ); QPopupMenu* view = new QPopupMenu( mb ); view->insertItem( "&Configure..." ); QPopupMenu* sniffer = new QPopupMenu( mb ); - sniffer->insertItem( "&Configure..." ); + sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) ); sniffer->insertSeparator(); + startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) ); + sniffer->setItemEnabled( startID, false ); + stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) ); + sniffer->setItemEnabled( stopID, false ); QPopupMenu* demo = new QPopupMenu( mb ); demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); id = mb->insertItem( "&File", file ); id = mb->insertItem( "&View", view ); mb->setItemEnabled( id, false ); id = mb->insertItem( "&Sniffer", sniffer ); - mb->setItemEnabled( id, false ); id = mb->insertItem( "&Demo", demo ); mb->setItemEnabled( id, true ); #ifdef QWS - mb->insertItem( startStopButton ); + mb->insertItem( startButton ); + mb->insertItem( stopButton ); mb->insertItem( c ); mb->insertItem( d ); #else // Qt3 changed the insertion order. It's now totally random :( mb->insertItem( d ); mb->insertItem( c ); - mb->insertItem( startStopButton ); + mb->insertItem( stopButton ); + mb->insertItem( startButton ); #endif + updateToolButtonState(); + // setup status bar (for now only on X11) #ifndef QWS statusBar()->message( "Ready." ); #endif + connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); + connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); }; + + void WellenreiterMainWindow::showConfigure() { qDebug( "show configure..." ); cw->setCaption( tr( "Configure" ) ); #ifdef QWS cw->showMaximized(); #endif int result = cw->exec(); - if ( result ) - { - // check configuration from config window + if ( result ) updateToolButtonState(); +} - 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 ... + +void WellenreiterMainWindow::updateToolButtonState() +{ + const QString& interface = cw->interfaceName->currentText(); + const int cardtype = cw->daemonDeviceType(); + const int interval = cw->daemonHopInterval(); + + if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) + { + startButton->setEnabled( true ); + menuBar()->setItemEnabled( startID, true ); + } + else + { + startButton->setEnabled( false ); + menuBar()->setItemEnabled( startID, false ); } } -WellenreiterMainWindow::~WellenreiterMainWindow() + +void WellenreiterMainWindow::changedSniffingState() { + startButton->setEnabled( !mw->sniffing ); + menuBar()->setItemEnabled( startID, !mw->sniffing ); + stopButton->setEnabled( mw->sniffing ); + menuBar()->setItemEnabled( stopID, mw->sniffing ); +} + +WellenreiterMainWindow::~WellenreiterMainWindow() +{ delete infoIconSet; delete settingsIconSet; - #ifdef QWS - delete searchIconSet; - delete cancelIconSet; - #else - delete startStopIconSet; - #endif - + delete startIconSet; + delete stopIconSet; }; void WellenreiterMainWindow::demoAddStations() { mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); } QString WellenreiterMainWindow::getFileName( bool save ) diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 1b08c5b..1e191e5 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h @@ -26,37 +26,41 @@ class QToolButton; class WellenreiterMainWindow: public QMainWindow { Q_OBJECT public: WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); ~WellenreiterMainWindow(); protected: Wellenreiter* mw; WellenreiterConfigWindow* cw; - QIconSet* startStopIconSet; - const QIconSet* searchIconSet; + const QIconSet* startIconSet; + const QIconSet* stopIconSet; const QIconSet* infoIconSet; const QIconSet* settingsIconSet; - const QIconSet* cancelIconSet; - QToolButton* startStopButton; + QToolButton* startButton; + QToolButton* stopButton; + int startID; + int stopID; protected: virtual void closeEvent( QCloseEvent* ); + void updateToolButtonState(); private: QString getFileName( bool save ); public slots: void showConfigure(); void demoAddStations(); void fileSaveLog(); void fileSaveHex(); void fileSaveSession(); void fileLoadSession(); void fileNew(); + void changedSniffingState(); }; #endif diff --git a/noncore/net/wellenreiter/gui/statwindow.cpp b/noncore/net/wellenreiter/gui/statwindow.cpp new file mode 100644 index 0000000..07d34ef --- a/dev/null +++ b/noncore/net/wellenreiter/gui/statwindow.cpp @@ -0,0 +1,45 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "statwindow.h" +#include <qmultilineedit.h> + +MStatWindow::MStatWindow( QWidget * parent, const char * name, WFlags f ) + :QVBox( parent, name, f ) +{ + ledit = new QMultiLineEdit( this ); + ledit->setFont( QFont( "fixed", 10 ) ); + + // FIXME: Set properties( font, read-only, etc...) + +}; + +void MStatWindow::log( QString text ) +{ + + ledit->append( text ); + +}; + +const QString MStatWindow::getLog() const +{ + return ledit->text(); +} + +void MStatWindow::clear() +{ + ledit->clear(); +} + diff --git a/noncore/net/wellenreiter/gui/statwindow.h b/noncore/net/wellenreiter/gui/statwindow.h new file mode 100644 index 0000000..bbdf777 --- a/dev/null +++ b/noncore/net/wellenreiter/gui/statwindow.h @@ -0,0 +1,40 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#ifndef STATWINDOW_H +#define STATWINDOW_H + +#include <qvbox.h> + +class QString; +class QMultiLineEdit; + +class MStatWindow: public QVBox +{ + + public: + MStatWindow( QWidget * parent = 0, const char * name = "MStatWindow", WFlags f = 0 ); + + void log( QString text ); + const QString getLog() const; + void clear(); + + protected: + QMultiLineEdit* ledit; + +}; + +#endif + diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 0bfc8e9..3372883 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -25,43 +25,44 @@ using namespace Opie; #else #include <qapplication.h> #endif #include <opie2/onetwork.h> #include <opie2/opcap.h> // Qt #include <qpushbutton.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qspinbox.h> +#include <qtoolbutton.h> #include <qmainwindow.h> // Standard #include <assert.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <stdlib.h> // Local #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "hexwindow.h" #include "configwindow.h" - +#include "statwindow.h" #include "manufacturers.h" Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) { // // construct manufacturer database // QString manufile; @@ -208,108 +209,131 @@ void Wellenreiter::receivePacket(OPacket* p) qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", (const char*) wlan->macAddress2().toString(true), (const char*) wlan->macAddress1().toString(true), (const char*) wlan->macAddress3().toString(true) ); netView()->traffic( "IBSS", wlan->macAddress2().toString(), wlan->macAddress1().toString(), wlan->macAddress3().toString() ); } return; } } -void Wellenreiter::startStopClicked() + +void Wellenreiter::stopClicked() { - if ( sniffing ) + disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); + disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); + iface->setChannelHopping(); // stop hopping channels + pcap->close(); + sniffing = false; + #ifdef QWS + oApp->setTitle(); + #else + qApp->mainWidget()->setCaption( "Wellenreiter II" ); + #endif + + // get interface name from config window + const QString& interface = configwindow->interfaceName->currentText(); + ONetwork* net = ONetwork::instance(); + iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); + + // switch off monitor mode + iface->setMonitorMode( false ); + // switch off promisc flag + iface->setPromiscuousMode( false ); + + system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess + logwindow->log( "(i) Stopped Scanning." ); + assert( parent() ); + ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); + + // message the user + QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); + + sniffing = false; + emit( stoppedSniffing() ); + + // print out statistics + statwindow->log( "-----------------------------------------" ); + statwindow->log( "- Wellenreiter II Capturing Statistic -" ); + statwindow->log( "-----------------------------------------" ); + statwindow->log( "Packet Type | Receive Count" ); + + for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) { - disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); - disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); - iface->setChannelHopping(); // stop hopping channels - pcap->close(); - sniffing = false; - #ifdef QWS - oApp->setTitle(); - #else - qApp->mainWidget()->setCaption( "Wellenreiter II" ); - #endif - - // get interface name from config window - const QString& interface = configwindow->interfaceName->currentText(); - ONetwork* net = ONetwork::instance(); - iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); - - // switch off monitor mode - iface->setMonitorMode( false ); - // switch off promisc flag - iface->setPromiscuousMode( false ); - - system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess - logwindow->log( "(i) Stopped Scanning." ); - assert( parent() ); - ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); - - // message the user - QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); + QString left; + left.sprintf( "%s", (const char*) it.key() ); + left = left.leftJustify( 20 ); + left.append( '|' ); + QString right; + right.sprintf( "%d", it.data() ); + right = right.rightJustify( 7 ); + statwindow->log( left + right ); } - else - { - // get configuration from config window +} - const QString& interface = configwindow->interfaceName->currentText(); - const int cardtype = configwindow->daemonDeviceType(); - const int interval = configwindow->daemonHopInterval(); - if ( ( interface == "" ) || ( cardtype == 0 ) ) - { - QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); - return; - } +void Wellenreiter::startClicked() +{ + // get configuration from config window - // configure device + const QString& interface = configwindow->interfaceName->currentText(); + const int cardtype = configwindow->daemonDeviceType(); + const int interval = configwindow->daemonHopInterval(); - ONetwork* net = ONetwork::instance(); - iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); + if ( ( interface == "" ) || ( cardtype == 0 ) ) + { + QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); + return; + } - // set monitor mode + // configure device - switch ( cardtype ) - { - case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; - case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; - case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; - case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; - default: assert( 0 ); // shouldn't happen - } + ONetwork* net = ONetwork::instance(); + iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); - iface->setMonitorMode( true ); + // set monitor mode - if ( !iface->monitorMode() ) - { - QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); - return; - } + switch ( cardtype ) + { + case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; + case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; + case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; + case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; + default: + QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); + } - // open pcap and start sniffing - pcap->open( interface ); + if ( cardtype > 0 && cardtype < 5 ) + iface->setMonitorMode( true ); - if ( !pcap->isOpen() ) - { - QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); - return; - } + if ( !iface->monitorMode() ) + { + QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); + return; + } - // set capturer to non-blocking mode - pcap->setBlocking( false ); + // open pcap and start sniffing + pcap->open( interface ); - // start channel hopper - iface->setChannelHopping( 1000 ); //use interval from config window + if ( !pcap->isOpen() ) + { + QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); + return; + } - // connect - connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); - connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); + // set capturer to non-blocking mode + pcap->setBlocking( false ); - logwindow->log( "(i) Started Scanning." ); - sniffing = true; + // start channel hopper + iface->setChannelHopping( 1000 ); //use interval from config window - } + // connect + connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); + connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); + + logwindow->log( "(i) Started Scanning." ); + sniffing = true; + emit( startedSniffing() ); } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 85f889b..839c77e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -38,35 +38,41 @@ class Wellenreiter : public WellenreiterBase { Q_OBJECT public: Wellenreiter( QWidget* parent = 0 ); ~Wellenreiter(); void setConfigWindow( WellenreiterConfigWindow* cw ); MScanListView* netView() const { return netview; }; MLogWindow* logWindow() const { return logwindow; }; MHexWindow* hexWindow() const { return hexwindow; }; bool isDaemonRunning() const { return sniffing; }; + bool sniffing; + public slots: void channelHopped(int); void receivePacket(OPacket*); - void startStopClicked(); + void startClicked(); + void stopClicked(); + + signals: + void startedSniffing(); + void stoppedSniffing(); private: #ifdef QWS OSystem _system; // Opie Operating System identifier #endif - bool sniffing; OWirelessNetworkInterface* iface; OPacketCapturer* pcap; ManufacturerDB* manufacturerdb; WellenreiterConfigWindow* configwindow; //void readConfig(); //void writeConfig(); }; #endif diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index 3a703bc..245b9fc 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -21,36 +21,37 @@ #include <qmultilineedit.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h> #include "logwindow.h" #include "hexwindow.h" #include "scanlist.h" +#include "statwindow.h" #ifdef QWS #include <qpe/resource.h> #include <opie/otabwidget.h> #else #include "resource.h" #include <qtabwidget.h> #endif -/* - * Constructs a WellenreiterBase which is a child of 'parent', with the +/* + * Constructs a WellenreiterBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); if ( !name ) setName( "WellenreiterBase" ); @@ -69,34 +70,36 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TabWidget = new QTabWidget( this, "TabWidget" ); #endif ap = new QWidget( TabWidget, "ap" ); apLayout = new QVBoxLayout( ap ); apLayout->setSpacing( 2 ); apLayout->setMargin( 2 ); //--------- NETVIEW TAB -------------- netview = new MScanListView( ap ); apLayout->addWidget( netview ); - //--------- LOG TAB -------------- logwindow = new MLogWindow( TabWidget, "Log" ); - //--------- HEX TAB -------------- hexwindow = new MHexWindow( TabWidget, "Hex" ); + //--------- STAT TAB -------------- + + statwindow = new MStatWindow( TabWidget, "Stat" ); + //--------- ABOUT TAB -------------- about = new QWidget( TabWidget, "about" ); aboutLayout = new QGridLayout( about ); aboutLayout->setSpacing( 6 ); aboutLayout->setMargin( 11 ); PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); PixmapLabel1_3_2->setLineWidth( 2 ); @@ -116,43 +119,45 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TextLabel1_4_2->setText( tr( "<p align=center>\n" "<hr>\n" "Max Moser<br>\n" "Martin J. Muench<br>\n" "Michael Lauer<br><hr>\n" "<b>www.remote-exploit.org</b>\n" "</p>" ) ); TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); #ifdef QWS - TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); + TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); + TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stats" ) ); TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); #else TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); + TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); #endif WellenreiterBaseLayout->addWidget( TabWidget ); - + #ifdef QWS - TabWidget->setCurrentTab( tr( "Networks" ) ); + TabWidget->setCurrentTab( tr( "Nets" ) ); #endif } -/* +/* * Destroys the object and frees any allocated resources */ WellenreiterBase::~WellenreiterBase() { // no need to delete child widgets, Qt does it all for us } /* * Main event handler. Reimplemented to handle application * font changes */ bool WellenreiterBase::event( QEvent* ev ) diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h index 1fa1ea3..ad2e96c 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.h +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h @@ -18,55 +18,57 @@ #include <qvariant.h> #include <qwidget.h> class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QLabel; class MScanListView; class MScanListItem; class QPushButton; class MLogWindow; class MHexWindow; +class MStatWindow; #ifdef QWS class OTabWidget; #else class QTabWidget; #endif class WellenreiterBase : public QWidget { Q_OBJECT public: WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~WellenreiterBase(); #ifdef QWS OTabWidget* TabWidget; #else QTabWidget* TabWidget; #endif QWidget* ap; MScanListView* netview; MLogWindow* logwindow; MHexWindow* hexwindow; + MStatWindow* statwindow; QWidget* about; QLabel* PixmapLabel1_3_2; QLabel* TextLabel1_4_2; protected: QVBoxLayout* WellenreiterBaseLayout; QVBoxLayout* apLayout; QGridLayout* aboutLayout; bool event( QEvent* ); QPixmap* ani1; QPixmap* ani2; QPixmap* ani3; QPixmap* ani4; - + }; #endif // WELLENREITERBASE_H |