Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 67 |
1 files changed, 49 insertions, 18 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 | |||
@@ -55,26 +55,29 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
55 | ++it; | 55 | ++it; |
56 | } | 56 | } |
57 | 57 | ||
58 | // try to guess device type | 58 | if ( !load() ) // no configuration present |
59 | QFile m( "/proc/modules" ); | ||
60 | if ( m.open( IO_ReadOnly ) ) | ||
61 | { | 59 | { |
62 | int devicetype(0); | 60 | // try to guess device type |
63 | QString line; | 61 | QFile m( "/proc/modules" ); |
64 | QTextStream modules( &m ); | 62 | if ( m.open( IO_ReadOnly ) ) |
65 | while( !modules.atEnd() && !devicetype ) | ||
66 | { | 63 | { |
67 | modules >> line; | 64 | int devicetype(0); |
68 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; | 65 | QString line; |
69 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; | 66 | QTextStream modules( &m ); |
70 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; | 67 | while( !modules.atEnd() && !devicetype ) |
71 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; | 68 | { |
72 | } | 69 | modules >> line; |
73 | if ( devicetype ) | 70 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; |
74 | { | 71 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; |
75 | deviceType->setCurrentItem( devicetype ); | 72 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; |
76 | _guess = devicetype; | 73 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; |
77 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | 74 | } |
75 | if ( devicetype ) | ||
76 | { | ||
77 | deviceType->setCurrentItem( devicetype ); | ||
78 | _guess = devicetype; | ||
79 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | ||
80 | } | ||
78 | } | 81 | } |
79 | } | 82 | } |
80 | 83 | ||
@@ -95,6 +98,12 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
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(); |
@@ -208,3 +217,25 @@ int WellenreiterConfigWindow::gpsPort() const | |||
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 | } | ||