summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-12-13 20:17:54 (UTC)
committer harlekin <harlekin>2002-12-13 20:17:54 (UTC)
commit5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0 (patch) (unidiff)
treeacd77f0506db69998638c3eea4fc1e3673fb62fd
parente348262d418e3a133d13d039ed23da4625726f9d (diff)
downloadopie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.zip
opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.tar.gz
opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.tar.bz2
added bass and treble control
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp234
-rw-r--r--core/applets/volumeapplet/volume.h10
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
@@ -35,6 +35,7 @@
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 <qlabel.h> 39#include <qlabel.h>
39 40
40#include <qtoolbutton.h> 41#include <qtoolbutton.h>
@@ -47,7 +48,7 @@
47 48
48using namespace Opie; 49using 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.
53 54
@@ -123,6 +124,63 @@ static const char * mic_xpm[] = {
123" . ", 124" . ",
124". "}; 125". "};
125 126
127
128static 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
155static 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 */
127static const char * alarm_xpm[] = { 185static const char * alarm_xpm[] = {
128"20 20 33 1", 186"20 20 33 1",
@@ -184,9 +242,11 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
184 : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) 242 : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup )
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:
192 has_wav_alarm = false; //poor guys probably feeling left out... 252 has_wav_alarm = false; //poor guys probably feeling left out...
@@ -194,28 +254,33 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
194 default: 254 default:
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 );
200 265
201 QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); 266 QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 );
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 ));
214 upButton-> setPixmap ( Resource::loadPixmap ( "up" )); 279 upButton-> setPixmap ( Resource::loadPixmap ( "up" ));
215 upButton-> setFocusPolicy ( QWidget::NoFocus ); 280 upButton-> setFocusPolicy ( QWidget::NoFocus );
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 ));
221 downButton-> setPixmap ( Resource::loadPixmap ( "down" )); 286 downButton-> setPixmap ( Resource::loadPixmap ( "down" ));
@@ -228,35 +293,71 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
228 volSlider-> setTickmarks ( QSlider::Both ); 293 volSlider-> setTickmarks ( QSlider::Both );
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 );
237 302
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 );
246 micSlider-> setTickmarks ( QSlider::Both ); 347 micSlider-> setTickmarks ( QSlider::Both );
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 );
255 356
256 micLed = new OLedBox ( red, this ); 357 micLed = new OLedBox ( red, this );
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
262 alarmSlider = new QSlider ( this ); 363 alarmSlider = new QSlider ( this );
@@ -267,14 +368,14 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
267 368
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 );
273 374
274 alarmLed = new OLedBox ( yellow, this ); 375 alarmLed = new OLedBox ( yellow, this );
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
280 if ( !has_wav_alarm ) { 381 if ( !has_wav_alarm ) {
@@ -282,26 +383,26 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
282 alarmLabel-> hide ( ); 383 alarmLabel-> hide ( );
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
307 if ( has_wav_alarm ) { 408 if ( has_wav_alarm ) {
@@ -315,7 +416,7 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
315 416
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 ( )));
321 connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); 422 connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( )));
@@ -324,7 +425,10 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
324 connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); 425 connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int )));
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 )));
330 connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); 434 connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool )));
@@ -336,16 +440,18 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
336 // initialize variables 440 // initialize variables
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 );
345 writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); 451 writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None );
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 );
351} 457}
@@ -403,13 +509,13 @@ void VolumeControl::show ( bool /*showMic*/ )
403 readConfig ( ); 509 readConfig ( );
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 ( );
415 521
@@ -422,6 +528,8 @@ void VolumeControl::readConfig ( bool force )
422 528
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;
427 bool old_sk = m_snd_key; 535 bool old_sk = m_snd_key;
@@ -431,6 +539,8 @@ void VolumeControl::readConfig ( bool force )
431 539
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 );
436 m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); 546 m_snd_key = cfg. readBoolEntry ( "KeySound", 0 );
@@ -438,26 +548,31 @@ void VolumeControl::readConfig ( bool force )
438 m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); 548 m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 );
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 );
450 if ( force || ( m_mic_muted != old_mm )) 565 if ( force || ( m_mic_muted != old_mm ))
451 micLed-> setOn ( !m_mic_muted ); 566 micLed-> setOn ( !m_mic_muted );
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 );
457 if ( force || ( m_snd_touch != old_st )) 572 if ( force || ( m_snd_touch != old_st ))
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
463 578
@@ -503,15 +618,15 @@ void VolumeControl::alarmSoundToggled ( bool b )
503void VolumeControl::volMuteToggled ( bool b ) 618void 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}
511 626
512void VolumeControl::micMuteToggled ( bool b ) 627void 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}
517 632
@@ -524,7 +639,7 @@ void VolumeControl::volMoved ( int percent )
524 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 );
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}
530 645
@@ -549,13 +664,37 @@ void VolumeControl::alarmMoved ( int percent )
549} 664}
550 665
551 666
667void 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
679void 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
552void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) 691void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
553{ 692{
554 Config cfg ( "qpe" ); 693 Config cfg ( "qpe" );
555 cfg. setGroup ( "Volume" ); 694 cfg. setGroup ( "Volume" );
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 ) {
561 case UPD_Vol: { 700 case UPD_Vol: {
@@ -566,7 +705,16 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
566 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; 705 QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted;
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 }
572#endif 720#endif
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
@@ -55,6 +55,8 @@ private slots:
55 void volMoved ( int percent ); 55 void volMoved ( int percent );
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 );
60 void micMuteToggled ( bool ); 62 void micMuteToggled ( bool );
@@ -71,13 +73,17 @@ private:
71 enum eUpdate { 73 enum eUpdate {
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 );
77 81
78 82
79private: 83private:
80 QSlider *volSlider; 84 QSlider *volSlider;
85 QSlider *bassSlider;
86 QSlider *trebleSlider;
81 QSlider *micSlider; 87 QSlider *micSlider;
82 QSlider *alarmSlider; 88 QSlider *alarmSlider;
83 OLedBox *volLed; 89 OLedBox *volLed;
@@ -94,6 +100,8 @@ private:
94 int m_vol_percent; 100 int m_vol_percent;
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;
99 bool m_snd_alarm; 107 bool m_snd_alarm;