summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 279b39c..89ed24c 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -34,15 +34,16 @@ using namespace Opie::Net;
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qlayout.h> 37#include <qlayout.h>
38#include <qmap.h> 38#include <qmap.h>
39#include <qpushbutton.h> 39#include <qpushbutton.h>
40#include <qradiobutton.h>
41#include <qspinbox.h>
40#include <qtabwidget.h> 42#include <qtabwidget.h>
41#include <qtoolbutton.h> 43#include <qtoolbutton.h>
42#include <qspinbox.h>
43#include <qtextstream.h> 44#include <qtextstream.h>
44 45
45/* STD */ 46/* STD */
46#include <assert.h> 47#include <assert.h>
47 48
48WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 49WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
@@ -109,13 +110,13 @@ WellenreiterConfigWindow::~WellenreiterConfigWindow()
109void WellenreiterConfigWindow::performAutodetection() 110void WellenreiterConfigWindow::performAutodetection()
110{ 111{
111 //TODO: insert modal splash screen here 112 //TODO: insert modal splash screen here
112 // and sleep a second, so that it looks 113 // and sleep a second, so that it looks
113 // like we're actually doing something fancy... ;-) 114 // like we're actually doing something fancy... ;-)
114 115
115 odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl; 116 odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl;
116 117
117 // try to guess device type 118 // try to guess device type
118 QFile m( "/proc/modules" ); 119 QFile m( "/proc/modules" );
119 if ( m.open( IO_ReadOnly ) ) 120 if ( m.open( IO_ReadOnly ) )
120 { 121 {
121 int devicetype(0); 122 int devicetype(0);
@@ -130,13 +131,13 @@ void WellenreiterConfigWindow::performAutodetection()
130 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 131 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
131 } 132 }
132 if ( devicetype ) 133 if ( devicetype )
133 { 134 {
134 deviceType->setCurrentItem( devicetype ); 135 deviceType->setCurrentItem( devicetype );
135 _guess = devicetype; 136 _guess = devicetype;
136 odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl; 137 odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl;
137 } 138 }
138 } 139 }
139} 140}
140 141
141 142
142int WellenreiterConfigWindow::driverType() const 143int WellenreiterConfigWindow::driverType() const
@@ -234,13 +235,13 @@ void WellenreiterConfigWindow::changedStationAction(int t)
234} 235}
235 236
236 237
237void WellenreiterConfigWindow::getCaptureFileNameClicked() 238void WellenreiterConfigWindow::getCaptureFileNameClicked()
238{ 239{
239 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 240 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
240 odebug << "name = " << name << "" << oendl; 241 odebug << "name = " << name << "" << oendl;
241 if ( !name.isEmpty() ) 242 if ( !name.isEmpty() )
242 { 243 {
243 captureFileName->setText( name ); 244 captureFileName->setText( name );
244 } 245 }
245} 246}
246 247
@@ -309,17 +310,17 @@ void WellenreiterConfigWindow::performAction( const QString& type,
309 { 310 {
310 action = newStationAction->currentItem(); 311 action = newStationAction->currentItem();
311 script = newStationScript->text(); 312 script = newStationScript->text();
312 } 313 }
313 else 314 else
314 { 315 {
315 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl; 316 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl;
316 return; 317 return;
317 } 318 }
318 319
319 odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; 320 odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl;
320 321
321 switch( action ) 322 switch( action )
322 { 323 {
323 case 0: /* Ignore */ return; 324 case 0: /* Ignore */ return;
324 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; 325 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
325 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; 326 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
@@ -338,15 +339,15 @@ void WellenreiterConfigWindow::performAction( const QString& type,
338 **/ 339 **/
339 script = script.replace( QRegExp( "$SSID" ), essid ); 340 script = script.replace( QRegExp( "$SSID" ), essid );
340 script = script.replace( QRegExp( "$MAC" ), mac ); 341 script = script.replace( QRegExp( "$MAC" ), mac );
341 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); 342 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
342 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); 343 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
343 344
344 odebug << "going to call script '" << script << "'" << oendl; 345 odebug << "going to call script '" << script << "'" << oendl;
345 ::system( script ); 346 ::system( script );
346 odebug << "script returned." << oendl; 347 odebug << "script returned." << oendl;
347 return; 348 return;
348 } 349 }
349 default: assert( false ); 350 default: assert( false );
350 } 351 }
351} 352}
352 353
@@ -354,13 +355,13 @@ void WellenreiterConfigWindow::performAction( const QString& type,
354void WellenreiterConfigWindow::load() 355void WellenreiterConfigWindow::load()
355{ 356{
356#ifdef Q_WS_X11 357#ifdef Q_WS_X11
357 #warning Persistent Configuration not yet implemented for standalone X11 build 358 #warning Persistent Configuration not yet implemented for standalone X11 build
358 performAutodetection(); 359 performAutodetection();
359#else 360#else
360 odebug << "loading configuration settings..." << oendl; 361 odebug << "loading configuration settings..." << oendl;
361 362
362 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 363 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
363 364
364 OConfig* c = oApp->config(); 365 OConfig* c = oApp->config();
365 366
366 c->setGroup( "Interface" ); 367 c->setGroup( "Interface" );
@@ -432,13 +433,13 @@ void WellenreiterConfigWindow::load()
432 433
433void WellenreiterConfigWindow::save() 434void WellenreiterConfigWindow::save()
434{ 435{
435#ifdef Q_WS_X11 436#ifdef Q_WS_X11
436 #warning Persistent Configuration not yet implemented for standalone X11 build 437 #warning Persistent Configuration not yet implemented for standalone X11 build
437#else 438#else
438 odebug << "saving configuration settings..." << oendl; 439 odebug << "saving configuration settings..." << oendl;
439 440
440 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 441 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
441 442
442 OConfig* c = oApp->config(); 443 OConfig* c = oApp->config();
443 444
444 c->setGroup( "Interface" ); 445 c->setGroup( "Interface" );
@@ -471,6 +472,12 @@ void WellenreiterConfigWindow::save()
471 c->writeEntry( "command", commandGPS->text() ); 472 c->writeEntry( "command", commandGPS->text() );
472 473
473 c->write(); 474 c->write();
474 475
475#endif 476#endif
476} 477}
478
479
480int WellenreiterConfigWindow::hexViewBuffer() const
481{
482 return hexViewBufferUnlimited->isChecked() ? -1 : hexViewBufferSize->value();
483}