Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 6cd364c..c4a8fbc 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -81,102 +81,102 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
81 | stopButton->setEnabled( false ); | 81 | stopButton->setEnabled( false ); |
82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); | 82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
83 | 83 | ||
84 | QToolButton* c = new QToolButton( 0 ); | 84 | QToolButton* c = new QToolButton( 0 ); |
85 | #ifdef QWS | 85 | #ifdef QWS |
86 | c->setAutoRaise( true ); | 86 | c->setAutoRaise( true ); |
87 | #endif | 87 | #endif |
88 | c->setIconSet( *infoIconSet ); | 88 | c->setIconSet( *infoIconSet ); |
89 | c->setEnabled( false ); | 89 | c->setEnabled( false ); |
90 | 90 | ||
91 | QToolButton* d = new QToolButton( 0 ); | 91 | QToolButton* d = new QToolButton( 0 ); |
92 | #ifdef QWS | 92 | #ifdef QWS |
93 | d->setAutoRaise( true ); | 93 | d->setAutoRaise( true ); |
94 | #endif | 94 | #endif |
95 | d->setIconSet( *settingsIconSet ); | 95 | d->setIconSet( *settingsIconSet ); |
96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
97 | 97 | ||
98 | // setup menu bar | 98 | // setup menu bar |
99 | 99 | ||
100 | int id; | 100 | int id; |
101 | 101 | ||
102 | QMenuBar* mb = menuBar(); | 102 | QMenuBar* mb = menuBar(); |
103 | 103 | ||
104 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 104 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
105 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); | 105 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); |
106 | fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) ); | 106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); |
107 | fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) ); | 107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); |
108 | 108 | ||
109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
110 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); | 110 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); |
111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
112 | 112 | ||
113 | QPopupMenu* file = new QPopupMenu( mb ); | 113 | QPopupMenu* file = new QPopupMenu( mb ); |
114 | file->insertItem( "&New", this, SLOT( fileNew() ) ); | 114 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
115 | id = file->insertItem( "&Load", fileLoad ); | 115 | id = file->insertItem( tr( "&Load" ), fileLoad ); |
116 | file->insertItem( "&Save", fileSave ); | 116 | file->insertItem( tr( "&Save" ), fileSave ); |
117 | file->insertSeparator(); | 117 | file->insertSeparator(); |
118 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); | 118 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
119 | 119 | ||
120 | QPopupMenu* view = new QPopupMenu( mb ); | 120 | QPopupMenu* view = new QPopupMenu( mb ); |
121 | view->insertItem( "&Configure..." ); | 121 | view->insertItem( tr( "&Configure..." ) ); |
122 | 122 | ||
123 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 123 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
124 | sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) ); | 124 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
125 | sniffer->insertSeparator(); | 125 | sniffer->insertSeparator(); |
126 | startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) ); | 126 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
127 | sniffer->setItemEnabled( startID, false ); | 127 | sniffer->setItemEnabled( startID, false ); |
128 | stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) ); | 128 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
129 | sniffer->setItemEnabled( stopID, false ); | 129 | sniffer->setItemEnabled( stopID, false ); |
130 | 130 | ||
131 | QPopupMenu* demo = new QPopupMenu( mb ); | 131 | QPopupMenu* demo = new QPopupMenu( mb ); |
132 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 132 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
133 | 133 | ||
134 | id = mb->insertItem( "&File", file ); | 134 | id = mb->insertItem( tr( "&File" ), file ); |
135 | id = mb->insertItem( "&View", view ); | 135 | id = mb->insertItem( tr( "&View" ), view ); |
136 | mb->setItemEnabled( id, false ); | 136 | mb->setItemEnabled( id, false ); |
137 | id = mb->insertItem( "&Sniffer", sniffer ); | 137 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
138 | id = mb->insertItem( "&Demo", demo ); | 138 | id = mb->insertItem( tr( "&Demo" ), demo ); |
139 | mb->setItemEnabled( id, true ); | 139 | mb->setItemEnabled( id, true ); |
140 | 140 | ||
141 | #ifdef QWS | 141 | #ifdef QWS |
142 | mb->insertItem( startButton ); | 142 | mb->insertItem( startButton ); |
143 | mb->insertItem( stopButton ); | 143 | mb->insertItem( stopButton ); |
144 | mb->insertItem( c ); | 144 | mb->insertItem( c ); |
145 | mb->insertItem( d ); | 145 | mb->insertItem( d ); |
146 | #else // Qt3 changed the insertion order. It's now totally random :( | 146 | #else // Qt3 changed the insertion order. It's now totally random :( |
147 | mb->insertItem( d ); | 147 | mb->insertItem( d ); |
148 | mb->insertItem( c ); | 148 | mb->insertItem( c ); |
149 | mb->insertItem( stopButton ); | 149 | mb->insertItem( stopButton ); |
150 | mb->insertItem( startButton ); | 150 | mb->insertItem( startButton ); |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | updateToolButtonState(); | 153 | updateToolButtonState(); |
154 | 154 | ||
155 | // setup status bar (for now only on X11) | 155 | // setup status bar (for now only on X11) |
156 | 156 | ||
157 | #ifndef QWS | 157 | #ifndef QWS |
158 | statusBar()->message( "Ready." ); | 158 | statusBar()->message( tr( "Ready." ) ); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
163 | }; | 163 | }; |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | void WellenreiterMainWindow::showConfigure() | 167 | void WellenreiterMainWindow::showConfigure() |
168 | { | 168 | { |
169 | qDebug( "show configure..." ); | 169 | qDebug( "show configure..." ); |
170 | cw->setCaption( tr( "Configure" ) ); | 170 | cw->setCaption( tr( "Configure" ) ); |
171 | #ifdef QWS | 171 | #ifdef QWS |
172 | cw->showMaximized(); | 172 | cw->showMaximized(); |
173 | #endif | 173 | #endif |
174 | int result = cw->exec(); | 174 | int result = cw->exec(); |
175 | 175 | ||
176 | if ( result ) updateToolButtonState(); | 176 | if ( result ) updateToolButtonState(); |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | 180 | ||
181 | void WellenreiterMainWindow::updateToolButtonState() | 181 | void WellenreiterMainWindow::updateToolButtonState() |
182 | { | 182 | { |
@@ -209,51 +209,51 @@ void WellenreiterMainWindow::changedSniffingState() | |||
209 | WellenreiterMainWindow::~WellenreiterMainWindow() | 209 | WellenreiterMainWindow::~WellenreiterMainWindow() |
210 | { | 210 | { |
211 | delete infoIconSet; | 211 | delete infoIconSet; |
212 | delete settingsIconSet; | 212 | delete settingsIconSet; |
213 | delete startIconSet; | 213 | delete startIconSet; |
214 | delete stopIconSet; | 214 | delete stopIconSet; |
215 | }; | 215 | }; |
216 | 216 | ||
217 | void WellenreiterMainWindow::demoAddStations() | 217 | void WellenreiterMainWindow::demoAddStations() |
218 | { | 218 | { |
219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); | 220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); | 221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); | 222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); | 223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | QString WellenreiterMainWindow::getFileName( bool save ) | 227 | QString WellenreiterMainWindow::getFileName( bool save ) |
228 | { | 228 | { |
229 | QMap<QString, QStringList> map; | 229 | QMap<QString, QStringList> map; |
230 | map.insert( tr("All"), QStringList() ); | 230 | map.insert( tr("All"), QStringList() ); |
231 | QStringList text; | 231 | QStringList text; |
232 | text << "text/*"; | 232 | text << "text/*"; |
233 | map.insert(tr("Text"), text ); | 233 | map.insert( tr("Text"), text ); |
234 | text << "*"; | 234 | text << "*"; |
235 | map.insert(tr("All"), text ); | 235 | map.insert( tr("All"), text ); |
236 | 236 | ||
237 | QString str; | 237 | QString str; |
238 | if ( save ) | 238 | if ( save ) |
239 | { | 239 | { |
240 | #ifdef QWS | 240 | #ifdef QWS |
241 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); | 241 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
242 | #else | 242 | #else |
243 | str = QFileDialog::getSaveFileName(); | 243 | str = QFileDialog::getSaveFileName(); |
244 | #endif | 244 | #endif |
245 | if ( str.isEmpty() || QFileInfo(str).isDir() ) | 245 | if ( str.isEmpty() || QFileInfo(str).isDir() ) |
246 | return ""; | 246 | return ""; |
247 | } | 247 | } |
248 | else | 248 | else |
249 | { | 249 | { |
250 | #ifdef QWS | 250 | #ifdef QWS |
251 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); | 251 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); |
252 | #else | 252 | #else |
253 | str = QFileDialog::getOpenFileName(); | 253 | str = QFileDialog::getOpenFileName(); |
254 | #endif | 254 | #endif |
255 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) | 255 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) |
256 | return ""; | 256 | return ""; |
257 | } | 257 | } |
258 | return str; | 258 | return str; |
259 | } | 259 | } |
@@ -330,32 +330,33 @@ void WellenreiterMainWindow::fileLoadSession() | |||
330 | { | 330 | { |
331 | QDataStream t( &f ); | 331 | QDataStream t( &f ); |
332 | t >> *mw->netView(); | 332 | t >> *mw->netView(); |
333 | f.close(); | 333 | f.close(); |
334 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 334 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
335 | } | 335 | } |
336 | else | 336 | else |
337 | { | 337 | { |
338 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 338 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | void WellenreiterMainWindow::fileNew() | 343 | void WellenreiterMainWindow::fileNew() |
344 | { | 344 | { |
345 | mw->netView()->clear(); | 345 | mw->netView()->clear(); |
346 | mw->logWindow()->clear(); | 346 | mw->logWindow()->clear(); |
347 | mw->hexWindow()->clear(); | 347 | mw->hexWindow()->clear(); |
348 | } | 348 | } |
349 | 349 | ||
350 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 350 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
351 | { | 351 | { |
352 | if ( mw->isDaemonRunning() ) | 352 | if ( mw->isDaemonRunning() ) |
353 | { | 353 | { |
354 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); | 354 | QMessageBox::warning( this, "Wellenreiter/Opie", |
355 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); | ||
355 | e->ignore(); | 356 | e->ignore(); |
356 | } | 357 | } |
357 | else | 358 | else |
358 | { | 359 | { |
359 | QMainWindow::closeEvent( e ); | 360 | QMainWindow::closeEvent( e ); |
360 | } | 361 | } |
361 | } | 362 | } |