Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 94 |
1 files changed, 66 insertions, 28 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 84d4c63..3ec190b 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -59,4 +59,37 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
59 | 59 | ||
60 | if ( !load() ) // no configuration present | 60 | load(); |
61 | |||
62 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | ||
63 | QPushButton* okButton = new QPushButton( "ok", this ); | ||
64 | okButton->show(); | ||
65 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui | ||
66 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | ||
67 | #endif | ||
68 | |||
69 | WellenreiterConfigWindow::_instance = this; | ||
70 | |||
71 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); | ||
72 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); | ||
73 | |||
74 | // make the checkbox 'channelAll' control all other channels | ||
75 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); | ||
76 | |||
77 | connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); | ||
78 | }; | ||
79 | |||
80 | |||
81 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | ||
61 | { | 82 | { |
83 | save(); | ||
84 | } | ||
85 | |||
86 | |||
87 | void WellenreiterConfigWindow::performAutodetection() | ||
88 | { | ||
89 | //TODO: insert modal splash screen here | ||
90 | // and sleep a second, so that it looks | ||
91 | // like we're actually doing something fancy... ;-) | ||
92 | |||
93 | qDebug( "WellenreiterConfigWindow::performAutodetection()" ); | ||
94 | |||
62 | // try to guess device type | 95 | // try to guess device type |
@@ -85,24 +118,2 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
85 | 118 | ||
86 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | ||
87 | QPushButton* okButton = new QPushButton( "ok", this ); | ||
88 | okButton->show(); | ||
89 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui | ||
90 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | ||
91 | #endif | ||
92 | |||
93 | WellenreiterConfigWindow::_instance = this; | ||
94 | |||
95 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); | ||
96 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); | ||
97 | |||
98 | // make the checkbox 'channelAll' control all other channels | ||
99 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); | ||
100 | }; | ||
101 | |||
102 | |||
103 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | ||
104 | { | ||
105 | save(); | ||
106 | } | ||
107 | |||
108 | 119 | ||
@@ -223,3 +234,3 @@ int WellenreiterConfigWindow::gpsPort() const | |||
223 | 234 | ||
224 | bool WellenreiterConfigWindow::load() | 235 | void WellenreiterConfigWindow::load() |
225 | { | 236 | { |
@@ -227,3 +238,3 @@ bool WellenreiterConfigWindow::load() | |||
227 | #warning Persistent Configuration not yet implemented for standalone X11 build | 238 | #warning Persistent Configuration not yet implemented for standalone X11 build |
228 | return false; | 239 | performAutodetection(); |
229 | #else | 240 | #else |
@@ -236,4 +247,32 @@ bool WellenreiterConfigWindow::load() | |||
236 | c->setGroup( "Interface" ); | 247 | c->setGroup( "Interface" ); |
237 | //interfaceName->setCurrentText( c->readEntry( "name" ) ); | 248 | |
238 | //deviceType->setCurrentText( c->readEntry( "type", "<select>" ) ); | 249 | QString interface = c->readEntry( "name", "<none>" ); |
250 | if ( interface != "<none>" ) | ||
251 | { | ||
252 | #if QT_VERSION < 300 | ||
253 | interfaceName->insertItem( interface, 0 ); | ||
254 | interfaceName->setCurrentItem( 0 ); | ||
255 | #else | ||
256 | interfaceName->setCurrentText( interface ); | ||
257 | #endif | ||
258 | |||
259 | QString device = c->readEntry( "type", "<select>" ); | ||
260 | #if QT_VERSION < 300 | ||
261 | for ( int i = 0; i < deviceType->count(); ++i ) | ||
262 | { | ||
263 | if ( deviceType->text( i ) == device ) | ||
264 | { | ||
265 | deviceType->setCurrentItem( i ); | ||
266 | break; | ||
267 | } | ||
268 | } | ||
269 | #else | ||
270 | deviceType->setCurrentText( device ); | ||
271 | #endif | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | performAutodetection(); | ||
276 | } | ||
277 | |||
239 | prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); | 278 | prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); |
@@ -263,3 +302,2 @@ bool WellenreiterConfigWindow::load() | |||
263 | 302 | ||
264 | return false; // false = perform autodetection; true = use config settings | ||
265 | #endif | 303 | #endif |