summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
+#include "infoimp.h"
+#include "wextensions.h"
+#include <qtimer.h>
+#include <qprogressbar.h>
+#include <qlabel.h>
+
+/**
+ * Constructor. If wireless extensions are enabled on device name then
+ * start a timer that every second will update the information.
+ */
+WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
+ WExtensions *wExtensions = new WExtensions(name);
+ if(!wExtensions->doesHaveWirelessExtensions()){
+ delete wExtensions;
+ qDebug("No extension");
+ return;
+ }
+ delete wExtensions;
+ timer = new QTimer( this );
+ connect( timer, SIGNAL(timeout()), this, SLOT(update()));
+ timer->start( 1000, false );
+}
+
+/**
+ * Updates the information about the wireless device.
+ */
+void WlanInfoImp::update(){
+ WExtensions *wExtensions = new WExtensions(this->name());
+ if(!wExtensions->doesHaveWirelessExtensions()){
+ qDebug("No extension");
+ delete wExtensions;
+ timer->stop();
+ return;
+ }
+ essidLabel->setText(wExtensions->essid());
+ apLabel->setText(wExtensions->ap());
+ stationLabel->setText(wExtensions->station());
+ modeLabel->setText(wExtensions->mode());
+ freqLabel->setText(QString("%1 GHz").arg(wExtensions->frequency()));
+ int signal = 0;
+ int noise = 0;
+ int quality = 0;
+ wExtensions->stats(signal, noise, quality);
+ if(signalProgressBar->progress() != signal)
+ signalProgressBar->setProgress(signal);
+ if(noiseProgressBar->progress() != noise)
+ noiseProgressBar->setProgress(noise);
+ if(qualityProgressBar->progress() != quality)
+ qualityProgressBar->setProgress(quality);
+ rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate()));
+ delete wExtensions;
+}
+
+// infoimp.cpp
+
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 @@
+#ifndef INFOIMP_H
+#define INFOIMP_H
+
+#include "info.h"
+
+class QTimer;
+class WExtensions;
+
+class WlanInfoImp : public WlanInfo {
+ Q_OBJECT
+
+public:
+ WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+private slots:
+ void update();
+
+private:
+ //WExtensions *wExtensions;
+ QTimer *timer;
+
+};
+
+#endif
+
+// infoimp.h
+
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 @@
#include "wlanmodule.h"
#include "wlanimp.h"
#include "infoimp.h"
#include "wextensions.h"
#include <qlabel.h>
#include <qprogressbar.h>
/**
* Constructor, find all of the possible interfaces
*/
WLANModule::WLANModule() : Module() {
}
/**
+ * Delete any interfaces that we own.
*/
WLANModule::~WLANModule(){
Interface *i;
for ( i=list.first(); i != 0; i=list.next() )
delete i;
}
/**
* Change the current profile
*/
void WLANModule::setProfile(QString newProfile){
profile = newProfile;
}
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
QString WLANModule::getPixmapName(Interface* ){
return "wlan";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool WLANModule::isOwner(Interface *i){
WExtensions we(i->getInterfaceName());
if(!we.doesHaveWirelessExtensions())
return false;
i->setHardwareName("802.11b");
list.append(i);
return true;
}
/**
* Create, set tabWiget and return the WLANConfigure Module
* @param tabWidget a pointer to the tab widget that this configure has.
* @return QWidget* pointer to the tab widget in this modules configure.
*/
QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){
WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose);
(*tabWidget) = wlanconfig->tabWidget;
return wlanconfig;
}
/**
* Create, set tabWiget and return the Information Module
* @param tabWidget a pointer to the tab widget that this information has.
* @return QWidget* pointer to the tab widget in this modules info.
*/
QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
WExtensions we(i->getInterfaceName());
if(!we.doesHaveWirelessExtensions())
return NULL;
WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
(*tabWidget) = info->tabWidget;
return info;
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> WLANModule::getInterfaces(){
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *WLANModule::addNewInterface(QString ){
// We can't add a 802.11 interface, either the hardware will be there
// or it wont.
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
bool WLANModule::remove(Interface*){
// Can't remove a hardware device, you can stop it though.
return false;
}
// wlanmodule.cpp
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 @@
+#include "infoimp.h"
+#include "wextensions.h"
+#include <qtimer.h>
+#include <qprogressbar.h>
+#include <qlabel.h>
+
+/**
+ * Constructor. If wireless extensions are enabled on device name then
+ * start a timer that every second will update the information.
+ */
+WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){
+ WExtensions *wExtensions = new WExtensions(name);
+ if(!wExtensions->doesHaveWirelessExtensions()){
+ delete wExtensions;
+ qDebug("No extension");
+ return;
+ }
+ delete wExtensions;
+ timer = new QTimer( this );
+ connect( timer, SIGNAL(timeout()), this, SLOT(update()));
+ timer->start( 1000, false );
+}
+
+/**
+ * Updates the information about the wireless device.
+ */
+void WlanInfoImp::update(){
+ WExtensions *wExtensions = new WExtensions(this->name());
+ if(!wExtensions->doesHaveWirelessExtensions()){
+ qDebug("No extension");
+ delete wExtensions;
+ timer->stop();
+ return;
+ }
+ essidLabel->setText(wExtensions->essid());
+ apLabel->setText(wExtensions->ap());
+ stationLabel->setText(wExtensions->station());
+ modeLabel->setText(wExtensions->mode());
+ freqLabel->setText(QString("%1 GHz").arg(wExtensions->frequency()));
+ int signal = 0;
+ int noise = 0;
+ int quality = 0;
+ wExtensions->stats(signal, noise, quality);
+ if(signalProgressBar->progress() != signal)
+ signalProgressBar->setProgress(signal);
+ if(noiseProgressBar->progress() != noise)
+ noiseProgressBar->setProgress(noise);
+ if(qualityProgressBar->progress() != quality)
+ qualityProgressBar->setProgress(quality);
+ rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate()));
+ delete wExtensions;
+}
+
+// infoimp.cpp
+
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 @@
+#ifndef INFOIMP_H
+#define INFOIMP_H
+
+#include "info.h"
+
+class QTimer;
+class WExtensions;
+
+class WlanInfoImp : public WlanInfo {
+ Q_OBJECT
+
+public:
+ WlanInfoImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+private slots:
+ void update();
+
+private:
+ //WExtensions *wExtensions;
+ QTimer *timer;
+
+};
+
+#endif
+
+// infoimp.h
+
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 @@
#include "wlanmodule.h"
#include "wlanimp.h"
#include "infoimp.h"
#include "wextensions.h"
#include <qlabel.h>
#include <qprogressbar.h>
/**
* Constructor, find all of the possible interfaces
*/
WLANModule::WLANModule() : Module() {
}
/**
+ * Delete any interfaces that we own.
*/
WLANModule::~WLANModule(){
Interface *i;
for ( i=list.first(); i != 0; i=list.next() )
delete i;
}
/**
* Change the current profile
*/
void WLANModule::setProfile(QString newProfile){
profile = newProfile;
}
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
QString WLANModule::getPixmapName(Interface* ){
return "wlan";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool WLANModule::isOwner(Interface *i){
WExtensions we(i->getInterfaceName());
if(!we.doesHaveWirelessExtensions())
return false;
i->setHardwareName("802.11b");
list.append(i);
return true;
}
/**
* Create, set tabWiget and return the WLANConfigure Module
* @param tabWidget a pointer to the tab widget that this configure has.
* @return QWidget* pointer to the tab widget in this modules configure.
*/
QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){
WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose);
(*tabWidget) = wlanconfig->tabWidget;
return wlanconfig;
}
/**
* Create, set tabWiget and return the Information Module
* @param tabWidget a pointer to the tab widget that this information has.
* @return QWidget* pointer to the tab widget in this modules info.
*/
QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){
WExtensions we(i->getInterfaceName());
if(!we.doesHaveWirelessExtensions())
return NULL;
WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
(*tabWidget) = info->tabWidget;
return info;
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> WLANModule::getInterfaces(){
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *WLANModule::addNewInterface(QString ){
// We can't add a 802.11 interface, either the hardware will be there
// or it wont.
return NULL;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
bool WLANModule::remove(Interface*){
// Can't remove a hardware device, you can stop it though.
return false;
}
// wlanmodule.cpp