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
@@ -9,13 +9,12 @@
** 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"
@@ -48,14 +47,14 @@
#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();
@@ -322,38 +321,32 @@ void WirelessApplet::displayStyleChange( int style )
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();
@@ -447,34 +440,34 @@ bool WirelessApplet::mustRepaint()
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;
@@ -486,27 +479,27 @@ const char** WirelessApplet::getQualityPixmap()
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;