author | mickeyl <mickeyl> | 2003-03-03 23:54:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-03 23:54:03 (UTC) |
commit | 8173569e94a72051d80b8441e70fa1d99f79ef3e (patch) (unidiff) | |
tree | 725b67bbee90a0deebb5177f58329cf23ee21baf | |
parent | 3688aa2cd692e3226f67a599daea99e35a36036f (diff) | |
download | opie-8173569e94a72051d80b8441e70fa1d99f79ef3e.zip opie-8173569e94a72051d80b8441e70fa1d99f79ef3e.tar.gz opie-8173569e94a72051d80b8441e70fa1d99f79ef3e.tar.bz2 |
add exit to file menu (not that someone would want to exit this fine app... :-D
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 9065351..1185f84 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -54,128 +54,130 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
54 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 54 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
55 | setIconText( "Wellenreiter/X11" ); | 55 | setIconText( "Wellenreiter/X11" ); |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | // setup icon sets | 58 | // setup icon sets |
59 | 59 | ||
60 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 60 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
61 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 61 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
62 | #ifdef QWS | 62 | #ifdef QWS |
63 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 63 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
64 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 64 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
65 | #else | 65 | #else |
66 | startStopIconSet = new QIconSet(); | 66 | startStopIconSet = new QIconSet(); |
67 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); | 67 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); |
68 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); | 68 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | // setup tool buttons | 71 | // setup tool buttons |
72 | 72 | ||
73 | startStopButton = new QToolButton( 0 ); | 73 | startStopButton = new QToolButton( 0 ); |
74 | #ifdef QWS | 74 | #ifdef QWS |
75 | startStopButton->setAutoRaise( true ); | 75 | startStopButton->setAutoRaise( true ); |
76 | #endif | 76 | #endif |
77 | #ifdef QWS | 77 | #ifdef QWS |
78 | startStopButton->setOnIconSet( *cancelIconSet ); | 78 | startStopButton->setOnIconSet( *cancelIconSet ); |
79 | startStopButton->setOffIconSet( *searchIconSet ); | 79 | startStopButton->setOffIconSet( *searchIconSet ); |
80 | #else | 80 | #else |
81 | startStopButton->setIconSet( *startStopIconSet ); | 81 | startStopButton->setIconSet( *startStopIconSet ); |
82 | #endif | 82 | #endif |
83 | startStopButton->setToggleButton( true ); | 83 | startStopButton->setToggleButton( true ); |
84 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | 84 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); |
85 | startStopButton->setEnabled( false ); | 85 | startStopButton->setEnabled( false ); |
86 | 86 | ||
87 | QToolButton* c = new QToolButton( 0 ); | 87 | QToolButton* c = new QToolButton( 0 ); |
88 | #ifdef QWS | 88 | #ifdef QWS |
89 | c->setAutoRaise( true ); | 89 | c->setAutoRaise( true ); |
90 | #endif | 90 | #endif |
91 | c->setIconSet( *infoIconSet ); | 91 | c->setIconSet( *infoIconSet ); |
92 | c->setEnabled( false ); | 92 | c->setEnabled( false ); |
93 | 93 | ||
94 | QToolButton* d = new QToolButton( 0 ); | 94 | QToolButton* d = new QToolButton( 0 ); |
95 | #ifdef QWS | 95 | #ifdef QWS |
96 | d->setAutoRaise( true ); | 96 | d->setAutoRaise( true ); |
97 | #endif | 97 | #endif |
98 | d->setIconSet( *settingsIconSet ); | 98 | d->setIconSet( *settingsIconSet ); |
99 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 99 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
100 | 100 | ||
101 | // setup menu bar | 101 | // setup menu bar |
102 | 102 | ||
103 | int id; | 103 | int id; |
104 | 104 | ||
105 | QMenuBar* mb = menuBar(); | 105 | QMenuBar* mb = menuBar(); |
106 | 106 | ||
107 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 107 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
108 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); | 108 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); |
109 | fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); | 109 | fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); |
110 | 110 | ||
111 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 111 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
112 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); | 112 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); |
113 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 113 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
114 | 114 | ||
115 | QPopupMenu* file = new QPopupMenu( mb ); | 115 | QPopupMenu* file = new QPopupMenu( mb ); |
116 | id = file->insertItem( "&Load", fileLoad ); | 116 | id = file->insertItem( "&Load", fileLoad ); |
117 | file->insertItem( "&Save", fileSave ); | 117 | file->insertItem( "&Save", fileSave ); |
118 | file->insertSeparator(); | ||
119 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); | ||
118 | 120 | ||
119 | QPopupMenu* view = new QPopupMenu( mb ); | 121 | QPopupMenu* view = new QPopupMenu( mb ); |
120 | view->insertItem( "&Configure..." ); | 122 | view->insertItem( "&Configure..." ); |
121 | 123 | ||
122 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 124 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
123 | sniffer->insertItem( "&Configure..." ); | 125 | sniffer->insertItem( "&Configure..." ); |
124 | sniffer->insertSeparator(); | 126 | sniffer->insertSeparator(); |
125 | 127 | ||
126 | QPopupMenu* demo = new QPopupMenu( mb ); | 128 | QPopupMenu* demo = new QPopupMenu( mb ); |
127 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 129 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); |
128 | 130 | ||
129 | id = mb->insertItem( "&File", file ); | 131 | id = mb->insertItem( "&File", file ); |
130 | id = mb->insertItem( "&View", view ); | 132 | id = mb->insertItem( "&View", view ); |
131 | mb->setItemEnabled( id, false ); | 133 | mb->setItemEnabled( id, false ); |
132 | id = mb->insertItem( "&Sniffer", sniffer ); | 134 | id = mb->insertItem( "&Sniffer", sniffer ); |
133 | mb->setItemEnabled( id, false ); | 135 | mb->setItemEnabled( id, false ); |
134 | id = mb->insertItem( "&Demo", demo ); | 136 | id = mb->insertItem( "&Demo", demo ); |
135 | mb->setItemEnabled( id, true ); | 137 | mb->setItemEnabled( id, true ); |
136 | 138 | ||
137 | #ifdef QWS | 139 | #ifdef QWS |
138 | mb->insertItem( startStopButton ); | 140 | mb->insertItem( startStopButton ); |
139 | mb->insertItem( c ); | 141 | mb->insertItem( c ); |
140 | mb->insertItem( d ); | 142 | mb->insertItem( d ); |
141 | #else // Qt3 changed the insertion order. It's now totally random :( | 143 | #else // Qt3 changed the insertion order. It's now totally random :( |
142 | mb->insertItem( d ); | 144 | mb->insertItem( d ); |
143 | mb->insertItem( c ); | 145 | mb->insertItem( c ); |
144 | mb->insertItem( startStopButton ); | 146 | mb->insertItem( startStopButton ); |
145 | #endif | 147 | #endif |
146 | 148 | ||
147 | // setup status bar (for now only on X11) | 149 | // setup status bar (for now only on X11) |
148 | 150 | ||
149 | #ifndef QWS | 151 | #ifndef QWS |
150 | statusBar()->message( "Ready." ); | 152 | statusBar()->message( "Ready." ); |
151 | #endif | 153 | #endif |
152 | 154 | ||
153 | }; | 155 | }; |
154 | 156 | ||
155 | void WellenreiterMainWindow::showConfigure() | 157 | void WellenreiterMainWindow::showConfigure() |
156 | { | 158 | { |
157 | qDebug( "show configure..." ); | 159 | qDebug( "show configure..." ); |
158 | cw->setCaption( tr( "Configure" ) ); | 160 | cw->setCaption( tr( "Configure" ) ); |
159 | #ifdef QWS | 161 | #ifdef QWS |
160 | cw->showMaximized(); | 162 | cw->showMaximized(); |
161 | #endif | 163 | #endif |
162 | int result = cw->exec(); | 164 | int result = cw->exec(); |
163 | 165 | ||
164 | if ( result ) | 166 | if ( result ) |
165 | { | 167 | { |
166 | // check configuration from config window | 168 | // check configuration from config window |
167 | 169 | ||
168 | const QString& interface = cw->interfaceName->currentText(); | 170 | const QString& interface = cw->interfaceName->currentText(); |
169 | const int cardtype = cw->daemonDeviceType(); | 171 | const int cardtype = cw->daemonDeviceType(); |
170 | const int interval = cw->daemonHopInterval(); | 172 | const int interval = cw->daemonHopInterval(); |
171 | 173 | ||
172 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 174 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
173 | startStopButton->setEnabled( true ); | 175 | startStopButton->setEnabled( true ); |
174 | //TODO ... | 176 | //TODO ... |
175 | else | 177 | else |
176 | startStopButton->setEnabled( false ); | 178 | startStopButton->setEnabled( false ); |
177 | //TODO ... | 179 | //TODO ... |
178 | } | 180 | } |
179 | } | 181 | } |
180 | 182 | ||
181 | WellenreiterMainWindow::~WellenreiterMainWindow() | 183 | WellenreiterMainWindow::~WellenreiterMainWindow() |