author | mickeyl <mickeyl> | 2004-01-07 23:04:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-07 23:04:55 (UTC) |
commit | cfb7335c5b65a79f5817b393e5a8b3345558f220 (patch) (unidiff) | |
tree | a8d2d2bcc0bd29a6aac7fec7325f058f148d466e /noncore/net/wellenreiter/gui | |
parent | c4d6574e85f74d6086c1709ecf0d117df7417222 (diff) | |
download | opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.zip opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.gz opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.bz2 |
A bunch of miscellaneous changes and improvements. read the ChangeLog :)
Oh and it's WIP - not everything mentioned there works already. Will soon, though.
Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 287 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 103 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 7 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 20 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 8 |
7 files changed, 347 insertions, 89 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 2c335df..de6abfc 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -1,63 +1,63 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WellenreiterConfigBase</class> | 2 | <class>WellenreiterConfigBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
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>303</width> | 14 | <width>250</width> |
15 | <height>343</height> | 15 | <height>371</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> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <grid> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget row="0" column="0" > | 37 | <widget row="0" column="0" > |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>tab</cstring> | 41 | <cstring>tab</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tab</cstring> | 53 | <cstring>tab</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Interface</string> | 57 | <string>Interface</string> |
58 | </attribute> | 58 | </attribute> |
59 | <vbox> | 59 | <vbox> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>6</number> | 62 | <number>6</number> |
63 | </property> | 63 | </property> |
@@ -661,232 +661,409 @@ | |||
661 | <widget> | 661 | <widget> |
662 | <class>QWidget</class> | 662 | <class>QWidget</class> |
663 | <property stdset="1"> | 663 | <property stdset="1"> |
664 | <name>name</name> | 664 | <name>name</name> |
665 | <cstring>tab</cstring> | 665 | <cstring>tab</cstring> |
666 | </property> | 666 | </property> |
667 | <attribute> | 667 | <attribute> |
668 | <name>title</name> | 668 | <name>title</name> |
669 | <string>Parse</string> | 669 | <string>Parse</string> |
670 | </attribute> | 670 | </attribute> |
671 | <grid> | 671 | <grid> |
672 | <property stdset="1"> | 672 | <property stdset="1"> |
673 | <name>margin</name> | 673 | <name>margin</name> |
674 | <number>5</number> | 674 | <number>5</number> |
675 | </property> | 675 | </property> |
676 | <property stdset="1"> | 676 | <property stdset="1"> |
677 | <name>spacing</name> | 677 | <name>spacing</name> |
678 | <number>3</number> | 678 | <number>3</number> |
679 | </property> | 679 | </property> |
680 | <widget row="0" column="0" > | 680 | <widget row="0" column="0" > |
681 | <class>ProtocolListView</class> | 681 | <class>ProtocolListView</class> |
682 | <property stdset="1"> | 682 | <property stdset="1"> |
683 | <name>name</name> | 683 | <name>name</name> |
684 | <cstring>parsePackets</cstring> | 684 | <cstring>parsePackets</cstring> |
685 | </property> | 685 | </property> |
686 | <property stdset="1"> | 686 | <property stdset="1"> |
687 | <name>sizePolicy</name> | 687 | <name>sizePolicy</name> |
688 | <sizepolicy> | 688 | <sizepolicy> |
689 | <hsizetype>7</hsizetype> | 689 | <hsizetype>7</hsizetype> |
690 | <vsizetype>7</vsizetype> | 690 | <vsizetype>7</vsizetype> |
691 | </sizepolicy> | 691 | </sizepolicy> |
692 | </property> | 692 | </property> |
693 | </widget> | 693 | </widget> |
694 | </grid> | 694 | </grid> |
695 | </widget> | 695 | </widget> |
696 | <widget> | 696 | <widget> |
697 | <class>QWidget</class> | 697 | <class>QWidget</class> |
698 | <property stdset="1"> | 698 | <property stdset="1"> |
699 | <name>name</name> | 699 | <name>name</name> |
700 | <cstring>tab</cstring> | 700 | <cstring>tab</cstring> |
701 | </property> | 701 | </property> |
702 | <attribute> | 702 | <attribute> |
703 | <name>title</name> | 703 | <name>title</name> |
704 | <string>UI</string> | 704 | <string>UI</string> |
705 | </attribute> | 705 | </attribute> |
706 | <vbox> | 706 | <vbox> |
707 | <property stdset="1"> | 707 | <property stdset="1"> |
708 | <name>margin</name> | 708 | <name>margin</name> |
709 | <number>6</number> | 709 | <number>5</number> |
710 | </property> | 710 | </property> |
711 | <property stdset="1"> | 711 | <property stdset="1"> |
712 | <name>spacing</name> | 712 | <name>spacing</name> |
713 | <number>6</number> | 713 | <number>3</number> |
714 | </property> | 714 | </property> |
715 | <widget> | 715 | <widget> |
716 | <class>QCheckBox</class> | 716 | <class>QCheckBox</class> |
717 | <property stdset="1"> | 717 | <property stdset="1"> |
718 | <name>name</name> | 718 | <name>name</name> |
719 | <cstring>lookupVendor</cstring> | 719 | <cstring>lookupVendor</cstring> |
720 | </property> | 720 | </property> |
721 | <property stdset="1"> | 721 | <property stdset="1"> |
722 | <name>text</name> | 722 | <name>text</name> |
723 | <string>Lookup MAC vendor names</string> | 723 | <string>Lookup MAC vendor names</string> |
724 | </property> | 724 | </property> |
725 | </widget> | 725 | </widget> |
726 | <widget> | 726 | <widget> |
727 | <class>QCheckBox</class> | 727 | <class>QCheckBox</class> |
728 | <property stdset="1"> | 728 | <property stdset="1"> |
729 | <name>name</name> | 729 | <name>name</name> |
730 | <cstring>openTree</cstring> | 730 | <cstring>openTree</cstring> |
731 | </property> | 731 | </property> |
732 | <property stdset="1"> | 732 | <property stdset="1"> |
733 | <name>text</name> | 733 | <name>text</name> |
734 | <string>Open Tree On New Station</string> | 734 | <string>Open Tree On New Station</string> |
735 | </property> | 735 | </property> |
736 | </widget> | 736 | </widget> |
737 | <widget> | 737 | <widget> |
738 | <class>QCheckBox</class> | 738 | <class>QCheckBox</class> |
739 | <property stdset="1"> | 739 | <property stdset="1"> |
740 | <name>name</name> | 740 | <name>name</name> |
741 | <cstring>disablePM</cstring> | 741 | <cstring>disablePM</cstring> |
742 | </property> | 742 | </property> |
743 | <property stdset="1"> | 743 | <property stdset="1"> |
744 | <name>text</name> | 744 | <name>text</name> |
745 | <string>Disable Power Management</string> | 745 | <string>Disable Power Management</string> |
746 | </property> | 746 | </property> |
747 | </widget> | 747 | </widget> |
748 | <spacer> | 748 | <spacer> |
749 | <property> | 749 | <property> |
750 | <name>name</name> | 750 | <name>name</name> |
751 | <cstring>Spacer3</cstring> | 751 | <cstring>Spacer3</cstring> |
752 | </property> | 752 | </property> |
753 | <property stdset="1"> | 753 | <property stdset="1"> |
754 | <name>orientation</name> | 754 | <name>orientation</name> |
755 | <enum>Vertical</enum> | 755 | <enum>Vertical</enum> |
756 | </property> | 756 | </property> |
757 | <property stdset="1"> | 757 | <property stdset="1"> |
758 | <name>sizeType</name> | 758 | <name>sizeType</name> |
759 | <enum>Expanding</enum> | 759 | <enum>Expanding</enum> |
760 | </property> | 760 | </property> |
761 | <property> | 761 | <property> |
762 | <name>sizeHint</name> | 762 | <name>sizeHint</name> |
763 | <size> | 763 | <size> |
764 | <width>20</width> | 764 | <width>20</width> |
765 | <height>20</height> | 765 | <height>20</height> |
766 | </size> | 766 | </size> |
767 | </property> | 767 | </property> |
768 | </spacer> | 768 | </spacer> |
769 | <widget> | 769 | <widget> |
770 | <class>QGroupBox</class> | 770 | <class>QGroupBox</class> |
771 | <property stdset="1"> | 771 | <property stdset="1"> |
772 | <name>name</name> | 772 | <name>name</name> |
773 | <cstring>GroupBox4_2</cstring> | 773 | <cstring>GroupBox4_2</cstring> |
774 | </property> | 774 | </property> |
775 | <property stdset="1"> | 775 | <property stdset="1"> |
776 | <name>enabled</name> | 776 | <name>enabled</name> |
777 | <bool>false</bool> | 777 | <bool>true</bool> |
778 | </property> | 778 | </property> |
779 | <property stdset="1"> | 779 | <property stdset="1"> |
780 | <name>title</name> | 780 | <name>title</name> |
781 | <string>Action On Detecting</string> | 781 | <string>Action on detecting a new</string> |
782 | </property> | ||
783 | <property> | ||
784 | <name>layoutMargin</name> | ||
785 | </property> | ||
786 | <property> | ||
787 | <name>layoutSpacing</name> | ||
782 | </property> | 788 | </property> |
783 | <grid> | 789 | <grid> |
784 | <property stdset="1"> | 790 | <property stdset="1"> |
785 | <name>margin</name> | 791 | <name>margin</name> |
786 | <number>11</number> | 792 | <number>3</number> |
787 | </property> | 793 | </property> |
788 | <property stdset="1"> | 794 | <property stdset="1"> |
789 | <name>spacing</name> | 795 | <name>spacing</name> |
790 | <number>6</number> | 796 | <number>0</number> |
791 | </property> | 797 | </property> |
792 | <widget row="1" column="0" > | ||
793 | <class>QLabel</class> | ||
794 | <property stdset="1"> | ||
795 | <name>name</name> | ||
796 | <cstring>TextLabel2</cstring> | ||
797 | </property> | ||
798 | <property stdset="1"> | ||
799 | <name>text</name> | ||
800 | <string>New Wireless Station</string> | ||
801 | </property> | ||
802 | </widget> | ||
803 | <widget row="0" column="0" > | 798 | <widget row="0" column="0" > |
804 | <class>QLabel</class> | 799 | <class>QLayoutWidget</class> |
805 | <property stdset="1"> | ||
806 | <name>name</name> | ||
807 | <cstring>TextLabel1_3</cstring> | ||
808 | </property> | ||
809 | <property stdset="1"> | ||
810 | <name>text</name> | ||
811 | <string>New Network</string> | ||
812 | </property> | ||
813 | </widget> | ||
814 | <widget row="0" column="1" > | ||
815 | <class>QComboBox</class> | ||
816 | <property stdset="1"> | ||
817 | <name>name</name> | ||
818 | <cstring>newNetwork</cstring> | ||
819 | </property> | ||
820 | </widget> | ||
821 | <widget row="1" column="1" > | ||
822 | <class>QComboBox</class> | ||
823 | <property stdset="1"> | ||
824 | <name>name</name> | ||
825 | <cstring>newWirelessStation</cstring> | ||
826 | </property> | ||
827 | </widget> | ||
828 | <widget row="2" column="1" > | ||
829 | <class>QComboBox</class> | ||
830 | <property stdset="1"> | 800 | <property stdset="1"> |
831 | <name>name</name> | 801 | <name>name</name> |
832 | <cstring>newStation</cstring> | 802 | <cstring>Layout6</cstring> |
833 | </property> | 803 | </property> |
834 | </widget> | 804 | <property> |
835 | <widget row="2" column="0" > | 805 | <name>layoutMargin</name> |
836 | <class>QLabel</class> | ||
837 | <property stdset="1"> | ||
838 | <name>name</name> | ||
839 | <cstring>TextLabel3</cstring> | ||
840 | </property> | 806 | </property> |
841 | <property stdset="1"> | 807 | <property> |
842 | <name>text</name> | 808 | <name>layoutSpacing</name> |
843 | <string>New Station</string> | ||
844 | </property> | 809 | </property> |
810 | <grid> | ||
811 | <property stdset="1"> | ||
812 | <name>margin</name> | ||
813 | <number>2</number> | ||
814 | </property> | ||
815 | <property stdset="1"> | ||
816 | <name>spacing</name> | ||
817 | <number>2</number> | ||
818 | </property> | ||
819 | <widget row="4" column="0" > | ||
820 | <class>QLabel</class> | ||
821 | <property stdset="1"> | ||
822 | <name>name</name> | ||
823 | <cstring>TextLabel3</cstring> | ||
824 | </property> | ||
825 | <property stdset="1"> | ||
826 | <name>text</name> | ||
827 | <string>Wired Station:</string> | ||
828 | </property> | ||
829 | </widget> | ||
830 | <widget row="0" column="0" > | ||
831 | <class>QLabel</class> | ||
832 | <property stdset="1"> | ||
833 | <name>name</name> | ||
834 | <cstring>TextLabel1_3</cstring> | ||
835 | </property> | ||
836 | <property stdset="1"> | ||
837 | <name>text</name> | ||
838 | <string>Network:</string> | ||
839 | </property> | ||
840 | </widget> | ||
841 | <widget row="2" column="1" > | ||
842 | <class>QComboBox</class> | ||
843 | <item> | ||
844 | <property> | ||
845 | <name>text</name> | ||
846 | <string><Ignore></string> | ||
847 | </property> | ||
848 | </item> | ||
849 | <item> | ||
850 | <property> | ||
851 | <name>text</name> | ||
852 | <string>Play Alarm</string> | ||
853 | </property> | ||
854 | </item> | ||
855 | <item> | ||
856 | <property> | ||
857 | <name>text</name> | ||
858 | <string>Play Click</string> | ||
859 | </property> | ||
860 | </item> | ||
861 | <item> | ||
862 | <property> | ||
863 | <name>text</name> | ||
864 | <string>Blink LED</string> | ||
865 | </property> | ||
866 | </item> | ||
867 | <item> | ||
868 | <property> | ||
869 | <name>text</name> | ||
870 | <string>Run Script</string> | ||
871 | </property> | ||
872 | </item> | ||
873 | <property stdset="1"> | ||
874 | <name>name</name> | ||
875 | <cstring>newClientAction</cstring> | ||
876 | </property> | ||
877 | <property stdset="1"> | ||
878 | <name>sizePolicy</name> | ||
879 | <sizepolicy> | ||
880 | <hsizetype>7</hsizetype> | ||
881 | <vsizetype>0</vsizetype> | ||
882 | </sizepolicy> | ||
883 | </property> | ||
884 | </widget> | ||
885 | <widget row="3" column="0" rowspan="1" colspan="2" > | ||
886 | <class>QLineEdit</class> | ||
887 | <property stdset="1"> | ||
888 | <name>name</name> | ||
889 | <cstring>newClientScript</cstring> | ||
890 | </property> | ||
891 | <property stdset="1"> | ||
892 | <name>enabled</name> | ||
893 | <bool>true</bool> | ||
894 | </property> | ||
895 | </widget> | ||
896 | <widget row="2" column="0" > | ||
897 | <class>QLabel</class> | ||
898 | <property stdset="1"> | ||
899 | <name>name</name> | ||
900 | <cstring>TextLabel2</cstring> | ||
901 | </property> | ||
902 | <property stdset="1"> | ||
903 | <name>text</name> | ||
904 | <string>Wireless Station:</string> | ||
905 | </property> | ||
906 | </widget> | ||
907 | <widget row="4" column="1" > | ||
908 | <class>QComboBox</class> | ||
909 | <item> | ||
910 | <property> | ||
911 | <name>text</name> | ||
912 | <string><Ignore></string> | ||
913 | </property> | ||
914 | </item> | ||
915 | <item> | ||
916 | <property> | ||
917 | <name>text</name> | ||
918 | <string>Play Alarm</string> | ||
919 | </property> | ||
920 | </item> | ||
921 | <item> | ||
922 | <property> | ||
923 | <name>text</name> | ||
924 | <string>Play Click</string> | ||
925 | </property> | ||
926 | </item> | ||
927 | <item> | ||
928 | <property> | ||
929 | <name>text</name> | ||
930 | <string>Blink LED</string> | ||
931 | </property> | ||
932 | </item> | ||
933 | <item> | ||
934 | <property> | ||
935 | <name>text</name> | ||
936 | <string>Run Script</string> | ||
937 | </property> | ||
938 | </item> | ||
939 | <property stdset="1"> | ||
940 | <name>name</name> | ||
941 | <cstring>newStationAction</cstring> | ||
942 | </property> | ||
943 | <property stdset="1"> | ||
944 | <name>sizePolicy</name> | ||
945 | <sizepolicy> | ||
946 | <hsizetype>7</hsizetype> | ||
947 | <vsizetype>0</vsizetype> | ||
948 | </sizepolicy> | ||
949 | </property> | ||
950 | </widget> | ||
951 | <widget row="0" column="1" > | ||
952 | <class>QComboBox</class> | ||
953 | <item> | ||
954 | <property> | ||
955 | <name>text</name> | ||
956 | <string><Ignore></string> | ||
957 | </property> | ||
958 | </item> | ||
959 | <item> | ||
960 | <property> | ||
961 | <name>text</name> | ||
962 | <string>Play Alarm</string> | ||
963 | </property> | ||
964 | </item> | ||
965 | <item> | ||
966 | <property> | ||
967 | <name>text</name> | ||
968 | <string>Play Click</string> | ||
969 | </property> | ||
970 | </item> | ||
971 | <item> | ||
972 | <property> | ||
973 | <name>text</name> | ||
974 | <string>Blink LED</string> | ||
975 | </property> | ||
976 | </item> | ||
977 | <item> | ||
978 | <property> | ||
979 | <name>text</name> | ||
980 | <string>Run Script</string> | ||
981 | </property> | ||
982 | </item> | ||
983 | <property stdset="1"> | ||
984 | <name>name</name> | ||
985 | <cstring>newNetworkAction</cstring> | ||
986 | </property> | ||
987 | <property stdset="1"> | ||
988 | <name>sizePolicy</name> | ||
989 | <sizepolicy> | ||
990 | <hsizetype>7</hsizetype> | ||
991 | <vsizetype>0</vsizetype> | ||
992 | </sizepolicy> | ||
993 | </property> | ||
994 | <property stdset="1"> | ||
995 | <name>editable</name> | ||
996 | <bool>false</bool> | ||
997 | </property> | ||
998 | </widget> | ||
999 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
1000 | <class>QLineEdit</class> | ||
1001 | <property stdset="1"> | ||
1002 | <name>name</name> | ||
1003 | <cstring>newNetworkScript</cstring> | ||
1004 | </property> | ||
1005 | <property stdset="1"> | ||
1006 | <name>enabled</name> | ||
1007 | <bool>true</bool> | ||
1008 | </property> | ||
1009 | </widget> | ||
1010 | <widget row="5" column="0" rowspan="1" colspan="2" > | ||
1011 | <class>QLineEdit</class> | ||
1012 | <property stdset="1"> | ||
1013 | <name>name</name> | ||
1014 | <cstring>newStationScript</cstring> | ||
1015 | </property> | ||
1016 | <property stdset="1"> | ||
1017 | <name>enabled</name> | ||
1018 | <bool>true</bool> | ||
1019 | </property> | ||
1020 | </widget> | ||
1021 | </grid> | ||
845 | </widget> | 1022 | </widget> |
846 | </grid> | 1023 | </grid> |
847 | </widget> | 1024 | </widget> |
848 | </vbox> | 1025 | </vbox> |
849 | </widget> | 1026 | </widget> |
850 | <widget> | 1027 | <widget> |
851 | <class>QWidget</class> | 1028 | <class>QWidget</class> |
852 | <property stdset="1"> | 1029 | <property stdset="1"> |
853 | <name>name</name> | 1030 | <name>name</name> |
854 | <cstring>tab</cstring> | 1031 | <cstring>tab</cstring> |
855 | </property> | 1032 | </property> |
856 | <attribute> | 1033 | <attribute> |
857 | <name>title</name> | 1034 | <name>title</name> |
858 | <string>Intrusion</string> | 1035 | <string>Intrusion</string> |
859 | </attribute> | 1036 | </attribute> |
860 | <grid> | 1037 | <grid> |
861 | <property stdset="1"> | 1038 | <property stdset="1"> |
862 | <name>margin</name> | 1039 | <name>margin</name> |
863 | <number>6</number> | 1040 | <number>6</number> |
864 | </property> | 1041 | </property> |
865 | <property stdset="1"> | 1042 | <property stdset="1"> |
866 | <name>spacing</name> | 1043 | <name>spacing</name> |
867 | <number>6</number> | 1044 | <number>6</number> |
868 | </property> | 1045 | </property> |
869 | <widget row="1" column="0" > | 1046 | <widget row="1" column="0" > |
870 | <class>QGroupBox</class> | 1047 | <class>QGroupBox</class> |
871 | <property stdset="1"> | 1048 | <property stdset="1"> |
872 | <name>name</name> | 1049 | <name>name</name> |
873 | <cstring>GroupBox3</cstring> | 1050 | <cstring>GroupBox3</cstring> |
874 | </property> | 1051 | </property> |
875 | <property stdset="1"> | 1052 | <property stdset="1"> |
876 | <name>enabled</name> | 1053 | <name>enabled</name> |
877 | <bool>false</bool> | 1054 | <bool>false</bool> |
878 | </property> | 1055 | </property> |
879 | <property stdset="1"> | 1056 | <property stdset="1"> |
880 | <name>title</name> | 1057 | <name>title</name> |
881 | <string>Link Level</string> | 1058 | <string>Link Level</string> |
882 | </property> | 1059 | </property> |
883 | <grid> | 1060 | <grid> |
884 | <property stdset="1"> | 1061 | <property stdset="1"> |
885 | <name>margin</name> | 1062 | <name>margin</name> |
886 | <number>11</number> | 1063 | <number>11</number> |
887 | </property> | 1064 | </property> |
888 | <property stdset="1"> | 1065 | <property stdset="1"> |
889 | <name>spacing</name> | 1066 | <name>spacing</name> |
890 | <number>6</number> | 1067 | <number>6</number> |
891 | </property> | 1068 | </property> |
892 | <widget row="0" column="0" > | 1069 | <widget row="0" column="0" > |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index f536f4e..1341d03 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -1,128 +1,135 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | /* LOCAL */ | 16 | /* LOCAL */ |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "mainwindow.h" | 18 | #include "mainwindow.h" |
19 | 19 | ||
20 | /* OPIE */ | ||
21 | #include <opie2/onetwork.h> | ||
22 | #ifdef QWS | ||
23 | #include <opie2/oapplication.h> | ||
24 | #include <opie2/oconfig.h> | ||
25 | #endif | ||
26 | |||
20 | /* QT */ | 27 | /* QT */ |
21 | #include <qapplication.h> | 28 | #include <qapplication.h> |
22 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
23 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
24 | #include <qfile.h> | 31 | #include <qfile.h> |
25 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
26 | #include <qlayout.h> | 33 | #include <qlayout.h> |
27 | #include <qmap.h> | 34 | #include <qmap.h> |
28 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qtabwidget.h> | ||
29 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
30 | #include <qspinbox.h> | 38 | #include <qspinbox.h> |
31 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
32 | 40 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/onetwork.h> | ||
35 | |||
36 | #ifdef QWS | ||
37 | #include <opie2/oapplication.h> | ||
38 | #include <opie2/oconfig.h> | ||
39 | #endif | ||
40 | 41 | ||
41 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | 42 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; |
42 | 43 | ||
43 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 44 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
44 | :WellenreiterConfigBase( parent, name, true, f ) | 45 | :WellenreiterConfigBase( parent, name, true, f ) |
45 | { | 46 | { |
46 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; | 47 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; |
47 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; | 48 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; |
48 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; | 49 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; |
49 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; | 50 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; |
50 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; | 51 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; |
51 | _devicetype[ "<file>" ] = DEVTYPE_FILE; | 52 | _devicetype[ "<file>" ] = DEVTYPE_FILE; |
52 | 53 | ||
53 | // gather possible interface names from ONetwork | 54 | // gather possible interface names from ONetwork |
54 | ONetwork* net = ONetwork::instance(); | 55 | ONetwork* net = ONetwork::instance(); |
55 | ONetwork::InterfaceIterator it = net->iterator(); | 56 | ONetwork::InterfaceIterator it = net->iterator(); |
56 | while ( it.current() ) | 57 | while ( it.current() ) |
57 | { | 58 | { |
58 | if ( it.current()->isWireless() ) | 59 | if ( it.current()->isWireless() ) |
59 | interfaceName->insertItem( it.current()->name() ); | 60 | interfaceName->insertItem( it.current()->name() ); |
60 | ++it; | 61 | ++it; |
61 | } | 62 | } |
62 | 63 | ||
63 | load(); | 64 | load(); |
64 | 65 | ||
65 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | 66 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here |
66 | QPushButton* okButton = new QPushButton( "ok", this ); | 67 | QPushButton* okButton = new QPushButton( "ok", this ); |
67 | okButton->show(); | 68 | okButton->show(); |
68 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui | 69 | WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui |
69 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 70 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
70 | #endif | 71 | #endif |
71 | 72 | ||
72 | WellenreiterConfigWindow::_instance = this; | 73 | WellenreiterConfigWindow::_instance = this; |
73 | 74 | ||
74 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); | 75 | connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); |
76 | connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); | ||
77 | connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); | ||
78 | connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); | ||
75 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); | 79 | connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); |
76 | 80 | ||
77 | // make the checkbox 'channelAll' control all other channels | 81 | // make the checkbox 'channelAll' control all other channels |
78 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); | 82 | connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); |
79 | 83 | ||
80 | connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); | 84 | connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); |
85 | |||
86 | // hide tab4 (parse) until Wellenreiter 1.2 | ||
87 | tab->removePage( tab_4 ); | ||
81 | }; | 88 | }; |
82 | 89 | ||
83 | 90 | ||
84 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | 91 | WellenreiterConfigWindow::~WellenreiterConfigWindow() |
85 | { | 92 | { |
86 | save(); | 93 | save(); |
87 | } | 94 | } |
88 | 95 | ||
89 | 96 | ||
90 | void WellenreiterConfigWindow::performAutodetection() | 97 | void WellenreiterConfigWindow::performAutodetection() |
91 | { | 98 | { |
92 | //TODO: insert modal splash screen here | 99 | //TODO: insert modal splash screen here |
93 | // and sleep a second, so that it looks | 100 | // and sleep a second, so that it looks |
94 | // like we're actually doing something fancy... ;-) | 101 | // like we're actually doing something fancy... ;-) |
95 | 102 | ||
96 | qDebug( "WellenreiterConfigWindow::performAutodetection()" ); | 103 | qDebug( "WellenreiterConfigWindow::performAutodetection()" ); |
97 | 104 | ||
98 | // try to guess device type | 105 | // try to guess device type |
99 | QFile m( "/proc/modules" ); | 106 | QFile m( "/proc/modules" ); |
100 | if ( m.open( IO_ReadOnly ) ) | 107 | if ( m.open( IO_ReadOnly ) ) |
101 | { | 108 | { |
102 | int devicetype(0); | 109 | int devicetype(0); |
103 | QString line; | 110 | QString line; |
104 | QTextStream modules( &m ); | 111 | QTextStream modules( &m ); |
105 | while( !modules.atEnd() && !devicetype ) | 112 | while( !modules.atEnd() && !devicetype ) |
106 | { | 113 | { |
107 | modules >> line; | 114 | modules >> line; |
108 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; | 115 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; |
109 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; | 116 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; |
110 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; | 117 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; |
111 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; | 118 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; |
112 | } | 119 | } |
113 | if ( devicetype ) | 120 | if ( devicetype ) |
114 | { | 121 | { |
115 | deviceType->setCurrentItem( devicetype ); | 122 | deviceType->setCurrentItem( devicetype ); |
116 | _guess = devicetype; | 123 | _guess = devicetype; |
117 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | 124 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); |
118 | } | 125 | } |
119 | } | 126 | } |
120 | } | 127 | } |
121 | 128 | ||
122 | 129 | ||
123 | int WellenreiterConfigWindow::driverType() const | 130 | int WellenreiterConfigWindow::driverType() const |
124 | { | 131 | { |
125 | QString name = deviceType->currentText(); | 132 | QString name = deviceType->currentText(); |
126 | if ( _devicetype.contains( name ) ) | 133 | if ( _devicetype.contains( name ) ) |
127 | { | 134 | { |
128 | return _devicetype[name]; | 135 | return _devicetype[name]; |
@@ -140,208 +147,290 @@ int WellenreiterConfigWindow::hoppingInterval() const | |||
140 | } | 147 | } |
141 | 148 | ||
142 | 149 | ||
143 | bool WellenreiterConfigWindow::usePrismHeader() const | 150 | bool WellenreiterConfigWindow::usePrismHeader() const |
144 | { | 151 | { |
145 | return prismHeader->isChecked(); | 152 | return prismHeader->isChecked(); |
146 | } | 153 | } |
147 | 154 | ||
148 | 155 | ||
149 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const | 156 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const |
150 | { | 157 | { |
151 | switch ( channel ) | 158 | switch ( channel ) |
152 | { | 159 | { |
153 | case 1: return channel1->isOn(); | 160 | case 1: return channel1->isOn(); |
154 | case 2: return channel2->isOn(); | 161 | case 2: return channel2->isOn(); |
155 | case 3: return channel3->isOn(); | 162 | case 3: return channel3->isOn(); |
156 | case 4: return channel4->isOn(); | 163 | case 4: return channel4->isOn(); |
157 | case 5: return channel5->isOn(); | 164 | case 5: return channel5->isOn(); |
158 | case 6: return channel6->isOn(); | 165 | case 6: return channel6->isOn(); |
159 | case 7: return channel7->isOn(); | 166 | case 7: return channel7->isOn(); |
160 | case 8: return channel8->isOn(); | 167 | case 8: return channel8->isOn(); |
161 | case 9: return channel9->isOn(); | 168 | case 9: return channel9->isOn(); |
162 | case 10: return channel10->isOn(); | 169 | case 10: return channel10->isOn(); |
163 | case 11: return channel11->isOn(); | 170 | case 11: return channel11->isOn(); |
164 | case 12: return channel12->isOn(); | 171 | case 12: return channel12->isOn(); |
165 | case 13: return channel13->isOn(); | 172 | case 13: return channel13->isOn(); |
166 | case 14: return channel14->isOn(); | 173 | case 14: return channel14->isOn(); |
167 | } | 174 | } |
168 | } | 175 | } |
169 | 176 | ||
170 | 177 | ||
171 | void WellenreiterConfigWindow::changedDeviceType(int t) | 178 | void WellenreiterConfigWindow::changedDeviceType(int t) |
172 | { | 179 | { |
173 | if ( t != DEVTYPE_FILE ) return; | 180 | if ( t != DEVTYPE_FILE ) return; |
174 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); | 181 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); |
175 | if ( !name.isEmpty() && QFile::exists( name ) ) | 182 | if ( !name.isEmpty() && QFile::exists( name ) ) |
176 | { | 183 | { |
177 | interfaceName->insertItem( name ); | 184 | interfaceName->insertItem( name ); |
178 | interfaceName->setCurrentItem( interfaceName->count()-1 ); | 185 | interfaceName->setCurrentItem( interfaceName->count()-1 ); |
179 | } | 186 | } |
180 | else | 187 | else |
181 | { | 188 | { |
182 | deviceType->setCurrentItem( _guess ); | 189 | deviceType->setCurrentItem( _guess ); |
183 | } | 190 | } |
184 | 191 | ||
185 | } | 192 | } |
186 | 193 | ||
187 | 194 | ||
195 | void WellenreiterConfigWindow::synchronizeActionsAndScripts() | ||
196 | { | ||
197 | if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); | ||
198 | if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); | ||
199 | if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); | ||
200 | |||
201 | //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); | ||
202 | //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); | ||
203 | //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); | ||
204 | } | ||
205 | |||
206 | |||
207 | void WellenreiterConfigWindow::changedNetworkAction(int t) | ||
208 | { | ||
209 | synchronizeActionsAndScripts(); | ||
210 | } | ||
211 | |||
212 | |||
213 | void WellenreiterConfigWindow::changedClientAction(int t) | ||
214 | { | ||
215 | synchronizeActionsAndScripts(); | ||
216 | } | ||
217 | |||
218 | |||
219 | void WellenreiterConfigWindow::changedStationAction(int t) | ||
220 | { | ||
221 | synchronizeActionsAndScripts(); | ||
222 | } | ||
223 | |||
224 | |||
188 | void WellenreiterConfigWindow::getCaptureFileNameClicked() | 225 | void WellenreiterConfigWindow::getCaptureFileNameClicked() |
189 | { | 226 | { |
190 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); | 227 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); |
191 | qDebug( "name = %s", (const char*) name ); | 228 | qDebug( "name = %s", (const char*) name ); |
192 | if ( !name.isEmpty() ) | 229 | if ( !name.isEmpty() ) |
193 | { | 230 | { |
194 | captureFileName->setText( name ); | 231 | captureFileName->setText( name ); |
195 | } | 232 | } |
196 | } | 233 | } |
197 | 234 | ||
198 | 235 | ||
199 | void WellenreiterConfigWindow::channelAllClicked(int state) | 236 | void WellenreiterConfigWindow::channelAllClicked(int state) |
200 | { | 237 | { |
201 | bool b = state; | 238 | bool b = state; |
202 | channel1->setChecked( b ); | 239 | channel1->setChecked( b ); |
203 | channel2->setChecked( b ); | 240 | channel2->setChecked( b ); |
204 | channel3->setChecked( b ); | 241 | channel3->setChecked( b ); |
205 | channel4->setChecked( b ); | 242 | channel4->setChecked( b ); |
206 | channel5->setChecked( b ); | 243 | channel5->setChecked( b ); |
207 | channel6->setChecked( b ); | 244 | channel6->setChecked( b ); |
208 | channel7->setChecked( b ); | 245 | channel7->setChecked( b ); |
209 | channel8->setChecked( b ); | 246 | channel8->setChecked( b ); |
210 | channel9->setChecked( b ); | 247 | channel9->setChecked( b ); |
211 | channel10->setChecked( b ); | 248 | channel10->setChecked( b ); |
212 | channel11->setChecked( b ); | 249 | channel11->setChecked( b ); |
213 | channel12->setChecked( b ); | 250 | channel12->setChecked( b ); |
214 | channel13->setChecked( b ); | 251 | channel13->setChecked( b ); |
215 | channel14->setChecked( b ); | 252 | channel14->setChecked( b ); |
216 | } | 253 | } |
217 | 254 | ||
218 | 255 | ||
219 | bool WellenreiterConfigWindow::useGPS() const | 256 | bool WellenreiterConfigWindow::useGPS() const |
220 | { | 257 | { |
221 | return enableGPS->isChecked(); | 258 | return enableGPS->isChecked(); |
222 | } | 259 | } |
223 | 260 | ||
224 | 261 | ||
225 | const QString WellenreiterConfigWindow::gpsHost() const | 262 | const QString WellenreiterConfigWindow::gpsHost() const |
226 | { | 263 | { |
227 | return useGPS() ? gpsdHost->currentText() : QString::null; | 264 | return useGPS() ? gpsdHost->currentText() : QString::null; |
228 | } | 265 | } |
229 | 266 | ||
230 | 267 | ||
231 | int WellenreiterConfigWindow::gpsPort() const | 268 | int WellenreiterConfigWindow::gpsPort() const |
232 | { | 269 | { |
233 | bool ok; | 270 | bool ok; |
234 | return useGPS() ? gpsdPort->value() : -1; | 271 | return useGPS() ? gpsdPort->value() : -1; |
235 | } | 272 | } |
236 | 273 | ||
237 | 274 | ||
275 | void WellenreiterConfigWindow::performAction( const QString& type ) | ||
276 | { | ||
277 | int action; | ||
278 | QString script; | ||
279 | |||
280 | if ( type == "network" ) | ||
281 | { | ||
282 | action = newNetworkAction->currentItem(); | ||
283 | script = newNetworkScript->text(); | ||
284 | } | ||
285 | else if ( type == "managed" || type == "adhoc" ) | ||
286 | { | ||
287 | action = newClientAction->currentItem(); | ||
288 | script = newClientScript->text(); | ||
289 | } | ||
290 | else if ( type == "station" ) | ||
291 | { | ||
292 | action = newStationAction->currentItem(); | ||
293 | script = newStationScript->text(); | ||
294 | } | ||
295 | else | ||
296 | { | ||
297 | qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | qDebug( "going to perform action %d (script='%s')", action, (const char*) script ); | ||
302 | |||
303 | /* | ||
304 | |||
305 | if ( sound == "Ignore" ) return; | ||
306 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | ||
307 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | ||
308 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | ||
309 | |||
310 | */ | ||
311 | } | ||
312 | |||
313 | |||
238 | void WellenreiterConfigWindow::load() | 314 | void WellenreiterConfigWindow::load() |
239 | { | 315 | { |
240 | #ifdef Q_WS_X11 | 316 | #ifdef Q_WS_X11 |
241 | #warning Persistent Configuration not yet implemented for standalone X11 build | 317 | #warning Persistent Configuration not yet implemented for standalone X11 build |
242 | performAutodetection(); | 318 | performAutodetection(); |
243 | #else | 319 | #else |
244 | qDebug( "loading configuration settings..." ); | 320 | qDebug( "loading configuration settings..." ); |
245 | 321 | ||
246 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ | 322 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ |
247 | 323 | ||
248 | OConfig* c = oApp->config(); | 324 | OConfig* c = oApp->config(); |
249 | 325 | ||
250 | c->setGroup( "Interface" ); | 326 | c->setGroup( "Interface" ); |
251 | 327 | ||
252 | QString interface = c->readEntry( "name", "<none>" ); | 328 | QString interface = c->readEntry( "name", "<none>" ); |
253 | if ( interface != "<none>" ) | 329 | if ( interface != "<none>" ) |
254 | { | 330 | { |
255 | #if QT_VERSION < 300 | 331 | #if QT_VERSION < 300 |
256 | interfaceName->insertItem( interface, 0 ); | 332 | interfaceName->insertItem( interface, 0 ); |
257 | interfaceName->setCurrentItem( 0 ); | 333 | interfaceName->setCurrentItem( 0 ); |
258 | #else | 334 | #else |
259 | interfaceName->setCurrentText( interface ); | 335 | interfaceName->setCurrentText( interface ); |
260 | #endif | 336 | #endif |
261 | 337 | ||
262 | QString device = c->readEntry( "type", "<select>" ); | 338 | QString device = c->readEntry( "type", "<select>" ); |
263 | #if QT_VERSION < 300 | 339 | #if QT_VERSION < 300 |
264 | for ( int i = 0; i < deviceType->count(); ++i ) | 340 | for ( int i = 0; i < deviceType->count(); ++i ) |
265 | { | 341 | { |
266 | if ( deviceType->text( i ) == device ) | 342 | if ( deviceType->text( i ) == device ) |
267 | { | 343 | { |
268 | deviceType->setCurrentItem( i ); | 344 | deviceType->setCurrentItem( i ); |
269 | break; | 345 | break; |
270 | } | 346 | } |
271 | } | 347 | } |
272 | #else | 348 | #else |
273 | deviceType->setCurrentText( device ); | 349 | deviceType->setCurrentText( device ); |
274 | #endif | 350 | #endif |
275 | } | 351 | } |
276 | else | 352 | else |
277 | { | 353 | { |
278 | performAutodetection(); | 354 | performAutodetection(); |
279 | } | 355 | } |
280 | 356 | ||
281 | prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); | 357 | prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); |
282 | hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); | 358 | hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); |
283 | hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); | 359 | hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); |
284 | adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); | 360 | adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); |
285 | 361 | ||
286 | c->setGroup( "Capture" ); | 362 | c->setGroup( "Capture" ); |
287 | captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); | 363 | captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); |
288 | 364 | ||
289 | c->setGroup( "UI" ); | 365 | c->setGroup( "UI" ); |
290 | lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); | 366 | lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); |
291 | openTree->setChecked( c->readBoolEntry( "openTree", true ) ); | 367 | openTree->setChecked( c->readBoolEntry( "openTree", true ) ); |
292 | disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); | 368 | disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); |
369 | newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 0 ) ); | ||
370 | newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) ); | ||
371 | newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 0 ) ); | ||
372 | newClientScript->setText( c->readEntry( "newClientScript", "" ) ); | ||
373 | newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 0 ) ); | ||
374 | newStationScript->setText( c->readEntry( "newStationScript", "" ) ); | ||
375 | synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand | ||
293 | 376 | ||
294 | c->setGroup( "GPS" ); | 377 | c->setGroup( "GPS" ); |
295 | enableGPS->setChecked( c->readBoolEntry( "use", false ) ); | 378 | enableGPS->setChecked( c->readBoolEntry( "use", false ) ); |
296 | #if QT_VERSION < 300 | 379 | #if QT_VERSION < 300 |
297 | gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); | 380 | gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); |
298 | gpsdHost->setCurrentItem( 0 ); | 381 | gpsdHost->setCurrentItem( 0 ); |
299 | #else | 382 | #else |
300 | gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); | 383 | gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); |
301 | #endif | 384 | #endif |
302 | gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); | 385 | gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); |
303 | startGPS->setChecked( c->readBoolEntry( "start", false ) ); | 386 | startGPS->setChecked( c->readBoolEntry( "start", false ) ); |
304 | commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); | 387 | commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); |
305 | 388 | ||
306 | #endif | 389 | #endif |
307 | } | 390 | } |
308 | 391 | ||
309 | 392 | ||
310 | void WellenreiterConfigWindow::save() | 393 | void WellenreiterConfigWindow::save() |
311 | { | 394 | { |
312 | #ifdef Q_WS_X11 | 395 | #ifdef Q_WS_X11 |
313 | #warning Persistent Configuration not yet implemented for standalone X11 build | 396 | #warning Persistent Configuration not yet implemented for standalone X11 build |
314 | #else | 397 | #else |
315 | qDebug( "saving configuration settings..." ); | 398 | qDebug( "saving configuration settings..." ); |
316 | 399 | ||
317 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ | 400 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ |
318 | 401 | ||
319 | OConfig* c = oApp->config(); | 402 | OConfig* c = oApp->config(); |
320 | 403 | ||
321 | c->setGroup( "Interface" ); | 404 | c->setGroup( "Interface" ); |
322 | c->writeEntry( "name", interfaceName->currentText() ); | 405 | c->writeEntry( "name", interfaceName->currentText() ); |
323 | c->writeEntry( "type", deviceType->currentText() ); | 406 | c->writeEntry( "type", deviceType->currentText() ); |
324 | c->writeEntry( "prism", prismHeader->isChecked() ); | 407 | c->writeEntry( "prism", prismHeader->isChecked() ); |
325 | c->writeEntry( "hop", hopChannels->isChecked() ); | 408 | c->writeEntry( "hop", hopChannels->isChecked() ); |
326 | c->writeEntry( "interval", hopInterval->value() ); | 409 | c->writeEntry( "interval", hopInterval->value() ); |
327 | c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); | 410 | c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); |
328 | 411 | ||
329 | c->setGroup( "Capture" ); | 412 | c->setGroup( "Capture" ); |
330 | c->writeEntry( "filename", captureFileName->text() ); | 413 | c->writeEntry( "filename", captureFileName->text() ); |
331 | 414 | ||
332 | c->setGroup( "UI" ); | 415 | c->setGroup( "UI" ); |
333 | c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); | 416 | c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); |
334 | c->writeEntry( "openTree", openTree->isChecked() ); | 417 | c->writeEntry( "openTree", openTree->isChecked() ); |
335 | c->writeEntry( "disablePM", disablePM->isChecked() ); | 418 | c->writeEntry( "disablePM", disablePM->isChecked() ); |
419 | c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() ); | ||
420 | c->writeEntry( "newNetworkScript", newNetworkScript->text() ); | ||
421 | c->writeEntry( "newClientAction", newClientAction->currentItem() ); | ||
422 | c->writeEntry( "newClientScript", newClientScript->text() ); | ||
423 | c->writeEntry( "newStationAction", newStationAction->currentItem() ); | ||
424 | c->writeEntry( "newStationScript", newStationScript->text() ); | ||
336 | 425 | ||
337 | c->setGroup( "GPS" ); | 426 | c->setGroup( "GPS" ); |
338 | c->writeEntry( "use", enableGPS->isChecked() ); | 427 | c->writeEntry( "use", enableGPS->isChecked() ); |
339 | c->writeEntry( "host", gpsdHost->currentText() ); | 428 | c->writeEntry( "host", gpsdHost->currentText() ); |
340 | c->writeEntry( "port", gpsdPort->value() ); | 429 | c->writeEntry( "port", gpsdPort->value() ); |
341 | c->writeEntry( "start", startGPS->isChecked() ); | 430 | c->writeEntry( "start", startGPS->isChecked() ); |
342 | c->writeEntry( "command", commandGPS->text() ); | 431 | c->writeEntry( "command", commandGPS->text() ); |
343 | 432 | ||
344 | c->write(); | 433 | c->write(); |
345 | 434 | ||
346 | #endif | 435 | #endif |
347 | } | 436 | } |
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 80b4d2b..b082331 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h | |||
@@ -12,60 +12,67 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef WELLENREITERCONFIGWINDOW_H | 16 | #ifndef WELLENREITERCONFIGWINDOW_H |
17 | #define WELLENREITERCONFIGWINDOW_H | 17 | #define WELLENREITERCONFIGWINDOW_H |
18 | 18 | ||
19 | #include "configbase.h" | 19 | #include "configbase.h" |
20 | #include <qmap.h> | 20 | #include <qmap.h> |
21 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | 23 | ||
24 | const int DEVTYPE_SELECT = 0; | 24 | const int DEVTYPE_SELECT = 0; |
25 | const int DEVTYPE_CISCO = 1; | 25 | const int DEVTYPE_CISCO = 1; |
26 | const int DEVTYPE_WLAN_NG = 2; | 26 | const int DEVTYPE_WLAN_NG = 2; |
27 | const int DEVTYPE_HOSTAP = 3; | 27 | const int DEVTYPE_HOSTAP = 3; |
28 | const int DEVTYPE_ORINOCO = 4; | 28 | const int DEVTYPE_ORINOCO = 4; |
29 | const int DEVTYPE_MANUAL = 5; | 29 | const int DEVTYPE_MANUAL = 5; |
30 | const int DEVTYPE_FILE = 6; | 30 | const int DEVTYPE_FILE = 6; |
31 | 31 | ||
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(); | 40 | ~WellenreiterConfigWindow(); |
41 | 41 | ||
42 | int driverType() const; | 42 | int driverType() const; |
43 | const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; | 43 | const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; |
44 | const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; | 44 | const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; |
45 | static WellenreiterConfigWindow* instance() { return _instance; }; | 45 | static WellenreiterConfigWindow* instance() { return _instance; }; |
46 | 46 | ||
47 | int hoppingInterval() const; | 47 | int hoppingInterval() const; |
48 | bool usePrismHeader() const; | 48 | bool usePrismHeader() const; |
49 | bool isChannelChecked( int ) const; | 49 | bool isChannelChecked( int ) const; |
50 | 50 | ||
51 | bool useGPS() const; | 51 | bool useGPS() const; |
52 | const QString gpsHost() const; | 52 | const QString gpsHost() const; |
53 | int gpsPort() const; | 53 | int gpsPort() const; |
54 | 54 | ||
55 | void save(); | 55 | void save(); |
56 | void load(); | 56 | void load(); |
57 | 57 | ||
58 | public slots: | 58 | public slots: |
59 | void changedDeviceType(int); | 59 | void changedDeviceType(int); |
60 | void changedNetworkAction(int t); | ||
61 | void changedClientAction(int t); | ||
62 | void changedStationAction(int t); | ||
60 | void getCaptureFileNameClicked(); | 63 | void getCaptureFileNameClicked(); |
61 | void performAutodetection(); | 64 | void performAutodetection(); |
62 | void channelAllClicked(int); | 65 | void channelAllClicked(int); |
66 | void performAction( const QString& ); | ||
67 | |||
68 | protected: | ||
69 | void synchronizeActionsAndScripts(); | ||
63 | 70 | ||
64 | protected: | 71 | protected: |
65 | QMap<QString, int> _devicetype; | 72 | QMap<QString, int> _devicetype; |
66 | static WellenreiterConfigWindow* _instance; | 73 | static WellenreiterConfigWindow* _instance; |
67 | int _guess; | 74 | int _guess; |
68 | 75 | ||
69 | }; | 76 | }; |
70 | 77 | ||
71 | #endif | 78 | #endif |
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 31f95ce..b814427 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -13,113 +13,113 @@ | |||
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "gps.h" | 16 | #include "gps.h" |
17 | 17 | ||
18 | /* QT */ | 18 | /* QT */ |
19 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
20 | 20 | ||
21 | /* STD */ | 21 | /* STD */ |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | 24 | ||
25 | GPS::GPS( QObject* parent, const char * name ) | 25 | GPS::GPS( QObject* parent, const char * name ) |
26 | :QObject( parent, name ) | 26 | :QObject( parent, name ) |
27 | { | 27 | { |
28 | qDebug( "GPS::GPS()" ); | 28 | qDebug( "GPS::GPS()" ); |
29 | _socket = new QSocket( this, "gpsd commsock" ); | 29 | _socket = new QSocket( this, "gpsd commsock" ); |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | GPS::~GPS() | 33 | GPS::~GPS() |
34 | { | 34 | { |
35 | qDebug( "GPS::~GPS()" ); | 35 | qDebug( "GPS::~GPS()" ); |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | bool GPS::open( const QString& host, int port ) | 39 | bool GPS::open( const QString& host, int port ) |
40 | { | 40 | { |
41 | _socket->connectToHost( host, port ); | 41 | _socket->connectToHost( host, port ); |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | GpsLocation GPS::position() const | 45 | GpsLocation GPS::position() const |
46 | { | 46 | { |
47 | char buf[256]; | 47 | char buf[256]; |
48 | 48 | ||
49 | int result = _socket->writeBlock( "p\r\n", 3 ); | 49 | int result = _socket->writeBlock( "p\r\n", 3 ); |
50 | _socket->flush(); | 50 | _socket->flush(); |
51 | if ( result ) | 51 | if ( result ) |
52 | { | 52 | { |
53 | int numAvail = _socket->bytesAvailable(); | 53 | int numAvail = _socket->bytesAvailable(); |
54 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); | 54 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); |
55 | if ( numAvail ) | 55 | if ( numAvail ) |
56 | { | 56 | { |
57 | QTextStream stream( _socket ); | 57 | QTextStream stream( _socket ); |
58 | 58 | ||
59 | QString str; | 59 | QString str; |
60 | stream.readRawBytes( &buf[0], 7 ); | 60 | stream.readRawBytes( &buf[0], 7 ); |
61 | float lat = -111.111; | 61 | float lat = -111; |
62 | stream >> lat; | 62 | stream >> lat; |
63 | stream.skipWhiteSpace(); | 63 | stream.skipWhiteSpace(); |
64 | float lon = -111.111; | 64 | float lon = -111; |
65 | stream >> lon; | 65 | stream >> lon; |
66 | stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF | 66 | stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF |
67 | 67 | ||
68 | return GpsLocation( lat, lon ); | 68 | return GpsLocation( lat, lon ); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | return GpsLocation( -111.111, -111.111 ); | 71 | return GpsLocation( -111, -111 ); |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | QString GpsLocation::dmsPosition() const | 75 | QString GpsLocation::dmsPosition() const |
76 | { | 76 | { |
77 | if ( _latitude == -111.111 || _longitude == -111.11 ) | 77 | if ( _latitude == -111 || _longitude == -111 ) |
78 | return "N/A"; | 78 | return "N/A"; |
79 | if ( _latitude == 0.0 && _longitude == 0.0 ) | 79 | if ( _latitude == 0.0 && _longitude == 0.0 ) |
80 | return "NULL"; | 80 | return "NULL"; |
81 | 81 | ||
82 | /* compute latitude */ | 82 | /* compute latitude */ |
83 | 83 | ||
84 | QString dms = "N"; | 84 | QString dms = "N"; |
85 | if ( _latitude >= 0 ) dms.append( "+" ); | 85 | if ( _latitude >= 0 ) dms.append( "+" ); |
86 | 86 | ||
87 | int trunc = int( _latitude ); | 87 | int trunc = int( _latitude ); |
88 | float rest = _latitude - trunc; | 88 | float rest = _latitude - trunc; |
89 | 89 | ||
90 | float minf = rest * 60; | 90 | float minf = rest * 60; |
91 | int minutes = int( minf ); | 91 | int minutes = int( minf ); |
92 | 92 | ||
93 | rest = minf - minutes; | 93 | rest = minf - minutes; |
94 | int seconds = int( rest * 60 ); | 94 | int seconds = int( rest * 60 ); |
95 | 95 | ||
96 | dms.append( QString::number( trunc ) ); | 96 | dms.append( QString::number( trunc ) ); |
97 | dms.append( "° " ); | 97 | dms.append( "° " ); |
98 | dms.append( QString::number( ::abs( minutes ) ) ); | 98 | dms.append( QString::number( ::abs( minutes ) ) ); |
99 | dms.append( "' " ); | 99 | dms.append( "' " ); |
100 | dms.append( QString::number( ::abs( seconds ) ) ); | 100 | dms.append( QString::number( ::abs( seconds ) ) ); |
101 | dms.append( "'' " ); | 101 | dms.append( "'' " ); |
102 | 102 | ||
103 | /* compute longitude */ | 103 | /* compute longitude */ |
104 | 104 | ||
105 | dms.append( " | W" ); | 105 | dms.append( " | W" ); |
106 | if ( _longitude > 0 ) dms.append( "+" ); | 106 | if ( _longitude > 0 ) dms.append( "+" ); |
107 | 107 | ||
108 | trunc = int( _longitude ); | 108 | trunc = int( _longitude ); |
109 | rest = _longitude - trunc; | 109 | rest = _longitude - trunc; |
110 | 110 | ||
111 | minf = rest * 60; | 111 | minf = rest * 60; |
112 | minutes = int( minf ); | 112 | minutes = int( minf ); |
113 | 113 | ||
114 | rest = minf - minutes; | 114 | rest = minf - minutes; |
115 | seconds = int( rest * 60 ); | 115 | seconds = int( rest * 60 ); |
116 | 116 | ||
117 | dms.append( QString::number( trunc ) ); | 117 | dms.append( QString::number( trunc ) ); |
118 | dms.append( "° " ); | 118 | dms.append( "° " ); |
119 | dms.append( QString::number( ::abs( minutes ) ) ); | 119 | dms.append( QString::number( ::abs( minutes ) ) ); |
120 | dms.append( "' " ); | 120 | dms.append( "' " ); |
121 | dms.append( QString::number( ::abs( seconds ) ) ); | 121 | dms.append( QString::number( ::abs( seconds ) ) ); |
122 | dms.append( "'' " ); | 122 | dms.append( "'' " ); |
123 | 123 | ||
124 | return dms; | 124 | return dms; |
125 | } | 125 | } |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index d89c71f..470646d 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -1,81 +1,78 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "logwindow.h" | 18 | #include "logwindow.h" |
19 | 19 | ||
20 | #include <assert.h> | 20 | #include <assert.h> |
21 | #include <qcursor.h> | 21 | #include <qcursor.h> |
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
24 | #include <qpopupmenu.h> | 24 | #include <qpopupmenu.h> |
25 | #include <qcheckbox.h> | 25 | #include <qcheckbox.h> |
26 | 26 | ||
27 | #ifdef QWS | 27 | #ifdef QWS |
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #include <opie/odevice.h> | ||
30 | using namespace Opie; | ||
31 | #endif | 29 | #endif |
32 | 30 | ||
33 | |||
34 | #ifdef QWS | 31 | #ifdef QWS |
35 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
36 | #else | 33 | #else |
37 | #include "resource.h" | 34 | #include "resource.h" |
38 | #endif | 35 | #endif |
39 | 36 | ||
40 | const int col_type = 0; | 37 | const int col_type = 0; |
41 | const int col_essid = 0; | 38 | const int col_essid = 0; |
42 | const int col_sig = 1; | 39 | const int col_sig = 1; |
43 | const int col_ap = 2; | 40 | const int col_ap = 2; |
44 | const int col_channel = 3; | 41 | const int col_channel = 3; |
45 | const int col_wep = 4; | 42 | const int col_wep = 4; |
46 | const int col_traffic = 5; | 43 | const int col_traffic = 5; |
47 | const int col_ip = 6; | 44 | const int col_ip = 6; |
48 | const int col_manuf = 7; | 45 | const int col_manuf = 7; |
49 | const int col_firstseen = 8; | 46 | const int col_firstseen = 8; |
50 | const int col_lastseen = 9; | 47 | const int col_lastseen = 9; |
51 | const int col_location = 10; | 48 | const int col_location = 10; |
52 | 49 | ||
53 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 50 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
54 | :OListView( parent, name ) | 51 | :OListView( parent, name ) |
55 | { | 52 | { |
56 | 53 | ||
57 | setFrameShape( QListView::StyledPanel ); | 54 | setFrameShape( QListView::StyledPanel ); |
58 | setFrameShadow( QListView::Sunken ); | 55 | setFrameShadow( QListView::Sunken ); |
59 | 56 | ||
60 | addColumn( tr( "Net/Station" ) ); | 57 | addColumn( tr( "Net/Station" ) ); |
61 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); | 58 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
62 | addColumn( tr( "#" ) ); | 59 | addColumn( tr( "#" ) ); |
63 | setColumnAlignment( col_sig, AlignCenter ); | 60 | setColumnAlignment( col_sig, AlignCenter ); |
64 | addColumn( tr( "MAC" ) ); | 61 | addColumn( tr( "MAC" ) ); |
65 | setColumnAlignment( col_ap, AlignCenter ); | 62 | setColumnAlignment( col_ap, AlignCenter ); |
66 | addColumn( tr( "Chn" ) ); | 63 | addColumn( tr( "Chn" ) ); |
67 | setColumnAlignment( col_channel, AlignCenter ); | 64 | setColumnAlignment( col_channel, AlignCenter ); |
68 | addColumn( tr( "W" ) ); | 65 | addColumn( tr( "W" ) ); |
69 | setColumnAlignment( col_wep, AlignCenter ); | 66 | setColumnAlignment( col_wep, AlignCenter ); |
70 | addColumn( tr( "T" ) ); | 67 | addColumn( tr( "T" ) ); |
71 | setColumnAlignment( col_traffic, AlignCenter ); | 68 | setColumnAlignment( col_traffic, AlignCenter ); |
72 | addColumn( tr( "IP" ) ); | 69 | addColumn( tr( "IP" ) ); |
73 | setColumnAlignment( col_ip, AlignCenter ); | 70 | setColumnAlignment( col_ip, AlignCenter ); |
74 | addColumn( tr( "Manufacturer" ) ); | 71 | addColumn( tr( "Manufacturer" ) ); |
75 | setColumnAlignment( col_manuf, AlignCenter ); | 72 | setColumnAlignment( col_manuf, AlignCenter ); |
76 | addColumn( tr( "First Seen" ) ); | 73 | addColumn( tr( "First Seen" ) ); |
77 | setColumnAlignment( col_firstseen, AlignCenter ); | 74 | setColumnAlignment( col_firstseen, AlignCenter ); |
78 | addColumn( tr( "Last Seen" ) ); | 75 | addColumn( tr( "Last Seen" ) ); |
79 | setColumnAlignment( col_lastseen, AlignCenter ); | 76 | setColumnAlignment( col_lastseen, AlignCenter ); |
80 | addColumn( tr( "Location" ) ); | 77 | addColumn( tr( "Location" ) ); |
81 | setColumnAlignment( col_location, AlignCenter ); | 78 | setColumnAlignment( col_location, AlignCenter ); |
@@ -376,98 +373,100 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, | |||
376 | // never seen that - add new item | 373 | // never seen that - add new item |
377 | 374 | ||
378 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); | 375 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
379 | item->setText( col_essid, name ); | 376 | item->setText( col_essid, name ); |
380 | 377 | ||
381 | return; | 378 | return; |
382 | } | 379 | } |
383 | } | 380 | } |
384 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 381 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
385 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 382 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
386 | (const char*) macaddr.toString(), (const char*) ip ) ); | 383 | (const char*) macaddr.toString(), (const char*) ip ) ); |
387 | } | 384 | } |
388 | 385 | ||
389 | 386 | ||
390 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 387 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
391 | { | 388 | { |
392 | if ( !item ) return; | 389 | if ( !item ) return; |
393 | 390 | ||
394 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 391 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
395 | 392 | ||
396 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 393 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", |
397 | (const char*) itm->text(0), (const char*) itm->type, col ); | 394 | (const char*) itm->text(0), (const char*) itm->type, col ); |
398 | 395 | ||
399 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 396 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
400 | { | 397 | { |
401 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 398 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |
402 | 399 | ||
403 | QPopupMenu m( this ); | 400 | QPopupMenu m( this ); |
404 | m.insertItem( entry, 37773, 0 ); | 401 | m.insertItem( entry, 37773, 0 ); |
405 | int result = m.exec( QCursor::pos() ); | 402 | int result = m.exec( QCursor::pos() ); |
406 | if ( result == 37773 ) | 403 | if ( result == 37773 ) |
407 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | 404 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); |
408 | } | 405 | } |
409 | } | 406 | } |
410 | 407 | ||
411 | //============================================================ | 408 | //============================================================ |
412 | // MScanListItem | 409 | // MScanListItem |
413 | //============================================================ | 410 | //============================================================ |
414 | 411 | ||
415 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 412 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
416 | bool wep, int channel, int signal ) | 413 | bool wep, int channel, int signal ) |
417 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 414 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
418 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 415 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
419 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 416 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
420 | { | 417 | { |
421 | #ifdef DEBUG | 418 | #ifdef DEBUG |
422 | qDebug( "creating scanlist item" ); | 419 | qDebug( "creating scanlist item" ); |
423 | #endif | 420 | #endif |
424 | if ( WellenreiterConfigWindow::instance() && type == "network" ) | 421 | |
425 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 422 | if ( WellenreiterConfigWindow::instance() ) |
423 | WellenreiterConfigWindow::instance()->performAction( type ); // better use signal/slot combination here | ||
424 | |||
426 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 425 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
427 | } | 426 | } |
428 | 427 | ||
429 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 428 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
430 | bool wep, int channel, int signal ) | 429 | bool wep, int channel, int signal ) |
431 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 430 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
432 | { | 431 | { |
433 | #ifdef DEBUG | 432 | #ifdef DEBUG |
434 | qDebug( "creating scanlist item" ); | 433 | qDebug( "creating scanlist item" ); |
435 | #endif | 434 | #endif |
436 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 435 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
437 | } | 436 | } |
438 | 437 | ||
439 | const QString& MScanListItem::essid() const | 438 | const QString& MScanListItem::essid() const |
440 | { | 439 | { |
441 | if ( type == "network" ) | 440 | if ( type == "network" ) |
442 | return _essid; | 441 | return _essid; |
443 | else | 442 | else |
444 | return ( (MScanListItem*) parent() )->essid(); | 443 | return ( (MScanListItem*) parent() )->essid(); |
445 | } | 444 | } |
446 | 445 | ||
447 | OListViewItem* MScanListItem::childFactory() | 446 | OListViewItem* MScanListItem::childFactory() |
448 | { | 447 | { |
449 | return new MScanListItem( this ); | 448 | return new MScanListItem( this ); |
450 | } | 449 | } |
451 | 450 | ||
452 | void MScanListItem::serializeTo( QDataStream& s ) const | 451 | void MScanListItem::serializeTo( QDataStream& s ) const |
453 | { | 452 | { |
454 | #ifdef DEBUG | 453 | #ifdef DEBUG |
455 | qDebug( "serializing MScanListItem" ); | 454 | qDebug( "serializing MScanListItem" ); |
456 | #endif | 455 | #endif |
457 | OListViewItem::serializeTo( s ); | 456 | OListViewItem::serializeTo( s ); |
458 | 457 | ||
459 | s << _type; | 458 | s << _type; |
460 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 459 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
461 | } | 460 | } |
462 | 461 | ||
463 | void MScanListItem::serializeFrom( QDataStream& s ) | 462 | void MScanListItem::serializeFrom( QDataStream& s ) |
464 | { | 463 | { |
465 | #ifdef DEBUG | 464 | #ifdef DEBUG |
466 | qDebug( "serializing MScanListItem" ); | 465 | qDebug( "serializing MScanListItem" ); |
467 | #endif | 466 | #endif |
468 | OListViewItem::serializeFrom( s ); | 467 | OListViewItem::serializeFrom( s ); |
469 | 468 | ||
470 | char wep; | 469 | char wep; |
471 | s >> _type; | 470 | s >> _type; |
472 | s >> (Q_UINT8) wep; | 471 | s >> (Q_UINT8) wep; |
473 | _wep = (wep == 'y'); | 472 | _wep = (wep == 'y'); |
@@ -494,73 +493,62 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
494 | QString name; | 493 | QString name; |
495 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 494 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
496 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 495 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
497 | 496 | ||
498 | // set icon for wep (wireless encryption protocol) | 497 | // set icon for wep (wireless encryption protocol) |
499 | if ( wep ) | 498 | if ( wep ) |
500 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 499 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
501 | 500 | ||
502 | // set channel and signal text | 501 | // set channel and signal text |
503 | 502 | ||
504 | if ( signal != -1 ) | 503 | if ( signal != -1 ) |
505 | setText( col_sig, QString::number( signal ) ); | 504 | setText( col_sig, QString::number( signal ) ); |
506 | if ( channel != -1 ) | 505 | if ( channel != -1 ) |
507 | setText( col_channel, QString::number( channel ) ); | 506 | setText( col_channel, QString::number( channel ) ); |
508 | 507 | ||
509 | setText( col_firstseen, QTime::currentTime().toString() ); | 508 | setText( col_firstseen, QTime::currentTime().toString() ); |
510 | //setText( col_lastseen, QTime::currentTime().toString() ); | 509 | //setText( col_lastseen, QTime::currentTime().toString() ); |
511 | 510 | ||
512 | listView()->triggerUpdate(); | 511 | listView()->triggerUpdate(); |
513 | 512 | ||
514 | this->type = type; | 513 | this->type = type; |
515 | _type = type; | 514 | _type = type; |
516 | _essid = essid; | 515 | _essid = essid; |
517 | _macaddr = macaddr; | 516 | _macaddr = macaddr; |
518 | _channel = channel; | 517 | _channel = channel; |
519 | _beacons = 1; | 518 | _beacons = 1; |
520 | _signal = 0; | 519 | _signal = 0; |
521 | 520 | ||
522 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) | 521 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) |
523 | { | 522 | { |
524 | listView()->ensureItemVisible( this ); | 523 | listView()->ensureItemVisible( this ); |
525 | } | 524 | } |
526 | 525 | ||
527 | } | 526 | } |
528 | 527 | ||
529 | 528 | ||
530 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 529 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
531 | { | 530 | { |
532 | setText( col_manuf, manufacturer ); | 531 | setText( col_manuf, manufacturer ); |
533 | } | 532 | } |
534 | 533 | ||
535 | 534 | ||
536 | void MScanListItem::setLocation( const QString& location ) | 535 | void MScanListItem::setLocation( const QString& location ) |
537 | { | 536 | { |
538 | setText( col_location, location ); | 537 | setText( col_location, location ); |
539 | } | 538 | } |
540 | 539 | ||
541 | 540 | ||
542 | void MScanListItem::playSound( const QString& sound ) const | ||
543 | { | ||
544 | #ifdef QWS | ||
545 | if ( sound == "Ignore" ) return; | ||
546 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | ||
547 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | ||
548 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | ||
549 | #endif | ||
550 | } | ||
551 | |||
552 | |||
553 | void MScanListItem::receivedBeacon() | 541 | void MScanListItem::receivedBeacon() |
554 | { | 542 | { |
555 | _beacons++; | 543 | _beacons++; |
556 | #ifdef DEBUG | 544 | #ifdef DEBUG |
557 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 545 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
558 | #endif | 546 | #endif |
559 | setText( col_sig, QString::number( _beacons ) ); | 547 | setText( col_sig, QString::number( _beacons ) ); |
560 | setText( col_lastseen, QTime::currentTime().toString() ); | 548 | setText( col_lastseen, QTime::currentTime().toString() ); |
561 | 549 | ||
562 | MScanListItem* p = (MScanListItem*) parent(); | 550 | MScanListItem* p = (MScanListItem*) parent(); |
563 | if ( p ) p->receivedBeacon(); | 551 | if ( p ) p->receivedBeacon(); |
564 | 552 | ||
565 | } | 553 | } |
566 | 554 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 6cd8fc0..42f35c2 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -64,79 +64,76 @@ class MScanListView: public OListView | |||
64 | 64 | ||
65 | //****************************** MScanListItem **************************************************************** | 65 | //****************************** MScanListItem **************************************************************** |
66 | 66 | ||
67 | class MScanListItem: public OListViewItem | 67 | class MScanListItem: public OListViewItem |
68 | { | 68 | { |
69 | public: | 69 | public: |
70 | MScanListItem::MScanListItem( QListView* parent, | 70 | MScanListItem::MScanListItem( QListView* parent, |
71 | QString type = "unknown", | 71 | QString type = "unknown", |
72 | QString essid = "unknown", | 72 | QString essid = "unknown", |
73 | QString macaddr = "unknown", | 73 | QString macaddr = "unknown", |
74 | bool wep = false, | 74 | bool wep = false, |
75 | int channel = 0, | 75 | int channel = 0, |
76 | int signal = 0 ); | 76 | int signal = 0 ); |
77 | 77 | ||
78 | MScanListItem::MScanListItem( QListViewItem* parent, | 78 | MScanListItem::MScanListItem( QListViewItem* parent, |
79 | QString type = "unknown", | 79 | QString type = "unknown", |
80 | QString essid = "unknown", | 80 | QString essid = "unknown", |
81 | QString macaddr = "unknown", | 81 | QString macaddr = "unknown", |
82 | bool wep = false, | 82 | bool wep = false, |
83 | int channel = 0, | 83 | int channel = 0, |
84 | int signal = 0 ); | 84 | int signal = 0 ); |
85 | 85 | ||
86 | 86 | ||
87 | protected: | 87 | protected: |
88 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 88 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); |
89 | 89 | ||
90 | public: | 90 | public: |
91 | QString type; | 91 | QString type; |
92 | 92 | ||
93 | public: | 93 | public: |
94 | //const QString& type() { return _type; }; | 94 | //const QString& type() { return _type; }; |
95 | const QString& essid() const; | 95 | const QString& essid() const; |
96 | const QString& macaddr() { return _macaddr; }; | 96 | const QString& macaddr() { return _macaddr; }; |
97 | bool wep() { return _wep; }; | 97 | bool wep() { return _wep; }; |
98 | int channel() { return _channel; }; | 98 | int channel() { return _channel; }; |
99 | int signal() { return _signal; }; | 99 | int signal() { return _signal; }; |
100 | int beacons() { return _beacons; }; | 100 | int beacons() { return _beacons; }; |
101 | 101 | ||
102 | void setSignal( int signal ) { /* TODO */ }; | 102 | void setSignal( int signal ) { /* TODO */ }; |
103 | void receivedBeacon(); | 103 | void receivedBeacon(); |
104 | 104 | ||
105 | void setManufacturer( const QString& manufacturer ); | 105 | void setManufacturer( const QString& manufacturer ); |
106 | void setLocation( const QString& location ); | 106 | void setLocation( const QString& location ); |
107 | 107 | ||
108 | virtual OListViewItem* childFactory(); | 108 | virtual OListViewItem* childFactory(); |
109 | virtual void serializeTo( QDataStream& s ) const; | 109 | virtual void serializeTo( QDataStream& s ) const; |
110 | virtual void serializeFrom( QDataStream& s ); | 110 | virtual void serializeFrom( QDataStream& s ); |
111 | 111 | ||
112 | protected: | ||
113 | void playSound( const QString& ) const; | ||
114 | |||
115 | private: | 112 | private: |
116 | QString _type; | 113 | QString _type; |
117 | QString _essid; | 114 | QString _essid; |
118 | QString _macaddr; | 115 | QString _macaddr; |
119 | bool _wep; | 116 | bool _wep; |
120 | int _channel; | 117 | int _channel; |
121 | int _signal; | 118 | int _signal; |
122 | int _beacons; | 119 | int _beacons; |
123 | 120 | ||
124 | }; | 121 | }; |
125 | 122 | ||
126 | //****************************** MScanListViewFactory **************************************************************** | 123 | //****************************** MScanListViewFactory **************************************************************** |
127 | 124 | ||
128 | /* | 125 | /* |
129 | 126 | ||
130 | class MScanListViewFactory : public OListViewFactory | 127 | class MScanListViewFactory : public OListViewFactory |
131 | { | 128 | { |
132 | public: | 129 | public: |
133 | virtual QListView* listViewFactory(); | 130 | virtual QListView* listViewFactory(); |
134 | virtual QListViewItem* listViewItemFactory( QListView* lv ); | 131 | virtual QListViewItem* listViewItemFactory( QListView* lv ); |
135 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); | 132 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); |
136 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); | 133 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); |
137 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); | 134 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); |
138 | } | 135 | } |
139 | */ | 136 | */ |
140 | 137 | ||
141 | #endif | 138 | #endif |
142 | 139 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 45d7142..25632f3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -136,176 +136,176 @@ void Wellenreiter::channelHopped(int c) | |||
136 | 136 | ||
137 | 137 | ||
138 | void Wellenreiter::handleNotification( OPacket* p ) | 138 | void Wellenreiter::handleNotification( OPacket* p ) |
139 | { | 139 | { |
140 | QObjectList* l = p->queryList(); | 140 | QObjectList* l = p->queryList(); |
141 | QObjectListIt it( *l ); | 141 | QObjectListIt it( *l ); |
142 | QObject* o; | 142 | QObject* o; |
143 | 143 | ||
144 | while ( (o = it.current()) != 0 ) | 144 | while ( (o = it.current()) != 0 ) |
145 | { | 145 | { |
146 | QString name = it.current()->name(); | 146 | QString name = it.current()->name(); |
147 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 147 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
148 | { | 148 | { |
149 | QString action = configwindow->parsePackets->protocolAction( name ); | 149 | QString action = configwindow->parsePackets->protocolAction( name ); |
150 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 150 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); |
151 | doAction( action, name, p ); | 151 | doAction( action, name, p ); |
152 | } | 152 | } |
153 | else | 153 | else |
154 | { | 154 | { |
155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); |
156 | } | 156 | } |
157 | ++it; | 157 | ++it; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) | 162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
163 | { | 163 | { |
164 | if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time | 164 | if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time |
165 | 165 | ||
166 | OWaveLanManagementPacket* beacon = manage; | 166 | OWaveLanManagementPacket* beacon = manage; |
167 | 167 | ||
168 | QString type; | 168 | QString type; |
169 | if ( beacon->canIBSS() ) | 169 | if ( beacon->canIBSS() ) |
170 | { | 170 | { |
171 | type = "adhoc"; | 171 | type = "adhoc"; |
172 | } | 172 | } |
173 | else if ( beacon->canESS() ) | 173 | else if ( beacon->canESS() ) |
174 | { | 174 | { |
175 | type = "managed"; | 175 | type = "managed"; |
176 | } | 176 | } |
177 | else | 177 | else |
178 | { | 178 | { |
179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | 182 | ||
183 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 183 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
184 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 184 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
186 | int channel = ds ? ds->channel() : -1; | 186 | int channel = ds ? ds->channel() : -1; |
187 | 187 | ||
188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
189 | 189 | ||
190 | GpsLocation loc( -111.111, -111.111 ); | 190 | GpsLocation loc( -111, -111 ); |
191 | if ( configwindow->enableGPS->isChecked() ) | 191 | if ( configwindow->enableGPS->isChecked() ) |
192 | { | 192 | { |
193 | // TODO: add check if GPS is working!? | 193 | // TODO: add check if GPS is working!? |
194 | qDebug( "Wellenreiter::gathering GPS data..." ); | 194 | qDebug( "Wellenreiter::gathering GPS data..." ); |
195 | loc = gps->position(); | 195 | loc = gps->position(); |
196 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 196 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
197 | } | 197 | } |
198 | 198 | ||
199 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 199 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
200 | 200 | ||
201 | // update graph window | 201 | // update graph window |
202 | if ( ds ) | 202 | if ( ds ) |
203 | { | 203 | { |
204 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 204 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
205 | if ( prism ) | 205 | if ( prism ) |
206 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 206 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
207 | else | 207 | else |
208 | graphwindow->traffic( ds->channel(), 95 ); | 208 | graphwindow->traffic( ds->channel(), 95 ); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | 213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) |
214 | { | 214 | { |
215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
216 | 216 | ||
217 | if ( control->controlType() == "Acknowledge" ) | 217 | if ( control->controlType() == "Acknowledge" ) |
218 | { | 218 | { |
219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) ); | 219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); |
220 | } | 220 | } |
221 | else | 221 | else |
222 | { | 222 | { |
223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | 223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
229 | { | 229 | { |
230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
231 | if ( wlan->fromDS() && !wlan->toDS() ) | 231 | if ( wlan->fromDS() && !wlan->toDS() ) |
232 | { | 232 | { |
233 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 233 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
234 | from = wlan->macAddress3(); | 234 | from = wlan->macAddress3(); |
235 | to = wlan->macAddress2(); | 235 | to = wlan->macAddress2(); |
236 | } | 236 | } |
237 | else if ( !wlan->fromDS() && wlan->toDS() ) | 237 | else if ( !wlan->fromDS() && wlan->toDS() ) |
238 | { | 238 | { |
239 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 239 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
240 | from = wlan->macAddress2(); | 240 | from = wlan->macAddress2(); |
241 | to = wlan->macAddress3(); | 241 | to = wlan->macAddress3(); |
242 | } | 242 | } |
243 | else if ( wlan->fromDS() && wlan->toDS() ) | 243 | else if ( wlan->fromDS() && wlan->toDS() ) |
244 | { | 244 | { |
245 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 245 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
246 | from = wlan->macAddress4(); | 246 | from = wlan->macAddress4(); |
247 | to = wlan->macAddress3(); | 247 | to = wlan->macAddress3(); |
248 | } | 248 | } |
249 | else | 249 | else |
250 | { | 250 | { |
251 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 251 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
252 | from = wlan->macAddress2(); | 252 | from = wlan->macAddress2(); |
253 | to = wlan->macAddress1(); | 253 | to = wlan->macAddress1(); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | 257 | ||
258 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | 258 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) |
259 | { | 259 | { |
260 | from = data->sourceAddress(); | 260 | from = data->sourceAddress(); |
261 | to = data->destinationAddress(); | 261 | to = data->destinationAddress(); |
262 | 262 | ||
263 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) ); | 263 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) | 267 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) |
268 | { | 268 | { |
269 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 269 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
270 | if ( arp ) | 270 | if ( arp ) |
271 | { | 271 | { |
272 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 272 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
273 | if ( arp->type() == "REQUEST" ) | 273 | if ( arp->type() == "REQUEST" ) |
274 | { | 274 | { |
275 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 275 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
276 | } | 276 | } |
277 | else if ( arp->type() == "REPLY" ) | 277 | else if ( arp->type() == "REPLY" ) |
278 | { | 278 | { |
279 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 279 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
280 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 280 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) | 286 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) |
287 | { | 287 | { |
288 | //TODO: Implement more IP based protocols | 288 | //TODO: Implement more IP based protocols |
289 | 289 | ||
290 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); | 290 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); |
291 | if ( dhcp ) | 291 | if ( dhcp ) |
292 | { | 292 | { |
293 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); | 293 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); |
294 | if ( dhcp->type() == "OFFER" ) | 294 | if ( dhcp->type() == "OFFER" ) |
295 | { | 295 | { |
296 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); | 296 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); |
297 | netView()->identify( source, dhcp->serverAddress().toString() ); | 297 | netView()->identify( source, dhcp->serverAddress().toString() ); |
298 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 298 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
299 | } | 299 | } |
300 | else if ( dhcp->type() == "ACK" ) | 300 | else if ( dhcp->type() == "ACK" ) |
301 | { | 301 | { |
302 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); | 302 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); |
303 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | 303 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 309 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
310 | { | 310 | { |
311 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 311 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |