summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet/wireless.cpp
Side-by-side diff
Diffstat (limited to 'noncore/applets/wirelessapplet/wireless.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp59
1 files changed, 26 insertions, 33 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index dc9742a..72ac380 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -3,25 +3,24 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "wireless.h"
-#include "networkinfo.h"
#include "mgraph.h"
#include "advancedconfig.h"
#include "connect0.xpm"
#include "connect1.xpm"
#include "connect2.xpm"
#include "connect3.xpm"
#include "connect4.xpm"
#include "connect5.xpm"
#include "nowireless.xpm"
/* OPIE */
#include <opie2/onetwork.h>
@@ -42,26 +41,26 @@
#include <qpixmap.h>
#include <qstring.h>
#include <qfile.h>
#include <qtextstream.h>
/* STD */
#include <sys/types.h>
#include <signal.h>
#define STYLE_BARS 0
#define STYLE_ANTENNA 1
-//#define MDEBUG
-#undef MDEBUG
+#define MDEBUG
+//#undef MDEBUG
WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name )
: QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet )
{
readConfig();
writeConfigEntry( "UpdateFrequency", updateFrequency );
writeConfigEntry( "DisplayStyle", displayStyle );
setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" );
@@ -316,50 +315,44 @@ void WirelessApplet::updateDelayChange( int delay )
void WirelessApplet::displayStyleChange( int style )
{
visualStyle = style;
repaint();
}
WirelessApplet::~WirelessApplet()
{}
void WirelessApplet::timerEvent( QTimerEvent* )
{
- /*
-
+ qDebug( "WirelessApplet::timerEvent" );
OWirelessNetworkInterface* iface = interface;
if ( iface )
{
- bool statResult = iface->updateStatistics();
- if ( !statResult )
+ if ( mustRepaint() )
{
- interface = 0;
- mustRepaint();
- return ;
+ qDebug( "WIFIAPPLET: A value has changed -> repainting." );
+ repaint();
}
- else
- if ( mustRepaint() )
- {
- //qDebug( "WIFIAPPLET: A value has changed -> repainting." );
- repaint();
- }
if ( status->isVisible() )
+ {
updatePopupWindow();
+ }
+ }
+ else
+ {
+ checkInterface();
}
- else checkInterface();
-
- */
}
void WirelessApplet::mousePressEvent( QMouseEvent * )
{
if ( status->isVisible() )
status->hide();
else
status->show( true );
}
bool WirelessApplet::mustRepaint()
{
@@ -441,78 +434,78 @@ bool WirelessApplet::mustRepaint()
}
oldESSID = iface->SSID();
oldMODE = iface->mode();
oldFREQ = iface->frequency();
oldAP = iface->associatedAP().toString();
return false;
}
void WirelessApplet::updatePopupWindow()
{
- MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface;
- int qualityH = iface->qualityPercent();
+ OWirelessNetworkInterface* iface = interface;
+ int qualityH = iface->signalStrength();
if ( status->mgraph )
status->mgraph->addValue( qualityH, false );
QString freqString;
- QString cell = ( iface->mode == "Managed" ) ? "AP: " : "Cell: ";
- freqString.sprintf( "%.3f GHz", iface->freq );
- status->statusLabel->setText( "Station: " + iface->nick + "<br>" +
- "ESSID: " + iface->essid + "<br>" +
- "MODE: " + iface->mode + "<br>" +
+ QString cell = ( iface->mode() == "Managed" ) ? "AP: " : "Cell: ";
+ freqString.sprintf( "%.3f GHz", iface->frequency() );
+ status->statusLabel->setText( "Station: " + iface->nickName() + "<br>" +
+ "ESSID: " + iface->SSID() + "<br>" +
+ "MODE: " + iface->mode() + "<br>" +
"FREQ: " + freqString + "<br>" +
- cell + " " + iface->APAddr );
+ cell + " " + iface->associatedAP().toString() );
}
const char** WirelessApplet::getQualityPixmap()
{
- MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface;
+ OWirelessNetworkInterface* iface = interface;
if ( !iface ) return ( const char** ) nowireless_xpm;
- int qualityH = iface->qualityPercent();
+ int qualityH = iface->signalStrength();
if ( qualityH < 0 ) return ( const char** ) nowireless_xpm;
if ( visualStyle == STYLE_ANTENNA )
{
if ( qualityH < 1 ) return ( const char** ) connect0_xpm;
if ( qualityH < 17 ) return ( const char** ) connect1_xpm;
if ( qualityH < 34 ) return ( const char** ) connect2_xpm;
if ( qualityH < 50 ) return ( const char** ) connect3_xpm;
if ( qualityH < 65 ) return ( const char** ) connect4_xpm;
return ( const char** ) connect5_xpm;
}
return 0; // please draw your bars
}
void WirelessApplet::paintEvent( QPaintEvent* )
{
- MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface;
+ OWirelessNetworkInterface* iface = interface;
QPainter p( this );
QColor color;
const char** pixmap = getQualityPixmap();
if ( pixmap )
p.drawPixmap( 0, 1, pixmap );
else
{
- int noiseH = iface->noisePercent() * ( height() - 3 ) / 100;
- int signalH = iface->signalPercent() * ( height() - 3 ) / 100;
- int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100;
+ int noiseH = 30; // iface->noisePercent() * ( height() - 3 ) / 100;
+ int signalH = 50; // iface->signalPercent() * ( height() - 3 ) / 100;
+ int qualityH = iface->signalStrength(); // iface->qualityPercent() * ( height() - 3 ) / 100;
double intensity;
int pixelHeight;
int pixelWidth = 2;
int Hue;
int barSpace = 3;
int leftoffset = 0;
int bottomoffset = 2;
// draw noise indicator
pixelHeight = noiseH;
Hue = 50;