author | dwmw2 <dwmw2> | 2002-04-03 12:35:47 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2002-04-03 12:35:47 (UTC) |
commit | 65ffe04c08cae587dda25381065f986ae20490d3 (patch) (unidiff) | |
tree | 7d9e32c86c056b7d1bb67665ab5d06bfd1ab6ac1 | |
parent | baf2c30815ade433d18d1b6c8a7924c050344d23 (diff) | |
download | opie-65ffe04c08cae587dda25381065f986ae20490d3.zip opie-65ffe04c08cae587dda25381065f986ae20490d3.tar.gz opie-65ffe04c08cae587dda25381065f986ae20490d3.tar.bz2 |
Network list working...
-rw-r--r-- | noncore/unsupported/gsmtool/gsmtool.cpp | 47 | ||||
-rw-r--r-- | noncore/unsupported/gsmtool/gsmtoolbase.ui | 16 |
2 files changed, 59 insertions, 4 deletions
diff --git a/noncore/unsupported/gsmtool/gsmtool.cpp b/noncore/unsupported/gsmtool/gsmtool.cpp index 38c8c59..38baf45 100644 --- a/noncore/unsupported/gsmtool/gsmtool.cpp +++ b/noncore/unsupported/gsmtool/gsmtool.cpp | |||
@@ -1,22 +1,23 @@ | |||
1 | #include "gsmtool.h" | 1 | #include "gsmtool.h" |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qtabwidget.h> | 6 | #include <qtabwidget.h> |
7 | #include <qlistview.h> | ||
7 | 8 | ||
8 | #include <termios.h> | 9 | #include <termios.h> |
9 | 10 | ||
10 | #include <gsmlib/gsm_me_ta.h> | 11 | #include <gsmlib/gsm_me_ta.h> |
11 | #include <gsmlib/gsm_unix_serial.h> | 12 | #include <gsmlib/gsm_unix_serial.h> |
12 | 13 | ||
13 | using namespace gsmlib; | 14 | using namespace gsmlib; |
14 | 15 | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Constructs a GSMTool which is a child of 'parent', with the | 18 | * Constructs a GSMTool which is a child of 'parent', with the |
18 | * name 'name' and widget flags set to 'f' | 19 | * name 'name' and widget flags set to 'f' |
19 | */ | 20 | */ |
20 | GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) | 21 | GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) |
21 | : GSMToolBase( parent, name, fl ) | 22 | : GSMToolBase( parent, name, fl ) |
22 | { | 23 | { |
@@ -118,32 +119,78 @@ void GSMTool::timerEvent( QTimerEvent * ) | |||
118 | SigStrText->setText("Unknown"); | 119 | SigStrText->setText("Unknown"); |
119 | dB->setEnabled(FALSE); | 120 | dB->setEnabled(FALSE); |
120 | SigStrLabel->setEnabled(FALSE); | 121 | SigStrLabel->setEnabled(FALSE); |
121 | } else { | 122 | } else { |
122 | char buf[6]; | 123 | char buf[6]; |
123 | sprintf(buf, "%d", -113 + (2*csq)); | 124 | sprintf(buf, "%d", -113 + (2*csq)); |
124 | SigStrText->setText(buf); | 125 | SigStrText->setText(buf); |
125 | dB->setEnabled(TRUE); | 126 | dB->setEnabled(TRUE); |
126 | SigStrLabel->setEnabled(TRUE); | 127 | SigStrLabel->setEnabled(TRUE); |
127 | } | 128 | } |
128 | } | 129 | } |
129 | } | 130 | } |
130 | 131 | ||
131 | void GSMTool::doScanButton() | 132 | void GSMTool::doScanButton() |
132 | { | 133 | { |
133 | qDebug("ScanButton"); | 134 | qDebug("ScanButton"); |
135 | |||
136 | NetworkList->setEnabled(FALSE); | ||
137 | AvailNetsLabel->setEnabled(FALSE); | ||
138 | NetworkList->clear(); | ||
139 | new QListViewItem(NetworkList, "Scanning..."); | ||
140 | |||
141 | vector<OPInfo> opis; | ||
142 | |||
143 | try { | ||
144 | opis = me->getAvailableOPInfo(); | ||
145 | } catch (GsmException) { | ||
146 | NetworkList->clear(); | ||
147 | new QListViewItem(NetworkList, "Scan failed..."); | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | NetworkList->clear(); | ||
152 | for (vector<OPInfo>::iterator i = opis.begin(); i != opis.end(); ++i) { | ||
153 | char *statustext; | ||
154 | switch (i->_status) { | ||
155 | |||
156 | case UnknownOPStatus: | ||
157 | statustext = "unknown"; | ||
158 | break; | ||
159 | |||
160 | case CurrentOPStatus: | ||
161 | statustext = "current"; | ||
162 | break; | ||
163 | |||
164 | case AvailableOPStatus: | ||
165 | statustext = "available"; | ||
166 | break; | ||
167 | |||
168 | case ForbiddenOPStatus: | ||
169 | statustext = "forbidden"; | ||
170 | break; | ||
171 | |||
172 | default: | ||
173 | statustext = "(ERROR)"; | ||
174 | } | ||
175 | char num[7]; | ||
176 | snprintf(num, 6, "%d", i->_numericName); | ||
177 | new QListViewItem(NetworkList, i->_longName.c_str(), statustext, num, i->_shortName.c_str()); | ||
178 | } | ||
179 | NetworkList->setEnabled(TRUE); | ||
180 | AvailNetsLabel->setEnabled(TRUE); | ||
134 | } | 181 | } |
135 | /* | 182 | /* |
136 | * A simple slot... not very interesting. | 183 | * A simple slot... not very interesting. |
137 | */ | 184 | */ |
138 | void GSMTool::doConnectButton() | 185 | void GSMTool::doConnectButton() |
139 | { | 186 | { |
140 | gsmlib::Port *port; | 187 | gsmlib::Port *port; |
141 | 188 | ||
142 | speed_t rate; | 189 | speed_t rate; |
143 | devicename = strdup(DeviceName->currentText().local8Bit().data()); | 190 | devicename = strdup(DeviceName->currentText().local8Bit().data()); |
144 | rate = baudrates[BaudRate->currentItem()]; | 191 | rate = baudrates[BaudRate->currentItem()]; |
145 | 192 | ||
146 | qDebug("Connect Button Pressed"); | 193 | qDebug("Connect Button Pressed"); |
147 | MfrText->setText("Opening..."); | 194 | MfrText->setText("Opening..."); |
148 | ModelText->setText(""); | 195 | ModelText->setText(""); |
149 | RevisionText->setText(""); | 196 | RevisionText->setText(""); |
diff --git a/noncore/unsupported/gsmtool/gsmtoolbase.ui b/noncore/unsupported/gsmtool/gsmtoolbase.ui index 36a3d8e..72c943a 100644 --- a/noncore/unsupported/gsmtool/gsmtoolbase.ui +++ b/noncore/unsupported/gsmtool/gsmtoolbase.ui | |||
@@ -1,31 +1,31 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>GSMToolBase</class> | 2 | <class>GSMToolBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>GSM Tool</cstring> | 7 | <cstring>GSM Tool</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>272</width> | 14 | <width>388</width> |
15 | <height>366</height> | 15 | <height>502</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>GSM Tool</string> | 20 | <string>GSM Tool</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 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>2</number> |
@@ -539,37 +539,37 @@ | |||
539 | <property> | 539 | <property> |
540 | <name>layoutMargin</name> | 540 | <name>layoutMargin</name> |
541 | </property> | 541 | </property> |
542 | <hbox> | 542 | <hbox> |
543 | <property stdset="1"> | 543 | <property stdset="1"> |
544 | <name>margin</name> | 544 | <name>margin</name> |
545 | <number>0</number> | 545 | <number>0</number> |
546 | </property> | 546 | </property> |
547 | <property stdset="1"> | 547 | <property stdset="1"> |
548 | <name>spacing</name> | 548 | <name>spacing</name> |
549 | <number>1</number> | 549 | <number>1</number> |
550 | </property> | 550 | </property> |
551 | <widget> | 551 | <widget> |
552 | <class>QLabel</class> | 552 | <class>QLabel</class> |
553 | <property stdset="1"> | 553 | <property stdset="1"> |
554 | <name>name</name> | 554 | <name>name</name> |
555 | <cstring>AltNetsLabel</cstring> | 555 | <cstring>AvailNetsLabel</cstring> |
556 | </property> | 556 | </property> |
557 | <property stdset="1"> | 557 | <property stdset="1"> |
558 | <name>text</name> | 558 | <name>text</name> |
559 | <string>Alternative Networks:</string> | 559 | <string>Available Networks:</string> |
560 | </property> | 560 | </property> |
561 | </widget> | 561 | </widget> |
562 | <spacer> | 562 | <spacer> |
563 | <property> | 563 | <property> |
564 | <name>name</name> | 564 | <name>name</name> |
565 | <cstring>Spacer13</cstring> | 565 | <cstring>Spacer13</cstring> |
566 | </property> | 566 | </property> |
567 | <property stdset="1"> | 567 | <property stdset="1"> |
568 | <name>orientation</name> | 568 | <name>orientation</name> |
569 | <enum>Horizontal</enum> | 569 | <enum>Horizontal</enum> |
570 | </property> | 570 | </property> |
571 | <property stdset="1"> | 571 | <property stdset="1"> |
572 | <name>sizeType</name> | 572 | <name>sizeType</name> |
573 | <enum>Expanding</enum> | 573 | <enum>Expanding</enum> |
574 | </property> | 574 | </property> |
575 | <property> | 575 | <property> |
@@ -643,32 +643,36 @@ | |||
643 | <string>Shortname</string> | 643 | <string>Shortname</string> |
644 | </property> | 644 | </property> |
645 | <property> | 645 | <property> |
646 | <name>clickable</name> | 646 | <name>clickable</name> |
647 | <bool>true</bool> | 647 | <bool>true</bool> |
648 | </property> | 648 | </property> |
649 | <property> | 649 | <property> |
650 | <name>resizeable</name> | 650 | <name>resizeable</name> |
651 | <bool>true</bool> | 651 | <bool>true</bool> |
652 | </property> | 652 | </property> |
653 | </column> | 653 | </column> |
654 | <property stdset="1"> | 654 | <property stdset="1"> |
655 | <name>name</name> | 655 | <name>name</name> |
656 | <cstring>NetworkList</cstring> | 656 | <cstring>NetworkList</cstring> |
657 | </property> | 657 | </property> |
658 | <property stdset="1"> | 658 | <property stdset="1"> |
659 | <name>enabled</name> | ||
660 | <bool>false</bool> | ||
661 | </property> | ||
662 | <property stdset="1"> | ||
659 | <name>sizePolicy</name> | 663 | <name>sizePolicy</name> |
660 | <sizepolicy> | 664 | <sizepolicy> |
661 | <hsizetype>7</hsizetype> | 665 | <hsizetype>7</hsizetype> |
662 | <vsizetype>7</vsizetype> | 666 | <vsizetype>7</vsizetype> |
663 | </sizepolicy> | 667 | </sizepolicy> |
664 | </property> | 668 | </property> |
665 | </widget> | 669 | </widget> |
666 | <widget> | 670 | <widget> |
667 | <class>QLayoutWidget</class> | 671 | <class>QLayoutWidget</class> |
668 | <property stdset="1"> | 672 | <property stdset="1"> |
669 | <name>name</name> | 673 | <name>name</name> |
670 | <cstring>Layout11</cstring> | 674 | <cstring>Layout11</cstring> |
671 | </property> | 675 | </property> |
672 | <hbox> | 676 | <hbox> |
673 | <property stdset="1"> | 677 | <property stdset="1"> |
674 | <name>margin</name> | 678 | <name>margin</name> |
@@ -693,32 +697,36 @@ | |||
693 | </property> | 697 | </property> |
694 | <property> | 698 | <property> |
695 | <name>sizeHint</name> | 699 | <name>sizeHint</name> |
696 | <size> | 700 | <size> |
697 | <width>20</width> | 701 | <width>20</width> |
698 | <height>20</height> | 702 | <height>20</height> |
699 | </size> | 703 | </size> |
700 | </property> | 704 | </property> |
701 | </spacer> | 705 | </spacer> |
702 | <widget> | 706 | <widget> |
703 | <class>QPushButton</class> | 707 | <class>QPushButton</class> |
704 | <property stdset="1"> | 708 | <property stdset="1"> |
705 | <name>name</name> | 709 | <name>name</name> |
706 | <cstring>RegisterButton</cstring> | 710 | <cstring>RegisterButton</cstring> |
707 | </property> | 711 | </property> |
708 | <property stdset="1"> | 712 | <property stdset="1"> |
713 | <name>enabled</name> | ||
714 | <bool>false</bool> | ||
715 | </property> | ||
716 | <property stdset="1"> | ||
709 | <name>sizePolicy</name> | 717 | <name>sizePolicy</name> |
710 | <sizepolicy> | 718 | <sizepolicy> |
711 | <hsizetype>7</hsizetype> | 719 | <hsizetype>7</hsizetype> |
712 | <vsizetype>0</vsizetype> | 720 | <vsizetype>0</vsizetype> |
713 | </sizepolicy> | 721 | </sizepolicy> |
714 | </property> | 722 | </property> |
715 | <property stdset="1"> | 723 | <property stdset="1"> |
716 | <name>text</name> | 724 | <name>text</name> |
717 | <string>Register</string> | 725 | <string>Register</string> |
718 | </property> | 726 | </property> |
719 | </widget> | 727 | </widget> |
720 | </hbox> | 728 | </hbox> |
721 | </widget> | 729 | </widget> |
722 | </vbox> | 730 | </vbox> |
723 | </widget> | 731 | </widget> |
724 | <widget> | 732 | <widget> |