-rw-r--r-- | noncore/applets/wirelessapplet/connect0.xpm | 28 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/connect1.xpm | 28 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/connect2.xpm | 29 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/connect3.xpm | 28 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/connect4.xpm | 26 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/connect5.xpm | 26 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/nowireless.xpm | 22 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 137 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.h | 5 |
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 */ | ||
2 | static 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 */ | ||
2 | static 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 */ | ||
2 | static 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 */ | ||
2 | static 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 */ | ||
2 | static 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 */ | ||
2 | static 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 @@ | |||
1 | static 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 | |||
@@ -11,19 +11,12 @@ | |||
11 | ** | 11 | ** |
12 | **********************************************************************/ | 12 | **********************************************************************/ |
13 | 13 | ||
14 | #include "wireless.h" | 14 | #include "wireless.h" |
15 | #include "mgraph.h" | 15 | #include "mgraph.h" |
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 | ||
25 | /* OPIE */ | 18 | /* OPIE */ |
26 | #include <opie2/onetwork.h> | 19 | #include <opie2/onetwork.h> |
27 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
28 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
29 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
@@ -37,30 +30,27 @@ | |||
37 | #include <qbuttongroup.h> | 30 | #include <qbuttongroup.h> |
38 | #include <qlayout.h> | 31 | #include <qlayout.h> |
39 | #include <qfile.h> | 32 | #include <qfile.h> |
40 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
41 | 34 | ||
42 | /* STD */ | 35 | /* STD */ |
36 | #include <math.h> | ||
43 | #include <sys/types.h> | 37 | #include <sys/types.h> |
44 | #include <signal.h> | 38 | #include <signal.h> |
45 | 39 | ||
46 | #define STYLE_BARS 0 | ||
47 | #define STYLE_ANTENNA 1 | ||
48 | |||
49 | //#define MDEBUG | 40 | //#define MDEBUG |
50 | #undef MDEBUG | 41 | #undef MDEBUG |
51 | 42 | ||
52 | using namespace Opie::Ui; | 43 | using namespace Opie::Ui; |
53 | using namespace Opie::Net; | 44 | using namespace Opie::Net; |
54 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) | 45 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) |
55 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) | 46 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) |
56 | { | 47 | { |
57 | 48 | ||
58 | readConfig(); | 49 | readConfig(); |
59 | writeConfigEntry( "UpdateFrequency", updateFrequency ); | 50 | writeConfigEntry( "UpdateFrequency", updateFrequency ); |
60 | writeConfigEntry( "DisplayStyle", displayStyle ); | ||
61 | 51 | ||
62 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 52 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
63 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); | 53 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); |
64 | 54 | ||
65 | /* status label */ | 55 | /* status label */ |
66 | 56 | ||
@@ -68,31 +58,22 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const | |||
68 | QString text( "Wireless Status:<br>" | 58 | QString text( "Wireless Status:<br>" |
69 | "*** Unknown ***<br>" | 59 | "*** Unknown ***<br>" |
70 | "Card not inserted ?<br>" | 60 | "Card not inserted ?<br>" |
71 | "Or Sharp ROM ?<br>" | 61 | "Or Sharp ROM ?<br>" |
72 | "CELL: 00:00:00:00:00:00" ); | 62 | "CELL: 00:00:00:00:00:00" ); |
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>" |
76 | "FREQ: Unknown<br>" | 66 | "FREQ: Unknown<br>" |
77 | "CELL: AA:BB:CC:DD:EE:FF" ); */ | 67 | "CELL: AA:BB:CC:DD:EE:FF" ); */ |
78 | statusLabel->setText( text ); | 68 | statusLabel->setText( text ); |
79 | statusLabel->setFixedSize( statusLabel->sizeHint() ); | 69 | statusLabel->setFixedSize( statusLabel->sizeHint() ); |
80 | grid->addWidget( statusLabel, 0, 0 ); | 70 | grid->addWidget( statusLabel, 0, 0 ); |
81 | 71 | ||
82 | /* visualization group box */ | 72 | /* visualization group box */ |
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 */ |
94 | 75 | ||
95 | mgraph = new MGraph( this ); | 76 | mgraph = new MGraph( this ); |
96 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 77 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
97 | mgraph->setMin( 0 ); | 78 | mgraph->setMin( 0 ); |
98 | mgraph->setMax( 92 ); | 79 | mgraph->setMax( 92 ); |
@@ -127,18 +108,14 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const | |||
127 | connect( updateSlider, SIGNAL( valueChanged(int) ), | 108 | connect( updateSlider, SIGNAL( valueChanged(int) ), |
128 | this, SLOT( updateDelayChange(int) ) ); | 109 | this, SLOT( updateDelayChange(int) ) ); |
129 | 110 | ||
130 | setFixedSize( sizeHint() ); | 111 | setFixedSize( sizeHint() ); |
131 | setFocusPolicy( QWidget::NoFocus ); | 112 | setFocusPolicy( QWidget::NoFocus ); |
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 ); |
140 | } | 117 | } |
141 | 118 | ||
142 | void WirelessControl::advancedConfigClicked() | 119 | void WirelessControl::advancedConfigClicked() |
143 | { | 120 | { |
144 | AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); | 121 | AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); |
@@ -184,13 +161,12 @@ void WirelessControl::show ( bool ) | |||
184 | void WirelessControl::readConfig() | 161 | void WirelessControl::readConfig() |
185 | { | 162 | { |
186 | Config cfg( "qpe" ); | 163 | Config cfg( "qpe" ); |
187 | cfg.setGroup( "Wireless" ); | 164 | cfg.setGroup( "Wireless" ); |
188 | 165 | ||
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 ); |
192 | rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); | 168 | rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); |
193 | rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); | 169 | rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); |
194 | rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); | 170 | rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); |
195 | } | 171 | } |
196 | 172 | ||
@@ -201,13 +177,13 @@ void WirelessControl::writeConfigEntry( const char *entry, int val ) | |||
201 | cfg.writeEntry( entry, val ); | 177 | cfg.writeEntry( entry, val ); |
202 | } | 178 | } |
203 | 179 | ||
204 | //=========================================================================== | 180 | //=========================================================================== |
205 | 181 | ||
206 | WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) | 182 | WirelessApplet::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 ), |
209 | rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) | 185 | rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) |
210 | { | 186 | { |
211 | setFixedHeight( 18 ); | 187 | setFixedHeight( 18 ); |
212 | setFixedWidth( 14 ); | 188 | setFixedWidth( 14 ); |
213 | status = new WirelessControl( this, this, "wireless status" ); | 189 | status = new WirelessControl( this, this, "wireless status" ); |
@@ -388,17 +364,17 @@ bool WirelessApplet::mustRepaint() | |||
388 | #endif | 364 | #endif |
389 | hide(); | 365 | hide(); |
390 | return true; | 366 | return true; |
391 | } | 367 | } |
392 | } | 368 | } |
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; |
400 | } | 376 | } |
401 | 377 | ||
402 | int noiseH = 50; // iface->noisePercent() * ( height() - 3 ) / 100; | 378 | int noiseH = 50; // iface->noisePercent() * ( height() - 3 ) / 100; |
403 | int signalH = interface->signalStrength() * ( height() - 3 ) / 100; | 379 | int signalH = interface->signalStrength() * ( height() - 3 ) / 100; |
404 | int qualityH = 50; // iface->qualityPercent() * ( height() - 3 ) / 100; | 380 | int qualityH = 50; // iface->qualityPercent() * ( height() - 3 ) / 100; |
@@ -464,90 +440,61 @@ void WirelessApplet::updatePopupWindow() | |||
464 | "ESSID: " + interface->SSID() + "<br>" + | 440 | "ESSID: " + interface->SSID() + "<br>" + |
465 | "MODE: " + interface->mode() + "<br>" + | 441 | "MODE: " + interface->mode() + "<br>" + |
466 | "FREQ: " + freqString + "<br>" + | 442 | "FREQ: " + freqString + "<br>" + |
467 | cell + " " + interface->associatedAP().toString() ); | 443 | cell + " " + interface->associatedAP().toString() ); |
468 | } | 444 | } |
469 | 445 | ||
470 | const char** WirelessApplet::getQualityPixmap() | 446 | int 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 | } |
488 | 458 | ||
489 | void WirelessApplet::paintEvent( QPaintEvent* ) | 459 | void WirelessApplet::paintEvent( QPaintEvent* ) |
490 | { | 460 | { |
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 | } |
549 | 496 | ||
550 | 497 | ||
551 | int WirelessApplet::position() | 498 | int WirelessApplet::position() |
552 | { | 499 | { |
553 | return 6; | 500 | return 6; |
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 | |||
@@ -47,13 +47,12 @@ class WirelessControl : public QFrame | |||
47 | void displayStyleChange( int ); | 47 | void displayStyleChange( int ); |
48 | void advancedConfigClicked(); | 48 | void advancedConfigClicked(); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | WirelessApplet* applet; | 51 | WirelessApplet* applet; |
52 | 52 | ||
53 | int displayStyle; | ||
54 | int updateFrequency; | 53 | int updateFrequency; |
55 | 54 | ||
56 | bool rocESSID; | 55 | bool rocESSID; |
57 | bool rocFREQ; | 56 | bool rocFREQ; |
58 | bool rocAP; | 57 | bool rocAP; |
59 | bool rocMODE; | 58 | bool rocMODE; |
@@ -79,23 +78,23 @@ class WirelessApplet : public QWidget | |||
79 | void paintEvent( QPaintEvent* ); | 78 | void paintEvent( QPaintEvent* ); |
80 | void checkInterface(); | 79 | void checkInterface(); |
81 | void renewDHCP(); | 80 | void renewDHCP(); |
82 | 81 | ||
83 | bool mustRepaint(); | 82 | bool mustRepaint(); |
84 | void updatePopupWindow(); | 83 | void updatePopupWindow(); |
85 | const char** getQualityPixmap(); | 84 | int numberOfRings(); |
86 | 85 | ||
87 | private: | 86 | private: |
88 | QPixmap snapshotPixmap; | 87 | QPixmap snapshotPixmap; |
89 | int visualStyle; | 88 | int visualStyle; |
90 | int timer; | 89 | int timer; |
91 | 90 | ||
92 | Opie::Net::OWirelessNetworkInterface* interface; | 91 | Opie::Net::OWirelessNetworkInterface* interface; |
93 | 92 | ||
94 | private: | 93 | private: |
95 | const char** oldpixmap; | 94 | int oldrings; |
96 | Opie::Net::OWirelessNetworkInterface* oldiface; | 95 | Opie::Net::OWirelessNetworkInterface* oldiface; |
97 | int oldqualityH; | 96 | int oldqualityH; |
98 | int oldsignalH; | 97 | int oldsignalH; |
99 | int oldnoiseH; | 98 | int oldnoiseH; |
100 | 99 | ||
101 | QString oldESSID; | 100 | QString oldESSID; |