summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet/wireless.cpp
authormickeyl <mickeyl>2004-02-23 18:38:28 (UTC)
committer mickeyl <mickeyl>2004-02-23 18:38:28 (UTC)
commitd66f871dfeae78babeb1fa0b8a3e1c72dd10ea2b (patch) (side-by-side diff)
tree224c86eb4ab72154365ae450ce517c559b363bf0 /noncore/applets/wirelessapplet/wireless.cpp
parent19b274033fc05d5190cee2fa974c683892173c84 (diff)
downloadopie-d66f871dfeae78babeb1fa0b8a3e1c72dd10ea2b.zip
opie-d66f871dfeae78babeb1fa0b8a3e1c72dd10ea2b.tar.gz
opie-d66f871dfeae78babeb1fa0b8a3e1c72dd10ea2b.tar.bz2
The wireless applet uses now libopie2net instead of its own routines.
Display mode "ANTENNA" is fixed, "BAR GRAPH" is still broken but will be removed anyway, since nearly everyone used "ANTENNA".
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;