Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 7507c54..3363b8a 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -1,118 +1,115 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
3 | #include "info.h" | 3 | #include "info.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 | */ |
12 | WLANModule::WLANModule() : Module() { | 12 | WLANModule::WLANModule() : Module() { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | */ | 16 | */ |
17 | WLANModule::~WLANModule(){ | 17 | WLANModule::~WLANModule(){ |
18 | qDebug("Deleting module"); | ||
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 | */ |
26 | void WLANModule::setProfile(QString newProfile){ | 27 | void 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 | */ |
35 | QString WLANModule::getPixmapName(Interface* ){ | 36 | QString 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 | */ |
44 | bool WLANModule::isOwner(Interface *i){ | 45 | bool 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 | */ |
59 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ | 60 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ |
60 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); | 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 | */ |
70 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 71 | QWidget *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 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); | 76 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); |
76 | (*tabWidget) = info->tabWidget; | 77 | (*tabWidget) = info->tabWidget; |
77 | 78 | ||
78 | info->essidLabel->setText(we.essid()); | 79 | info->essidLabel->setText(we.essid()); |
79 | info->apLabel->setText(we.ap()); | 80 | info->apLabel->setText(we.ap()); |
80 | info->stationLabel->setText(we.station()); | 81 | info->stationLabel->setText(we.station()); |
81 | info->modeLabel->setText(we.mode()); | 82 | info->modeLabel->setText(we.mode()); |
82 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); | 83 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); |
83 | int signal = 0; | 84 | int signal = 0; |
84 | int noise = 0; | 85 | int noise = 0; |
85 | int quality = 0; | 86 | int quality = 0; |
86 | we.stats(signal, noise, quality); | 87 | we.stats(signal, noise, quality); |
87 | info->signalProgressBar->setProgress(signal); | 88 | info->signalProgressBar->setProgress(signal); |
88 | info->noiseProgressBar->setProgress(noise); | 89 | info->noiseProgressBar->setProgress(noise); |
89 | info->qualityProgressBar->setProgress(quality); | 90 | info->qualityProgressBar->setProgress(quality); |
90 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); | 91 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); |
91 | //WlanInfo info (0, "wireless info", true); | ||
92 | //info.show(); | ||
93 | //return NULL; | ||
94 | |||
95 | return info; | 92 | return info; |
96 | } | 93 | } |
97 | 94 | ||
98 | /** | 95 | /** |
99 | * Get all active (up or down) interfaces | 96 | * Get all active (up or down) interfaces |
100 | * @return QList<Interface> A list of interfaces that exsist that havn't | 97 | * @return QList<Interface> A list of interfaces that exsist that havn't |
101 | * been called by isOwner() | 98 | * been called by isOwner() |
102 | */ | 99 | */ |
103 | QList<Interface> WLANModule::getInterfaces(){ | 100 | QList<Interface> WLANModule::getInterfaces(){ |
104 | return list; | 101 | return list; |
105 | } | 102 | } |
106 | 103 | ||
107 | /** | 104 | /** |
108 | * Attempt to add a new interface as defined by name | 105 | * Attempt to add a new interface as defined by name |
109 | * @param name the name of the type of interface that should be created given | 106 | * @param name the name of the type of interface that should be created given |
110 | * by possibleNewInterfaces(); | 107 | * by possibleNewInterfaces(); |
111 | * @return Interface* NULL if it was unable to be created. | 108 | * @return Interface* NULL if it was unable to be created. |
112 | */ | 109 | */ |
113 | Interface *WLANModule::addNewInterface(QString ){ | 110 | Interface *WLANModule::addNewInterface(QString ){ |
114 | // We can't add a 802.11 interface, either the hardware will be there | 111 | // We can't add a 802.11 interface, either the hardware will be there |
115 | // or it wont. | 112 | // or it wont. |
116 | return NULL; | 113 | return NULL; |
117 | } | 114 | } |
118 | 115 | ||