summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-10-25 15:47:02 (UTC)
committer benmeyer <benmeyer>2002-10-25 15:47:02 (UTC)
commite26cf0e83db11d6d135176f874c0781b4b6481d2 (patch) (unidiff)
treea7fbeb28b804f91f76eaa24ec23449bbd623bd45
parentd0d87d596d64cc1d5ef6322896c68883e4dfb5d0 (diff)
downloadopie-e26cf0e83db11d6d135176f874c0781b4b6481d2.zip
opie-e26cf0e83db11d6d135176f874c0781b4b6481d2.tar.gz
opie-e26cf0e83db11d6d135176f874c0781b4b6481d2.tar.bz2
Adding infoimp class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/infoimp.cpp55
-rw-r--r--noncore/net/networksetup/wlan/infoimp.h27
-rw-r--r--noncore/net/networksetup/wlan/wlanmodule.cpp1
-rw-r--r--noncore/settings/networksettings/wlan/infoimp.cpp55
-rw-r--r--noncore/settings/networksettings/wlan/infoimp.h27
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp1
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 */
11WlanInfoImp::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 */
27void 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
6class QTimer;
7class WExtensions;
8
9class WlanInfoImp : public WlanInfo {
10 Q_OBJECT
11
12public:
13 WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
14
15private slots:
16 void update();
17
18private:
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
@@ -1,111 +1,112 @@
1#include "wlanmodule.h" 1#include "wlanmodule.h"
2#include "wlanimp.h" 2#include "wlanimp.h"
3#include "infoimp.h" 3#include "infoimp.h"
4#include "wextensions.h" 4#include "wextensions.h"
5 5
6#include <qlabel.h> 6#include <qlabel.h>
7#include <qprogressbar.h> 7#include <qprogressbar.h>
8 8
9/** 9/**
10 * Constructor, find all of the possible interfaces 10 * Constructor, find all of the possible interfaces
11 */ 11 */
12WLANModule::WLANModule() : Module() { 12WLANModule::WLANModule() : Module() {
13} 13}
14 14
15/** 15/**
16 * Delete any interfaces that we own.
16 */ 17 */
17WLANModule::~WLANModule(){ 18WLANModule::~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/**
24 * Change the current profile 25 * Change the current profile
25 */ 26 */
26void WLANModule::setProfile(QString newProfile){ 27void WLANModule::setProfile(QString newProfile){
27 profile = newProfile; 28 profile = newProfile;
28} 29}
29 30
30/** 31/**
31 * get the icon name for this device. 32 * get the icon name for this device.
32 * @param Interface* can be used in determining the icon. 33 * @param Interface* can be used in determining the icon.
33 * @return QString the icon name (minus .png, .gif etc) 34 * @return QString the icon name (minus .png, .gif etc)
34 */ 35 */
35QString WLANModule::getPixmapName(Interface* ){ 36QString WLANModule::getPixmapName(Interface* ){
36 return "wlan"; 37 return "wlan";
37} 38}
38 39
39/** 40/**
40 * Check to see if the interface i is owned by this module. 41 * Check to see if the interface i is owned by this module.
41 * @param Interface* interface to check against 42 * @param Interface* interface to check against
42 * @return bool true if i is owned by this module, false otherwise. 43 * @return bool true if i is owned by this module, false otherwise.
43 */ 44 */
44bool WLANModule::isOwner(Interface *i){ 45bool WLANModule::isOwner(Interface *i){
45 WExtensions we(i->getInterfaceName()); 46 WExtensions we(i->getInterfaceName());
46 if(!we.doesHaveWirelessExtensions()) 47 if(!we.doesHaveWirelessExtensions())
47 return false; 48 return false;
48 49
49 i->setHardwareName("802.11b"); 50 i->setHardwareName("802.11b");
50 list.append(i); 51 list.append(i);
51 return true; 52 return true;
52} 53}
53 54
54/** 55/**
55 * Create, set tabWiget and return the WLANConfigure Module 56 * Create, set tabWiget and return the WLANConfigure Module
56 * @param tabWidget a pointer to the tab widget that this configure has. 57 * @param tabWidget a pointer to the tab widget that this configure has.
57 * @return QWidget* pointer to the tab widget in this modules configure. 58 * @return QWidget* pointer to the tab widget in this modules configure.
58 */ 59 */
59QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ 60QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){
60 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose); 61 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose);
61 (*tabWidget) = wlanconfig->tabWidget; 62 (*tabWidget) = wlanconfig->tabWidget;
62 return wlanconfig; 63 return wlanconfig;
63} 64}
64 65
65/** 66/**
66 * Create, set tabWiget and return the Information Module 67 * Create, set tabWiget and return the Information Module
67 * @param tabWidget a pointer to the tab widget that this information has. 68 * @param tabWidget a pointer to the tab widget that this information has.
68 * @return QWidget* pointer to the tab widget in this modules info. 69 * @return QWidget* pointer to the tab widget in this modules info.
69 */ 70 */
70QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ 71QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
71 WExtensions we(i->getInterfaceName()); 72 WExtensions we(i->getInterfaceName());
72 if(!we.doesHaveWirelessExtensions()) 73 if(!we.doesHaveWirelessExtensions())
73 return NULL; 74 return NULL;
74 75
75 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 76 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
76 (*tabWidget) = info->tabWidget; 77 (*tabWidget) = info->tabWidget;
77 return info; 78 return info;
78} 79}
79 80
80/** 81/**
81 * Get all active (up or down) interfaces 82 * Get all active (up or down) interfaces
82 * @return QList<Interface> A list of interfaces that exsist that havn't 83 * @return QList<Interface> A list of interfaces that exsist that havn't
83 * been called by isOwner() 84 * been called by isOwner()
84 */ 85 */
85QList<Interface> WLANModule::getInterfaces(){ 86QList<Interface> WLANModule::getInterfaces(){
86 return list; 87 return list;
87} 88}
88 89
89/** 90/**
90 * Attempt to add a new interface as defined by name 91 * Attempt to add a new interface as defined by name
91 * @param name the name of the type of interface that should be created given 92 * @param name the name of the type of interface that should be created given
92 * by possibleNewInterfaces(); 93 * by possibleNewInterfaces();
93 * @return Interface* NULL if it was unable to be created. 94 * @return Interface* NULL if it was unable to be created.
94 */ 95 */
95Interface *WLANModule::addNewInterface(QString ){ 96Interface *WLANModule::addNewInterface(QString ){
96 // We can't add a 802.11 interface, either the hardware will be there 97 // We can't add a 802.11 interface, either the hardware will be there
97 // or it wont. 98 // or it wont.
98 return NULL; 99 return NULL;
99} 100}
100 101
101/** 102/**
102 * Attempts to remove the interface, doesn't delete i 103 * Attempts to remove the interface, doesn't delete i
103 * @return bool true if successfull, false otherwise. 104 * @return bool true if successfull, false otherwise.
104 */ 105 */
105bool WLANModule::remove(Interface*){ 106bool WLANModule::remove(Interface*){
106 // Can't remove a hardware device, you can stop it though. 107 // Can't remove a hardware device, you can stop it though.
107 return false; 108 return false;
108} 109}
109 110
110// wlanmodule.cpp 111// wlanmodule.cpp
111 112
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 */
11WlanInfoImp::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 */
27void 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
6class QTimer;
7class WExtensions;
8
9class WlanInfoImp : public WlanInfo {
10 Q_OBJECT
11
12public:
13 WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
14
15private slots:
16 void update();
17
18private:
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
@@ -1,111 +1,112 @@
1#include "wlanmodule.h" 1#include "wlanmodule.h"
2#include "wlanimp.h" 2#include "wlanimp.h"
3#include "infoimp.h" 3#include "infoimp.h"
4#include "wextensions.h" 4#include "wextensions.h"
5 5
6#include <qlabel.h> 6#include <qlabel.h>
7#include <qprogressbar.h> 7#include <qprogressbar.h>
8 8
9/** 9/**
10 * Constructor, find all of the possible interfaces 10 * Constructor, find all of the possible interfaces
11 */ 11 */
12WLANModule::WLANModule() : Module() { 12WLANModule::WLANModule() : Module() {
13} 13}
14 14
15/** 15/**
16 * Delete any interfaces that we own.
16 */ 17 */
17WLANModule::~WLANModule(){ 18WLANModule::~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/**
24 * Change the current profile 25 * Change the current profile
25 */ 26 */
26void WLANModule::setProfile(QString newProfile){ 27void WLANModule::setProfile(QString newProfile){
27 profile = newProfile; 28 profile = newProfile;
28} 29}
29 30
30/** 31/**
31 * get the icon name for this device. 32 * get the icon name for this device.
32 * @param Interface* can be used in determining the icon. 33 * @param Interface* can be used in determining the icon.
33 * @return QString the icon name (minus .png, .gif etc) 34 * @return QString the icon name (minus .png, .gif etc)
34 */ 35 */
35QString WLANModule::getPixmapName(Interface* ){ 36QString WLANModule::getPixmapName(Interface* ){
36 return "wlan"; 37 return "wlan";
37} 38}
38 39
39/** 40/**
40 * Check to see if the interface i is owned by this module. 41 * Check to see if the interface i is owned by this module.
41 * @param Interface* interface to check against 42 * @param Interface* interface to check against
42 * @return bool true if i is owned by this module, false otherwise. 43 * @return bool true if i is owned by this module, false otherwise.
43 */ 44 */
44bool WLANModule::isOwner(Interface *i){ 45bool WLANModule::isOwner(Interface *i){
45 WExtensions we(i->getInterfaceName()); 46 WExtensions we(i->getInterfaceName());
46 if(!we.doesHaveWirelessExtensions()) 47 if(!we.doesHaveWirelessExtensions())
47 return false; 48 return false;
48 49
49 i->setHardwareName("802.11b"); 50 i->setHardwareName("802.11b");
50 list.append(i); 51 list.append(i);
51 return true; 52 return true;
52} 53}
53 54
54/** 55/**
55 * Create, set tabWiget and return the WLANConfigure Module 56 * Create, set tabWiget and return the WLANConfigure Module
56 * @param tabWidget a pointer to the tab widget that this configure has. 57 * @param tabWidget a pointer to the tab widget that this configure has.
57 * @return QWidget* pointer to the tab widget in this modules configure. 58 * @return QWidget* pointer to the tab widget in this modules configure.
58 */ 59 */
59QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ 60QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){
60 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose); 61 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose);
61 (*tabWidget) = wlanconfig->tabWidget; 62 (*tabWidget) = wlanconfig->tabWidget;
62 return wlanconfig; 63 return wlanconfig;
63} 64}
64 65
65/** 66/**
66 * Create, set tabWiget and return the Information Module 67 * Create, set tabWiget and return the Information Module
67 * @param tabWidget a pointer to the tab widget that this information has. 68 * @param tabWidget a pointer to the tab widget that this information has.
68 * @return QWidget* pointer to the tab widget in this modules info. 69 * @return QWidget* pointer to the tab widget in this modules info.
69 */ 70 */
70QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ 71QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
71 WExtensions we(i->getInterfaceName()); 72 WExtensions we(i->getInterfaceName());
72 if(!we.doesHaveWirelessExtensions()) 73 if(!we.doesHaveWirelessExtensions())
73 return NULL; 74 return NULL;
74 75
75 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 76 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
76 (*tabWidget) = info->tabWidget; 77 (*tabWidget) = info->tabWidget;
77 return info; 78 return info;
78} 79}
79 80
80/** 81/**
81 * Get all active (up or down) interfaces 82 * Get all active (up or down) interfaces
82 * @return QList<Interface> A list of interfaces that exsist that havn't 83 * @return QList<Interface> A list of interfaces that exsist that havn't
83 * been called by isOwner() 84 * been called by isOwner()
84 */ 85 */
85QList<Interface> WLANModule::getInterfaces(){ 86QList<Interface> WLANModule::getInterfaces(){
86 return list; 87 return list;
87} 88}
88 89
89/** 90/**
90 * Attempt to add a new interface as defined by name 91 * Attempt to add a new interface as defined by name
91 * @param name the name of the type of interface that should be created given 92 * @param name the name of the type of interface that should be created given
92 * by possibleNewInterfaces(); 93 * by possibleNewInterfaces();
93 * @return Interface* NULL if it was unable to be created. 94 * @return Interface* NULL if it was unable to be created.
94 */ 95 */
95Interface *WLANModule::addNewInterface(QString ){ 96Interface *WLANModule::addNewInterface(QString ){
96 // We can't add a 802.11 interface, either the hardware will be there 97 // We can't add a 802.11 interface, either the hardware will be there
97 // or it wont. 98 // or it wont.
98 return NULL; 99 return NULL;
99} 100}
100 101
101/** 102/**
102 * Attempts to remove the interface, doesn't delete i 103 * Attempts to remove the interface, doesn't delete i
103 * @return bool true if successfull, false otherwise. 104 * @return bool true if successfull, false otherwise.
104 */ 105 */
105bool WLANModule::remove(Interface*){ 106bool WLANModule::remove(Interface*){
106 // Can't remove a hardware device, you can stop it though. 107 // Can't remove a hardware device, you can stop it though.
107 return false; 108 return false;
108} 109}
109 110
110// wlanmodule.cpp 111// wlanmodule.cpp
111 112