summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp94
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
- if ( !load() ) // no configuration present
+ load();
+
+ #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
+ QPushButton* okButton = new QPushButton( "ok", this );
+ okButton->show();
+ WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
+ connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ #endif
+
+ WellenreiterConfigWindow::_instance = this;
+
+ connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
+ connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
+
+ // make the checkbox 'channelAll' control all other channels
+ connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
+
+ connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) );
+};
+
+
+WellenreiterConfigWindow::~WellenreiterConfigWindow()
{
+ save();
+}
+
+
+void WellenreiterConfigWindow::performAutodetection()
+{
+ //TODO: insert modal splash screen here
+ // and sleep a second, so that it looks
+ // like we're actually doing something fancy... ;-)
+
+ qDebug( "WellenreiterConfigWindow::performAutodetection()" );
+
// try to guess device type
@@ -85,24 +118,2 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
- #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
- QPushButton* okButton = new QPushButton( "ok", this );
- okButton->show();
- WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
- connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
- #endif
-
- WellenreiterConfigWindow::_instance = this;
-
- connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
- connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
-
- // make the checkbox 'channelAll' control all other channels
- connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
-};
-
-
-WellenreiterConfigWindow::~WellenreiterConfigWindow()
-{
- save();
-}
-
@@ -223,3 +234,3 @@ int WellenreiterConfigWindow::gpsPort() const
-bool WellenreiterConfigWindow::load()
+void WellenreiterConfigWindow::load()
{
@@ -227,3 +238,3 @@ bool WellenreiterConfigWindow::load()
#warning Persistent Configuration not yet implemented for standalone X11 build
- return false;
+ performAutodetection();
#else
@@ -236,4 +247,32 @@ bool WellenreiterConfigWindow::load()
c->setGroup( "Interface" );
- //interfaceName->setCurrentText( c->readEntry( "name" ) );
- //deviceType->setCurrentText( c->readEntry( "type", "<select>" ) );
+
+ QString interface = c->readEntry( "name", "<none>" );
+ if ( interface != "<none>" )
+ {
+#if QT_VERSION < 300
+ interfaceName->insertItem( interface, 0 );
+ interfaceName->setCurrentItem( 0 );
+#else
+ interfaceName->setCurrentText( interface );
+#endif
+
+ QString device = c->readEntry( "type", "<select>" );
+#if QT_VERSION < 300
+ for ( int i = 0; i < deviceType->count(); ++i )
+ {
+ if ( deviceType->text( i ) == device )
+ {
+ deviceType->setCurrentItem( i );
+ break;
+ }
+ }
+#else
+ deviceType->setCurrentText( device );
+#endif
+ }
+ else
+ {
+ performAutodetection();
+ }
+
prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
@@ -263,3 +302,2 @@ bool WellenreiterConfigWindow::load()
- return false; // false = perform autodetection; true = use config settings
#endif