summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/connect0.xpm28
-rw-r--r--noncore/applets/wirelessapplet/connect1.xpm28
-rw-r--r--noncore/applets/wirelessapplet/connect2.xpm29
-rw-r--r--noncore/applets/wirelessapplet/connect3.xpm28
-rw-r--r--noncore/applets/wirelessapplet/connect4.xpm26
-rw-r--r--noncore/applets/wirelessapplet/connect5.xpm26
-rw-r--r--noncore/applets/wirelessapplet/nowireless.xpm22
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp137
-rw-r--r--noncore/applets/wirelessapplet/wireless.h5
9 files changed, 44 insertions, 285 deletions
diff --git a/noncore/applets/wirelessapplet/connect0.xpm b/noncore/applets/wirelessapplet/connect0.xpm
deleted file mode 100644
index f2c0bb7..0000000
--- a/noncore/applets/wirelessapplet/connect0.xpm
+++ b/dev/null
@@ -1,28 +0,0 @@
1/* XPM */
2static char * connect0_xpm[] = {
3"14 14 11 1",
4 " c None",
5 ".c #FFFFFF",
6 "+c #848284",
7 "@c #000000",
8 "#c #C6C3C6",
9 "$c #877F81",
10 "%c #191819",
11 "&c #897D7F",
12 "*c #0E0E0E",
13 "=c #575657",
14 "-c #131313",
15" ",
16" ",
17" ",
18" +@+ ",
19" #@@ ",
20" $%+ ",
21" + ",
22" @ ",
23" &*= ",
24" +-@ ",
25" +@@ ",
26" +#@@+ ",
27" +#@@@ ",
28" +#@@@ "};
diff --git a/noncore/applets/wirelessapplet/connect1.xpm b/noncore/applets/wirelessapplet/connect1.xpm
deleted file mode 100644
index d831437..0000000
--- a/noncore/applets/wirelessapplet/connect1.xpm
+++ b/dev/null
@@ -1,28 +0,0 @@
1/* XPM */
2static char * connect1_xpm[] = {
3"14 14 11 1",
4 " c None",
5 ".c #FFFFFF",
6 "+c #848284",
7 "@c #FF2609",
8 "#c #877F81",
9 "$c #000000",
10 "%c #897D7F",
11 "&c #0E0E0E",
12 "*c #575657",
13 "=c #131313",
14 "-c #C6C3C6",
15" ",
16" ",
17" ",
18" +@+ ",
19" @@@ ",
20" #@+ ",
21" + ",
22" $ ",
23" %&* ",
24" +=$ ",
25" +$$ ",
26" +-$$+ ",
27" +-$$$ ",
28" +-$$$ "};
diff --git a/noncore/applets/wirelessapplet/connect2.xpm b/noncore/applets/wirelessapplet/connect2.xpm
deleted file mode 100644
index 9e42f33..0000000
--- a/noncore/applets/wirelessapplet/connect2.xpm
+++ b/dev/null
@@ -1,29 +0,0 @@
1/* XPM */
2static char * connect2_xpm[] = {
3"14 14 12 1",
4 " c None",
5 ".c #FF2609",
6 "+c #FFFFFF",
7 "@c #848284",
8 "#c #000000",
9 "$c #C6C3C6",
10 "%c #877F81",
11 "&c #191819",
12 "*c #897D7F",
13 "=c #0E0E0E",
14 "-c #575657",
15 ";c #131313",
16" ",
17" ",
18" ... ",
19" .@#@. ",
20" .$##. ",
21" .%&@. ",
22" ... ",
23" # ",
24" *=- ",
25" @;# ",
26" @## ",
27" @$##@ ",
28" @$### ",
29" @$### "};
diff --git a/noncore/applets/wirelessapplet/connect3.xpm b/noncore/applets/wirelessapplet/connect3.xpm
deleted file mode 100644
index 263443d..0000000
--- a/noncore/applets/wirelessapplet/connect3.xpm
+++ b/dev/null
@@ -1,28 +0,0 @@
1/* XPM */
2static char * connect3_xpm[] = {
3"14 14 11 1",
4 " c None",
5 ".c #FF2609",
6 "+c #848284",
7 "@c #000000",
8 "#c #C6C3C6",
9 "$c #877F81",
10 "%c #191819",
11 "&c #897D7F",
12 "*c #0E0E0E",
13 "=c #575657",
14 "-c #131313",
15" ",
16" ... ",
17" . . ",
18" . +@+ . ",
19" . #@@ . ",
20" . $%+ . ",
21" . + . ",
22" ... ",
23" &*= ",
24" +-@ ",
25" +@@ ",
26" +#@@+ ",
27" +#@@@ ",
28" +#@@@ "};
diff --git a/noncore/applets/wirelessapplet/connect4.xpm b/noncore/applets/wirelessapplet/connect4.xpm
deleted file mode 100644
index 471ed64..0000000
--- a/noncore/applets/wirelessapplet/connect4.xpm
+++ b/dev/null
@@ -1,26 +0,0 @@
1/* XPM */
2static char * connect4_xpm[] = {
3"14 14 9 1",
4 " c None",
5 ".c #FF2609",
6 "+c #FFFFFF",
7 "@c #848284",
8 "#c #000000",
9 "$c #C6C3C6",
10 "%c #877F81",
11 "&c #191819",
12 "*c #131313",
13" ... ",
14" .. .. ",
15" . . ",
16" . @#@ . ",
17" . $## . ",
18" . %&@ . ",
19" . @ . ",
20" .. # .. ",
21" ... ",
22" @*# ",
23" @## ",
24" @$##@ ",
25" @$### ",
26" @$### "};
diff --git a/noncore/applets/wirelessapplet/connect5.xpm b/noncore/applets/wirelessapplet/connect5.xpm
deleted file mode 100644
index a67be9a..0000000
--- a/noncore/applets/wirelessapplet/connect5.xpm
+++ b/dev/null
@@ -1,26 +0,0 @@
1/* XPM */
2static char * connect5_xpm[] = {
3"14 14 9 1",
4 " c None",
5 ".c #FF2609",
6 "+c #FFFFFF",
7 "@c #848284",
8 "#c #000000",
9 "$c #C6C3C6",
10 "%c #877F81",
11 "&c #191819",
12 "*c #131313",
13" . ... . ",
14" . .. .. . ",
15" . . . .",
16" . . @#@ . .",
17" . . $## . .",
18" . . %&@ . .",
19" . . @ . .",
20" . .. # .. . ",
21" . ... . ",
22" @*# ",
23" @## ",
24" @$##@ ",
25" @$### ",
26" @$### "};
diff --git a/noncore/applets/wirelessapplet/nowireless.xpm b/noncore/applets/wirelessapplet/nowireless.xpm
deleted file mode 100644
index a76322d..0000000
--- a/noncore/applets/wirelessapplet/nowireless.xpm
+++ b/dev/null
@@ -1,22 +0,0 @@
1static char * nowireless_xpm[] = {
2"14 14 6 1",
3" c None",
4". c #FFFFFF",
5"+ c #848284",
6"@ c #000000",
7"# c #FF0000",
8"$ c #C6C3C6",
9" ",
10" ",
11" ",
12" +@+ ",
13" # $#@ ",
14" ####@+ ",
15" ## + ",
16" ####@ ",
17" # #@+ ",
18" # +#@ ",
19" +@@ ",
20" +$@@+ ",
21" +$@@@ ",
22" +$@@@ "};
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index f244426..711d0dd 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -16,9 +16,2 @@
16#include "advancedconfig.h" 16#include "advancedconfig.h"
17#include "connect0.xpm"
18#include "connect1.xpm"
19#include "connect2.xpm"
20#include "connect3.xpm"
21#include "connect4.xpm"
22#include "connect5.xpm"
23#include "nowireless.xpm"
24 17
@@ -42,2 +35,3 @@
42/* STD */ 35/* STD */
36#include <math.h>
43#include <sys/types.h> 37#include <sys/types.h>
@@ -45,5 +39,2 @@
45 39
46#define STYLE_BARS 0
47#define STYLE_ANTENNA 1
48
49//#define MDEBUG 40//#define MDEBUG
@@ -59,3 +50,2 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
59 writeConfigEntry( "UpdateFrequency", updateFrequency ); 50 writeConfigEntry( "UpdateFrequency", updateFrequency );
60 writeConfigEntry( "DisplayStyle", displayStyle );
61 51
@@ -73,3 +63,3 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
73 /* QString text( "Station: Unknown<br>" 63 /* QString text( "Station: Unknown<br>"
74 "ESSID: Unknown<br>" 64 "ESSID: Unknown<br>"
75 "MODE: Unknown<br>" 65 "MODE: Unknown<br>"
@@ -83,11 +73,2 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
83 73
84 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this );
85 QRadioButton* r1 = new QRadioButton( "Color Bars", group );
86 QRadioButton* r2 = new QRadioButton( "Antenna", group );
87 r1->setFocusPolicy( QWidget::NoFocus );
88 r2->setFocusPolicy( QWidget::NoFocus );
89 group->setFocusPolicy( QWidget::NoFocus );
90 group->setButton( displayStyle );
91 grid->addWidget( group, 0, 1 );
92
93 /* quality graph */ 74 /* quality graph */
@@ -132,8 +113,4 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
132 113
133 applet->displayStyleChange( displayStyle );
134 applet->updateDelayChange( updateFrequency ); 114 applet->updateDelayChange( updateFrequency );
135 115
136 connect( group, SIGNAL( clicked(int) ),
137 this, SLOT( displayStyleChange(int) ) );
138
139 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); 116 applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
@@ -189,3 +166,2 @@ void WirelessControl::readConfig()
189 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); 166 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
190 displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA );
191 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); 167 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false );
@@ -206,3 +182,3 @@ void WirelessControl::writeConfigEntry( const char *entry, int val )
206WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) 182WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
207 : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), 183 : QWidget( parent, name ),
208 timer( 0 ), interface( 0 ), oldiface( 0 ), 184 timer( 0 ), interface( 0 ), oldiface( 0 ),
@@ -393,7 +369,7 @@ bool WirelessApplet::mustRepaint()
393 369
394 const char** pixmap = getQualityPixmap(); 370 int rings = numberOfRings();
395 371
396 if ( pixmap && ( pixmap != oldpixmap ) ) 372 if ( rings != oldrings )
397 { 373 {
398 oldpixmap = pixmap; 374 oldrings = rings;
399 return true; 375 return true;
@@ -469,19 +445,13 @@ void WirelessApplet::updatePopupWindow()
469 445
470const char** WirelessApplet::getQualityPixmap() 446int WirelessApplet::numberOfRings()
471{ 447{
472 if ( !interface ) return ( const char** ) nowireless_xpm; 448 if ( !interface ) return -1;
473 int qualityH = interface->signalStrength(); 449 int qualityH = interface->signalStrength();
474 if ( qualityH < 0 ) return ( const char** ) nowireless_xpm; 450 qDebug( "quality = %d", qualityH );
475 451 if ( qualityH < 1 ) return -1;
476 if ( visualStyle == STYLE_ANTENNA ) 452 if ( qualityH < 20 ) return 0;
477 { 453 if ( qualityH < 40 ) return 1;
478 if ( qualityH < 1 ) return ( const char** ) connect0_xpm; 454 if ( qualityH < 60 ) return 2;
479 if ( qualityH < 17 ) return ( const char** ) connect1_xpm; 455 if ( qualityH < 65 ) return 3;
480 if ( qualityH < 34 ) return ( const char** ) connect2_xpm; 456 return 4;
481 if ( qualityH < 50 ) return ( const char** ) connect3_xpm;
482 if ( qualityH < 65 ) return ( const char** ) connect4_xpm;
483 return ( const char** ) connect5_xpm;
484 }
485
486 return 0; // please draw your bars
487} 457}
@@ -491,58 +461,35 @@ void WirelessApplet::paintEvent( QPaintEvent* )
491 QPainter p( this ); 461 QPainter p( this );
492 QColor color; 462 int h = height();
463 int w = width();
464 int m = 2;
493 465
494 const char** pixmap = getQualityPixmap(); 466 p.drawLine( m, h-m-1, round( w/2.0 ), round( 0+h/3.0 ) );
467 p.drawLine( round( w/2.0 ), round( 0+h/3.0 ), w-m, h-m-1 );
468 p.setPen( QColor( 150, 150, 150 ) );
469 p.drawLine( w-m, h-m-1, m, h-m-1 );
495 470
496 if ( pixmap ) 471 int rings = numberOfRings();
497 p.drawPixmap( 0, 1, pixmap ); 472
498 else 473 if ( rings == -1 )
474 {
475 p.setPen( QPen( QColor( 200, 20, 20 ), 2 ) );
476 p.drawLine( w/2-m-m, h/2-m-m, w/2+m+m, h/2+m+m );
477 p.drawLine( w/2+m+m, h/2-m-m, w/2-m-m, h/2+m+m );
478 return;
479 }
480
481 qDebug( "WirelessApplet: painting %d rings", rings );
482 int radius = 2;
483 int rstep = 4;
484 int maxrings = w/rstep;
485
486 p.setPen( QColor( 200, 20, 20 ) );
487 for ( int i = 0; i < rings; ++i )
499 { 488 {
489 p.drawEllipse( w/2 - radius/2, h/3 - radius/2, radius, radius );
490 radius += rstep;
491 };
500 492
501 int noiseH = 30; // iface->noisePercent() * ( height() - 3 ) / 100;
502 int signalH = 50; // iface->signalPercent() * ( height() - 3 ) / 100;
503 int qualityH = interface->signalStrength(); // iface->qualityPercent() * ( height() - 3 ) / 100;
504
505 double intensity;
506 int pixelHeight;
507 int pixelWidth = 2;
508 int Hue;
509 int barSpace = 3;
510 int leftoffset = 0;
511 int bottomoffset = 2;
512
513 // draw noise indicator
514 pixelHeight = noiseH;
515 Hue = 50;
516 for ( int i = 0; i < pixelHeight; ++i )
517 {
518 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205;
519 color.setHsv( Hue, 255, intensity );
520 p.setPen ( color );
521 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i );
522 }
523 493
524 // draw signal indicator
525 pixelHeight = signalH;
526 Hue = 100;
527 leftoffset += pixelWidth + barSpace;
528 for ( int i = 0; i < pixelHeight; ++i )
529 {
530 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205;
531 color.setHsv( Hue, 255, intensity );
532 p.setPen ( color );
533 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i );
534 }
535 494
536 // draw quality indicator
537 pixelHeight = qualityH;
538 Hue = 250;
539 leftoffset += pixelWidth + barSpace;
540 for ( int i = 0; i < pixelHeight; ++i )
541 {
542 intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205;
543 color.setHsv( Hue, 255, intensity );
544 p.setPen ( color );
545 p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i );
546 }
547 }
548} 495}
diff --git a/noncore/applets/wirelessapplet/wireless.h b/noncore/applets/wirelessapplet/wireless.h
index b475a46..9146c66 100644
--- a/noncore/applets/wirelessapplet/wireless.h
+++ b/noncore/applets/wirelessapplet/wireless.h
@@ -52,3 +52,2 @@ class WirelessControl : public QFrame
52 52
53 int displayStyle;
54 int updateFrequency; 53 int updateFrequency;
@@ -84,3 +83,3 @@ class WirelessApplet : public QWidget
84 void updatePopupWindow(); 83 void updatePopupWindow();
85 const char** getQualityPixmap(); 84 int numberOfRings();
86 85
@@ -94,3 +93,3 @@ class WirelessApplet : public QWidget
94 private: 93 private:
95 const char** oldpixmap; 94 int oldrings;
96 Opie::Net::OWirelessNetworkInterface* oldiface; 95 Opie::Net::OWirelessNetworkInterface* oldiface;