-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 107 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 67 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 5 |
3 files changed, 113 insertions, 66 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index d9a0aea..d7ab3bb 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -6,18 +6,18 @@ | |||
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WellenreiterConfigBase</cstring> | 7 | <cstring>WellenreiterConfigBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>286</width> | 14 | <width>303</width> |
15 | <height>280</height> | 15 | <height>287</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Wellenreiter II COnfiguration Dialog</string> | 20 | <string>Wellenreiter II COnfiguration Dialog</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
@@ -622,26 +622,80 @@ | |||
622 | <property stdset="1"> | 622 | <property stdset="1"> |
623 | <name>name</name> | 623 | <name>name</name> |
624 | <cstring>tab</cstring> | 624 | <cstring>tab</cstring> |
625 | </property> | 625 | </property> |
626 | <attribute> | 626 | <attribute> |
627 | <name>title</name> | 627 | <name>title</name> |
628 | <string>UI</string> | 628 | <string>UI</string> |
629 | </attribute> | 629 | </attribute> |
630 | <grid> | 630 | <vbox> |
631 | <property stdset="1"> | 631 | <property stdset="1"> |
632 | <name>margin</name> | 632 | <name>margin</name> |
633 | <number>11</number> | 633 | <number>11</number> |
634 | </property> | 634 | </property> |
635 | <property stdset="1"> | 635 | <property stdset="1"> |
636 | <name>spacing</name> | 636 | <name>spacing</name> |
637 | <number>6</number> | 637 | <number>6</number> |
638 | </property> | 638 | </property> |
639 | <widget row="3" column="0" > | 639 | <widget> |
640 | <class>QCheckBox</class> | ||
641 | <property stdset="1"> | ||
642 | <name>name</name> | ||
643 | <cstring>lookupVendor</cstring> | ||
644 | </property> | ||
645 | <property stdset="1"> | ||
646 | <name>text</name> | ||
647 | <string>Lookup MAC vendor names</string> | ||
648 | </property> | ||
649 | </widget> | ||
650 | <widget> | ||
651 | <class>QCheckBox</class> | ||
652 | <property stdset="1"> | ||
653 | <name>name</name> | ||
654 | <cstring>openTree</cstring> | ||
655 | </property> | ||
656 | <property stdset="1"> | ||
657 | <name>text</name> | ||
658 | <string>Open Tree On New Station</string> | ||
659 | </property> | ||
660 | </widget> | ||
661 | <widget> | ||
662 | <class>QCheckBox</class> | ||
663 | <property stdset="1"> | ||
664 | <name>name</name> | ||
665 | <cstring>disablePM</cstring> | ||
666 | </property> | ||
667 | <property stdset="1"> | ||
668 | <name>text</name> | ||
669 | <string>Disable Power Management</string> | ||
670 | </property> | ||
671 | </widget> | ||
672 | <spacer> | ||
673 | <property> | ||
674 | <name>name</name> | ||
675 | <cstring>Spacer3</cstring> | ||
676 | </property> | ||
677 | <property stdset="1"> | ||
678 | <name>orientation</name> | ||
679 | <enum>Vertical</enum> | ||
680 | </property> | ||
681 | <property stdset="1"> | ||
682 | <name>sizeType</name> | ||
683 | <enum>Expanding</enum> | ||
684 | </property> | ||
685 | <property> | ||
686 | <name>sizeHint</name> | ||
687 | <size> | ||
688 | <width>20</width> | ||
689 | <height>20</height> | ||
690 | </size> | ||
691 | </property> | ||
692 | </spacer> | ||
693 | <widget> | ||
640 | <class>QGroupBox</class> | 694 | <class>QGroupBox</class> |
641 | <property stdset="1"> | 695 | <property stdset="1"> |
642 | <name>name</name> | 696 | <name>name</name> |
643 | <cstring>GroupBox4_2</cstring> | 697 | <cstring>GroupBox4_2</cstring> |
644 | </property> | 698 | </property> |
645 | <property stdset="1"> | 699 | <property stdset="1"> |
646 | <name>title</name> | 700 | <name>title</name> |
647 | <string>Action On Detecting</string> | 701 | <string>Action On Detecting</string> |
@@ -706,60 +760,17 @@ | |||
706 | </property> | 760 | </property> |
707 | <property stdset="1"> | 761 | <property stdset="1"> |
708 | <name>text</name> | 762 | <name>text</name> |
709 | <string>New Station</string> | 763 | <string>New Station</string> |
710 | </property> | 764 | </property> |
711 | </widget> | 765 | </widget> |
712 | </grid> | 766 | </grid> |
713 | </widget> | 767 | </widget> |
714 | <spacer row="2" column="0" > | 768 | </vbox> |
715 | <property> | ||
716 | <name>name</name> | ||
717 | <cstring>Spacer3</cstring> | ||
718 | </property> | ||
719 | <property stdset="1"> | ||
720 | <name>orientation</name> | ||
721 | <enum>Vertical</enum> | ||
722 | </property> | ||
723 | <property stdset="1"> | ||
724 | <name>sizeType</name> | ||
725 | <enum>Expanding</enum> | ||
726 | </property> | ||
727 | <property> | ||
728 | <name>sizeHint</name> | ||
729 | <size> | ||
730 | <width>20</width> | ||
731 | <height>20</height> | ||
732 | </size> | ||
733 | </property> | ||
734 | </spacer> | ||
735 | <widget row="0" column="0" > | ||
736 | <class>QCheckBox</class> | ||
737 | <property stdset="1"> | ||
738 | <name>name</name> | ||
739 | <cstring>lookupVendor</cstring> | ||
740 | </property> | ||
741 | <property stdset="1"> | ||
742 | <name>text</name> | ||
743 | <string>Lookup MAC vendor names</string> | ||
744 | </property> | ||
745 | </widget> | ||
746 | <widget row="1" column="0" > | ||
747 | <class>QCheckBox</class> | ||
748 | <property stdset="1"> | ||
749 | <name>name</name> | ||
750 | <cstring>openTree</cstring> | ||
751 | </property> | ||
752 | <property stdset="1"> | ||
753 | <name>text</name> | ||
754 | <string>Open Tree On New Station</string> | ||
755 | </property> | ||
756 | </widget> | ||
757 | </grid> | ||
758 | </widget> | 769 | </widget> |
759 | <widget> | 770 | <widget> |
760 | <class>QWidget</class> | 771 | <class>QWidget</class> |
761 | <property stdset="1"> | 772 | <property stdset="1"> |
762 | <name>name</name> | 773 | <name>name</name> |
763 | <cstring>tab</cstring> | 774 | <cstring>tab</cstring> |
764 | </property> | 775 | </property> |
765 | <attribute> | 776 | <attribute> |
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 | |||
@@ -50,36 +50,39 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
50 | ONetwork::InterfaceIterator it = net->iterator(); | 50 | ONetwork::InterfaceIterator it = net->iterator(); |
51 | while ( it.current() ) | 51 | while ( it.current() ) |
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 | // 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 | ||
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() ) ); |
@@ -90,16 +93,22 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
90 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); | 93 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); |
91 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); | 94 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); |
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]; |
104 | } | 113 | } |
105 | else | 114 | else |
@@ -203,8 +212,30 @@ const QString WellenreiterConfigWindow::gpsHost() const | |||
203 | } | 212 | } |
204 | 213 | ||
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 | } | ||
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 8f160b1..2986320 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h | |||
@@ -32,29 +32,34 @@ const int DEVTYPE_FILE = 6; | |||
32 | class WellenreiterConfigWindow; | 32 | class WellenreiterConfigWindow; |
33 | 33 | ||
34 | class WellenreiterConfigWindow : public WellenreiterConfigBase | 34 | class WellenreiterConfigWindow : public WellenreiterConfigBase |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); | 39 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); |
40 | ~WellenreiterConfigWindow(); | ||
41 | |||
40 | int driverType() const; | 42 | int driverType() const; |
41 | const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; | 43 | const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; |
42 | const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; | 44 | const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; |
43 | static WellenreiterConfigWindow* instance() { return _instance; }; | 45 | static WellenreiterConfigWindow* instance() { return _instance; }; |
44 | 46 | ||
45 | int hoppingInterval() const; | 47 | int hoppingInterval() const; |
46 | bool usePrismHeader() const; | 48 | bool usePrismHeader() const; |
47 | bool isChannelChecked( int ) const; | 49 | bool isChannelChecked( int ) const; |
48 | 50 | ||
49 | bool useGPS() const; | 51 | bool useGPS() const; |
50 | const QString gpsHost() const; | 52 | const QString gpsHost() const; |
51 | int gpsPort() const; | 53 | int gpsPort() const; |
52 | 54 | ||
55 | void save(); | ||
56 | bool load(); | ||
57 | |||
53 | public slots: | 58 | public slots: |
54 | void changedDeviceType(int); | 59 | void changedDeviceType(int); |
55 | void getCaptureFileNameClicked(); | 60 | void getCaptureFileNameClicked(); |
56 | 61 | ||
57 | void channelAllClicked(int); | 62 | void channelAllClicked(int); |
58 | 63 | ||
59 | protected: | 64 | protected: |
60 | QMap<QString, int> _devicetype; | 65 | QMap<QString, int> _devicetype; |