author | benmeyer <benmeyer> | 2002-10-25 15:47:02 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-25 15:47:02 (UTC) |
commit | e26cf0e83db11d6d135176f874c0781b4b6481d2 (patch) (unidiff) | |
tree | a7fbeb28b804f91f76eaa24ec23449bbd623bd45 | |
parent | d0d87d596d64cc1d5ef6322896c68883e4dfb5d0 (diff) | |
download | opie-e26cf0e83db11d6d135176f874c0781b4b6481d2.zip opie-e26cf0e83db11d6d135176f874c0781b4b6481d2.tar.gz opie-e26cf0e83db11d6d135176f874c0781b4b6481d2.tar.bz2 |
Adding infoimp class
-rw-r--r-- | noncore/net/networksetup/wlan/infoimp.cpp | 55 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/infoimp.h | 27 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 1 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/infoimp.cpp | 55 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/infoimp.h | 27 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 1 |
6 files changed, 166 insertions, 0 deletions
diff --git a/noncore/net/networksetup/wlan/infoimp.cpp b/noncore/net/networksetup/wlan/infoimp.cpp new file mode 100644 index 0000000..e1eef81 --- a/dev/null +++ b/noncore/net/networksetup/wlan/infoimp.cpp | |||
@@ -0,0 +1,55 @@ | |||
1 | #include "infoimp.h" | ||
2 | #include "wextensions.h" | ||
3 | #include <qtimer.h> | ||
4 | #include <qprogressbar.h> | ||
5 | #include <qlabel.h> | ||
6 | |||
7 | /** | ||
8 | * Constructor. If wireless extensions are enabled on device name then | ||
9 | * start a timer that every second will update the information. | ||
10 | */ | ||
11 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ | ||
12 | WExtensions *wExtensions = new WExtensions(name); | ||
13 | if(!wExtensions->doesHaveWirelessExtensions()){ | ||
14 | delete wExtensions; | ||
15 | qDebug("No extension"); | ||
16 | return; | ||
17 | } | ||
18 | delete wExtensions; | ||
19 | timer = new QTimer( this ); | ||
20 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); | ||
21 | timer->start( 1000, false ); | ||
22 | } | ||
23 | |||
24 | /** | ||
25 | * Updates the information about the wireless device. | ||
26 | */ | ||
27 | void WlanInfoImp::update(){ | ||
28 | WExtensions *wExtensions = new WExtensions(this->name()); | ||
29 | if(!wExtensions->doesHaveWirelessExtensions()){ | ||
30 | qDebug("No extension"); | ||
31 | delete wExtensions; | ||
32 | timer->stop(); | ||
33 | return; | ||
34 | } | ||
35 | essidLabel->setText(wExtensions->essid()); | ||
36 | apLabel->setText(wExtensions->ap()); | ||
37 | stationLabel->setText(wExtensions->station()); | ||
38 | modeLabel->setText(wExtensions->mode()); | ||
39 | freqLabel->setText(QString("%1 GHz").arg(wExtensions->frequency())); | ||
40 | int signal = 0; | ||
41 | int noise = 0; | ||
42 | int quality = 0; | ||
43 | wExtensions->stats(signal, noise, quality); | ||
44 | if(signalProgressBar->progress() != signal) | ||
45 | signalProgressBar->setProgress(signal); | ||
46 | if(noiseProgressBar->progress() != noise) | ||
47 | noiseProgressBar->setProgress(noise); | ||
48 | if(qualityProgressBar->progress() != quality) | ||
49 | qualityProgressBar->setProgress(quality); | ||
50 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); | ||
51 | delete wExtensions; | ||
52 | } | ||
53 | |||
54 | // infoimp.cpp | ||
55 | |||
diff --git a/noncore/net/networksetup/wlan/infoimp.h b/noncore/net/networksetup/wlan/infoimp.h new file mode 100644 index 0000000..5311bea --- a/dev/null +++ b/noncore/net/networksetup/wlan/infoimp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef INFOIMP_H | ||
2 | #define INFOIMP_H | ||
3 | |||
4 | #include "info.h" | ||
5 | |||
6 | class QTimer; | ||
7 | class WExtensions; | ||
8 | |||
9 | class WlanInfoImp : public WlanInfo { | ||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
14 | |||
15 | private slots: | ||
16 | void update(); | ||
17 | |||
18 | private: | ||
19 | //WExtensions *wExtensions; | ||
20 | QTimer *timer; | ||
21 | |||
22 | }; | ||
23 | |||
24 | #endif | ||
25 | |||
26 | // infoimp.h | ||
27 | |||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index 3993ca0..9ab3b76 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -8,16 +8,17 @@ | |||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | WLANModule::WLANModule() : Module() { | 12 | WLANModule::WLANModule() : Module() { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | ||
16 | */ | 17 | */ |
17 | WLANModule::~WLANModule(){ | 18 | WLANModule::~WLANModule(){ |
18 | Interface *i; | 19 | Interface *i; |
19 | for ( i=list.first(); i != 0; i=list.next() ) | 20 | for ( i=list.first(); i != 0; i=list.next() ) |
20 | delete i; | 21 | delete i; |
21 | } | 22 | } |
22 | 23 | ||
23 | /** | 24 | /** |
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp new file mode 100644 index 0000000..e1eef81 --- a/dev/null +++ b/noncore/settings/networksettings/wlan/infoimp.cpp | |||
@@ -0,0 +1,55 @@ | |||
1 | #include "infoimp.h" | ||
2 | #include "wextensions.h" | ||
3 | #include <qtimer.h> | ||
4 | #include <qprogressbar.h> | ||
5 | #include <qlabel.h> | ||
6 | |||
7 | /** | ||
8 | * Constructor. If wireless extensions are enabled on device name then | ||
9 | * start a timer that every second will update the information. | ||
10 | */ | ||
11 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ | ||
12 | WExtensions *wExtensions = new WExtensions(name); | ||
13 | if(!wExtensions->doesHaveWirelessExtensions()){ | ||
14 | delete wExtensions; | ||
15 | qDebug("No extension"); | ||
16 | return; | ||
17 | } | ||
18 | delete wExtensions; | ||
19 | timer = new QTimer( this ); | ||
20 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); | ||
21 | timer->start( 1000, false ); | ||
22 | } | ||
23 | |||
24 | /** | ||
25 | * Updates the information about the wireless device. | ||
26 | */ | ||
27 | void WlanInfoImp::update(){ | ||
28 | WExtensions *wExtensions = new WExtensions(this->name()); | ||
29 | if(!wExtensions->doesHaveWirelessExtensions()){ | ||
30 | qDebug("No extension"); | ||
31 | delete wExtensions; | ||
32 | timer->stop(); | ||
33 | return; | ||
34 | } | ||
35 | essidLabel->setText(wExtensions->essid()); | ||
36 | apLabel->setText(wExtensions->ap()); | ||
37 | stationLabel->setText(wExtensions->station()); | ||
38 | modeLabel->setText(wExtensions->mode()); | ||
39 | freqLabel->setText(QString("%1 GHz").arg(wExtensions->frequency())); | ||
40 | int signal = 0; | ||
41 | int noise = 0; | ||
42 | int quality = 0; | ||
43 | wExtensions->stats(signal, noise, quality); | ||
44 | if(signalProgressBar->progress() != signal) | ||
45 | signalProgressBar->setProgress(signal); | ||
46 | if(noiseProgressBar->progress() != noise) | ||
47 | noiseProgressBar->setProgress(noise); | ||
48 | if(qualityProgressBar->progress() != quality) | ||
49 | qualityProgressBar->setProgress(quality); | ||
50 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); | ||
51 | delete wExtensions; | ||
52 | } | ||
53 | |||
54 | // infoimp.cpp | ||
55 | |||
diff --git a/noncore/settings/networksettings/wlan/infoimp.h b/noncore/settings/networksettings/wlan/infoimp.h new file mode 100644 index 0000000..5311bea --- a/dev/null +++ b/noncore/settings/networksettings/wlan/infoimp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef INFOIMP_H | ||
2 | #define INFOIMP_H | ||
3 | |||
4 | #include "info.h" | ||
5 | |||
6 | class QTimer; | ||
7 | class WExtensions; | ||
8 | |||
9 | class WlanInfoImp : public WlanInfo { | ||
10 | Q_OBJECT | ||
11 | |||
12 | public: | ||
13 | WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
14 | |||
15 | private slots: | ||
16 | void update(); | ||
17 | |||
18 | private: | ||
19 | //WExtensions *wExtensions; | ||
20 | QTimer *timer; | ||
21 | |||
22 | }; | ||
23 | |||
24 | #endif | ||
25 | |||
26 | // infoimp.h | ||
27 | |||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 3993ca0..9ab3b76 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -8,16 +8,17 @@ | |||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | WLANModule::WLANModule() : Module() { | 12 | WLANModule::WLANModule() : Module() { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | ||
16 | */ | 17 | */ |
17 | WLANModule::~WLANModule(){ | 18 | WLANModule::~WLANModule(){ |
18 | Interface *i; | 19 | Interface *i; |
19 | for ( i=list.first(); i != 0; i=list.next() ) | 20 | for ( i=list.first(); i != 0; i=list.next() ) |
20 | delete i; | 21 | delete i; |
21 | } | 22 | } |
22 | 23 | ||
23 | /** | 24 | /** |