Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 74 |
1 files changed, 61 insertions, 13 deletions
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 @@ -15,2 +15,3 @@ +#include "configwindow.h" #include "mainwindow.h" @@ -18,2 +19,3 @@ +#include <qcombobox.h> #include <qiconset.h> @@ -33,3 +35,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n { + cw = new WellenreiterConfigWindow( this ); mw = new Wellenreiter( this ); + mw->setConfigWindow( cw ); setCentralWidget( mw ); @@ -45,7 +49,9 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n - 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 ); @@ -59,2 +65,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n d->setIconSet( *settingsIconSet ); + connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); @@ -64,14 +71,31 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n - 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 @@ -79,2 +103,26 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n +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() |