Diffstat (limited to 'noncore/applets/wirelessapplet/wireless.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 149 |
1 files changed, 136 insertions, 13 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 183aab8..a5aabb0 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -12,49 +12,57 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "wireless.h" | 16 | #include "wireless.h" |
17 | 17 | ||
18 | #include <qapplication.h> | 18 | #include <qapplication.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | 21 | ||
22 | #include <qpoint.h> | 22 | #include <qpoint.h> |
23 | #include <qradiobutton.h> | 23 | #include <qradiobutton.h> |
24 | #include <qcheckbox.h> | 24 | #include <qpushbutton.h> |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qslider.h> | 27 | #include <qslider.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qframe.h> | 30 | #include <qframe.h> |
31 | #include <qpixmap.h> | 31 | #include <qpixmap.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | ||
35 | |||
36 | #include <sys/types.h> | ||
37 | #include <signal.h> | ||
34 | 38 | ||
35 | #include "networkinfo.h" | 39 | #include "networkinfo.h" |
36 | #include "mgraph.h" | 40 | #include "mgraph.h" |
37 | 41 | ||
42 | #include "advancedconfig.h" | ||
43 | |||
38 | #include "connect0.xpm" | 44 | #include "connect0.xpm" |
39 | #include "connect1.xpm" | 45 | #include "connect1.xpm" |
40 | #include "connect2.xpm" | 46 | #include "connect2.xpm" |
41 | #include "connect3.xpm" | 47 | #include "connect3.xpm" |
42 | #include "connect4.xpm" | 48 | #include "connect4.xpm" |
43 | #include "connect5.xpm" | 49 | #include "connect5.xpm" |
44 | #include "nowireless.xpm" | 50 | #include "nowireless.xpm" |
45 | 51 | ||
46 | #define STYLE_BARS 0 | 52 | #define STYLE_BARS 0 |
47 | #define STYLE_ANTENNA 1 | 53 | #define STYLE_ANTENNA 1 |
48 | 54 | ||
55 | #define MDEBUG 0 | ||
56 | |||
49 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) | 57 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) |
50 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) | 58 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) |
51 | { | 59 | { |
52 | 60 | ||
53 | readConfig(); | 61 | readConfig(); |
54 | writeConfigEntry( "UpdateFrequency", updateFrequency ); | 62 | writeConfigEntry( "UpdateFrequency", updateFrequency ); |
55 | writeConfigEntry( "DisplayStyle", displayStyle ); | 63 | writeConfigEntry( "DisplayStyle", displayStyle ); |
56 | 64 | ||
57 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 65 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
58 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); | 66 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); |
59 | 67 | ||
60 | /* status label */ | 68 | /* status label */ |
@@ -85,30 +93,31 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const | |||
85 | group->setButton( displayStyle ); | 93 | group->setButton( displayStyle ); |
86 | grid->addWidget( group, 0, 1 ); | 94 | grid->addWidget( group, 0, 1 ); |
87 | 95 | ||
88 | /* quality graph */ | 96 | /* quality graph */ |
89 | 97 | ||
90 | mgraph = new MGraph( this ); | 98 | mgraph = new MGraph( this ); |
91 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 99 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
92 | mgraph->setMin( 0 ); | 100 | mgraph->setMin( 0 ); |
93 | mgraph->setMax( 92 ); | 101 | mgraph->setMax( 92 ); |
94 | grid->addWidget( mgraph, 1, 0 ); | 102 | grid->addWidget( mgraph, 1, 0 ); |
95 | mgraph->setFocusPolicy( QWidget::NoFocus ); | 103 | mgraph->setFocusPolicy( QWidget::NoFocus ); |
96 | 104 | ||
97 | /* dhcp renew CheckBox */ | 105 | /* advanced configuration Button */ |
98 | 106 | ||
99 | //FIXME: under construction | 107 | QPushButton* advanced = new QPushButton( "Advanced...", this ); |
100 | //QCheckBox* dhcpCheckBox = new QCheckBox( "DHCP renew", this ); | 108 | advanced->setFocusPolicy( QWidget::NoFocus ); |
101 | //dhcpCheckBox->setFocusPolicy( QWidget::NoFocus ); | 109 | grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); |
102 | //grid->addWidget( dhcpCheckBox, 2, 0, Qt::AlignCenter ); | 110 | connect( advanced, SIGNAL( clicked() ), |
111 | this, SLOT( advancedConfigClicked() ) ); | ||
103 | 112 | ||
104 | /* update Frequency Label */ | 113 | /* update Frequency Label */ |
105 | 114 | ||
106 | updateLabel = new QLabel( this ); | 115 | updateLabel = new QLabel( this ); |
107 | text.sprintf( "Update every %d s", updateFrequency ); | 116 | text.sprintf( "Update every %d s", updateFrequency ); |
108 | updateLabel->setText( text ); | 117 | updateLabel->setText( text ); |
109 | grid->addWidget( updateLabel, 2, 1 ); | 118 | grid->addWidget( updateLabel, 2, 1 ); |
110 | 119 | ||
111 | /* update Frequency Slider */ | 120 | /* update Frequency Slider */ |
112 | 121 | ||
113 | QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); | 122 | QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); |
114 | updateSlider->setRange( 0, 9 ); | 123 | updateSlider->setRange( 0, 9 ); |
@@ -119,25 +128,40 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const | |||
119 | updateSlider->setFocusPolicy( QWidget::NoFocus ); | 128 | updateSlider->setFocusPolicy( QWidget::NoFocus ); |
120 | grid->addWidget( updateSlider, 1, 1 ); | 129 | grid->addWidget( updateSlider, 1, 1 ); |
121 | connect( updateSlider, SIGNAL( valueChanged( int ) ), | 130 | connect( updateSlider, SIGNAL( valueChanged( int ) ), |
122 | this, SLOT( updateDelayChange( int ) ) ); | 131 | this, SLOT( updateDelayChange( int ) ) ); |
123 | 132 | ||
124 | setFixedSize( sizeHint() ); | 133 | setFixedSize( sizeHint() ); |
125 | setFocusPolicy( QWidget::NoFocus ); | 134 | setFocusPolicy( QWidget::NoFocus ); |
126 | 135 | ||
127 | applet->displayStyleChange( displayStyle ); | 136 | applet->displayStyleChange( displayStyle ); |
128 | applet->updateDelayChange( updateFrequency ); | 137 | applet->updateDelayChange( updateFrequency ); |
129 | 138 | ||
130 | connect( group, SIGNAL( clicked( int ) ), | 139 | connect( group, SIGNAL( clicked( int ) ), |
131 | this, SLOT( displayStyleChange( int ) ) ); | 140 | this, SLOT( displayStyleChange( int ) ) ); |
141 | |||
142 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | ||
143 | } | ||
144 | |||
145 | void WirelessControl::advancedConfigClicked() | ||
146 | { | ||
147 | AdvancedConfig* a = new AdvancedConfig( this, "dialog", TRUE ); | ||
148 | int result = a->exec(); | ||
149 | a->hide(); | ||
150 | delete a; | ||
151 | if ( result == QDialog::Accepted ) | ||
152 | { | ||
153 | readConfig(); | ||
154 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | ||
155 | } | ||
132 | } | 156 | } |
133 | 157 | ||
134 | void WirelessControl::updateDelayChange( int delay ) | 158 | void WirelessControl::updateDelayChange( int delay ) |
135 | { | 159 | { |
136 | QString text; | 160 | QString text; |
137 | text.sprintf( "Update every %d s", delay ); | 161 | text.sprintf( "Update every %d s", delay ); |
138 | updateLabel->setText( text ); | 162 | updateLabel->setText( text ); |
139 | applet->updateDelayChange( delay ); | 163 | applet->updateDelayChange( delay ); |
140 | writeConfigEntry( "UpdateFrequency", delay ); | 164 | writeConfigEntry( "UpdateFrequency", delay ); |
141 | } | 165 | } |
142 | 166 | ||
143 | void WirelessControl::displayStyleChange( int style ) | 167 | void WirelessControl::displayStyleChange( int style ) |
@@ -157,60 +181,105 @@ void WirelessControl::show ( bool ) | |||
157 | x = QPEApplication::desktop ( )-> width ( ) - w; | 181 | x = QPEApplication::desktop ( )-> width ( ) - w; |
158 | 182 | ||
159 | move( x, curPos.y () - sizeHint().height () ); | 183 | move( x, curPos.y () - sizeHint().height () ); |
160 | QFrame::show(); | 184 | QFrame::show(); |
161 | } | 185 | } |
162 | 186 | ||
163 | void WirelessControl::readConfig() | 187 | void WirelessControl::readConfig() |
164 | { | 188 | { |
165 | Config cfg( "qpe" ); | 189 | Config cfg( "qpe" ); |
166 | cfg.setGroup( "Wireless" ); | 190 | cfg.setGroup( "Wireless" ); |
167 | 191 | ||
168 | updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); | 192 | updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); |
169 | displayStyle = cfg. readNumEntry( "DisplayStyle", STYLE_ANTENNA ); | 193 | displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA ); |
194 | rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); | ||
195 | rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); | ||
196 | rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); | ||
197 | rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); | ||
170 | } | 198 | } |
171 | 199 | ||
172 | void WirelessControl::writeConfigEntry( const char *entry, int val ) | 200 | void WirelessControl::writeConfigEntry( const char *entry, int val ) |
173 | { | 201 | { |
174 | Config cfg( "qpe" ); | 202 | Config cfg( "qpe" ); |
175 | cfg.setGroup( "Wireless" ); | 203 | cfg.setGroup( "Wireless" ); |
176 | cfg.writeEntry( entry, val ); | 204 | cfg.writeEntry( entry, val ); |
177 | } | 205 | } |
178 | 206 | ||
179 | //=========================================================================== | 207 | //=========================================================================== |
180 | 208 | ||
181 | WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) | 209 | WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) |
182 | : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), | 210 | : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), |
183 | timer( 0 ), interface( 0 ) | 211 | timer( 0 ), interface( 0 ), |
212 | rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) | ||
184 | { | 213 | { |
185 | setFixedHeight( 18 ); | 214 | setFixedHeight( 18 ); |
186 | setFixedWidth( 14 ); | 215 | setFixedWidth( 14 ); |
187 | network = new MWirelessNetwork(); | 216 | network = new MWirelessNetwork(); |
188 | status = new WirelessControl( this, 0, "wireless status" ); | 217 | status = new WirelessControl( this, 0, "wireless status" ); |
189 | } | 218 | } |
190 | 219 | ||
191 | void WirelessApplet::checkInterface() | 220 | void WirelessApplet::checkInterface() |
192 | { | 221 | { |
193 | interface = network->getFirstInterface(); | 222 | interface = network->getFirstInterface(); |
194 | if ( interface ) | 223 | if ( interface ) |
195 | { | 224 | { |
225 | #ifdef MDEBUG | ||
196 | qDebug( "WIFIAPPLET: using interface '%s'", (const char*) | 226 | qDebug( "WIFIAPPLET: using interface '%s'", (const char*) |
227 | #endif | ||
197 | interface->getName() ); | 228 | interface->getName() ); |
198 | } | 229 | } |
199 | else | 230 | else |
200 | { | 231 | { |
232 | #ifdef MDEBUG | ||
201 | qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); | 233 | qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); |
234 | hide(); | ||
235 | #endif | ||
202 | } | 236 | } |
203 | } | 237 | } |
204 | 238 | ||
239 | void WirelessApplet::renewDHCP() | ||
240 | { | ||
241 | #ifdef MDEBUG | ||
242 | qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); | ||
243 | #endif | ||
244 | |||
245 | QString pidfile; | ||
246 | if ( !interface ) | ||
247 | return; | ||
248 | QString ifacename( interface->getName() ); | ||
249 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); | ||
250 | #ifdef MDEBUG | ||
251 | qDebug( "WIFIAPPLET: pidfile is '%s'", (const char*) pidfile ); | ||
252 | #endif | ||
253 | int pid; | ||
254 | QFile pfile( pidfile ); | ||
255 | bool hasFile = pfile.open( IO_ReadOnly ); | ||
256 | QTextStream s( &pfile ); | ||
257 | if ( hasFile ) | ||
258 | s >> pid; | ||
259 | #ifdef MDEBUG | ||
260 | qDebug( "WIFIAPPLET: sent -14 to pid %d", pid ); | ||
261 | #endif | ||
262 | kill( pid, -14 ); | ||
263 | |||
264 | } | ||
265 | |||
266 | void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) | ||
267 | { | ||
268 | rocESSID = ESSID; | ||
269 | rocFREQ = FREQ; | ||
270 | rocAP = AP; | ||
271 | rocMODE = MODE; | ||
272 | } | ||
273 | |||
205 | void WirelessApplet::updateDelayChange( int delay ) | 274 | void WirelessApplet::updateDelayChange( int delay ) |
206 | { | 275 | { |
207 | if ( timer ) | 276 | if ( timer ) |
208 | killTimer( timer ); | 277 | killTimer( timer ); |
209 | delay *= 1000; | 278 | delay *= 1000; |
210 | if ( delay == 0 ) | 279 | if ( delay == 0 ) |
211 | delay = 50; | 280 | delay = 50; |
212 | timer = startTimer( delay ); | 281 | timer = startTimer( delay ); |
213 | } | 282 | } |
214 | 283 | ||
215 | void WirelessApplet::displayStyleChange( int style ) | 284 | void WirelessApplet::displayStyleChange( int style ) |
216 | { | 285 | { |
@@ -219,25 +288,31 @@ void WirelessApplet::displayStyleChange( int style ) | |||
219 | } | 288 | } |
220 | 289 | ||
221 | WirelessApplet::~WirelessApplet() | 290 | WirelessApplet::~WirelessApplet() |
222 | { | 291 | { |
223 | } | 292 | } |
224 | 293 | ||
225 | void WirelessApplet::timerEvent( QTimerEvent* ) | 294 | void WirelessApplet::timerEvent( QTimerEvent* ) |
226 | { | 295 | { |
227 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; | 296 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; |
228 | 297 | ||
229 | if ( iface ) | 298 | if ( iface ) |
230 | { | 299 | { |
231 | iface->updateStatistics(); | 300 | bool statResult = iface->updateStatistics(); |
301 | if ( !statResult ) | ||
302 | { | ||
303 | interface = 0; | ||
304 | mustRepaint(); | ||
305 | return; | ||
306 | } else | ||
232 | if ( mustRepaint() ) | 307 | if ( mustRepaint() ) |
233 | { | 308 | { |
234 | //qDebug( "WIFIAPPLET: A value has changed -> repainting." ); | 309 | //qDebug( "WIFIAPPLET: A value has changed -> repainting." ); |
235 | repaint(); | 310 | repaint(); |
236 | } | 311 | } |
237 | 312 | ||
238 | if ( status->isVisible() ) | 313 | if ( status->isVisible() ) |
239 | updatePopupWindow(); | 314 | updatePopupWindow(); |
240 | } else checkInterface(); | 315 | } else checkInterface(); |
241 | } | 316 | } |
242 | 317 | ||
243 | void WirelessApplet::mousePressEvent( QMouseEvent *) | 318 | void WirelessApplet::mousePressEvent( QMouseEvent *) |
@@ -249,49 +324,97 @@ void WirelessApplet::mousePressEvent( QMouseEvent *) | |||
249 | } | 324 | } |
250 | 325 | ||
251 | bool WirelessApplet::mustRepaint() | 326 | bool WirelessApplet::mustRepaint() |
252 | { | 327 | { |
253 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; | 328 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; |
254 | 329 | ||
255 | // check if there are enough changes to justify a (flickering) repaint | 330 | // check if there are enough changes to justify a (flickering) repaint |
256 | 331 | ||
257 | // has the interface changed? | 332 | // has the interface changed? |
258 | 333 | ||
259 | if ( iface != oldiface ) | 334 | if ( iface != oldiface ) |
260 | { | 335 | { |
261 | oldiface = iface; | 336 | oldiface = iface; |
262 | return true; | 337 | if ( iface ) |
338 | { | ||
339 | #ifdef MDEBUG | ||
340 | qDebug( "WIFIAPPLET: We had no interface but now we have one! :-)" ); | ||
341 | #endif | ||
342 | show(); | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | #ifdef MDEBUG | ||
347 | qDebug( "WIFIAPPLET: We had a interface but now we don't have one! ;-(" ); | ||
348 | #endif | ||
349 | hide(); | ||
350 | return true; | ||
351 | } | ||
263 | } | 352 | } |
264 | 353 | ||
265 | const char** pixmap = getQualityPixmap(); | 354 | const char** pixmap = getQualityPixmap(); |
266 | 355 | ||
267 | if ( pixmap && ( pixmap != oldpixmap ) ) | 356 | if ( pixmap && ( pixmap != oldpixmap ) ) |
268 | { | 357 | { |
269 | oldpixmap = pixmap; | 358 | oldpixmap = pixmap; |
270 | return true; | 359 | return true; |
271 | } | 360 | } |
272 | 361 | ||
273 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; | 362 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; |
274 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; | 363 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; |
275 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; | 364 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; |
276 | 365 | ||
277 | if ( ( noiseH != oldnoiseH ) | 366 | if ( ( noiseH != oldnoiseH ) |
278 | || ( signalH != oldsignalH ) | 367 | || ( signalH != oldsignalH ) |
279 | || ( qualityH != oldqualityH ) ) | 368 | || ( qualityH != oldqualityH ) ) |
280 | { | 369 | { |
281 | oldnoiseH = noiseH; | 370 | oldnoiseH = noiseH; |
282 | oldsignalH = signalH; | 371 | oldsignalH = signalH; |
283 | oldqualityH = qualityH; | 372 | oldqualityH = qualityH; |
284 | return true; | 373 | return true; |
285 | } | 374 | } |
375 | |||
376 | if ( rocESSID && ( oldESSID != iface->essid ) ) | ||
377 | { | ||
378 | #ifdef MDEBUG | ||
379 | qDebug( "WIFIAPPLET: ESSID has changed."); | ||
380 | #endif | ||
381 | renewDHCP(); | ||
382 | } | ||
383 | else if ( rocFREQ && ( oldFREQ != iface->freq ) ) | ||
384 | { | ||
385 | #ifdef MDEBUG | ||
386 | qDebug( "WIFIAPPLET: FREQ has changed."); | ||
387 | #endif | ||
388 | renewDHCP(); | ||
389 | } | ||
390 | else if ( rocAP && ( oldAP != iface->APAddr ) ) | ||
391 | { | ||
392 | #ifdef MDEBUG | ||
393 | qDebug( "WIFIAPPLET: AP has changed."); | ||
394 | #endif | ||
395 | renewDHCP(); | ||
396 | } | ||
397 | else if ( rocMODE && ( oldMODE != iface->mode ) ) | ||
398 | { | ||
399 | #ifdef MDEBUG | ||
400 | qDebug( "WIFIAPPLET: MODE has changed."); | ||
401 | #endif | ||
402 | renewDHCP(); | ||
403 | } | ||
404 | |||
405 | oldESSID = iface->essid; | ||
406 | oldMODE = iface->mode; | ||
407 | oldFREQ = iface->freq; | ||
408 | oldAP = iface->APAddr; | ||
286 | 409 | ||
287 | return false; | 410 | return false; |
288 | } | 411 | } |
289 | 412 | ||
290 | void WirelessApplet::updatePopupWindow() | 413 | void WirelessApplet::updatePopupWindow() |
291 | { | 414 | { |
292 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; | 415 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; |
293 | int qualityH = iface->qualityPercent(); | 416 | int qualityH = iface->qualityPercent(); |
294 | 417 | ||
295 | if ( status->mgraph ) | 418 | if ( status->mgraph ) |
296 | status->mgraph->addValue( qualityH, false ); | 419 | status->mgraph->addValue( qualityH, false ); |
297 | 420 | ||
@@ -325,25 +448,25 @@ const char** WirelessApplet::getQualityPixmap() | |||
325 | 448 | ||
326 | return 0; // please draw your bars | 449 | return 0; // please draw your bars |
327 | } | 450 | } |
328 | 451 | ||
329 | void WirelessApplet::paintEvent( QPaintEvent* ) | 452 | void WirelessApplet::paintEvent( QPaintEvent* ) |
330 | { | 453 | { |
331 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; | 454 | MWirelessNetworkInterface* iface = ( MWirelessNetworkInterface* ) interface; |
332 | 455 | ||
333 | QPainter p(this); | 456 | QPainter p(this); |
334 | QColor color; | 457 | QColor color; |
335 | 458 | ||
336 | const char** pixmap = getQualityPixmap(); | 459 | const char** pixmap = getQualityPixmap(); |
337 | 460 | ||
338 | if ( pixmap ) | 461 | if ( pixmap ) |
339 | p.drawPixmap( 0, 1, pixmap ); | 462 | p.drawPixmap( 0, 1, pixmap ); |
340 | else | 463 | else |
341 | { | 464 | { |
342 | 465 | ||
343 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; | 466 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; |
344 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; | 467 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; |
345 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; | 468 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; |
346 | 469 | ||
347 | double intensity; | 470 | double intensity; |
348 | int pixelHeight; | 471 | int pixelHeight; |
349 | int pixelWidth = 2; | 472 | int pixelWidth = 2; |