Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (ignore 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 @@ | |||
15 | 15 | ||
16 | #include "configwindow.h" | ||
16 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
@@ -18,2 +19,3 @@ | |||
18 | 19 | ||
20 | #include <qcombobox.h> | ||
19 | #include <qiconset.h> | 21 | #include <qiconset.h> |
@@ -33,3 +35,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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 ); |
@@ -45,7 +49,9 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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 | ||
@@ -59,2 +65,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
59 | d->setIconSet( *settingsIconSet ); | 65 | d->setIconSet( *settingsIconSet ); |
66 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | ||
60 | 67 | ||
@@ -64,14 +71,31 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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 | ||
@@ -79,2 +103,26 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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() |