author | harlekin <harlekin> | 2002-12-13 20:17:54 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-12-13 20:17:54 (UTC) |
commit | 5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0 (patch) (unidiff) | |
tree | acd77f0506db69998638c3eea4fc1e3673fb62fd /core/applets/volumeapplet | |
parent | e348262d418e3a133d13d039ed23da4625726f9d (diff) | |
download | opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.zip opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.tar.gz opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.tar.bz2 |
added bass and treble control
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 234 | ||||
-rw-r--r-- | core/applets/volumeapplet/volume.h | 10 |
2 files changed, 200 insertions, 44 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index 06eec58..e066a83 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -36,4 +36,5 @@ | |||
36 | #include <qframe.h> | 36 | #include <qframe.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qvbox.h> | ||
38 | #include <qlabel.h> | 39 | #include <qlabel.h> |
39 | 40 | ||
@@ -48,5 +49,5 @@ | |||
48 | using namespace Opie; | 49 | using namespace Opie; |
49 | 50 | ||
50 | #define RATE_TIMER_INTERVAL 100 | 51 | #define RATE_TIMER_INTERVAL 100 |
51 | // 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 |
52 | // 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. |
@@ -124,4 +125,61 @@ static const char * mic_xpm[] = { | |||
124 | ". "}; | 125 | ". "}; |
125 | 126 | ||
127 | |||
128 | static const char * bass_xpm[] = { | ||
129 | "20 20 3 1", | ||
130 | " c None", | ||
131 | ". c #000000", | ||
132 | "+ c #0000FF", | ||
133 | " ", | ||
134 | " ", | ||
135 | " ", | ||
136 | "..... +++ ......", | ||
137 | " +++++++ ", | ||
138 | " ++ ++ ", | ||
139 | "... ++ ... ++ ++ .", | ||
140 | " +++ ++ ++ ", | ||
141 | " ++++ ++ ", | ||
142 | "... ++++ .. ++ .....", | ||
143 | " ++ ++ ", | ||
144 | " ++ ++ ", | ||
145 | "..........++ ++ .", | ||
146 | " ++ ", | ||
147 | " ++ ", | ||
148 | "...... ++ .........", | ||
149 | " + ", | ||
150 | " ", | ||
151 | " ", | ||
152 | " "}; | ||
153 | |||
154 | |||
155 | static const char * treble_xpm[] = { | ||
156 | "20 20 3 1", | ||
157 | " c None", | ||
158 | ". c #0000FF", | ||
159 | "+ c #000000", | ||
160 | " .. ", | ||
161 | " . .. ", | ||
162 | " . .. ", | ||
163 | "++++++++ . .. ++++++", | ||
164 | " . . ", | ||
165 | " ... ", | ||
166 | "++++++++ . +++++++", | ||
167 | " .. ", | ||
168 | " .. . ", | ||
169 | "+++ .. ... +++++++", | ||
170 | " .. .. .. ", | ||
171 | " .. . . .. ", | ||
172 | "+++ .. . . + . +++++", | ||
173 | " .. . .. ", | ||
174 | " .. . .. ", | ||
175 | "++++ ...... +++++++", | ||
176 | " . ", | ||
177 | " .. . ", | ||
178 | " .. . ", | ||
179 | " .. "}; | ||
180 | |||
181 | |||
182 | |||
183 | |||
126 | /* XPM */ | 184 | /* XPM */ |
127 | static const char * alarm_xpm[] = { | 185 | static const char * alarm_xpm[] = { |
@@ -185,7 +243,9 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
185 | { | 243 | { |
186 | m_icon = icon; | 244 | m_icon = icon; |
187 | 245 | ||
188 | bool has_wav_alarm = true; | 246 | bool has_wav_alarm = true; |
189 | 247 | bool has_bass = true; | |
248 | bool has_treble = true; | ||
249 | |||
190 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually | 250 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually |
191 | case Model_Zaurus_SL5000: | 251 | case Model_Zaurus_SL5000: |
@@ -195,5 +255,10 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
195 | break; | 255 | break; |
196 | } | 256 | } |
197 | 257 | ||
258 | if ( !ODevice::series == Model_iPAQ ) { | ||
259 | has_bass = false; | ||
260 | has_treble = false; | ||
261 | } | ||
262 | |||
198 | 263 | ||
199 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 264 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
@@ -202,12 +267,12 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
202 | grid-> setSpacing ( 4 ); | 267 | grid-> setSpacing ( 4 ); |
203 | grid-> setMargin ( 6 ); | 268 | grid-> setMargin ( 6 ); |
204 | 269 | ||
205 | QVBoxLayout *vbox; | 270 | QVBoxLayout *vbox; |
206 | QLabel *l; | 271 | QLabel *l; |
207 | 272 | ||
208 | vbox = new QVBoxLayout ( ); | 273 | vbox = new QVBoxLayout ( ); |
209 | vbox-> setSpacing ( 4 ); | 274 | vbox-> setSpacing ( 4 ); |
210 | grid-> addLayout ( vbox, 1, 0 ); | 275 | grid-> addLayout ( vbox, 1, 0 ); |
211 | 276 | ||
212 | upButton = new QPushButton ( this ); | 277 | upButton = new QPushButton ( this ); |
213 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 278 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
@@ -216,5 +281,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
216 | 281 | ||
217 | vbox-> addWidget ( upButton ); | 282 | vbox-> addWidget ( upButton ); |
218 | 283 | ||
219 | downButton = new QPushButton ( this ); | 284 | downButton = new QPushButton ( this ); |
220 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 285 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
@@ -229,8 +294,8 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
229 | volSlider-> setTickInterval ( 20 ); | 294 | volSlider-> setTickInterval ( 20 ); |
230 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); | 295 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); |
231 | 296 | ||
232 | l = new QLabel ( this ); | 297 | l = new QLabel ( this ); |
233 | l-> setPixmap ( QPixmap ( vol_xpm )); | 298 | l-> setPixmap ( QPixmap ( vol_xpm )); |
234 | 299 | ||
235 | grid-> addWidget ( l, 0, 1, AlignCenter ); | 300 | grid-> addWidget ( l, 0, 1, AlignCenter ); |
236 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); | 301 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); |
@@ -238,8 +303,44 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
238 | volLed = new OLedBox ( green, this ); | 303 | volLed = new OLedBox ( green, this ); |
239 | volLed-> setFocusPolicy ( QWidget::NoFocus ); | 304 | volLed-> setFocusPolicy ( QWidget::NoFocus ); |
240 | volLed-> setFixedSize ( 16, 16 ); | 305 | volLed-> setFixedSize ( 16, 16 ); |
241 | 306 | ||
242 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); | 307 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); |
243 | 308 | ||
309 | QVBox *basstrebleBox = new QVBox( this ); | ||
310 | |||
311 | trebleSlider = new QSlider ( basstrebleBox ); | ||
312 | trebleSlider-> setRange ( 0, 100 ); | ||
313 | trebleSlider-> setTickmarks ( QSlider::Both ); | ||
314 | trebleSlider-> setTickInterval ( 20 ); | ||
315 | trebleSlider->setMaximumHeight( 40 ); | ||
316 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); | ||
317 | |||
318 | bassSlider = new QSlider ( basstrebleBox ); | ||
319 | bassSlider-> setRange ( 0, 100 ); | ||
320 | bassSlider-> setTickmarks ( QSlider::Both ); | ||
321 | bassSlider-> setTickInterval ( 20 ); | ||
322 | bassSlider->setMaximumHeight( 40 ); | ||
323 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); | ||
324 | |||
325 | QLabel *bassLabel = new QLabel ( this ); | ||
326 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); | ||
327 | |||
328 | QLabel *trebleLabel = new QLabel( this ); | ||
329 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); | ||
330 | |||
331 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); | ||
332 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); | ||
333 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); | ||
334 | |||
335 | if ( !has_bass ) { | ||
336 | bassSlider->hide(); | ||
337 | bassLabel->hide(); | ||
338 | } | ||
339 | |||
340 | if ( !has_treble ) { | ||
341 | trebleSlider->hide(); | ||
342 | trebleLabel->hide(); | ||
343 | } | ||
344 | |||
244 | micSlider = new QSlider ( this ); | 345 | micSlider = new QSlider ( this ); |
245 | micSlider-> setRange ( 0, 100 ); | 346 | micSlider-> setRange ( 0, 100 ); |
@@ -247,8 +348,8 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
247 | micSlider-> setTickInterval ( 20 ); | 348 | micSlider-> setTickInterval ( 20 ); |
248 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); | 349 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); |
249 | 350 | ||
250 | l = new QLabel ( this ); | 351 | l = new QLabel ( this ); |
251 | l-> setPixmap ( QPixmap ( mic_xpm )); | 352 | l-> setPixmap ( QPixmap ( mic_xpm )); |
252 | 353 | ||
253 | grid-> addWidget ( l, 0, 2, AlignCenter ); | 354 | grid-> addWidget ( l, 0, 2, AlignCenter ); |
254 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); | 355 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); |
@@ -257,5 +358,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
257 | micLed-> setFocusPolicy ( QWidget::NoFocus ); | 358 | micLed-> setFocusPolicy ( QWidget::NoFocus ); |
258 | micLed-> setFixedSize ( 16, 16 ); | 359 | micLed-> setFixedSize ( 16, 16 ); |
259 | 360 | ||
260 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); | 361 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); |
261 | 362 | ||
@@ -268,5 +369,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
268 | QLabel *alarmLabel = new QLabel ( this ); | 369 | QLabel *alarmLabel = new QLabel ( this ); |
269 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); | 370 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); |
270 | 371 | ||
271 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); | 372 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); |
272 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); | 373 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); |
@@ -275,5 +376,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
275 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); | 376 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); |
276 | alarmLed-> setFixedSize ( 16, 16 ); | 377 | alarmLed-> setFixedSize ( 16, 16 ); |
277 | 378 | ||
278 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); | 379 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); |
279 | 380 | ||
@@ -283,24 +384,24 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
283 | alarmLed-> hide ( ); | 384 | alarmLed-> hide ( ); |
284 | } | 385 | } |
285 | 386 | ||
286 | grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 4, AlignVCenter | AlignLeft ); | 387 | grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); |
287 | 388 | ||
288 | vbox = new QVBoxLayout ( ); | 389 | vbox = new QVBoxLayout ( ); |
289 | vbox-> setSpacing ( 4 ); | 390 | vbox-> setSpacing ( 4 ); |
290 | grid-> addMultiCellLayout ( vbox, 1, 2, 4, 4 ); | 391 | grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); |
291 | 392 | ||
292 | tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); | 393 | tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); |
293 | tapBox-> setFocusPolicy ( QWidget::NoFocus ); | 394 | tapBox-> setFocusPolicy ( QWidget::NoFocus ); |
294 | 395 | ||
295 | vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); | 396 | vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); |
296 | 397 | ||
297 | keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); | 398 | keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); |
298 | keyBox-> setFocusPolicy ( QWidget::NoFocus ); | 399 | keyBox-> setFocusPolicy ( QWidget::NoFocus ); |
299 | 400 | ||
300 | vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); | 401 | vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); |
301 | 402 | ||
302 | alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); | 403 | alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); |
303 | alarmBox-> setFocusPolicy ( QWidget::NoFocus ); | 404 | alarmBox-> setFocusPolicy ( QWidget::NoFocus ); |
304 | 405 | ||
305 | vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); | 406 | vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); |
306 | 407 | ||
@@ -316,5 +417,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
316 | rateTimer = new QTimer( this ); | 417 | rateTimer = new QTimer( this ); |
317 | connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); | 418 | connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); |
318 | 419 | ||
319 | connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); | 420 | connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); |
320 | connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); | 421 | connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); |
@@ -325,5 +426,8 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
325 | connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); | 426 | connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); |
326 | connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); | 427 | connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); |
327 | 428 | connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); | |
429 | connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); | ||
430 | |||
431 | |||
328 | connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); | 432 | connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); |
329 | connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); | 433 | connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); |
@@ -337,8 +441,10 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
337 | 441 | ||
338 | readConfig ( true ); | 442 | readConfig ( true ); |
339 | 443 | ||
340 | // initialize the config file, in case some entries are missing | 444 | // initialize the config file, in case some entries are missing |
341 | 445 | ||
342 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); | 446 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); |
447 | writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); | ||
448 | writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); | ||
343 | writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); | 449 | writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); |
344 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); | 450 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); |
@@ -346,5 +452,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
346 | writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); | 452 | writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); |
347 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); | 453 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); |
348 | 454 | ||
349 | writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); | 455 | writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); |
350 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 456 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
@@ -404,11 +510,11 @@ void VolumeControl::show ( bool /*showMic*/ ) | |||
404 | 510 | ||
405 | QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); | 511 | QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); |
406 | 512 | ||
407 | int w = sizeHint ( ). width ( ); | 513 | int w = sizeHint ( ). width ( ); |
408 | int x = curPos.x ( ) - ( w / 2 ); | 514 | int x = curPos.x ( ) - ( w / 2 ); |
409 | 515 | ||
410 | if (( x + w ) > QPEApplication::desktop ( )-> width ( )) | 516 | if (( x + w ) > QPEApplication::desktop ( )-> width ( )) |
411 | x = QPEApplication::desktop ( )-> width ( ) - w; | 517 | x = QPEApplication::desktop ( )-> width ( ) - w; |
412 | 518 | ||
413 | move ( x, curPos. y ( ) - sizeHint ( ). height ( )); | 519 | move ( x, curPos. y ( ) - sizeHint ( ). height ( )); |
414 | QFrame::show ( ); | 520 | QFrame::show ( ); |
@@ -423,4 +529,6 @@ void VolumeControl::readConfig ( bool force ) | |||
423 | int old_vp = m_vol_percent; | 529 | int old_vp = m_vol_percent; |
424 | int old_mp = m_mic_percent; | 530 | int old_mp = m_mic_percent; |
531 | int old_bass = m_bass_percent; | ||
532 | int old_treble = m_treble_percent; | ||
425 | bool old_vm = m_vol_muted; | 533 | bool old_vm = m_vol_muted; |
426 | bool old_mm = m_mic_muted; | 534 | bool old_mm = m_mic_muted; |
@@ -432,4 +540,6 @@ void VolumeControl::readConfig ( bool force ) | |||
432 | m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); | 540 | m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); |
433 | m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); | 541 | m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); |
542 | m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 ); | ||
543 | m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 ); | ||
434 | m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); | 544 | m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); |
435 | m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); | 545 | m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); |
@@ -439,11 +549,16 @@ void VolumeControl::readConfig ( bool force ) | |||
439 | m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); | 549 | m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); |
440 | 550 | ||
441 | if ( force || ( m_vol_percent != old_vp )) | 551 | if ( force || ( m_vol_percent != old_vp )) |
442 | volSlider-> setValue ( 100 - m_vol_percent ); | 552 | volSlider-> setValue ( 100 - m_vol_percent ); |
443 | if ( force || ( m_mic_percent != old_mp )) | 553 | if ( force || ( m_mic_percent != old_mp )) |
444 | micSlider-> setValue ( 100 - m_mic_percent ); | 554 | micSlider-> setValue ( 100 - m_mic_percent ); |
445 | if ( force || ( m_alarm_percent != old_ap )) | 555 | if ( force || ( m_alarm_percent != old_ap )) |
446 | alarmSlider-> setValue ( 100 - m_alarm_percent ); | 556 | alarmSlider-> setValue ( 100 - m_alarm_percent ); |
447 | 557 | if ( force || ( m_bass_percent != old_bass )) | |
558 | bassSlider-> setValue ( 100 - m_bass_percent ); | ||
559 | if ( force || ( m_treble_percent != old_treble )) | ||
560 | trebleSlider-> setValue ( 100 - m_treble_percent ); | ||
561 | |||
562 | |||
448 | if ( force || ( m_vol_muted != old_vm )) | 563 | if ( force || ( m_vol_muted != old_vm )) |
449 | volLed-> setOn ( !m_vol_muted ); | 564 | volLed-> setOn ( !m_vol_muted ); |
@@ -452,5 +567,5 @@ void VolumeControl::readConfig ( bool force ) | |||
452 | if ( force || ( m_snd_alarm != old_sa )) | 567 | if ( force || ( m_snd_alarm != old_sa )) |
453 | alarmLed-> setOn ( m_snd_alarm ); | 568 | alarmLed-> setOn ( m_snd_alarm ); |
454 | 569 | ||
455 | if ( force || ( m_snd_key != old_sk )) | 570 | if ( force || ( m_snd_key != old_sk )) |
456 | keyBox-> setChecked ( m_snd_key ); | 571 | keyBox-> setChecked ( m_snd_key ); |
@@ -458,5 +573,5 @@ void VolumeControl::readConfig ( bool force ) | |||
458 | tapBox-> setChecked ( m_snd_touch ); | 573 | tapBox-> setChecked ( m_snd_touch ); |
459 | if ( force || ( m_snd_alarm != old_sa )) | 574 | if ( force || ( m_snd_alarm != old_sa )) |
460 | alarmBox-> setChecked ( m_snd_alarm ); | 575 | alarmBox-> setChecked ( m_snd_alarm ); |
461 | } | 576 | } |
462 | 577 | ||
@@ -504,7 +619,7 @@ void VolumeControl::volMuteToggled ( bool b ) | |||
504 | { | 619 | { |
505 | m_vol_muted = !b; | 620 | m_vol_muted = !b; |
506 | 621 | ||
507 | m_icon-> redraw ( true ); | 622 | m_icon-> redraw ( true ); |
508 | 623 | ||
509 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); | 624 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); |
510 | } | 625 | } |
@@ -512,5 +627,5 @@ void VolumeControl::volMuteToggled ( bool b ) | |||
512 | void VolumeControl::micMuteToggled ( bool b ) | 627 | void VolumeControl::micMuteToggled ( bool b ) |
513 | { | 628 | { |
514 | m_mic_muted = !b; | 629 | m_mic_muted = !b; |
515 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 630 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
516 | } | 631 | } |
@@ -525,5 +640,5 @@ void VolumeControl::volMoved ( int percent ) | |||
525 | // repaint just the little volume rectangle | 640 | // repaint just the little volume rectangle |
526 | m_icon-> redraw ( false ); | 641 | m_icon-> redraw ( false ); |
527 | 642 | ||
528 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); | 643 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); |
529 | } | 644 | } |
@@ -550,4 +665,28 @@ void VolumeControl::alarmMoved ( int percent ) | |||
550 | 665 | ||
551 | 666 | ||
667 | void VolumeControl::bassMoved ( int percent ) | ||
668 | { | ||
669 | m_bass_percent = 100 - percent; | ||
670 | |||
671 | // clamp bass percent to be between 0 and 100 | ||
672 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); | ||
673 | |||
674 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); | ||
675 | } | ||
676 | |||
677 | |||
678 | |||
679 | void VolumeControl::trebleMoved ( int percent ) | ||
680 | { | ||
681 | m_treble_percent = 100 - percent; | ||
682 | |||
683 | // clamp treble percent to be between 0 and 100 | ||
684 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); | ||
685 | |||
686 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); | ||
687 | } | ||
688 | |||
689 | |||
690 | |||
552 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | 691 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) |
553 | { | 692 | { |
@@ -556,5 +695,5 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | |||
556 | cfg. writeEntry ( entry, val ); | 695 | cfg. writeEntry ( entry, val ); |
557 | // cfg. write ( ); | 696 | // cfg. write ( ); |
558 | 697 | ||
559 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 698 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
560 | switch ( upd ) { | 699 | switch ( upd ) { |
@@ -567,5 +706,14 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | |||
567 | break; | 706 | break; |
568 | } | 707 | } |
569 | case UPD_None: | 708 | case UPD_Bass: { |
709 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; | ||
710 | break; | ||
711 | } | ||
712 | case UPD_Treble: { | ||
713 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; | ||
714 | break; | ||
715 | } | ||
716 | |||
717 | case UPD_None: | ||
570 | break; | 718 | break; |
571 | } | 719 | } |
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h index 4d988ac..d2345b5 100644 --- a/core/applets/volumeapplet/volume.h +++ b/core/applets/volumeapplet/volume.h | |||
@@ -56,4 +56,6 @@ private slots: | |||
56 | void micMoved ( int percent ); | 56 | void micMoved ( int percent ); |
57 | void alarmMoved ( int percent ); | 57 | void alarmMoved ( int percent ); |
58 | void bassMoved( int percent ); | ||
59 | void trebleMoved( int percent ); | ||
58 | 60 | ||
59 | void volMuteToggled ( bool ); | 61 | void volMuteToggled ( bool ); |
@@ -72,5 +74,7 @@ private: | |||
72 | UPD_None, | 74 | UPD_None, |
73 | UPD_Vol, | 75 | UPD_Vol, |
74 | UPD_Mic | 76 | UPD_Mic, |
77 | UPD_Bass, | ||
78 | UPD_Treble | ||
75 | }; | 79 | }; |
76 | void writeConfigEntry ( const char *entry, int val, eUpdate upd ); | 80 | void writeConfigEntry ( const char *entry, int val, eUpdate upd ); |
@@ -79,4 +83,6 @@ private: | |||
79 | private: | 83 | private: |
80 | QSlider *volSlider; | 84 | QSlider *volSlider; |
85 | QSlider *bassSlider; | ||
86 | QSlider *trebleSlider; | ||
81 | QSlider *micSlider; | 87 | QSlider *micSlider; |
82 | QSlider *alarmSlider; | 88 | QSlider *alarmSlider; |
@@ -95,4 +101,6 @@ private: | |||
95 | int m_mic_percent; | 101 | int m_mic_percent; |
96 | int m_alarm_percent; | 102 | int m_alarm_percent; |
103 | int m_bass_percent; | ||
104 | int m_treble_percent; | ||
97 | bool m_vol_muted; | 105 | bool m_vol_muted; |
98 | bool m_mic_muted; | 106 | bool m_mic_muted; |