From e26cf0e83db11d6d135176f874c0781b4b6481d2 Mon Sep 17 00:00:00 2001 From: benmeyer Date: Fri, 25 Oct 2002 15:47:02 +0000 Subject: Adding infoimp class --- (limited to 'noncore/settings/networksettings') 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 +#include +#include + +/** + * 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 @@ -13,6 +13,7 @@ WLANModule::WLANModule() : Module() { } /** + * Delete any interfaces that we own. */ WLANModule::~WLANModule(){ Interface *i; -- cgit v0.9.0.2