-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index f82c088..68da712 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -91,255 +91,255 @@ 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 QFile m( "/proc/modules" ); if ( m.open( IO_ReadOnly ) ) { int devicetype(0); QString line; QTextStream modules( &m ); while( !modules.atEnd() && !devicetype ) { modules >> line; if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; } if ( devicetype ) { deviceType->setCurrentItem( devicetype ); _guess = devicetype; qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); } } } int WellenreiterConfigWindow::driverType() const { QString name = deviceType->currentText(); if ( _devicetype.contains( name ) ) { return _devicetype[name]; } else { return 0; } }; int WellenreiterConfigWindow::hoppingInterval() const { return hopInterval->cleanText().toInt(); } bool WellenreiterConfigWindow::usePrismHeader() const { return prismHeader->isChecked(); } bool WellenreiterConfigWindow::isChannelChecked( int channel ) const { switch ( channel ) { case 1: return channel1->isOn(); case 2: return channel2->isOn(); case 3: return channel3->isOn(); case 4: return channel4->isOn(); case 5: return channel5->isOn(); case 6: return channel6->isOn(); case 7: return channel7->isOn(); case 8: return channel8->isOn(); case 9: return channel9->isOn(); case 10: return channel10->isOn(); case 11: return channel11->isOn(); case 12: return channel12->isOn(); case 13: return channel13->isOn(); case 14: return channel14->isOn(); } } void WellenreiterConfigWindow::changedDeviceType(int t) { if ( t != DEVTYPE_FILE ) return; QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); if ( !name.isEmpty() && QFile::exists( name ) ) { interfaceName->insertItem( name ); interfaceName->setCurrentItem( interfaceName->count()-1 ); } else { deviceType->setCurrentItem( _guess ); } } void WellenreiterConfigWindow::getCaptureFileNameClicked() { QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); qDebug( "name = %s", (const char*) name ); if ( !name.isEmpty() ) { captureFileName->setText( name ); } } void WellenreiterConfigWindow::channelAllClicked(int state) { bool b = state; channel1->setChecked( b ); channel2->setChecked( b ); channel3->setChecked( b ); channel4->setChecked( b ); channel5->setChecked( b ); channel6->setChecked( b ); channel7->setChecked( b ); channel8->setChecked( b ); channel9->setChecked( b ); channel10->setChecked( b ); channel11->setChecked( b ); channel12->setChecked( b ); channel13->setChecked( b ); channel14->setChecked( b ); } bool WellenreiterConfigWindow::useGPS() const { return enableGPS->isChecked(); } const QString WellenreiterConfigWindow::gpsHost() const { return useGPS() ? gpsdHost->currentText() : QString::null; } int WellenreiterConfigWindow::gpsPort() const { bool ok; return useGPS() ? gpsdPort->value() : -1; } void WellenreiterConfigWindow::load() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build performAutodetection(); #else qDebug( "loading configuration settings..." ); /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); 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 ) ); hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); - hopInterval->setValue( c->readNumEntry( "interval", 100 ) ); + hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); c->setGroup( "Capture" ); captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); c->setGroup( "UI" ); lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); openTree->setChecked( c->readBoolEntry( "openTree", true ) ); disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); c->setGroup( "GPS" ); enableGPS->setChecked( c->readBoolEntry( "use", false ) ); #if QT_VERSION < 300 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); gpsdHost->setCurrentItem( 0 ); #else gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); #endif gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); startGPS->setChecked( c->readBoolEntry( "start", false ) ); commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); #endif } void WellenreiterConfigWindow::save() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build #else qDebug( "saving configuration settings..." ); /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); c->writeEntry( "name", interfaceName->currentText() ); c->writeEntry( "type", deviceType->currentText() ); c->writeEntry( "prism", prismHeader->isChecked() ); c->writeEntry( "hop", hopChannels->isChecked() ); c->writeEntry( "interval", hopInterval->value() ); c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); c->setGroup( "Capture" ); c->writeEntry( "filename", captureFileName->text() ); c->setGroup( "UI" ); c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); c->writeEntry( "openTree", openTree->isChecked() ); c->writeEntry( "disablePM", disablePM->isChecked() ); c->setGroup( "GPS" ); c->writeEntry( "use", enableGPS->isChecked() ); c->writeEntry( "host", gpsdHost->currentText() ); c->writeEntry( "port", gpsdPort->value() ); c->writeEntry( "start", startGPS->isChecked() ); c->writeEntry( "command", commandGPS->text() ); #endif } |