-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index e066a83..ed07ec4 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -1,642 +1,642 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | 22 | ||
23 | #include "volume.h" | 23 | #include "volume.h" |
24 | 24 | ||
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 28 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
29 | #include <qpe/qcopenvelope_qws.h> | 29 | #include <qpe/qcopenvelope_qws.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <qpainter.h> | 32 | #include <qpainter.h> |
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | #include <qslider.h> | 34 | #include <qslider.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qframe.h> | 36 | #include <qframe.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qvbox.h> | 38 | #include <qvbox.h> |
39 | #include <qlabel.h> | 39 | #include <qlabel.h> |
40 | 40 | ||
41 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
42 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | 44 | ||
45 | #include <opie/odevice.h> | 45 | #include <opie/odevice.h> |
46 | 46 | ||
47 | #include "oledbox.h" | 47 | #include "oledbox.h" |
48 | 48 | ||
49 | using namespace Opie; | 49 | using namespace Opie; |
50 | 50 | ||
51 | #define RATE_TIMER_INTERVAL 100 | 51 | #define RATE_TIMER_INTERVAL 100 |
52 | // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time | 52 | // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time |
53 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. | 53 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. |
54 | 54 | ||
55 | 55 | ||
56 | /* XPM */ | 56 | /* XPM */ |
57 | static const char * vol_xpm[] = { | 57 | static const char * vol_xpm[] = { |
58 | "20 20 3 1", | 58 | "20 20 3 1", |
59 | " c None", | 59 | " c None", |
60 | ". c #0000FF", | 60 | ". c #0000FF", |
61 | "+ c #000000", | 61 | "+ c #000000", |
62 | " ", | 62 | " ", |
63 | " . ", | 63 | " . ", |
64 | " . . . . ", | 64 | " . . . . ", |
65 | " . . . . . . ", | 65 | " . . . . . . ", |
66 | " . . . . . . . ", | 66 | " . . . . . . . ", |
67 | " . . ..... . . ", | 67 | " . . ..... . . ", |
68 | " . ... ..... ... ", | 68 | " . ... ..... ... ", |
69 | " ........... .... ", | 69 | " ........... .... ", |
70 | " ................. ", | 70 | " ................. ", |
71 | "++++++++++++++++++++", | 71 | "++++++++++++++++++++", |
72 | " .................. ", | 72 | " .................. ", |
73 | " . ............. . ", | 73 | " . ............. . ", |
74 | " . ..... ....... ", | 74 | " . ..... ....... ", |
75 | " . ... ..... . ", | 75 | " . ... ..... . ", |
76 | " . ... ..... . ", | 76 | " . ... ..... . ", |
77 | " . ... ..... ", | 77 | " . ... ..... ", |
78 | " . . . . . ", | 78 | " . . . . . ", |
79 | " . . . ", | 79 | " . . . ", |
80 | " . . . ", | 80 | " . . . ", |
81 | " "}; | 81 | " "}; |
82 | /* XPM */ | 82 | /* XPM */ |
83 | static const char * mic_xpm[] = { | 83 | static const char * mic_xpm[] = { |
84 | "20 20 21 1", | 84 | "20 20 21 1", |
85 | " c None", | 85 | " c None", |
86 | ". c #000000", | 86 | ". c #000000", |
87 | "+ c #EEEEEE", | 87 | "+ c #EEEEEE", |
88 | "@ c #B4B6B4", | 88 | "@ c #B4B6B4", |
89 | "# c #8B8D8B", | 89 | "# c #8B8D8B", |
90 | "$ c #D5D6D5", | 90 | "$ c #D5D6D5", |
91 | "% c #E6E6E6", | 91 | "% c #E6E6E6", |
92 | "& c #9C9D9C", | 92 | "& c #9C9D9C", |
93 | "* c #6A696A", | 93 | "* c #6A696A", |
94 | "= c #E6E2E6", | 94 | "= c #E6E2E6", |
95 | "- c #F6F2F6", | 95 | "- c #F6F2F6", |
96 | "; c #CDC6CD", | 96 | "; c #CDC6CD", |
97 | "> c #737573", | 97 | "> c #737573", |
98 | ", c #4A484A", | 98 | ", c #4A484A", |
99 | "' c #DEDEDE", | 99 | "' c #DEDEDE", |
100 | ") c #F6EEF6", | 100 | ") c #F6EEF6", |
101 | "! c #414041", | 101 | "! c #414041", |
102 | "~ c #202020", | 102 | "~ c #202020", |
103 | "{ c #ACAEAC", | 103 | "{ c #ACAEAC", |
104 | "] c #838583", | 104 | "] c #838583", |
105 | "^ c #6A656A", | 105 | "^ c #6A656A", |
106 | " ", | 106 | " ", |
107 | " .... ", | 107 | " .... ", |
108 | " .+@+#. ", | 108 | " .+@+#. ", |
109 | " ..$%&%*. ", | 109 | " ..$%&%*. ", |
110 | " .=-.;=>=,. ", | 110 | " .=-.;=>=,. ", |
111 | " .'+).&+!+. ", | 111 | " .'+).&+!+. ", |
112 | " .+;+;.~+~. ", | 112 | " .+;+;.~+~. ", |
113 | " ..%{%,.... ", | 113 | " ..%{%,.... ", |
114 | " ..&=>=~.. ", | 114 | " ..&=>=~.. ", |
115 | " .+..]^,.. ", | 115 | " .+..]^,.. ", |
116 | " .+....... ", | 116 | " .+....... ", |
117 | " .%... ", | 117 | " .%... ", |
118 | " .=... ", | 118 | " .=... ", |
119 | " .+... ", | 119 | " .+... ", |
120 | " .+... ", | 120 | " .+... ", |
121 | " .... ", | 121 | " .... ", |
122 | " .... ", | 122 | " .... ", |
123 | " .. ", | 123 | " .. ", |
124 | " . ", | 124 | " . ", |
125 | ". "}; | 125 | ". "}; |
126 | 126 | ||
127 | 127 | ||
128 | static const char * bass_xpm[] = { | 128 | static const char * bass_xpm[] = { |
129 | "20 20 3 1", | 129 | "20 20 3 1", |
130 | " c None", | 130 | " c None", |
131 | ". c #000000", | 131 | ". c #000000", |
132 | "+ c #0000FF", | 132 | "+ c #0000FF", |
133 | " ", | 133 | " ", |
134 | " ", | 134 | " ", |
135 | " ", | 135 | " ", |
136 | "..... +++ ......", | 136 | "..... +++ ......", |
137 | " +++++++ ", | 137 | " +++++++ ", |
138 | " ++ ++ ", | 138 | " ++ ++ ", |
139 | "... ++ ... ++ ++ .", | 139 | "... ++ ... ++ ++ .", |
140 | " +++ ++ ++ ", | 140 | " +++ ++ ++ ", |
141 | " ++++ ++ ", | 141 | " ++++ ++ ", |
142 | "... ++++ .. ++ .....", | 142 | "... ++++ .. ++ .....", |
143 | " ++ ++ ", | 143 | " ++ ++ ", |
144 | " ++ ++ ", | 144 | " ++ ++ ", |
145 | "..........++ ++ .", | 145 | "..........++ ++ .", |
146 | " ++ ", | 146 | " ++ ", |
147 | " ++ ", | 147 | " ++ ", |
148 | "...... ++ .........", | 148 | "...... ++ .........", |
149 | " + ", | 149 | " + ", |
150 | " ", | 150 | " ", |
151 | " ", | 151 | " ", |
152 | " "}; | 152 | " "}; |
153 | 153 | ||
154 | 154 | ||
155 | static const char * treble_xpm[] = { | 155 | static const char * treble_xpm[] = { |
156 | "20 20 3 1", | 156 | "20 20 3 1", |
157 | " c None", | 157 | " c None", |
158 | ". c #0000FF", | 158 | ". c #0000FF", |
159 | "+ c #000000", | 159 | "+ c #000000", |
160 | " .. ", | 160 | " .. ", |
161 | " . .. ", | 161 | " . .. ", |
162 | " . .. ", | 162 | " . .. ", |
163 | "++++++++ . .. ++++++", | 163 | "++++++++ . .. ++++++", |
164 | " . . ", | 164 | " . . ", |
165 | " ... ", | 165 | " ... ", |
166 | "++++++++ . +++++++", | 166 | "++++++++ . +++++++", |
167 | " .. ", | 167 | " .. ", |
168 | " .. . ", | 168 | " .. . ", |
169 | "+++ .. ... +++++++", | 169 | "+++ .. ... +++++++", |
170 | " .. .. .. ", | 170 | " .. .. .. ", |
171 | " .. . . .. ", | 171 | " .. . . .. ", |
172 | "+++ .. . . + . +++++", | 172 | "+++ .. . . + . +++++", |
173 | " .. . .. ", | 173 | " .. . .. ", |
174 | " .. . .. ", | 174 | " .. . .. ", |
175 | "++++ ...... +++++++", | 175 | "++++ ...... +++++++", |
176 | " . ", | 176 | " . ", |
177 | " .. . ", | 177 | " .. . ", |
178 | " .. . ", | 178 | " .. . ", |
179 | " .. "}; | 179 | " .. "}; |
180 | 180 | ||
181 | 181 | ||
182 | 182 | ||
183 | 183 | ||
184 | /* XPM */ | 184 | /* XPM */ |
185 | static const char * alarm_xpm[] = { | 185 | static const char * alarm_xpm[] = { |
186 | "20 20 33 1", | 186 | "20 20 33 1", |
187 | " c None", | 187 | " c None", |
188 | ". c #080602", | 188 | ". c #080602", |
189 | "+ c #AAA602", | 189 | "+ c #AAA602", |
190 | "@ c #252002", | 190 | "@ c #252002", |
191 | "# c #434202", | 191 | "# c #434202", |
192 | "$ c #795602", | 192 | "$ c #795602", |
193 | "% c #C3C20D", | 193 | "% c #C3C20D", |
194 | "& c #DADAC2", | 194 | "& c #DADAC2", |
195 | "* c #826002", | 195 | "* c #826002", |
196 | "= c #740502", | 196 | "= c #740502", |
197 | "- c #D6D602", | 197 | "- c #D6D602", |
198 | "; c #322E02", | 198 | "; c #322E02", |
199 | "> c #826A02", | 199 | "> c #826A02", |
200 | ", c #F1F195", | 200 | ", c #F1F195", |
201 | "' c #959215", | 201 | "' c #959215", |
202 | ") c #423602", | 202 | ") c #423602", |
203 | "! c #4B0302", | 203 | "! c #4B0302", |
204 | "~ c #844315", | 204 | "~ c #844315", |
205 | "{ c #AAAA2A", | 205 | "{ c #AAAA2A", |
206 | "] c #E2DE42", | 206 | "] c #E2DE42", |
207 | "^ c #BA7E04", | 207 | "^ c #BA7E04", |
208 | "/ c #7F7502", | 208 | "/ c #7F7502", |
209 | "( c #828276", | 209 | "( c #828276", |
210 | "_ c #FEFE4E", | 210 | "_ c #FEFE4E", |
211 | ": c #7D1902", | 211 | ": c #7D1902", |
212 | "< c #989656", | 212 | "< c #989656", |
213 | "[ c #260B02", | 213 | "[ c #260B02", |
214 | "} c #F7F7D8", | 214 | "} c #F7F7D8", |
215 | "| c #DCDA5A", | 215 | "| c #DCDA5A", |
216 | "1 c #823102", | 216 | "1 c #823102", |
217 | "2 c #B1AC6B", | 217 | "2 c #B1AC6B", |
218 | "3 c #F7F710", | 218 | "3 c #F7F710", |
219 | "4 c #838204", | 219 | "4 c #838204", |
220 | " ", | 220 | " ", |
221 | " ", | 221 | " ", |
222 | " 4'4/ ", | 222 | " 4'4/ ", |
223 | " /-^= ", | 223 | " /-^= ", |
224 | " 42{4>4 ", | 224 | " 42{4>4 ", |
225 | " '2|+*$44 ", | 225 | " '2|+*$44 ", |
226 | " +2&3+$1*44 ", | 226 | " +2&3+$1*44 ", |
227 | " (%_}_+/$:>/4 ", | 227 | " (%_}_+/$:>/4 ", |
228 | " 4%_}3+#;>:*4 ", | 228 | " 4%_}3+#;>:*4 ", |
229 | " 4%_}&+#[1$/4 ", | 229 | " 4%_}&+#[1$/4 ", |
230 | " 4%_,2')[~~>4 ", | 230 | " 4%_,2')[~~>4 ", |
231 | " 4%33'4#@~1>4 ", | 231 | " 4%33'4#@~1>4 ", |
232 | " 4%3344#[:>/4 ", | 232 | " 4%3344#[:>/4 ", |
233 | " 42&_3'4#@>:*44 ", | 233 | " 42&_3'4#@>:*44 ", |
234 | " 42|}}3'4#[;$)$44 ", | 234 | " 42|}}3'4#[;$)$44 ", |
235 | "444{]]2^~~:!!#.@##/ ", | 235 | "444{]]2^~~:!!#.@##/ ", |
236 | "4444-%*:==!!=...../ ", | 236 | "4444-%*:==!!=...../ ", |
237 | " /:[.. ", | 237 | " /:[.. ", |
238 | " /@. ", | 238 | " /@. ", |
239 | " "}; | 239 | " "}; |
240 | 240 | ||
241 | VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) | 241 | VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) |
242 | : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) | 242 | : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) |
243 | { | 243 | { |
244 | m_icon = icon; | 244 | m_icon = icon; |
245 | 245 | ||
246 | bool has_wav_alarm = true; | 246 | bool has_wav_alarm = true; |
247 | bool has_bass = true; | 247 | bool has_bass = true; |
248 | bool has_treble = true; | 248 | bool has_treble = true; |
249 | 249 | ||
250 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually | 250 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually |
251 | case Model_Zaurus_SL5000: | 251 | case Model_Zaurus_SL5000: |
252 | has_wav_alarm = false; //poor guys probably feeling left out... | 252 | has_wav_alarm = false; //poor guys probably feeling left out... |
253 | break; | 253 | break; |
254 | default: | 254 | default: |
255 | break; | 255 | break; |
256 | } | 256 | } |
257 | 257 | ||
258 | if ( !ODevice::series == Model_iPAQ ) { | 258 | if ( !ODevice::inst ( )-> series ( ) == Model_iPAQ ) { |
259 | has_bass = false; | 259 | has_bass = false; |
260 | has_treble = false; | 260 | has_treble = false; |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 264 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
265 | 265 | ||
266 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); | 266 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); |
267 | grid-> setSpacing ( 4 ); | 267 | grid-> setSpacing ( 4 ); |
268 | grid-> setMargin ( 6 ); | 268 | grid-> setMargin ( 6 ); |
269 | 269 | ||
270 | QVBoxLayout *vbox; | 270 | QVBoxLayout *vbox; |
271 | QLabel *l; | 271 | QLabel *l; |
272 | 272 | ||
273 | vbox = new QVBoxLayout ( ); | 273 | vbox = new QVBoxLayout ( ); |
274 | vbox-> setSpacing ( 4 ); | 274 | vbox-> setSpacing ( 4 ); |
275 | grid-> addLayout ( vbox, 1, 0 ); | 275 | grid-> addLayout ( vbox, 1, 0 ); |
276 | 276 | ||
277 | upButton = new QPushButton ( this ); | 277 | upButton = new QPushButton ( this ); |
278 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 278 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
279 | upButton-> setPixmap ( Resource::loadPixmap ( "up" )); | 279 | upButton-> setPixmap ( Resource::loadPixmap ( "up" )); |
280 | upButton-> setFocusPolicy ( QWidget::NoFocus ); | 280 | upButton-> setFocusPolicy ( QWidget::NoFocus ); |
281 | 281 | ||
282 | vbox-> addWidget ( upButton ); | 282 | vbox-> addWidget ( upButton ); |
283 | 283 | ||
284 | downButton = new QPushButton ( this ); | 284 | downButton = new QPushButton ( this ); |
285 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 285 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
286 | downButton-> setPixmap ( Resource::loadPixmap ( "down" )); | 286 | downButton-> setPixmap ( Resource::loadPixmap ( "down" )); |
287 | downButton-> setFocusPolicy ( QWidget::NoFocus ); | 287 | downButton-> setFocusPolicy ( QWidget::NoFocus ); |
288 | 288 | ||
289 | vbox-> addWidget ( downButton ); | 289 | vbox-> addWidget ( downButton ); |
290 | 290 | ||
291 | volSlider = new QSlider ( this ); | 291 | volSlider = new QSlider ( this ); |
292 | volSlider-> setRange ( 0, 100 ); | 292 | volSlider-> setRange ( 0, 100 ); |
293 | volSlider-> setTickmarks ( QSlider::Both ); | 293 | volSlider-> setTickmarks ( QSlider::Both ); |
294 | volSlider-> setTickInterval ( 20 ); | 294 | volSlider-> setTickInterval ( 20 ); |
295 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); | 295 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); |
296 | 296 | ||
297 | l = new QLabel ( this ); | 297 | l = new QLabel ( this ); |
298 | l-> setPixmap ( QPixmap ( vol_xpm )); | 298 | l-> setPixmap ( QPixmap ( vol_xpm )); |
299 | 299 | ||
300 | grid-> addWidget ( l, 0, 1, AlignCenter ); | 300 | grid-> addWidget ( l, 0, 1, AlignCenter ); |
301 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); | 301 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); |
302 | 302 | ||
303 | volLed = new OLedBox ( green, this ); | 303 | volLed = new OLedBox ( green, this ); |
304 | volLed-> setFocusPolicy ( QWidget::NoFocus ); | 304 | volLed-> setFocusPolicy ( QWidget::NoFocus ); |
305 | volLed-> setFixedSize ( 16, 16 ); | 305 | volLed-> setFixedSize ( 16, 16 ); |
306 | 306 | ||
307 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); | 307 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); |
308 | 308 | ||
309 | QVBox *basstrebleBox = new QVBox( this ); | 309 | QVBox *basstrebleBox = new QVBox( this ); |
310 | 310 | ||
311 | trebleSlider = new QSlider ( basstrebleBox ); | 311 | trebleSlider = new QSlider ( basstrebleBox ); |
312 | trebleSlider-> setRange ( 0, 100 ); | 312 | trebleSlider-> setRange ( 0, 100 ); |
313 | trebleSlider-> setTickmarks ( QSlider::Both ); | 313 | trebleSlider-> setTickmarks ( QSlider::Both ); |
314 | trebleSlider-> setTickInterval ( 20 ); | 314 | trebleSlider-> setTickInterval ( 20 ); |
315 | trebleSlider->setMaximumHeight( 40 ); | 315 | trebleSlider->setMaximumHeight( 40 ); |
316 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); | 316 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); |
317 | 317 | ||
318 | bassSlider = new QSlider ( basstrebleBox ); | 318 | bassSlider = new QSlider ( basstrebleBox ); |
319 | bassSlider-> setRange ( 0, 100 ); | 319 | bassSlider-> setRange ( 0, 100 ); |
320 | bassSlider-> setTickmarks ( QSlider::Both ); | 320 | bassSlider-> setTickmarks ( QSlider::Both ); |
321 | bassSlider-> setTickInterval ( 20 ); | 321 | bassSlider-> setTickInterval ( 20 ); |
322 | bassSlider->setMaximumHeight( 40 ); | 322 | bassSlider->setMaximumHeight( 40 ); |
323 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); | 323 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); |
324 | 324 | ||
325 | QLabel *bassLabel = new QLabel ( this ); | 325 | QLabel *bassLabel = new QLabel ( this ); |
326 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); | 326 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); |
327 | 327 | ||
328 | QLabel *trebleLabel = new QLabel( this ); | 328 | QLabel *trebleLabel = new QLabel( this ); |
329 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); | 329 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); |
330 | 330 | ||
331 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); | 331 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); |
332 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); | 332 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); |
333 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); | 333 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); |
334 | 334 | ||
335 | if ( !has_bass ) { | 335 | if ( !has_bass ) { |
336 | bassSlider->hide(); | 336 | bassSlider->hide(); |
337 | bassLabel->hide(); | 337 | bassLabel->hide(); |
338 | } | 338 | } |
339 | 339 | ||
340 | if ( !has_treble ) { | 340 | if ( !has_treble ) { |
341 | trebleSlider->hide(); | 341 | trebleSlider->hide(); |
342 | trebleLabel->hide(); | 342 | trebleLabel->hide(); |
343 | } | 343 | } |
344 | 344 | ||
345 | micSlider = new QSlider ( this ); | 345 | micSlider = new QSlider ( this ); |
346 | micSlider-> setRange ( 0, 100 ); | 346 | micSlider-> setRange ( 0, 100 ); |
347 | micSlider-> setTickmarks ( QSlider::Both ); | 347 | micSlider-> setTickmarks ( QSlider::Both ); |
348 | micSlider-> setTickInterval ( 20 ); | 348 | micSlider-> setTickInterval ( 20 ); |
349 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); | 349 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); |
350 | 350 | ||
351 | l = new QLabel ( this ); | 351 | l = new QLabel ( this ); |
352 | l-> setPixmap ( QPixmap ( mic_xpm )); | 352 | l-> setPixmap ( QPixmap ( mic_xpm )); |
353 | 353 | ||
354 | grid-> addWidget ( l, 0, 2, AlignCenter ); | 354 | grid-> addWidget ( l, 0, 2, AlignCenter ); |
355 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); | 355 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); |
356 | 356 | ||
357 | micLed = new OLedBox ( red, this ); | 357 | micLed = new OLedBox ( red, this ); |
358 | micLed-> setFocusPolicy ( QWidget::NoFocus ); | 358 | micLed-> setFocusPolicy ( QWidget::NoFocus ); |
359 | micLed-> setFixedSize ( 16, 16 ); | 359 | micLed-> setFixedSize ( 16, 16 ); |
360 | 360 | ||
361 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); | 361 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); |
362 | 362 | ||
363 | alarmSlider = new QSlider ( this ); | 363 | alarmSlider = new QSlider ( this ); |
364 | alarmSlider-> setRange ( 0, 100 ); | 364 | alarmSlider-> setRange ( 0, 100 ); |
365 | alarmSlider-> setTickmarks ( QSlider::Both ); | 365 | alarmSlider-> setTickmarks ( QSlider::Both ); |
366 | alarmSlider-> setTickInterval ( 20 ); | 366 | alarmSlider-> setTickInterval ( 20 ); |
367 | alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); | 367 | alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); |
368 | 368 | ||
369 | QLabel *alarmLabel = new QLabel ( this ); | 369 | QLabel *alarmLabel = new QLabel ( this ); |
370 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); | 370 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); |
371 | 371 | ||
372 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); | 372 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); |
373 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); | 373 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); |
374 | 374 | ||
375 | alarmLed = new OLedBox ( yellow, this ); | 375 | alarmLed = new OLedBox ( yellow, this ); |
376 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); | 376 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); |
377 | alarmLed-> setFixedSize ( 16, 16 ); | 377 | alarmLed-> setFixedSize ( 16, 16 ); |
378 | 378 | ||
379 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); | 379 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); |
380 | 380 | ||
381 | if ( !has_wav_alarm ) { | 381 | if ( !has_wav_alarm ) { |
382 | alarmSlider-> hide ( ); | 382 | alarmSlider-> hide ( ); |
383 | alarmLabel-> hide ( ); | 383 | alarmLabel-> hide ( ); |
384 | alarmLed-> hide ( ); | 384 | alarmLed-> hide ( ); |
385 | } | 385 | } |
386 | 386 | ||
387 | grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); | 387 | grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); |
388 | 388 | ||
389 | vbox = new QVBoxLayout ( ); | 389 | vbox = new QVBoxLayout ( ); |
390 | vbox-> setSpacing ( 4 ); | 390 | vbox-> setSpacing ( 4 ); |
391 | grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); | 391 | grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); |
392 | 392 | ||
393 | tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); | 393 | tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); |
394 | tapBox-> setFocusPolicy ( QWidget::NoFocus ); | 394 | tapBox-> setFocusPolicy ( QWidget::NoFocus ); |
395 | 395 | ||
396 | vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); | 396 | vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); |
397 | 397 | ||
398 | keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); | 398 | keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); |
399 | keyBox-> setFocusPolicy ( QWidget::NoFocus ); | 399 | keyBox-> setFocusPolicy ( QWidget::NoFocus ); |
400 | 400 | ||
401 | vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); | 401 | vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); |
402 | 402 | ||
403 | alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); | 403 | alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); |
404 | alarmBox-> setFocusPolicy ( QWidget::NoFocus ); | 404 | alarmBox-> setFocusPolicy ( QWidget::NoFocus ); |
405 | 405 | ||
406 | vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); | 406 | vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); |
407 | 407 | ||
408 | if ( has_wav_alarm ) { | 408 | if ( has_wav_alarm ) { |
409 | alarmBox-> hide ( ); | 409 | alarmBox-> hide ( ); |
410 | } | 410 | } |
411 | 411 | ||
412 | vbox-> addStretch ( 100 ); | 412 | vbox-> addStretch ( 100 ); |
413 | 413 | ||
414 | setFixedSize ( sizeHint ( )); | 414 | setFixedSize ( sizeHint ( )); |
415 | setFocusPolicy ( QWidget::NoFocus ); | 415 | setFocusPolicy ( QWidget::NoFocus ); |
416 | 416 | ||
417 | rateTimer = new QTimer( this ); | 417 | rateTimer = new QTimer( this ); |
418 | connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); | 418 | connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); |
419 | 419 | ||
420 | connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); | 420 | connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); |
421 | connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); | 421 | connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); |
422 | connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); | 422 | connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); |
423 | connect ( downButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); | 423 | connect ( downButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); |
424 | 424 | ||
425 | connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); | 425 | connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); |
426 | connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); | 426 | connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); |
427 | connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); | 427 | connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); |
428 | connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); | 428 | connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); |
429 | connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); | 429 | connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); |
430 | 430 | ||
431 | 431 | ||
432 | connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); | 432 | connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); |
433 | connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); | 433 | connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); |
434 | connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); | 434 | connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); |
435 | 435 | ||
436 | connect ( alarmBox, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); | 436 | connect ( alarmBox, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); |
437 | connect ( keyBox, SIGNAL( toggled ( bool )), this, SLOT( keyClickToggled ( bool ))); | 437 | connect ( keyBox, SIGNAL( toggled ( bool )), this, SLOT( keyClickToggled ( bool ))); |
438 | connect ( tapBox, SIGNAL( toggled ( bool )), this, SLOT( screenTapToggled ( bool ))); | 438 | connect ( tapBox, SIGNAL( toggled ( bool )), this, SLOT( screenTapToggled ( bool ))); |
439 | 439 | ||
440 | // initialize variables | 440 | // initialize variables |
441 | 441 | ||
442 | readConfig ( true ); | 442 | readConfig ( true ); |
443 | 443 | ||
444 | // initialize the config file, in case some entries are missing | 444 | // initialize the config file, in case some entries are missing |
445 | 445 | ||
446 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); | 446 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); |
447 | writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); | 447 | writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); |
448 | writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); | 448 | writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); |
449 | writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); | 449 | writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); |
450 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); | 450 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); |
451 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); | 451 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); |
452 | writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); | 452 | writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); |
453 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); | 453 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); |
454 | 454 | ||
455 | writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); | 455 | writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); |
456 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 456 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
457 | } | 457 | } |
458 | 458 | ||
459 | bool VolumeControl::volMuted ( ) const | 459 | bool VolumeControl::volMuted ( ) const |
460 | { | 460 | { |
461 | return m_vol_muted; | 461 | return m_vol_muted; |
462 | } | 462 | } |
463 | 463 | ||
464 | int VolumeControl::volPercent ( ) const | 464 | int VolumeControl::volPercent ( ) const |
465 | { | 465 | { |
466 | return m_vol_percent; | 466 | return m_vol_percent; |
467 | } | 467 | } |
468 | 468 | ||
469 | void VolumeControl::keyPressEvent ( QKeyEvent *e ) | 469 | void VolumeControl::keyPressEvent ( QKeyEvent *e ) |
470 | { | 470 | { |
471 | switch ( e-> key ( )) { | 471 | switch ( e-> key ( )) { |
472 | case Key_Up: | 472 | case Key_Up: |
473 | volSlider-> subtractStep ( ); | 473 | volSlider-> subtractStep ( ); |
474 | break; | 474 | break; |
475 | case Key_Down: | 475 | case Key_Down: |
476 | volSlider-> addStep ( ); | 476 | volSlider-> addStep ( ); |
477 | break; | 477 | break; |
478 | case Key_Space: | 478 | case Key_Space: |
479 | volLed-> toggle ( ); | 479 | volLed-> toggle ( ); |
480 | break; | 480 | break; |
481 | case Key_Escape: | 481 | case Key_Escape: |
482 | hide ( ); | 482 | hide ( ); |
483 | break; | 483 | break; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | 486 | ||
487 | void VolumeControl::buttonChanged ( ) | 487 | void VolumeControl::buttonChanged ( ) |
488 | { | 488 | { |
489 | if ( upButton-> isDown ( ) || downButton->isDown ( )) { | 489 | if ( upButton-> isDown ( ) || downButton->isDown ( )) { |
490 | rateTimerDone ( ); // Call it one time manually, otherwise it wont get | 490 | rateTimerDone ( ); // Call it one time manually, otherwise it wont get |
491 | // called at all when a button is pressed for a time | 491 | // called at all when a button is pressed for a time |
492 | // shorter than RATE_TIMER_INTERVAL. | 492 | // shorter than RATE_TIMER_INTERVAL. |
493 | rateTimer-> start ( RATE_TIMER_INTERVAL, false ); | 493 | rateTimer-> start ( RATE_TIMER_INTERVAL, false ); |
494 | } | 494 | } |
495 | else | 495 | else |
496 | rateTimer-> stop ( ); | 496 | rateTimer-> stop ( ); |
497 | } | 497 | } |
498 | 498 | ||
499 | void VolumeControl::rateTimerDone ( ) | 499 | void VolumeControl::rateTimerDone ( ) |
500 | { | 500 | { |
501 | if ( upButton-> isDown ( )) | 501 | if ( upButton-> isDown ( )) |
502 | volSlider-> setValue ( volSlider-> value ( ) - 2 ); | 502 | volSlider-> setValue ( volSlider-> value ( ) - 2 ); |
503 | else // if ( downButton-> isDown ( )) | 503 | else // if ( downButton-> isDown ( )) |
504 | volSlider-> setValue ( volSlider-> value ( ) + 2 ); | 504 | volSlider-> setValue ( volSlider-> value ( ) + 2 ); |
505 | } | 505 | } |
506 | 506 | ||
507 | void VolumeControl::show ( bool /*showMic*/ ) | 507 | void VolumeControl::show ( bool /*showMic*/ ) |
508 | { | 508 | { |
509 | readConfig ( ); | 509 | readConfig ( ); |
510 | 510 | ||
511 | QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); | 511 | QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); |
512 | 512 | ||
513 | int w = sizeHint ( ). width ( ); | 513 | int w = sizeHint ( ). width ( ); |
514 | int x = curPos.x ( ) - ( w / 2 ); | 514 | int x = curPos.x ( ) - ( w / 2 ); |
515 | 515 | ||
516 | if (( x + w ) > QPEApplication::desktop ( )-> width ( )) | 516 | if (( x + w ) > QPEApplication::desktop ( )-> width ( )) |
517 | x = QPEApplication::desktop ( )-> width ( ) - w; | 517 | x = QPEApplication::desktop ( )-> width ( ) - w; |
518 | 518 | ||
519 | move ( x, curPos. y ( ) - sizeHint ( ). height ( )); | 519 | move ( x, curPos. y ( ) - sizeHint ( ). height ( )); |
520 | QFrame::show ( ); | 520 | QFrame::show ( ); |
521 | 521 | ||
522 | } | 522 | } |
523 | 523 | ||
524 | void VolumeControl::readConfig ( bool force ) | 524 | void VolumeControl::readConfig ( bool force ) |
525 | { | 525 | { |
526 | Config cfg ( "qpe" ); | 526 | Config cfg ( "qpe" ); |
527 | cfg. setGroup ( "Volume" ); | 527 | cfg. setGroup ( "Volume" ); |
528 | 528 | ||
529 | int old_vp = m_vol_percent; | 529 | int old_vp = m_vol_percent; |
530 | int old_mp = m_mic_percent; | 530 | int old_mp = m_mic_percent; |
531 | int old_bass = m_bass_percent; | 531 | int old_bass = m_bass_percent; |
532 | int old_treble = m_treble_percent; | 532 | int old_treble = m_treble_percent; |
533 | bool old_vm = m_vol_muted; | 533 | bool old_vm = m_vol_muted; |
534 | bool old_mm = m_mic_muted; | 534 | bool old_mm = m_mic_muted; |
535 | bool old_sk = m_snd_key; | 535 | bool old_sk = m_snd_key; |
536 | bool old_st = m_snd_touch; | 536 | bool old_st = m_snd_touch; |
537 | bool old_sa = m_snd_alarm; | 537 | bool old_sa = m_snd_alarm; |
538 | int old_ap = m_alarm_percent; | 538 | int old_ap = m_alarm_percent; |
539 | 539 | ||
540 | m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); | 540 | m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); |
541 | m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); | 541 | m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); |
542 | m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 ); | 542 | m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 ); |
543 | m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 ); | 543 | m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 ); |
544 | m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); | 544 | m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); |
545 | m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); | 545 | m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); |
546 | m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); | 546 | m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); |
547 | m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 ); | 547 | m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 ); |
548 | m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); | 548 | m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); |
549 | m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); | 549 | m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); |
550 | 550 | ||
551 | if ( force || ( m_vol_percent != old_vp )) | 551 | if ( force || ( m_vol_percent != old_vp )) |
552 | volSlider-> setValue ( 100 - m_vol_percent ); | 552 | volSlider-> setValue ( 100 - m_vol_percent ); |
553 | if ( force || ( m_mic_percent != old_mp )) | 553 | if ( force || ( m_mic_percent != old_mp )) |
554 | micSlider-> setValue ( 100 - m_mic_percent ); | 554 | micSlider-> setValue ( 100 - m_mic_percent ); |
555 | if ( force || ( m_alarm_percent != old_ap )) | 555 | if ( force || ( m_alarm_percent != old_ap )) |
556 | alarmSlider-> setValue ( 100 - m_alarm_percent ); | 556 | alarmSlider-> setValue ( 100 - m_alarm_percent ); |
557 | if ( force || ( m_bass_percent != old_bass )) | 557 | if ( force || ( m_bass_percent != old_bass )) |
558 | bassSlider-> setValue ( 100 - m_bass_percent ); | 558 | bassSlider-> setValue ( 100 - m_bass_percent ); |
559 | if ( force || ( m_treble_percent != old_treble )) | 559 | if ( force || ( m_treble_percent != old_treble )) |
560 | trebleSlider-> setValue ( 100 - m_treble_percent ); | 560 | trebleSlider-> setValue ( 100 - m_treble_percent ); |
561 | 561 | ||
562 | 562 | ||
563 | if ( force || ( m_vol_muted != old_vm )) | 563 | if ( force || ( m_vol_muted != old_vm )) |
564 | volLed-> setOn ( !m_vol_muted ); | 564 | volLed-> setOn ( !m_vol_muted ); |
565 | if ( force || ( m_mic_muted != old_mm )) | 565 | if ( force || ( m_mic_muted != old_mm )) |
566 | micLed-> setOn ( !m_mic_muted ); | 566 | micLed-> setOn ( !m_mic_muted ); |
567 | if ( force || ( m_snd_alarm != old_sa )) | 567 | if ( force || ( m_snd_alarm != old_sa )) |
568 | alarmLed-> setOn ( m_snd_alarm ); | 568 | alarmLed-> setOn ( m_snd_alarm ); |
569 | 569 | ||
570 | if ( force || ( m_snd_key != old_sk )) | 570 | if ( force || ( m_snd_key != old_sk )) |
571 | keyBox-> setChecked ( m_snd_key ); | 571 | keyBox-> setChecked ( m_snd_key ); |
572 | if ( force || ( m_snd_touch != old_st )) | 572 | if ( force || ( m_snd_touch != old_st )) |
573 | tapBox-> setChecked ( m_snd_touch ); | 573 | tapBox-> setChecked ( m_snd_touch ); |
574 | if ( force || ( m_snd_alarm != old_sa )) | 574 | if ( force || ( m_snd_alarm != old_sa )) |
575 | alarmBox-> setChecked ( m_snd_alarm ); | 575 | alarmBox-> setChecked ( m_snd_alarm ); |
576 | } | 576 | } |
577 | 577 | ||
578 | 578 | ||
579 | void VolumeControl::volumeChanged ( bool /*nowMuted*/ ) | 579 | void VolumeControl::volumeChanged ( bool /*nowMuted*/ ) |
580 | { | 580 | { |
581 | int prevVol = m_vol_percent; | 581 | int prevVol = m_vol_percent; |
582 | bool prevMute = m_vol_muted; | 582 | bool prevMute = m_vol_muted; |
583 | 583 | ||
584 | readConfig ( ); | 584 | readConfig ( ); |
585 | 585 | ||
586 | // Handle case where muting it toggled | 586 | // Handle case where muting it toggled |
587 | if ( m_vol_muted != prevMute ) | 587 | if ( m_vol_muted != prevMute ) |
588 | m_icon-> redraw ( true ); | 588 | m_icon-> redraw ( true ); |
589 | else if ( prevVol != m_vol_percent ) // Avoid over repainting | 589 | else if ( prevVol != m_vol_percent ) // Avoid over repainting |
590 | m_icon-> redraw ( false ); | 590 | m_icon-> redraw ( false ); |
591 | } | 591 | } |
592 | 592 | ||
593 | void VolumeControl::micChanged ( bool nowMuted ) | 593 | void VolumeControl::micChanged ( bool nowMuted ) |
594 | { | 594 | { |
595 | if ( !nowMuted ) | 595 | if ( !nowMuted ) |
596 | readConfig ( ); | 596 | readConfig ( ); |
597 | m_mic_muted = nowMuted; | 597 | m_mic_muted = nowMuted; |
598 | } | 598 | } |
599 | 599 | ||
600 | void VolumeControl::screenTapToggled ( bool b ) | 600 | void VolumeControl::screenTapToggled ( bool b ) |
601 | { | 601 | { |
602 | m_snd_touch = b; | 602 | m_snd_touch = b; |
603 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); | 603 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); |
604 | } | 604 | } |
605 | 605 | ||
606 | void VolumeControl::keyClickToggled ( bool b ) | 606 | void VolumeControl::keyClickToggled ( bool b ) |
607 | { | 607 | { |
608 | m_snd_key = b; | 608 | m_snd_key = b; |
609 | writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); | 609 | writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); |
610 | } | 610 | } |
611 | 611 | ||
612 | void VolumeControl::alarmSoundToggled ( bool b ) | 612 | void VolumeControl::alarmSoundToggled ( bool b ) |
613 | { | 613 | { |
614 | m_snd_alarm = b; | 614 | m_snd_alarm = b; |
615 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); | 615 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); |
616 | } | 616 | } |
617 | 617 | ||
618 | void VolumeControl::volMuteToggled ( bool b ) | 618 | void VolumeControl::volMuteToggled ( bool b ) |
619 | { | 619 | { |
620 | m_vol_muted = !b; | 620 | m_vol_muted = !b; |
621 | 621 | ||
622 | m_icon-> redraw ( true ); | 622 | m_icon-> redraw ( true ); |
623 | 623 | ||
624 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); | 624 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); |
625 | } | 625 | } |
626 | 626 | ||
627 | void VolumeControl::micMuteToggled ( bool b ) | 627 | void VolumeControl::micMuteToggled ( bool b ) |
628 | { | 628 | { |
629 | m_mic_muted = !b; | 629 | m_mic_muted = !b; |
630 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 630 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
631 | } | 631 | } |
632 | 632 | ||
633 | 633 | ||
634 | void VolumeControl::volMoved ( int percent ) | 634 | void VolumeControl::volMoved ( int percent ) |
635 | { | 635 | { |
636 | m_vol_percent = 100 - percent; | 636 | m_vol_percent = 100 - percent; |
637 | 637 | ||
638 | // clamp volume percent to be between 0 and 100 | 638 | // clamp volume percent to be between 0 and 100 |
639 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); | 639 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); |
640 | // repaint just the little volume rectangle | 640 | // repaint just the little volume rectangle |
641 | m_icon-> redraw ( false ); | 641 | m_icon-> redraw ( false ); |
642 | 642 | ||