summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
authormickeyl <mickeyl>2004-01-07 23:04:55 (UTC)
committer mickeyl <mickeyl>2004-01-07 23:04:55 (UTC)
commitcfb7335c5b65a79f5817b393e5a8b3345558f220 (patch) (unidiff)
treea8d2d2bcc0bd29a6aac7fec7325f058f148d466e /noncore/net/wellenreiter/gui/configwindow.cpp
parentc4d6574e85f74d6086c1709ecf0d117df7417222 (diff)
downloadopie-cfb7335c5b65a79f5817b393e5a8b3345558f220.zip
opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.gz
opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.bz2
A bunch of miscellaneous changes and improvements. read the ChangeLog :)
Oh and it's WIP - not everything mentioned there works already. Will soon, though.
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp103
1 files changed, 96 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index f536f4e..1341d03 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -17,6 +17,13 @@
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19 19
20/* OPIE */
21#include <opie2/onetwork.h>
22#ifdef QWS
23#include <opie2/oapplication.h>
24#include <opie2/oconfig.h>
25#endif
26
20/* QT */ 27/* QT */
21#include <qapplication.h> 28#include <qapplication.h>
22#include <qcheckbox.h> 29#include <qcheckbox.h>
@@ -26,17 +33,11 @@
26#include <qlayout.h> 33#include <qlayout.h>
27#include <qmap.h> 34#include <qmap.h>
28#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qtabwidget.h>
29#include <qtoolbutton.h> 37#include <qtoolbutton.h>
30#include <qspinbox.h> 38#include <qspinbox.h>
31#include <qtextstream.h> 39#include <qtextstream.h>
32 40
33/* OPIE */
34#include <opie2/onetwork.h>
35
36#ifdef QWS
37#include <opie2/oapplication.h>
38#include <opie2/oconfig.h>
39#endif
40 41
41WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 42WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
42 43
@@ -72,12 +73,18 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
72 WellenreiterConfigWindow::_instance = this; 73 WellenreiterConfigWindow::_instance = this;
73 74
74 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 75 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
76 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) );
77 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) );
78 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) );
75 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 79 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
76 80
77 // make the checkbox 'channelAll' control all other channels 81 // make the checkbox 'channelAll' control all other channels
78 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 82 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
79 83
80 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); 84 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) );
85
86 // hide tab4 (parse) until Wellenreiter 1.2
87 tab->removePage( tab_4 );
81}; 88};
82 89
83 90
@@ -185,6 +192,36 @@ void WellenreiterConfigWindow::changedDeviceType(int t)
185} 192}
186 193
187 194
195void WellenreiterConfigWindow::synchronizeActionsAndScripts()
196{
197 if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide();
198 if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide();
199 if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide();
200
201 //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 );
202 //newClientScript->setEnabled( newClientAction->currentItem() == 4 );
203 //newStationScript->setEnabled( newStationAction->currentItem() == 4 );
204}
205
206
207void WellenreiterConfigWindow::changedNetworkAction(int t)
208{
209 synchronizeActionsAndScripts();
210}
211
212
213void WellenreiterConfigWindow::changedClientAction(int t)
214{
215 synchronizeActionsAndScripts();
216}
217
218
219void WellenreiterConfigWindow::changedStationAction(int t)
220{
221 synchronizeActionsAndScripts();
222}
223
224
188void WellenreiterConfigWindow::getCaptureFileNameClicked() 225void WellenreiterConfigWindow::getCaptureFileNameClicked()
189{ 226{
190 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 227 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
@@ -235,6 +272,45 @@ int WellenreiterConfigWindow::gpsPort() const
235} 272}
236 273
237 274
275void WellenreiterConfigWindow::performAction( const QString& type )
276{
277 int action;
278 QString script;
279
280 if ( type == "network" )
281 {
282 action = newNetworkAction->currentItem();
283 script = newNetworkScript->text();
284 }
285 else if ( type == "managed" || type == "adhoc" )
286 {
287 action = newClientAction->currentItem();
288 script = newClientScript->text();
289 }
290 else if ( type == "station" )
291 {
292 action = newStationAction->currentItem();
293 script = newStationScript->text();
294 }
295 else
296 {
297 qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
298 return;
299 }
300
301 qDebug( "going to perform action %d (script='%s')", action, (const char*) script );
302
303 /*
304
305 if ( sound == "Ignore" ) return;
306 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
307 else if ( sound == "Key" ) ODevice::inst()->keySound();
308 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
309
310 */
311}
312
313
238void WellenreiterConfigWindow::load() 314void WellenreiterConfigWindow::load()
239{ 315{
240#ifdef Q_WS_X11 316#ifdef Q_WS_X11
@@ -290,6 +366,13 @@ void WellenreiterConfigWindow::load()
290 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); 366 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) );
291 openTree->setChecked( c->readBoolEntry( "openTree", true ) ); 367 openTree->setChecked( c->readBoolEntry( "openTree", true ) );
292 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); 368 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) );
369 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 0 ) );
370 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) );
371 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 0 ) );
372 newClientScript->setText( c->readEntry( "newClientScript", "" ) );
373 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 0 ) );
374 newStationScript->setText( c->readEntry( "newStationScript", "" ) );
375 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand
293 376
294 c->setGroup( "GPS" ); 377 c->setGroup( "GPS" );
295 enableGPS->setChecked( c->readBoolEntry( "use", false ) ); 378 enableGPS->setChecked( c->readBoolEntry( "use", false ) );
@@ -333,6 +416,12 @@ void WellenreiterConfigWindow::save()
333 c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); 416 c->writeEntry( "lookupVendor", lookupVendor->isChecked() );
334 c->writeEntry( "openTree", openTree->isChecked() ); 417 c->writeEntry( "openTree", openTree->isChecked() );
335 c->writeEntry( "disablePM", disablePM->isChecked() ); 418 c->writeEntry( "disablePM", disablePM->isChecked() );
419 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() );
420 c->writeEntry( "newNetworkScript", newNetworkScript->text() );
421 c->writeEntry( "newClientAction", newClientAction->currentItem() );
422 c->writeEntry( "newClientScript", newClientScript->text() );
423 c->writeEntry( "newStationAction", newStationAction->currentItem() );
424 c->writeEntry( "newStationScript", newStationScript->text() );
336 425
337 c->setGroup( "GPS" ); 426 c->setGroup( "GPS" );
338 c->writeEntry( "use", enableGPS->isChecked() ); 427 c->writeEntry( "use", enableGPS->isChecked() );