summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-12-09 21:33:48 (UTC)
committer mickeyl <mickeyl>2003-12-09 21:33:48 (UTC)
commit0a1f6405780b18c9f3d953adcfd072de8fd4dc18 (patch) (side-by-side diff)
treeb155d2ee3c7766155b028f4e8ee92599fd50e8a9
parentdc1fc74ee3988fb3a89f6fc46cbcfe8b74416647 (diff)
downloadopie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.zip
opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.tar.gz
opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.tar.bz2
misc. fixes and preparations for uploading dumps
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp56
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h8
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp38
3 files changed, 54 insertions, 48 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 868b0b0..ab7e0c7 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -54,51 +54,45 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
#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" ) );
- startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
- stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
-
// setup tool buttons
startButton = new QToolButton( 0 );
#ifdef QWS
startButton->setAutoRaise( true );
#endif
- startButton->setIconSet( *startIconSet );
+ startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) );
startButton->setEnabled( false );
connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) );
stopButton = new QToolButton( 0 );
#ifdef QWS
stopButton->setAutoRaise( true );
#endif
- stopButton->setIconSet( *stopIconSet );
+ stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) );
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
- d->setIconSet( *settingsIconSet );
+ d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) );
connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
+ uploadButton = new QToolButton( 0 );
+ #ifdef QWS
+ uploadButton->setAutoRaise( true );
+ #endif
+ uploadButton->setIconSet( Resource::loadIconSet( "up" ) );
+ uploadButton->setEnabled( false );
+ connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) );
+
// setup menu bar
int id;
QMenuBar* mb = menuBar();
@@ -113,12 +107,14 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
QPopupMenu* file = new QPopupMenu( mb );
file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) );
id = file->insertItem( tr( "&Load" ), fileLoad );
file->insertItem( tr( "&Save" ), fileSave );
file->insertSeparator();
+ uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) );
+ file->insertSeparator();
file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) );
QPopupMenu* view = new QPopupMenu( mb );
view->insertItem( tr( "&Configure..." ) );
QPopupMenu* sniffer = new QPopupMenu( mb );
@@ -136,21 +132,22 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
//id = mb->insertItem( tr( "&View" ), view );
//mb->setItemEnabled( id, false );
id = mb->insertItem( tr( "&Sniffer" ), sniffer );
id = mb->insertItem( tr( "&Demo" ), demo );
mb->setItemEnabled( id, true );
+ mb->setItemEnabled( uploadID, false );
#ifdef QWS
mb->insertItem( startButton );
mb->insertItem( stopButton );
- mb->insertItem( c );
+ mb->insertItem( uploadButton );
mb->insertItem( d );
#else // Qt3 changed the insertion order. It's now totally random :(
mb->insertItem( d );
- mb->insertItem( c );
+ mb->insertItem( uploadButton );
mb->insertItem( stopButton );
mb->insertItem( startButton );
#endif
updateToolButtonState();
@@ -176,13 +173,12 @@ void WellenreiterMainWindow::showConfigure()
int result = cw->exec();
if ( result ) updateToolButtonState();
}
-
void WellenreiterMainWindow::updateToolButtonState()
{
const QString& interface = cw->interfaceName->currentText();
const int cardtype = cw->driverType();
if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
@@ -201,23 +197,27 @@ void WellenreiterMainWindow::updateToolButtonState()
void WellenreiterMainWindow::changedSniffingState()
{
startButton->setEnabled( !mw->sniffing );
menuBar()->setItemEnabled( startID, !mw->sniffing );
stopButton->setEnabled( mw->sniffing );
menuBar()->setItemEnabled( stopID, mw->sniffing );
+
+ if ( !mw->sniffing )
+ {
+ menuBar()->setItemEnabled( uploadID, true );
+ uploadButton->setEnabled( true );
+ }
}
WellenreiterMainWindow::~WellenreiterMainWindow()
{
- delete infoIconSet;
- delete settingsIconSet;
- delete startIconSet;
- delete stopIconSet;
+ qDebug( "Wellenreiter:: bye." );
};
+
void WellenreiterMainWindow::demoAddStations()
{
//mw = 0; // test SIGSGV handling
mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) );
mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
@@ -340,19 +340,21 @@ void WellenreiterMainWindow::fileLoadSession()
{
qDebug( "Problem loading session from file '%s'", (const char*) fname );
}
}
}
+
void WellenreiterMainWindow::fileNew()
{
mw->netView()->clear();
mw->logWindow()->clear();
mw->hexWindow()->clear();
}
+
void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
{
if ( mw->isDaemonRunning() )
{
QMessageBox::warning( this, "Wellenreiter/Opie",
tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) );
@@ -362,6 +364,12 @@ void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
{
QMainWindow::closeEvent( e );
}
}
+void WellenreiterMainWindow::uploadSession()
+{
+ QMessageBox::warning( this, "Wellenreiter/Opie",
+ tr( "This feature is\nunder construction... ;-)" ) );
+}
+
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h
index 926bb0a..8d4e768 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.h
+++ b/noncore/net/wellenreiter/gui/mainwindow.h
@@ -33,21 +33,18 @@ class WellenreiterMainWindow: public QMainWindow
QString getFileName( bool save );
protected:
Wellenreiter* mw;
WellenreiterConfigWindow* cw;
- const QIconSet* startIconSet;
- const QIconSet* stopIconSet;
- const QIconSet* infoIconSet;
- const QIconSet* settingsIconSet;
-
QToolButton* startButton;
QToolButton* stopButton;
+ QToolButton* uploadButton;
int startID;
int stopID;
+ int uploadID;
protected:
virtual void closeEvent( QCloseEvent* );
void updateToolButtonState();
public slots:
@@ -55,10 +52,11 @@ class WellenreiterMainWindow: public QMainWindow
void demoAddStations();
void fileSaveLog();
void fileSaveHex();
void fileSaveSession();
void fileLoadSession();
void fileNew();
+ void uploadSession();
void changedSniffingState();
};
#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 1d4a98b..ec89f1e 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -299,13 +299,13 @@ QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
bool Wellenreiter::checkDumpPacket( OPacket* p )
{
// go through all child packets and see if one is inside the child hierarchy for p
// if so, do what the user requested (protocolAction), e.g. pass or discard
if ( !configwindow->writeCaptureFile->isChecked() )
- return false;
+ return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
QObjectList* l = p->queryList();
QObjectListIt it( *l );
QObject* o;
while ( (o = it.current()) != 0 )
@@ -503,35 +503,35 @@ void Wellenreiter::startClicked()
{
qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
}
// open pcap and start sniffing
- if ( cardtype != DEVTYPE_FILE )
- {
- pcap->open( interface );
- if ( configwindow->writeCaptureFile->isChecked() )
- {
- QString dumpname( configwindow->captureFileName->text() );
- if ( dumpname.isEmpty() ) dumpname = "captureFile";
- dumpname.append( '-' );
- dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
- dumpname.append( ".wellenreiter" );
- pcap->openDumpFile( dumpname );
- }
- else
- {
- pcap->open( interface );
- }
+ QString dumpname;
+ if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
+ {
+ dumpname = configwindow->captureFileName->text();
+ if ( dumpname.isEmpty() ) dumpname = "captureFile";
+ dumpname.append( '-' );
+ dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
+ dumpname.append( ".wellenreiter" );
}
- else
+ else // write it anyway ;)
{
- pcap->open( QFile( interface ) );
+ dumpname = "/var/log/dump.wellenreiter";
}
+ if ( cardtype != DEVTYPE_FILE )
+ pcap->open( interface );
+ else
+ pcap->open( QFile( interface ) );
+
+ qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname );
+ pcap->openDumpFile( dumpname );
+
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
return;
}