Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / network / WirelessManager / wpa_supplicant / wpa_gui / scanresults.ui.h
blob530d2e6a495c074e3db26445eb3695ae9f64f6a3
1 /****************************************************************************
2 ** ui.h extension file, included from the uic-generated form implementation.
3 **
4 ** If you want to add, delete, or rename functions or slots, use
5 ** Qt Designer to update this file, preserving your code.
6 **
7 ** You should not define a constructor or destructor in this file.
8 ** Instead, write your code in functions called init() and destroy().
9 ** These will automatically be called by the form's constructor and
10 ** destructor.
11 *****************************************************************************/
13 void ScanResults::init()
15 wpagui = NULL;
19 void ScanResults::destroy()
21 delete timer;
25 void ScanResults::setWpaGui(WpaGui *_wpagui)
27 wpagui = _wpagui;
28 updateResults();
30 timer = new QTimer(this);
31 connect(timer, SIGNAL(timeout()), SLOT(getResults()));
32 timer->start(10000, FALSE);
36 void ScanResults::updateResults()
38 char reply[8192];
39 size_t reply_len;
41 if (wpagui == NULL)
42 return;
44 reply_len = sizeof(reply) - 1;
45 if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
46 return;
47 reply[reply_len] = '\0';
49 scanResultsView->clear();
51 QString res(reply);
52 QStringList lines = QStringList::split(QChar('\n'), res);
53 bool first = true;
54 for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
55 if (first) {
56 first = false;
57 continue;
60 QStringList cols = QStringList::split(QChar('\t'), *it, true);
61 QString ssid, bssid, freq, signal, flags;
62 bssid = cols.count() > 0 ? cols[0] : "";
63 freq = cols.count() > 1 ? cols[1] : "";
64 signal = cols.count() > 2 ? cols[2] : "";
65 flags = cols.count() > 3 ? cols[3] : "";
66 ssid = cols.count() > 4 ? cols[4] : "";
67 new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal, flags);
72 void ScanResults::scanRequest()
74 char reply[10];
75 size_t reply_len = sizeof(reply);
77 if (wpagui == NULL)
78 return;
80 wpagui->ctrlRequest("SCAN", reply, &reply_len);
84 void ScanResults::getResults()
86 updateResults();
92 void ScanResults::bssSelected( Q3ListViewItem * sel )
94 NetworkConfig *nc = new NetworkConfig();
95 if (nc == NULL)
96 return;
97 nc->setWpaGui(wpagui);
98 nc->paramsFromScanResults(sel);
99 nc->show();
100 nc->exec();