Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index a331925..d255c6a 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -52,12 +52,14 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
52 | { | 52 | { |
53 | if ( it.current()->isWireless() ) | 53 | if ( it.current()->isWireless() ) |
54 | interfaceName->insertItem( it.current()->name() ); | 54 | interfaceName->insertItem( it.current()->name() ); |
55 | ++it; | 55 | ++it; |
56 | } | 56 | } |
57 | 57 | ||
58 | if ( !load() ) // no configuration present | ||
59 | { | ||
58 | // try to guess device type | 60 | // try to guess device type |
59 | QFile m( "/proc/modules" ); | 61 | QFile m( "/proc/modules" ); |
60 | if ( m.open( IO_ReadOnly ) ) | 62 | if ( m.open( IO_ReadOnly ) ) |
61 | { | 63 | { |
62 | int devicetype(0); | 64 | int devicetype(0); |
63 | QString line; | 65 | QString line; |
@@ -74,12 +76,13 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
74 | { | 76 | { |
75 | deviceType->setCurrentItem( devicetype ); | 77 | deviceType->setCurrentItem( devicetype ); |
76 | _guess = devicetype; | 78 | _guess = devicetype; |
77 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | 79 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); |
78 | } | 80 | } |
79 | } | 81 | } |
82 | } | ||
80 | 83 | ||
81 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | 84 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here |
82 | QPushButton* okButton = new QPushButton( "ok", this ); | 85 | QPushButton* okButton = new QPushButton( "ok", this ); |
83 | okButton->show(); | 86 | okButton->show(); |
84 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui | 87 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui |
85 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 88 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
@@ -92,12 +95,18 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
92 | 95 | ||
93 | // make the checkbox 'channelAll' control all other channels | 96 | // make the checkbox 'channelAll' control all other channels |
94 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); | 97 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); |
95 | }; | 98 | }; |
96 | 99 | ||
97 | 100 | ||
101 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | ||
102 | { | ||
103 | save(); | ||
104 | } | ||
105 | |||
106 | |||
98 | int WellenreiterConfigWindow::driverType() const | 107 | int WellenreiterConfigWindow::driverType() const |
99 | { | 108 | { |
100 | QString name = deviceType->currentText(); | 109 | QString name = deviceType->currentText(); |
101 | if ( _devicetype.contains( name ) ) | 110 | if ( _devicetype.contains( name ) ) |
102 | { | 111 | { |
103 | return _devicetype[name]; | 112 | return _devicetype[name]; |
@@ -205,6 +214,28 @@ const QString WellenreiterConfigWindow::gpsHost() const | |||
205 | 214 | ||
206 | int WellenreiterConfigWindow::gpsPort() const | 215 | int WellenreiterConfigWindow::gpsPort() const |
207 | { | 216 | { |
208 | bool ok; | 217 | bool ok; |
209 | return useGPS() ? gpsdPort->value() : -1; | 218 | return useGPS() ? gpsdPort->value() : -1; |
210 | } | 219 | } |
220 | |||
221 | |||
222 | bool WellenreiterConfigWindow::load() | ||
223 | { | ||
224 | #ifdef Q_WS_X11 | ||
225 | #warning Persistent Configuration not yet implemented for standalone X11 build | ||
226 | return false; | ||
227 | #else | ||
228 | qDebug( "loading configuration settings..." ); | ||
229 | return true; | ||
230 | #endif | ||
231 | } | ||
232 | |||
233 | |||
234 | void WellenreiterConfigWindow::save() | ||
235 | { | ||
236 | #ifdef Q_WS_X11 | ||
237 | #warning Persistent Configuration not yet implemented for standalone X11 build | ||
238 | #else | ||
239 | qDebug( "saving configuration settings..." ); | ||
240 | #endif | ||
241 | } | ||