-rw-r--r-- | noncore/applets/wirelessapplet/config.in | 2 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 50 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.h | 10 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wirelessapplet.pro | 2 |
4 files changed, 36 insertions, 28 deletions
diff --git a/noncore/applets/wirelessapplet/config.in b/noncore/applets/wirelessapplet/config.in index 8e948a2..f4828d3 100644 --- a/noncore/applets/wirelessapplet/config.in +++ b/noncore/applets/wirelessapplet/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config WIRELESSAPPLET | 1 | config WIRELESSAPPLET |
2 | boolean "opie-wirelessapplet (view wireless signal strength, and renew IP on AP change)" | 2 | boolean "opie-wirelessapplet (view wireless signal strength, and renew IP on AP change)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2NET |
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index cbaf5d6..dc9742a 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -1,552 +1,564 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer <mickey@vanille.de> | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer <mickey@vanille.de> |
3 | ** | 3 | ** |
4 | ** 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 |
5 | ** 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 |
6 | ** Foundation and appearing in the file LICENSE.GPL included in the | 6 | ** Foundation and appearing in the file LICENSE.GPL included in the |
7 | ** packaging of this file. | 7 | ** packaging of this file. |
8 | ** | 8 | ** |
9 | ** 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 |
10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
11 | ** | 11 | ** |
12 | **********************************************************************/ | 12 | **********************************************************************/ |
13 | 13 | ||
14 | #include "wireless.h" | 14 | #include "wireless.h" |
15 | #include "networkinfo.h" | 15 | #include "networkinfo.h" |
16 | #include "mgraph.h" | 16 | #include "mgraph.h" |
17 | #include "advancedconfig.h" | 17 | #include "advancedconfig.h" |
18 | #include "connect0.xpm" | 18 | #include "connect0.xpm" |
19 | #include "connect1.xpm" | 19 | #include "connect1.xpm" |
20 | #include "connect2.xpm" | 20 | #include "connect2.xpm" |
21 | #include "connect3.xpm" | 21 | #include "connect3.xpm" |
22 | #include "connect4.xpm" | 22 | #include "connect4.xpm" |
23 | #include "connect5.xpm" | 23 | #include "connect5.xpm" |
24 | #include "nowireless.xpm" | 24 | #include "nowireless.xpm" |
25 | 25 | ||
26 | /* OPIE */ | 26 | /* OPIE */ |
27 | #include <opie2/onetwork.h> | ||
27 | #include <opie2/otaskbarapplet.h> | 28 | #include <opie2/otaskbarapplet.h> |
28 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
30 | 31 | ||
31 | /* QT */ | 32 | /* QT */ |
32 | #include <qpoint.h> | 33 | #include <qpoint.h> |
33 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
34 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
35 | #include <qpainter.h> | 36 | #include <qpainter.h> |
36 | #include <qlabel.h> | 37 | #include <qlabel.h> |
37 | #include <qslider.h> | 38 | #include <qslider.h> |
38 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
39 | #include <qlayout.h> | 40 | #include <qlayout.h> |
40 | #include <qframe.h> | 41 | #include <qframe.h> |
41 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
42 | #include <qstring.h> | 43 | #include <qstring.h> |
43 | #include <qfile.h> | 44 | #include <qfile.h> |
44 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
45 | 46 | ||
46 | /* STD */ | 47 | /* STD */ |
47 | #include <sys/types.h> | 48 | #include <sys/types.h> |
48 | #include <signal.h> | 49 | #include <signal.h> |
49 | 50 | ||
50 | #define STYLE_BARS 0 | 51 | #define STYLE_BARS 0 |
51 | #define STYLE_ANTENNA 1 | 52 | #define STYLE_ANTENNA 1 |
52 | 53 | ||
53 | //#define MDEBUG | 54 | //#define MDEBUG |
54 | #undef MDEBUG | 55 | #undef MDEBUG |
55 | 56 | ||
56 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) | 57 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) |
57 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) | 58 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) |
58 | { | 59 | { |
59 | 60 | ||
60 | readConfig(); | 61 | readConfig(); |
61 | writeConfigEntry( "UpdateFrequency", updateFrequency ); | 62 | writeConfigEntry( "UpdateFrequency", updateFrequency ); |
62 | writeConfigEntry( "DisplayStyle", displayStyle ); | 63 | writeConfigEntry( "DisplayStyle", displayStyle ); |
63 | 64 | ||
64 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 65 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
65 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); | 66 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); |
66 | 67 | ||
67 | /* status label */ | 68 | /* status label */ |
68 | 69 | ||
69 | statusLabel = new QLabel( this, "statuslabel" ); | 70 | statusLabel = new QLabel( this, "statuslabel" ); |
70 | QString text( "Wireless Status:<br>" | 71 | QString text( "Wireless Status:<br>" |
71 | "*** Unknown ***<br>" | 72 | "*** Unknown ***<br>" |
72 | "Card not inserted ?<br>" | 73 | "Card not inserted ?<br>" |
73 | "Or Sharp ROM ?<br>" | 74 | "Or Sharp ROM ?<br>" |
74 | "CELL: 00:00:00:00:00:00" ); | 75 | "CELL: 00:00:00:00:00:00" ); |
75 | /* QString text( "Station: Unknown<br>" | 76 | /* QString text( "Station: Unknown<br>" |
76 | "ESSID: Unknown<br>" | 77 | "ESSID: Unknown<br>" |
77 | "MODE: Unknown<br>" | 78 | "MODE: Unknown<br>" |
78 | "FREQ: Unknown<br>" | 79 | "FREQ: Unknown<br>" |
79 | "CELL: AA:BB:CC:DD:EE:FF" ); */ | 80 | "CELL: AA:BB:CC:DD:EE:FF" ); */ |
80 | statusLabel->setText( text ); | 81 | statusLabel->setText( text ); |
81 | statusLabel->setFixedSize( statusLabel->sizeHint() ); | 82 | statusLabel->setFixedSize( statusLabel->sizeHint() ); |
82 | grid->addWidget( statusLabel, 0, 0 ); | 83 | grid->addWidget( statusLabel, 0, 0 ); |
83 | 84 | ||
84 | /* visualization group box */ | 85 | /* visualization group box */ |
85 | 86 | ||
86 | QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this ); | 87 | QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this ); |
87 | QRadioButton* r1 = new QRadioButton( "Color Bars", group ); | 88 | QRadioButton* r1 = new QRadioButton( "Color Bars", group ); |
88 | QRadioButton* r2 = new QRadioButton( "Antenna", group ); | 89 | QRadioButton* r2 = new QRadioButton( "Antenna", group ); |
89 | r1->setFocusPolicy( QWidget::NoFocus ); | 90 | r1->setFocusPolicy( QWidget::NoFocus ); |
90 | r2->setFocusPolicy( QWidget::NoFocus ); | 91 | r2->setFocusPolicy( QWidget::NoFocus ); |
91 | group->setFocusPolicy( QWidget::NoFocus ); | 92 | group->setFocusPolicy( QWidget::NoFocus ); |
92 | group->setButton( displayStyle ); | 93 | group->setButton( displayStyle ); |
93 | grid->addWidget( group, 0, 1 ); | 94 | grid->addWidget( group, 0, 1 ); |
94 | 95 | ||
95 | /* quality graph */ | 96 | /* quality graph */ |
96 | 97 | ||
97 | mgraph = new MGraph( this ); | 98 | mgraph = new MGraph( this ); |
98 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 99 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
99 | mgraph->setMin( 0 ); | 100 | mgraph->setMin( 0 ); |
100 | mgraph->setMax( 92 ); | 101 | mgraph->setMax( 92 ); |
101 | grid->addWidget( mgraph, 1, 0 ); | 102 | grid->addWidget( mgraph, 1, 0 ); |
102 | mgraph->setFocusPolicy( QWidget::NoFocus ); | 103 | mgraph->setFocusPolicy( QWidget::NoFocus ); |
103 | 104 | ||
104 | /* advanced configuration Button */ | 105 | /* advanced configuration Button */ |
105 | 106 | ||
106 | QPushButton* advanced = new QPushButton( "Advanced...", this ); | 107 | QPushButton* advanced = new QPushButton( "Advanced...", this ); |
107 | advanced->setFocusPolicy( QWidget::NoFocus ); | 108 | advanced->setFocusPolicy( QWidget::NoFocus ); |
108 | grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); | 109 | grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); |
109 | connect( advanced, SIGNAL( clicked() ), | 110 | connect( advanced, SIGNAL( clicked() ), |
110 | this, SLOT( advancedConfigClicked() ) ); | 111 | this, SLOT( advancedConfigClicked() ) ); |
111 | 112 | ||
112 | /* update Frequency Label */ | 113 | /* update Frequency Label */ |
113 | 114 | ||
114 | updateLabel = new QLabel( this ); | 115 | updateLabel = new QLabel( this ); |
115 | text.sprintf( "Update every %d s", updateFrequency ); | 116 | text.sprintf( "Update every %d s", updateFrequency ); |
116 | updateLabel->setText( text ); | 117 | updateLabel->setText( text ); |
117 | grid->addWidget( updateLabel, 2, 1 ); | 118 | grid->addWidget( updateLabel, 2, 1 ); |
118 | 119 | ||
119 | /* update Frequency Slider */ | 120 | /* update Frequency Slider */ |
120 | 121 | ||
121 | QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); | 122 | QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); |
122 | updateSlider->setRange( 0, 9 ); | 123 | updateSlider->setRange( 0, 9 ); |
123 | updateSlider->setValue( updateFrequency ); | 124 | updateSlider->setValue( updateFrequency ); |
124 | updateSlider->setTickmarks( QSlider::Both ); | 125 | updateSlider->setTickmarks( QSlider::Both ); |
125 | updateSlider->setTickInterval( 1 ); | 126 | updateSlider->setTickInterval( 1 ); |
126 | updateSlider->setSteps( 1, 1 ); | 127 | updateSlider->setSteps( 1, 1 ); |
127 | updateSlider->setFocusPolicy( QWidget::NoFocus ); | 128 | updateSlider->setFocusPolicy( QWidget::NoFocus ); |
128 | grid->addWidget( updateSlider, 1, 1 ); | 129 | grid->addWidget( updateSlider, 1, 1 ); |
129 | connect( updateSlider, SIGNAL( valueChanged( int ) ), | 130 | connect( updateSlider, SIGNAL( valueChanged( int ) ), |
130 | this, SLOT( updateDelayChange( int ) ) ); | 131 | this, SLOT( updateDelayChange( int ) ) ); |
131 | 132 | ||
132 | setFixedSize( sizeHint() ); | 133 | setFixedSize( sizeHint() ); |
133 | setFocusPolicy( QWidget::NoFocus ); | 134 | setFocusPolicy( QWidget::NoFocus ); |
134 | 135 | ||
135 | applet->displayStyleChange( displayStyle ); | 136 | applet->displayStyleChange( displayStyle ); |
136 | applet->updateDelayChange( updateFrequency ); | 137 | applet->updateDelayChange( updateFrequency ); |
137 | 138 | ||
138 | connect( group, SIGNAL( clicked( int ) ), | 139 | connect( group, SIGNAL( clicked( int ) ), |
139 | this, SLOT( displayStyleChange( int ) ) ); | 140 | this, SLOT( displayStyleChange( int ) ) ); |
140 | 141 | ||
141 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | 142 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); |
142 | } | 143 | } |
143 | 144 | ||
144 | void WirelessControl::advancedConfigClicked() | 145 | void WirelessControl::advancedConfigClicked() |
145 | { | 146 | { |
146 | AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); | 147 | AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); |
147 | int result = a->exec(); | 148 | int result = a->exec(); |
148 | a->hide(); | 149 | a->hide(); |
149 | delete a; | 150 | delete a; |
150 | if ( result == QDialog::Accepted ) | 151 | if ( result == QDialog::Accepted ) |
151 | { | 152 | { |
152 | readConfig(); | 153 | readConfig(); |
153 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | 154 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); |
154 | } | 155 | } |
155 | } | 156 | } |
156 | 157 | ||
157 | void WirelessControl::updateDelayChange( int delay ) | 158 | void WirelessControl::updateDelayChange( int delay ) |
158 | { | 159 | { |
159 | QString text; | 160 | QString text; |
160 | text.sprintf( "Update every %d s", delay ); | 161 | text.sprintf( "Update every %d s", delay ); |
161 | updateLabel->setText( text ); | 162 | updateLabel->setText( text ); |
162 | applet->updateDelayChange( delay ); | 163 | applet->updateDelayChange( delay ); |
163 | writeConfigEntry( "UpdateFrequency", delay ); | 164 | writeConfigEntry( "UpdateFrequency", delay ); |
164 | } | 165 | } |
165 | 166 | ||
166 | void WirelessControl::displayStyleChange( int style ) | 167 | void WirelessControl::displayStyleChange( int style ) |
167 | { | 168 | { |
168 | applet->displayStyleChange( style ); | 169 | applet->displayStyleChange( style ); |
169 | writeConfigEntry( "DisplayStyle", style ); | 170 | writeConfigEntry( "DisplayStyle", style ); |
170 | } | 171 | } |
171 | 172 | ||
172 | void WirelessControl::show ( bool ) | 173 | void WirelessControl::show ( bool ) |
173 | { | 174 | { |
174 | QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); | 175 | QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); |
175 | 176 | ||
176 | int w = sizeHint().width(); | 177 | int w = sizeHint().width(); |
177 | int x = curPos.x() - ( w / 2 ); | 178 | int x = curPos.x() - ( w / 2 ); |
178 | 179 | ||
179 | if ( ( x + w ) > QPEApplication::desktop() ->width() ) | 180 | if ( ( x + w ) > QPEApplication::desktop() ->width() ) |
180 | x = QPEApplication::desktop ( ) -> width ( ) - w; | 181 | x = QPEApplication::desktop ( ) -> width ( ) - w; |
181 | 182 | ||
182 | move( x, curPos.y () - sizeHint().height () ); | 183 | move( x, curPos.y () - sizeHint().height () ); |
183 | QFrame::show(); | 184 | QFrame::show(); |
184 | } | 185 | } |
185 | 186 | ||
186 | void WirelessControl::readConfig() | 187 | void WirelessControl::readConfig() |
187 | { | 188 | { |
188 | Config cfg( "qpe" ); | 189 | Config cfg( "qpe" ); |
189 | cfg.setGroup( "Wireless" ); | 190 | cfg.setGroup( "Wireless" ); |
190 | 191 | ||
191 | updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); | 192 | updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); |
192 | displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA ); | 193 | displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA ); |
193 | rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); | 194 | rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); |
194 | rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); | 195 | rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); |
195 | rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); | 196 | rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); |
196 | rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); | 197 | rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); |
197 | } | 198 | } |
198 | 199 | ||
199 | void WirelessControl::writeConfigEntry( const char *entry, int val ) | 200 | void WirelessControl::writeConfigEntry( const char *entry, int val ) |
200 | { | 201 | { |
201 | Config cfg( "qpe" ); | 202 | Config cfg( "qpe" ); |
202 | cfg.setGroup( "Wireless" ); | 203 | cfg.setGroup( "Wireless" ); |
203 | cfg.writeEntry( entry, val ); | 204 | cfg.writeEntry( entry, val ); |
204 | } | 205 | } |
205 | 206 | ||
206 | //=========================================================================== | 207 | //=========================================================================== |
207 | 208 | ||
208 | WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) | 209 | WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) |
209 | : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), | 210 | : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), |
210 | timer( 0 ), interface( 0 ), | 211 | timer( 0 ), interface( 0 ), oldiface( 0 ), |
211 | rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) | 212 | rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) |
212 | { | 213 | { |
213 | setFixedHeight( 18 ); | 214 | setFixedHeight( 18 ); |
214 | setFixedWidth( 14 ); | 215 | setFixedWidth( 14 ); |
215 | network = new MWirelessNetwork(); | ||
216 | status = new WirelessControl( this, this, "wireless status" ); | 216 | status = new WirelessControl( this, this, "wireless status" ); |
217 | } | 217 | } |
218 | 218 | ||
219 | void WirelessApplet::checkInterface() | 219 | void WirelessApplet::checkInterface() |
220 | { | 220 | { |
221 | interface = network->getFirstInterface(); | 221 | interface = 0L; |
222 | ONetwork* net = ONetwork::instance(); | ||
223 | ONetwork::InterfaceIterator it = net->iterator(); | ||
224 | |||
225 | while ( it.current() && !it.current()->isWireless() ) ++it; | ||
226 | |||
227 | if ( it.current() && it.current()->isWireless() ) | ||
228 | interface = static_cast<OWirelessNetworkInterface*>( it.current() ); | ||
229 | |||
222 | if ( interface ) | 230 | if ( interface ) |
223 | { | 231 | { |
224 | #ifdef MDEBUG | 232 | #ifdef MDEBUG |
225 | qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->getName() ); | 233 | qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->name() ); |
226 | #endif | 234 | #endif |
227 | 235 | ||
228 | } | 236 | } |
229 | else | 237 | else |
230 | { | 238 | { |
231 | #ifdef MDEBUG | 239 | #ifdef MDEBUG |
232 | qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); | 240 | qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); |
233 | #endif | 241 | #endif |
234 | hide(); | 242 | hide(); |
235 | } | 243 | } |
236 | } | 244 | } |
237 | 245 | ||
238 | void WirelessApplet::renewDHCP() | 246 | void WirelessApplet::renewDHCP() |
239 | { | 247 | { |
240 | #ifdef MDEBUG | 248 | #ifdef MDEBUG |
241 | qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); | 249 | qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); |
242 | #endif | 250 | #endif |
243 | 251 | ||
244 | QString pidfile; | 252 | QString pidfile; |
245 | if ( !interface ) | 253 | if ( !interface ) |
246 | return ; | 254 | return ; |
247 | QString ifacename( interface->getName() ); | 255 | QString ifacename( interface->name() ); |
248 | 256 | ||
249 | // At first we are trying dhcpcd | 257 | // At first we are trying dhcpcd |
250 | 258 | ||
251 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", ( const char* ) ifacename ); | 259 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", ( const char* ) ifacename ); |
252 | #ifdef MDEBUG | 260 | #ifdef MDEBUG |
253 | qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", ( const char* ) pidfile ); | 261 | qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", ( const char* ) pidfile ); |
254 | #endif | 262 | #endif |
255 | int pid; | 263 | int pid; |
256 | QFile pfile( pidfile ); | 264 | QFile pfile( pidfile ); |
257 | bool hasFile = pfile.open( IO_ReadOnly ); | 265 | bool hasFile = pfile.open( IO_ReadOnly ); |
258 | QTextStream s( &pfile ); | 266 | QTextStream s( &pfile ); |
259 | if ( hasFile ) | 267 | if ( hasFile ) |
260 | { | 268 | { |
261 | s >> pid; | 269 | s >> pid; |
262 | #ifdef MDEBUG | 270 | #ifdef MDEBUG |
263 | qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); | 271 | qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); |
264 | #endif | 272 | #endif |
265 | kill( pid, SIGALRM ); | 273 | kill( pid, SIGALRM ); |
266 | return ; | 274 | return ; |
267 | } | 275 | } |
268 | 276 | ||
269 | // No dhcpcd, so we are trying udhcpc | 277 | // No dhcpcd, so we are trying udhcpc |
270 | #ifdef MDEBUG | 278 | #ifdef MDEBUG |
271 | qDebug( "WIFIAPPLET: dhcpcd not available." ); | 279 | qDebug( "WIFIAPPLET: dhcpcd not available." ); |
272 | #endif | 280 | #endif |
273 | pidfile.sprintf( "/var/run/udhcpc.%s.pid", ( const char* ) ifacename ); | 281 | pidfile.sprintf( "/var/run/udhcpc.%s.pid", ( const char* ) ifacename ); |
274 | #ifdef MDEBUG | 282 | #ifdef MDEBUG |
275 | qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", ( const char* ) pidfile ); | 283 | qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", ( const char* ) pidfile ); |
276 | #endif | 284 | #endif |
277 | QFile pfile2( pidfile ); | 285 | QFile pfile2( pidfile ); |
278 | hasFile = pfile2.open( IO_ReadOnly ); | 286 | hasFile = pfile2.open( IO_ReadOnly ); |
279 | QTextStream s2( &pfile2 ); | 287 | QTextStream s2( &pfile2 ); |
280 | if ( hasFile ) | 288 | if ( hasFile ) |
281 | { | 289 | { |
282 | s2 >> pid; | 290 | s2 >> pid; |
283 | #ifdef MDEBUG | 291 | #ifdef MDEBUG |
284 | qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid ); | 292 | qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid ); |
285 | #endif | 293 | #endif |
286 | kill( pid, SIGUSR1 ); | 294 | kill( pid, SIGUSR1 ); |
287 | return ; | 295 | return ; |
288 | } | 296 | } |
289 | } | 297 | } |
290 | 298 | ||
291 | void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) | 299 | void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) |
292 | { | 300 | { |
293 | rocESSID = ESSID; | 301 | rocESSID = ESSID; |
294 | rocFREQ = FREQ; | 302 | rocFREQ = FREQ; |
295 | rocAP = AP; | 303 | rocAP = AP; |
296 | rocMODE = MODE; | 304 | rocMODE = MODE; |
297 | } | 305 | } |
298 | 306 | ||
299 | void WirelessApplet::updateDelayChange( int delay ) | 307 | void WirelessApplet::updateDelayChange( int delay ) |
300 | { | 308 | { |
301 | if ( timer ) | 309 | if ( timer ) |
302 | killTimer( timer ); | 310 | killTimer( timer ); |
303 | delay *= 1000; | 311 | delay *= 1000; |
304 | if ( delay == 0 ) | 312 | if ( delay == 0 ) |
305 | delay = 50; | 313 | delay = 50; |
306 | timer = startTimer( delay ); | 314 | timer = startTimer( delay ); |
307 | } | 315 | } |
308 | 316 | ||
309 | void WirelessApplet::displayStyleChange( int style ) | 317 | void WirelessApplet::displayStyleChange( int style ) |
310 | { | 318 | { |
311 | visualStyle = style; | 319 | visualStyle = style; |
312 | repaint(); | 320 | repaint(); |
313 | } | 321 | } |
314 | 322 | ||
315 | WirelessApplet::~WirelessApplet() | 323 | WirelessApplet::~WirelessApplet() |
316 | {} | 324 | {} |
317 | 325 | ||
318 | void WirelessApplet::timerEvent( QTimerEvent* ) | 326 | void WirelessApplet::timerEvent( QTimerEvent* ) |
319 | { | 327 | { |
320 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; | 328 | /* |
329 | |||
330 | OWirelessNetworkInterface* iface = interface; | ||
321 | 331 | ||
322 | if ( iface ) | 332 | if ( iface ) |
323 | { | 333 | { |
324 | bool statResult = iface->updateStatistics(); | 334 | bool statResult = iface->updateStatistics(); |
325 | if ( !statResult ) | 335 | if ( !statResult ) |
326 | { | 336 | { |
327 | interface = 0; | 337 | interface = 0; |
328 | mustRepaint(); | 338 | mustRepaint(); |
329 | return ; | 339 | return ; |
330 | } | 340 | } |
331 | else | 341 | else |
332 | if ( mustRepaint() ) | 342 | if ( mustRepaint() ) |
333 | { | 343 | { |
334 | //qDebug( "WIFIAPPLET: A value has changed -> repainting." ); | 344 | //qDebug( "WIFIAPPLET: A value has changed -> repainting." ); |
335 | repaint(); | 345 | repaint(); |
336 | } | 346 | } |
337 | 347 | ||
338 | if ( status->isVisible() ) | 348 | if ( status->isVisible() ) |
339 | updatePopupWindow(); | 349 | updatePopupWindow(); |
340 | } | 350 | } |
341 | else checkInterface(); | 351 | else checkInterface(); |
352 | |||
353 | */ | ||
342 | } | 354 | } |
343 | 355 | ||
344 | void WirelessApplet::mousePressEvent( QMouseEvent * ) | 356 | void WirelessApplet::mousePressEvent( QMouseEvent * ) |
345 | { | 357 | { |
346 | if ( status->isVisible() ) | 358 | if ( status->isVisible() ) |
347 | status->hide(); | 359 | status->hide(); |
348 | else | 360 | else |
349 | status->show( true ); | 361 | status->show( true ); |
350 | } | 362 | } |
351 | 363 | ||
352 | bool WirelessApplet::mustRepaint() | 364 | bool WirelessApplet::mustRepaint() |
353 | { | 365 | { |
354 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; | 366 | OWirelessNetworkInterface* iface = interface; |
355 | 367 | ||
356 | // check if there are enough changes to justify a (flickering) repaint | 368 | // check if there are enough changes to justify a (flickering) repaint |
357 | 369 | ||
358 | // has the interface changed? | 370 | // has the interface changed? |
359 | 371 | ||
360 | if ( iface != oldiface ) | 372 | if ( iface != oldiface ) |
361 | { | 373 | { |
362 | oldiface = iface; | 374 | oldiface = iface; |
363 | if ( iface ) | 375 | if ( iface ) |
364 | { | 376 | { |
365 | #ifdef MDEBUG | 377 | #ifdef MDEBUG |
366 | qDebug( "WIFIAPPLET: We had no interface but now we have one! :-)" ); | 378 | qDebug( "WIFIAPPLET: We had no interface but now we have one! :-)" ); |
367 | #endif | 379 | #endif |
368 | show(); | 380 | show(); |
369 | } | 381 | } |
370 | else | 382 | else |
371 | { | 383 | { |
372 | #ifdef MDEBUG | 384 | #ifdef MDEBUG |
373 | qDebug( "WIFIAPPLET: We had a interface but now we don't have one! ;-(" ); | 385 | qDebug( "WIFIAPPLET: We had a interface but now we don't have one! ;-(" ); |
374 | #endif | 386 | #endif |
375 | hide(); | 387 | hide(); |
376 | return true; | 388 | return true; |
377 | } | 389 | } |
378 | } | 390 | } |
379 | 391 | ||
380 | const char** pixmap = getQualityPixmap(); | 392 | const char** pixmap = getQualityPixmap(); |
381 | 393 | ||
382 | if ( pixmap && ( pixmap != oldpixmap ) ) | 394 | if ( pixmap && ( pixmap != oldpixmap ) ) |
383 | { | 395 | { |
384 | oldpixmap = pixmap; | 396 | oldpixmap = pixmap; |
385 | return true; | 397 | return true; |
386 | } | 398 | } |
387 | 399 | ||
388 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; | 400 | int noiseH = 50; // iface->noisePercent() * ( height() - 3 ) / 100; |
389 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; | 401 | int signalH = iface->signalStrength() * ( height() - 3 ) / 100; |
390 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; | 402 | int qualityH = 50; // iface->qualityPercent() * ( height() - 3 ) / 100; |
391 | 403 | ||
392 | if ( ( noiseH != oldnoiseH ) | 404 | if ( ( noiseH != oldnoiseH ) |
393 | || ( signalH != oldsignalH ) | 405 | || ( signalH != oldsignalH ) |
394 | || ( qualityH != oldqualityH ) ) | 406 | || ( qualityH != oldqualityH ) ) |
395 | { | 407 | { |
396 | oldnoiseH = noiseH; | 408 | oldnoiseH = noiseH; |
397 | oldsignalH = signalH; | 409 | oldsignalH = signalH; |
398 | oldqualityH = qualityH; | 410 | oldqualityH = qualityH; |
399 | return true; | 411 | return true; |
400 | } | 412 | } |
401 | 413 | ||
402 | if ( rocESSID && ( oldESSID != iface->essid ) ) | 414 | if ( rocESSID && ( oldESSID != iface->SSID() ) ) |
403 | { | 415 | { |
404 | #ifdef MDEBUG | 416 | #ifdef MDEBUG |
405 | qDebug( "WIFIAPPLET: ESSID has changed." ); | 417 | qDebug( "WIFIAPPLET: ESSID has changed." ); |
406 | #endif | 418 | #endif |
407 | renewDHCP(); | 419 | renewDHCP(); |
408 | } | 420 | } |
409 | else if ( rocFREQ && ( oldFREQ != iface->freq ) ) | 421 | else if ( rocFREQ && ( oldFREQ != iface->frequency() ) ) |
410 | { | 422 | { |
411 | #ifdef MDEBUG | 423 | #ifdef MDEBUG |
412 | qDebug( "WIFIAPPLET: FREQ has changed." ); | 424 | qDebug( "WIFIAPPLET: FREQ has changed." ); |
413 | #endif | 425 | #endif |
414 | renewDHCP(); | 426 | renewDHCP(); |
415 | } | 427 | } |
416 | else if ( rocAP && ( oldAP != iface->APAddr ) ) | 428 | else if ( rocAP && ( oldAP != iface->associatedAP().toString() ) ) |
417 | { | 429 | { |
418 | #ifdef MDEBUG | 430 | #ifdef MDEBUG |
419 | qDebug( "WIFIAPPLET: AP has changed." ); | 431 | qDebug( "WIFIAPPLET: AP has changed." ); |
420 | #endif | 432 | #endif |
421 | renewDHCP(); | 433 | renewDHCP(); |
422 | } | 434 | } |
423 | else if ( rocMODE && ( oldMODE != iface->mode ) ) | 435 | else if ( rocMODE && ( oldMODE != iface->mode() ) ) |
424 | { | 436 | { |
425 | #ifdef MDEBUG | 437 | #ifdef MDEBUG |
426 | qDebug( "WIFIAPPLET: MODE has changed." ); | 438 | qDebug( "WIFIAPPLET: MODE has changed." ); |
427 | #endif | 439 | #endif |
428 | renewDHCP(); | 440 | renewDHCP(); |
429 | } | 441 | } |
430 | 442 | ||
431 | oldESSID = iface->essid; | 443 | oldESSID = iface->SSID(); |
432 | oldMODE = iface->mode; | 444 | oldMODE = iface->mode(); |
433 | oldFREQ = iface->freq; | 445 | oldFREQ = iface->frequency(); |
434 | oldAP = iface->APAddr; | 446 | oldAP = iface->associatedAP().toString(); |
435 | 447 | ||
436 | return false; | 448 | return false; |
437 | } | 449 | } |
438 | 450 | ||
439 | void WirelessApplet::updatePopupWindow() | 451 | void WirelessApplet::updatePopupWindow() |
440 | { | 452 | { |
441 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; | 453 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; |
442 | int qualityH = iface->qualityPercent(); | 454 | int qualityH = iface->qualityPercent(); |
443 | 455 | ||
444 | if ( status->mgraph ) | 456 | if ( status->mgraph ) |
445 | status->mgraph->addValue( qualityH, false ); | 457 | status->mgraph->addValue( qualityH, false ); |
446 | 458 | ||
447 | QString freqString; | 459 | QString freqString; |
448 | QString cell = ( iface->mode == "Managed" ) ? "AP: " : "Cell: "; | 460 | QString cell = ( iface->mode == "Managed" ) ? "AP: " : "Cell: "; |
449 | freqString.sprintf( "%.3f GHz", iface->freq ); | 461 | freqString.sprintf( "%.3f GHz", iface->freq ); |
450 | status->statusLabel->setText( "Station: " + iface->nick + "<br>" + | 462 | status->statusLabel->setText( "Station: " + iface->nick + "<br>" + |
451 | "ESSID: " + iface->essid + "<br>" + | 463 | "ESSID: " + iface->essid + "<br>" + |
452 | "MODE: " + iface->mode + "<br>" + | 464 | "MODE: " + iface->mode + "<br>" + |
453 | "FREQ: " + freqString + "<br>" + | 465 | "FREQ: " + freqString + "<br>" + |
454 | cell + " " + iface->APAddr ); | 466 | cell + " " + iface->APAddr ); |
455 | } | 467 | } |
456 | 468 | ||
457 | const char** WirelessApplet::getQualityPixmap() | 469 | const char** WirelessApplet::getQualityPixmap() |
458 | { | 470 | { |
459 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; | 471 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; |
460 | 472 | ||
461 | if ( !iface ) return ( const char** ) nowireless_xpm; | 473 | if ( !iface ) return ( const char** ) nowireless_xpm; |
462 | int qualityH = iface->qualityPercent(); | 474 | int qualityH = iface->qualityPercent(); |
463 | if ( qualityH < 0 ) return ( const char** ) nowireless_xpm; | 475 | if ( qualityH < 0 ) return ( const char** ) nowireless_xpm; |
464 | 476 | ||
465 | if ( visualStyle == STYLE_ANTENNA ) | 477 | if ( visualStyle == STYLE_ANTENNA ) |
466 | { | 478 | { |
467 | if ( qualityH < 1 ) return ( const char** ) connect0_xpm; | 479 | if ( qualityH < 1 ) return ( const char** ) connect0_xpm; |
468 | if ( qualityH < 17 ) return ( const char** ) connect1_xpm; | 480 | if ( qualityH < 17 ) return ( const char** ) connect1_xpm; |
469 | if ( qualityH < 34 ) return ( const char** ) connect2_xpm; | 481 | if ( qualityH < 34 ) return ( const char** ) connect2_xpm; |
470 | if ( qualityH < 50 ) return ( const char** ) connect3_xpm; | 482 | if ( qualityH < 50 ) return ( const char** ) connect3_xpm; |
471 | if ( qualityH < 65 ) return ( const char** ) connect4_xpm; | 483 | if ( qualityH < 65 ) return ( const char** ) connect4_xpm; |
472 | return ( const char** ) connect5_xpm; | 484 | return ( const char** ) connect5_xpm; |
473 | } | 485 | } |
474 | 486 | ||
475 | return 0; // please draw your bars | 487 | return 0; // please draw your bars |
476 | } | 488 | } |
477 | 489 | ||
478 | void WirelessApplet::paintEvent( QPaintEvent* ) | 490 | void WirelessApplet::paintEvent( QPaintEvent* ) |
479 | { | 491 | { |
480 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; | 492 | MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; |
481 | 493 | ||
482 | QPainter p( this ); | 494 | QPainter p( this ); |
483 | QColor color; | 495 | QColor color; |
484 | 496 | ||
485 | const char** pixmap = getQualityPixmap(); | 497 | const char** pixmap = getQualityPixmap(); |
486 | 498 | ||
487 | if ( pixmap ) | 499 | if ( pixmap ) |
488 | p.drawPixmap( 0, 1, pixmap ); | 500 | p.drawPixmap( 0, 1, pixmap ); |
489 | else | 501 | else |
490 | { | 502 | { |
491 | 503 | ||
492 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; | 504 | int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; |
493 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; | 505 | int signalH = iface->signalPercent() * ( height() - 3 ) / 100; |
494 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; | 506 | int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; |
495 | 507 | ||
496 | double intensity; | 508 | double intensity; |
497 | int pixelHeight; | 509 | int pixelHeight; |
498 | int pixelWidth = 2; | 510 | int pixelWidth = 2; |
499 | int Hue; | 511 | int Hue; |
500 | int barSpace = 3; | 512 | int barSpace = 3; |
501 | int leftoffset = 0; | 513 | int leftoffset = 0; |
502 | int bottomoffset = 2; | 514 | int bottomoffset = 2; |
503 | 515 | ||
504 | // draw noise indicator | 516 | // draw noise indicator |
505 | pixelHeight = noiseH; | 517 | pixelHeight = noiseH; |
506 | Hue = 50; | 518 | Hue = 50; |
507 | for ( int i = 0; i < pixelHeight; ++i ) | 519 | for ( int i = 0; i < pixelHeight; ++i ) |
508 | { | 520 | { |
509 | intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; | 521 | intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; |
510 | color.setHsv( Hue, 255, intensity ); | 522 | color.setHsv( Hue, 255, intensity ); |
511 | p.setPen ( color ); | 523 | p.setPen ( color ); |
512 | p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); | 524 | p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); |
513 | } | 525 | } |
514 | 526 | ||
515 | // draw signal indicator | 527 | // draw signal indicator |
516 | pixelHeight = signalH; | 528 | pixelHeight = signalH; |
517 | Hue = 100; | 529 | Hue = 100; |
518 | leftoffset += pixelWidth + barSpace; | 530 | leftoffset += pixelWidth + barSpace; |
519 | for ( int i = 0; i < pixelHeight; ++i ) | 531 | for ( int i = 0; i < pixelHeight; ++i ) |
520 | { | 532 | { |
521 | intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; | 533 | intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; |
522 | color.setHsv( Hue, 255, intensity ); | 534 | color.setHsv( Hue, 255, intensity ); |
523 | p.setPen ( color ); | 535 | p.setPen ( color ); |
524 | p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); | 536 | p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); |
525 | } | 537 | } |
526 | 538 | ||
527 | // draw quality indicator | 539 | // draw quality indicator |
528 | pixelHeight = qualityH; | 540 | pixelHeight = qualityH; |
529 | Hue = 250; | 541 | Hue = 250; |
530 | leftoffset += pixelWidth + barSpace; | 542 | leftoffset += pixelWidth + barSpace; |
531 | for ( int i = 0; i < pixelHeight; ++i ) | 543 | for ( int i = 0; i < pixelHeight; ++i ) |
532 | { | 544 | { |
533 | intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; | 545 | intensity = 50 + ( ( double ) i / ( double ) pixelHeight ) * 205; |
534 | color.setHsv( Hue, 255, intensity ); | 546 | color.setHsv( Hue, 255, intensity ); |
535 | p.setPen ( color ); | 547 | p.setPen ( color ); |
536 | p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); | 548 | p.drawLine( leftoffset, height() - bottomoffset - i, pixelWidth + leftoffset, height() - bottomoffset - i ); |
537 | } | 549 | } |
538 | } | 550 | } |
539 | } | 551 | } |
540 | 552 | ||
541 | 553 | ||
542 | int WirelessApplet::position() | 554 | int WirelessApplet::position() |
543 | { | 555 | { |
544 | return 6; | 556 | return 6; |
545 | } | 557 | } |
546 | 558 | ||
547 | 559 | ||
548 | Q_EXPORT_INTERFACE() | 560 | Q_EXPORT_INTERFACE() |
549 | { | 561 | { |
550 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<WirelessApplet> ); | 562 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<WirelessApplet> ); |
551 | } | 563 | } |
552 | 564 | ||
diff --git a/noncore/applets/wirelessapplet/wireless.h b/noncore/applets/wirelessapplet/wireless.h index 644be26..27f8c90 100644 --- a/noncore/applets/wirelessapplet/wireless.h +++ b/noncore/applets/wirelessapplet/wireless.h | |||
@@ -1,114 +1,110 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
3 | ** All rights reserved. | 3 | ** All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | **********************************************************************/ | 13 | **********************************************************************/ |
14 | 14 | ||
15 | #ifndef __WIRELESS_APPLET_H__ | 15 | #ifndef __WIRELESS_APPLET_H__ |
16 | #define __WIRELESS_APPLET_H__ | 16 | #define __WIRELESS_APPLET_H__ |
17 | 17 | ||
18 | #include <qwidget.h> | 18 | #include <qwidget.h> |
19 | #include <qframe.h> | 19 | #include <qframe.h> |
20 | #include <qpixmap.h> | 20 | #include <qpixmap.h> |
21 | 21 | ||
22 | class MNetwork; | 22 | class OWirelessNetworkInterface; |
23 | class MWirelessNetwork; | ||
24 | class MNetworkInterface; | ||
25 | class MWirelessNetworkInterface; | ||
26 | class Y; | 23 | class Y; |
27 | class QLabel; | 24 | class QLabel; |
28 | class WirelessApplet; | 25 | class WirelessApplet; |
29 | class MGraph; | 26 | class MGraph; |
30 | 27 | ||
31 | class WirelessControl : public QFrame | 28 | class WirelessControl : public QFrame |
32 | { | 29 | { |
33 | Q_OBJECT | 30 | Q_OBJECT |
34 | public: | 31 | public: |
35 | WirelessControl( WirelessApplet* icon, QWidget *parent=0, const char *name=0 ); | 32 | WirelessControl( WirelessApplet* icon, QWidget *parent=0, const char *name=0 ); |
36 | void show( bool ); | 33 | void show( bool ); |
37 | 34 | ||
38 | void readConfig(); | 35 | void readConfig(); |
39 | void writeConfigEntry( const char* entry, int val ); | 36 | void writeConfigEntry( const char* entry, int val ); |
40 | 37 | ||
41 | MGraph* mgraph; | 38 | MGraph* mgraph; |
42 | QLabel* statusLabel; | 39 | QLabel* statusLabel; |
43 | QLabel* updateLabel; | 40 | QLabel* updateLabel; |
44 | 41 | ||
45 | public slots: | 42 | public slots: |
46 | void updateDelayChange( int ); | 43 | void updateDelayChange( int ); |
47 | void displayStyleChange( int ); | 44 | void displayStyleChange( int ); |
48 | void advancedConfigClicked(); | 45 | void advancedConfigClicked(); |
49 | 46 | ||
50 | private: | 47 | private: |
51 | WirelessApplet* applet; | 48 | WirelessApplet* applet; |
52 | 49 | ||
53 | int displayStyle; | 50 | int displayStyle; |
54 | int updateFrequency; | 51 | int updateFrequency; |
55 | 52 | ||
56 | bool rocESSID; | 53 | bool rocESSID; |
57 | bool rocFREQ; | 54 | bool rocFREQ; |
58 | bool rocAP; | 55 | bool rocAP; |
59 | bool rocMODE; | 56 | bool rocMODE; |
60 | }; | 57 | }; |
61 | 58 | ||
62 | class WirelessApplet : public QWidget | 59 | class WirelessApplet : public QWidget |
63 | { | 60 | { |
64 | Q_OBJECT | 61 | Q_OBJECT |
65 | public: | 62 | public: |
66 | WirelessApplet( QWidget *parent = 0, const char *name=0 ); | 63 | WirelessApplet( QWidget *parent = 0, const char *name=0 ); |
67 | ~WirelessApplet(); | 64 | ~WirelessApplet(); |
68 | static int position(); | 65 | static int position(); |
69 | WirelessControl* status; | 66 | WirelessControl* status; |
70 | 67 | ||
71 | virtual void timerEvent( QTimerEvent* ); | 68 | virtual void timerEvent( QTimerEvent* ); |
72 | void updateDelayChange( int delay ); | 69 | void updateDelayChange( int delay ); |
73 | void displayStyleChange( int style ); | 70 | void displayStyleChange( int style ); |
74 | 71 | ||
75 | void updateDHCPConfig( bool, bool, bool, bool ); | 72 | void updateDHCPConfig( bool, bool, bool, bool ); |
76 | 73 | ||
77 | private: | 74 | private: |
78 | void mousePressEvent( QMouseEvent * ); | 75 | void mousePressEvent( QMouseEvent * ); |
79 | void paintEvent( QPaintEvent* ); | 76 | void paintEvent( QPaintEvent* ); |
80 | void checkInterface(); | 77 | void checkInterface(); |
81 | void renewDHCP(); | 78 | void renewDHCP(); |
82 | 79 | ||
83 | bool mustRepaint(); | 80 | bool mustRepaint(); |
84 | void updatePopupWindow(); | 81 | void updatePopupWindow(); |
85 | const char** getQualityPixmap(); | 82 | const char** getQualityPixmap(); |
86 | 83 | ||
87 | private: | 84 | private: |
88 | QPixmap snapshotPixmap; | 85 | QPixmap snapshotPixmap; |
89 | int visualStyle; | 86 | int visualStyle; |
90 | int timer; | 87 | int timer; |
91 | 88 | ||
92 | MWirelessNetwork* network; | 89 | OWirelessNetworkInterface* interface; |
93 | MNetworkInterface* interface; | ||
94 | 90 | ||
95 | private: | 91 | private: |
96 | const char** oldpixmap; | 92 | const char** oldpixmap; |
97 | MWirelessNetworkInterface* oldiface; | 93 | OWirelessNetworkInterface* oldiface; |
98 | int oldqualityH; | 94 | int oldqualityH; |
99 | int oldsignalH; | 95 | int oldsignalH; |
100 | int oldnoiseH; | 96 | int oldnoiseH; |
101 | 97 | ||
102 | QString oldESSID; | 98 | QString oldESSID; |
103 | QString oldAP; | 99 | QString oldAP; |
104 | QString oldMODE; | 100 | QString oldMODE; |
105 | double oldFREQ; | 101 | double oldFREQ; |
106 | 102 | ||
107 | bool rocESSID; | 103 | bool rocESSID; |
108 | bool rocFREQ; | 104 | bool rocFREQ; |
109 | bool rocAP; | 105 | bool rocAP; |
110 | bool rocMODE; | 106 | bool rocMODE; |
111 | }; | 107 | }; |
112 | 108 | ||
113 | #endif // __WIRELESS_APPLET_H__ | 109 | #endif // __WIRELESS_APPLET_H__ |
114 | 110 | ||
diff --git a/noncore/applets/wirelessapplet/wirelessapplet.pro b/noncore/applets/wirelessapplet/wirelessapplet.pro index 38cb475..7bd7380 100644 --- a/noncore/applets/wirelessapplet/wirelessapplet.pro +++ b/noncore/applets/wirelessapplet/wirelessapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = wireless.h networkinfo.h mgraph.h advancedconfig.h | 3 | HEADERS = wireless.h networkinfo.h mgraph.h advancedconfig.h |
4 | SOURCES = wireless.cpp networkinfo.cpp mgraph.cpp advancedconfig.cpp | 4 | SOURCES = wireless.cpp networkinfo.cpp mgraph.cpp advancedconfig.cpp |
5 | INTERFACES = advancedconfigbase.ui | 5 | INTERFACES = advancedconfigbase.ui |
6 | TARGET = wirelessapplet | 6 | TARGET = wirelessapplet |
7 | DESTDIR = $(OPIEDIR)/plugins/applets | 7 | DESTDIR = $(OPIEDIR)/plugins/applets |
8 | INCLUDEPATH += $(OPIEDIR)/include | 8 | INCLUDEPATH += $(OPIEDIR)/include |
9 | DEPENDPATH += $(OPIEDIR)/include | 9 | DEPENDPATH += $(OPIEDIR)/include |
10 | LIBS += -lqpe | 10 | LIBS += -lqpe -lopiecore2 -lopienet2 |
11 | VERSION = 0.1.1 | 11 | VERSION = 0.1.1 |
12 | 12 | ||
13 | include ( $(OPIEDIR)/include.pro ) | 13 | include ( $(OPIEDIR)/include.pro ) |