author | brad <brad> | 2004-04-03 07:01:25 (UTC) |
---|---|---|
committer | brad <brad> | 2004-04-03 07:01:25 (UTC) |
commit | a2fa6f99b2a9c9f6d7e3b49847dfad619c606ac1 (patch) (unidiff) | |
tree | 4f9fa6de2199494e69d57d65b76333c41b5eeda6 | |
parent | ff531aabe98565e041301f5f5b796cbf61b84fa1 (diff) | |
download | opie-a2fa6f99b2a9c9f6d7e3b49847dfad619c606ac1.zip opie-a2fa6f99b2a9c9f6d7e3b49847dfad619c606ac1.tar.gz opie-a2fa6f99b2a9c9f6d7e3b49847dfad619c606ac1.tar.bz2 |
Fix for building on gcc-2.95.3
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 711d0dd..0491a86 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -1,134 +1,137 @@ | |||
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 "mgraph.h" | 15 | #include "mgraph.h" |
16 | #include "advancedconfig.h" | 16 | #include "advancedconfig.h" |
17 | 17 | ||
18 | /* OPIE */ | 18 | /* OPIE */ |
19 | #include <opie2/onetwork.h> | 19 | #include <opie2/onetwork.h> |
20 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | 23 | ||
24 | /* QT */ | 24 | /* QT */ |
25 | #include <qradiobutton.h> | 25 | #include <qradiobutton.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qslider.h> | 29 | #include <qslider.h> |
30 | #include <qbuttongroup.h> | 30 | #include <qbuttongroup.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | 34 | ||
35 | /* STD */ | 35 | /* STD */ |
36 | #include <math.h> | 36 | #include <math.h> |
37 | #include <sys/types.h> | 37 | #include <sys/types.h> |
38 | #include <signal.h> | 38 | #include <signal.h> |
39 | #if defined (__GNUC__) && (__GNUC__ < 3) | ||
40 | #define round qRound | ||
41 | #endif | ||
39 | 42 | ||
40 | //#define MDEBUG | 43 | //#define MDEBUG |
41 | #undef MDEBUG | 44 | #undef MDEBUG |
42 | 45 | ||
43 | using namespace Opie::Ui; | 46 | using namespace Opie::Ui; |
44 | using namespace Opie::Net; | 47 | using namespace Opie::Net; |
45 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) | 48 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) |
46 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) | 49 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) |
47 | { | 50 | { |
48 | 51 | ||
49 | readConfig(); | 52 | readConfig(); |
50 | writeConfigEntry( "UpdateFrequency", updateFrequency ); | 53 | writeConfigEntry( "UpdateFrequency", updateFrequency ); |
51 | 54 | ||
52 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 55 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
53 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); | 56 | QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); |
54 | 57 | ||
55 | /* status label */ | 58 | /* status label */ |
56 | 59 | ||
57 | statusLabel = new QLabel( this, "statuslabel" ); | 60 | statusLabel = new QLabel( this, "statuslabel" ); |
58 | QString text( "Wireless Status:<br>" | 61 | QString text( "Wireless Status:<br>" |
59 | "*** Unknown ***<br>" | 62 | "*** Unknown ***<br>" |
60 | "Card not inserted ?<br>" | 63 | "Card not inserted ?<br>" |
61 | "Or Sharp ROM ?<br>" | 64 | "Or Sharp ROM ?<br>" |
62 | "CELL: 00:00:00:00:00:00" ); | 65 | "CELL: 00:00:00:00:00:00" ); |
63 | /* QString text( "Station: Unknown<br>" | 66 | /* QString text( "Station: Unknown<br>" |
64 | "ESSID: Unknown<br>" | 67 | "ESSID: Unknown<br>" |
65 | "MODE: Unknown<br>" | 68 | "MODE: Unknown<br>" |
66 | "FREQ: Unknown<br>" | 69 | "FREQ: Unknown<br>" |
67 | "CELL: AA:BB:CC:DD:EE:FF" ); */ | 70 | "CELL: AA:BB:CC:DD:EE:FF" ); */ |
68 | statusLabel->setText( text ); | 71 | statusLabel->setText( text ); |
69 | statusLabel->setFixedSize( statusLabel->sizeHint() ); | 72 | statusLabel->setFixedSize( statusLabel->sizeHint() ); |
70 | grid->addWidget( statusLabel, 0, 0 ); | 73 | grid->addWidget( statusLabel, 0, 0 ); |
71 | 74 | ||
72 | /* visualization group box */ | 75 | /* visualization group box */ |
73 | 76 | ||
74 | /* quality graph */ | 77 | /* quality graph */ |
75 | 78 | ||
76 | mgraph = new MGraph( this ); | 79 | mgraph = new MGraph( this ); |
77 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 80 | mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
78 | mgraph->setMin( 0 ); | 81 | mgraph->setMin( 0 ); |
79 | mgraph->setMax( 92 ); | 82 | mgraph->setMax( 92 ); |
80 | grid->addWidget( mgraph, 1, 0 ); | 83 | grid->addWidget( mgraph, 1, 0 ); |
81 | mgraph->setFocusPolicy( QWidget::NoFocus ); | 84 | mgraph->setFocusPolicy( QWidget::NoFocus ); |
82 | 85 | ||
83 | /* advanced configuration Button */ | 86 | /* advanced configuration Button */ |
84 | 87 | ||
85 | QPushButton* advanced = new QPushButton( "Advanced...", this ); | 88 | QPushButton* advanced = new QPushButton( "Advanced...", this ); |
86 | advanced->setFocusPolicy( QWidget::NoFocus ); | 89 | advanced->setFocusPolicy( QWidget::NoFocus ); |
87 | grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); | 90 | grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); |
88 | connect( advanced, SIGNAL( clicked() ), | 91 | connect( advanced, SIGNAL( clicked() ), |
89 | this, SLOT( advancedConfigClicked() ) ); | 92 | this, SLOT( advancedConfigClicked() ) ); |
90 | 93 | ||
91 | /* update Frequency Label */ | 94 | /* update Frequency Label */ |
92 | 95 | ||
93 | updateLabel = new QLabel( this ); | 96 | updateLabel = new QLabel( this ); |
94 | text.sprintf( "Update every %d s", updateFrequency ); | 97 | text.sprintf( "Update every %d s", updateFrequency ); |
95 | updateLabel->setText( text ); | 98 | updateLabel->setText( text ); |
96 | grid->addWidget( updateLabel, 2, 1 ); | 99 | grid->addWidget( updateLabel, 2, 1 ); |
97 | 100 | ||
98 | /* update Frequency Slider */ | 101 | /* update Frequency Slider */ |
99 | 102 | ||
100 | QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); | 103 | QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); |
101 | updateSlider->setRange( 0, 9 ); | 104 | updateSlider->setRange( 0, 9 ); |
102 | updateSlider->setValue( updateFrequency ); | 105 | updateSlider->setValue( updateFrequency ); |
103 | updateSlider->setTickmarks( QSlider::Both ); | 106 | updateSlider->setTickmarks( QSlider::Both ); |
104 | updateSlider->setTickInterval( 1 ); | 107 | updateSlider->setTickInterval( 1 ); |
105 | updateSlider->setSteps( 1, 1 ); | 108 | updateSlider->setSteps( 1, 1 ); |
106 | updateSlider->setFocusPolicy( QWidget::NoFocus ); | 109 | updateSlider->setFocusPolicy( QWidget::NoFocus ); |
107 | grid->addWidget( updateSlider, 1, 1 ); | 110 | grid->addWidget( updateSlider, 1, 1 ); |
108 | connect( updateSlider, SIGNAL( valueChanged(int) ), | 111 | connect( updateSlider, SIGNAL( valueChanged(int) ), |
109 | this, SLOT( updateDelayChange(int) ) ); | 112 | this, SLOT( updateDelayChange(int) ) ); |
110 | 113 | ||
111 | setFixedSize( sizeHint() ); | 114 | setFixedSize( sizeHint() ); |
112 | setFocusPolicy( QWidget::NoFocus ); | 115 | setFocusPolicy( QWidget::NoFocus ); |
113 | 116 | ||
114 | applet->updateDelayChange( updateFrequency ); | 117 | applet->updateDelayChange( updateFrequency ); |
115 | 118 | ||
116 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | 119 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); |
117 | } | 120 | } |
118 | 121 | ||
119 | void WirelessControl::advancedConfigClicked() | 122 | void WirelessControl::advancedConfigClicked() |
120 | { | 123 | { |
121 | AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); | 124 | AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); |
122 | int result = a->exec(); | 125 | int result = a->exec(); |
123 | a->hide(); | 126 | a->hide(); |
124 | delete a; | 127 | delete a; |
125 | if ( result == QDialog::Accepted ) | 128 | if ( result == QDialog::Accepted ) |
126 | { | 129 | { |
127 | readConfig(); | 130 | readConfig(); |
128 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | 131 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); |
129 | } | 132 | } |
130 | } | 133 | } |
131 | 134 | ||
132 | void WirelessControl::updateDelayChange( int delay ) | 135 | void WirelessControl::updateDelayChange( int delay ) |
133 | { | 136 | { |
134 | QString text; | 137 | QString text; |