summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet/wireless.cpp
authormickeyl <mickeyl>2004-02-23 13:37:46 (UTC)
committer mickeyl <mickeyl>2004-02-23 13:37:46 (UTC)
commit1f362cd77a2b39eae2abca6da28efa5118d2c347 (patch) (unidiff)
treeddc796d7505b2ec0f20e9b74154316d3f818d16c /noncore/applets/wirelessapplet/wireless.cpp
parent12ce268e3f75e4f07699b8e0c368f2112e651f7f (diff)
downloadopie-1f362cd77a2b39eae2abca6da28efa5118d2c347.zip
opie-1f362cd77a2b39eae2abca6da28efa5118d2c347.tar.gz
opie-1f362cd77a2b39eae2abca6da28efa5118d2c347.tar.bz2
start with the long awaited wireless applet overhaul
Diffstat (limited to 'noncore/applets/wirelessapplet/wireless.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp55
1 files changed, 34 insertions, 21 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 763aab8..cbaf5d6 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -1,27 +1,37 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer 2** Copyright (C) 2002-2004 Michael 'Mickey' Lauer <mickey@vanille.de>
3** <mickey@tm.informatik.uni-frankfurt.de>
4** http://www.Vanille.de
5** 3**
6** This file may be distributed and/or modified under the terms of the 4** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 5** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 6** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 7** packaging of this file.
10** 8**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 11**
14**********************************************************************/ 12**********************************************************************/
15 13
16#include "wireless.h" 14#include "wireless.h"
15#include "networkinfo.h"
16#include "mgraph.h"
17#include "advancedconfig.h"
18#include "connect0.xpm"
19#include "connect1.xpm"
20#include "connect2.xpm"
21#include "connect3.xpm"
22#include "connect4.xpm"
23#include "connect5.xpm"
24#include "nowireless.xpm"
17 25
18#include <qapplication.h> 26/* OPIE */
27#include <opie2/otaskbarapplet.h>
19#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
20#include <qpe/config.h> 29#include <qpe/config.h>
21 30
31/* QT */
22#include <qpoint.h> 32#include <qpoint.h>
23#include <qradiobutton.h> 33#include <qradiobutton.h>
24#include <qpushbutton.h> 34#include <qpushbutton.h>
25#include <qpainter.h> 35#include <qpainter.h>
26#include <qlabel.h> 36#include <qlabel.h>
27#include <qslider.h> 37#include <qslider.h>
@@ -30,28 +40,16 @@
30#include <qframe.h> 40#include <qframe.h>
31#include <qpixmap.h> 41#include <qpixmap.h>
32#include <qstring.h> 42#include <qstring.h>
33#include <qfile.h> 43#include <qfile.h>
34#include <qtextstream.h> 44#include <qtextstream.h>
35 45
46/* STD */
36#include <sys/types.h> 47#include <sys/types.h>
37#include <signal.h> 48#include <signal.h>
38 49
39#include "networkinfo.h"
40#include "mgraph.h"
41
42#include "advancedconfig.h"
43
44#include "connect0.xpm"
45#include "connect1.xpm"
46#include "connect2.xpm"
47#include "connect3.xpm"
48#include "connect4.xpm"
49#include "connect5.xpm"
50#include "nowireless.xpm"
51
52#define STYLE_BARS 0 50#define STYLE_BARS 0
53#define STYLE_ANTENNA 1 51#define STYLE_ANTENNA 1
54 52
55//#define MDEBUG 53//#define MDEBUG
56#undef MDEBUG 54#undef MDEBUG
57 55
@@ -223,12 +221,13 @@ void WirelessApplet::checkInterface()
223 interface = network->getFirstInterface(); 221 interface = network->getFirstInterface();
224 if ( interface ) 222 if ( interface )
225 { 223 {
226#ifdef MDEBUG 224#ifdef MDEBUG
227 qDebug( "WIFIAPPLET: using interface '%s'", (const char*) interface->getName() ); 225 qDebug( "WIFIAPPLET: using interface '%s'", (const char*) interface->getName() );
228#endif 226#endif
227
229 } 228 }
230 else 229 else
231 { 230 {
232#ifdef MDEBUG 231#ifdef MDEBUG
233 qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); 232 qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" );
234#endif 233#endif
@@ -311,14 +310,13 @@ void WirelessApplet::displayStyleChange( int style )
311{ 310{
312 visualStyle = style; 311 visualStyle = style;
313 repaint(); 312 repaint();
314} 313}
315 314
316WirelessApplet::~WirelessApplet() 315WirelessApplet::~WirelessApplet()
317{ 316{}
318}
319 317
320void WirelessApplet::timerEvent( QTimerEvent* ) 318void WirelessApplet::timerEvent( QTimerEvent* )
321{ 319{
322 MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; 320 MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface;
323 321
324 if ( iface ) 322 if ( iface )
@@ -326,22 +324,24 @@ void WirelessApplet::timerEvent( QTimerEvent* )
326 bool statResult = iface->updateStatistics(); 324 bool statResult = iface->updateStatistics();
327 if ( !statResult ) 325 if ( !statResult )
328 { 326 {
329 interface = 0; 327 interface = 0;
330 mustRepaint(); 328 mustRepaint();
331 return; 329 return;
332 } else 330 }
331 else
333 if ( mustRepaint() ) 332 if ( mustRepaint() )
334 { 333 {
335 //qDebug( "WIFIAPPLET: A value has changed -> repainting." ); 334 //qDebug( "WIFIAPPLET: A value has changed -> repainting." );
336 repaint(); 335 repaint();
337 } 336 }
338 337
339 if ( status->isVisible() ) 338 if ( status->isVisible() )
340 updatePopupWindow(); 339 updatePopupWindow();
341 } else checkInterface(); 340 }
341 else checkInterface();
342} 342}
343 343
344void WirelessApplet::mousePressEvent( QMouseEvent *) 344void WirelessApplet::mousePressEvent( QMouseEvent *)
345{ 345{
346 if ( status->isVisible() ) 346 if ( status->isVisible() )
347 status->hide(); 347 status->hide();
@@ -534,6 +534,19 @@ void WirelessApplet::paintEvent( QPaintEvent* )
534 color.setHsv( Hue, 255, intensity ); 534 color.setHsv( Hue, 255, intensity );
535 p.setPen ( color ); 535 p.setPen ( color );
536 p.drawLine( leftoffset, height()-bottomoffset-i, pixelWidth+leftoffset, height()-bottomoffset-i ); 536 p.drawLine( leftoffset, height()-bottomoffset-i, pixelWidth+leftoffset, height()-bottomoffset-i );
537 } 537 }
538 } 538 }
539} 539}
540
541
542int WirelessApplet::position()
543{
544 return 6;
545}
546
547
548Q_EXPORT_INTERFACE()
549{
550 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<WirelessApplet> );
551}
552