author | mickeyl <mickeyl> | 2003-02-23 15:14:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-23 15:14:18 (UTC) |
commit | 9b7faae2ec12eeb9a056ca6093ac6e0840b11717 (patch) (unidiff) | |
tree | fc4d9de4ee2fd5c502513ccf0fa592bfaaa87185 /noncore/net/wellenreiter/gui/mainwindow.cpp | |
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
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 | |||
@@ -4,88 +4,136 @@ | |||
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | ||
16 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
17 | #include "wellenreiter.h" | 18 | #include "wellenreiter.h" |
18 | 19 | ||
20 | #include <qcombobox.h> | ||
19 | #include <qiconset.h> | 21 | #include <qiconset.h> |
20 | #include <qmenubar.h> | 22 | #include <qmenubar.h> |
21 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
22 | #include <qstatusbar.h> | 24 | #include <qstatusbar.h> |
23 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
24 | 26 | ||
25 | #ifdef QWS | 27 | #ifdef QWS |
26 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
27 | #else | 29 | #else |
28 | #include "resource.h" | 30 | #include "resource.h" |
29 | #endif | 31 | #endif |
30 | 32 | ||
31 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 33 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
32 | :QMainWindow( parent, name, f ) | 34 | :QMainWindow( parent, name, f ) |
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 ); |
36 | 40 | ||
37 | // setup icon sets | 41 | // setup icon sets |
38 | 42 | ||
39 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 43 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
40 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 44 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
41 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 45 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
42 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 46 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
43 | 47 | ||
44 | // setup tool buttons | 48 | // setup tool buttons |
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 | ||
52 | QToolButton* c = new QToolButton( 0 ); | 58 | QToolButton* c = new QToolButton( 0 ); |
53 | c->setAutoRaise( true ); | 59 | c->setAutoRaise( true ); |
54 | c->setIconSet( *infoIconSet ); | 60 | c->setIconSet( *infoIconSet ); |
55 | c->setEnabled( false ); | 61 | c->setEnabled( false ); |
56 | 62 | ||
57 | QToolButton* d = new QToolButton( 0 ); | 63 | QToolButton* d = new QToolButton( 0 ); |
58 | d->setAutoRaise( true ); | 64 | d->setAutoRaise( true ); |
59 | d->setIconSet( *settingsIconSet ); | 65 | d->setIconSet( *settingsIconSet ); |
66 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | ||
60 | 67 | ||
61 | // setup menu bar | 68 | // setup menu bar |
62 | 69 | ||
63 | QMenuBar* mb = menuBar(); | 70 | QMenuBar* mb = menuBar(); |
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 | ||
78 | }; | 102 | }; |
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() |
81 | { | 129 | { |
82 | 130 | ||
83 | delete searchIconSet; | 131 | delete searchIconSet; |
84 | delete infoIconSet; | 132 | delete infoIconSet; |
85 | delete settingsIconSet; | 133 | delete settingsIconSet; |
86 | delete cancelIconSet; | 134 | delete cancelIconSet; |
87 | 135 | ||
88 | 136 | ||
89 | }; | 137 | }; |
90 | 138 | ||
91 | 139 | ||