summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-12-13 20:17:54 (UTC)
committer harlekin <harlekin>2002-12-13 20:17:54 (UTC)
commit5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0 (patch) (side-by-side diff)
treeacd77f0506db69998638c3eea4fc1e3673fb62fd
parente348262d418e3a133d13d039ed23da4625726f9d (diff)
downloadopie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.zip
opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.tar.gz
opie-5fd9574aca2cbcf9fde0b4a43ae1881af7ba2fa0.tar.bz2
added bass and treble control
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp152
-rw-r--r--core/applets/volumeapplet/volume.h10
2 files changed, 159 insertions, 3 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
@@ -37,2 +37,3 @@
#include <qpixmap.h>
+#include <qvbox.h>
#include <qlabel.h>
@@ -125,2 +126,59 @@ static const char * mic_xpm[] = {
+
+static const char * bass_xpm[] = {
+"20 20 3 1",
+" c None",
+". c #000000",
+"+ c #0000FF",
+" ",
+" ",
+" ",
+"..... +++ ......",
+" +++++++ ",
+" ++ ++ ",
+"... ++ ... ++ ++ .",
+" +++ ++ ++ ",
+" ++++ ++ ",
+"... ++++ .. ++ .....",
+" ++ ++ ",
+" ++ ++ ",
+"..........++ ++ .",
+" ++ ",
+" ++ ",
+"...... ++ .........",
+" + ",
+" ",
+" ",
+" "};
+
+
+static const char * treble_xpm[] = {
+"20 20 3 1",
+" c None",
+". c #0000FF",
+"+ c #000000",
+" .. ",
+" . .. ",
+" . .. ",
+"++++++++ . .. ++++++",
+" . . ",
+" ... ",
+"++++++++ . +++++++",
+" .. ",
+" .. . ",
+"+++ .. ... +++++++",
+" .. .. .. ",
+" .. . . .. ",
+"+++ .. . . + . +++++",
+" .. . .. ",
+" .. . .. ",
+"++++ ...... +++++++",
+" . ",
+" .. . ",
+" .. . ",
+" .. "};
+
+
+
+
/* XPM */
@@ -188,2 +246,4 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
bool has_wav_alarm = true;
+ bool has_bass = true;
+ bool has_treble = true;
@@ -197,2 +257,7 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
+ if ( !ODevice::series == Model_iPAQ ) {
+ has_bass = false;
+ has_treble = false;
+ }
+
@@ -243,2 +308,38 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
+ QVBox *basstrebleBox = new QVBox( this );
+
+ trebleSlider = new QSlider ( basstrebleBox );
+ trebleSlider-> setRange ( 0, 100 );
+ trebleSlider-> setTickmarks ( QSlider::Both );
+ trebleSlider-> setTickInterval ( 20 );
+ trebleSlider->setMaximumHeight( 40 );
+ trebleSlider-> setFocusPolicy ( QWidget::NoFocus );
+
+ bassSlider = new QSlider ( basstrebleBox );
+ bassSlider-> setRange ( 0, 100 );
+ bassSlider-> setTickmarks ( QSlider::Both );
+ bassSlider-> setTickInterval ( 20 );
+ bassSlider->setMaximumHeight( 40 );
+ bassSlider-> setFocusPolicy ( QWidget::NoFocus );
+
+ QLabel *bassLabel = new QLabel ( this );
+ bassLabel-> setPixmap ( QPixmap ( bass_xpm ));
+
+ QLabel *trebleLabel = new QLabel( this );
+ trebleLabel->setPixmap( QPixmap ( treble_xpm ) );
+
+ grid->addWidget( trebleLabel, 0, 4, AlignCenter );
+ grid->addWidget( basstrebleBox, 1, 4, AlignCenter );
+ grid-> addWidget ( bassLabel, 2, 4, AlignCenter );
+
+ if ( !has_bass ) {
+ bassSlider->hide();
+ bassLabel->hide();
+ }
+
+ if ( !has_treble ) {
+ trebleSlider->hide();
+ trebleLabel->hide();
+ }
+
micSlider = new QSlider ( this );
@@ -285,3 +386,3 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
- grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 4, AlignVCenter | AlignLeft );
+ grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft );
@@ -289,3 +390,3 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
vbox-> setSpacing ( 4 );
- grid-> addMultiCellLayout ( vbox, 1, 2, 4, 4 );
+ grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 );
@@ -326,2 +427,5 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int )));
+ connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int )));
+ connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int )));
+
@@ -342,2 +446,4 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None );
+ writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None );
+ writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None );
writeConfigEntry ( "Mute", m_vol_muted, UPD_None );
@@ -424,2 +530,4 @@ void VolumeControl::readConfig ( bool force )
int old_mp = m_mic_percent;
+ int old_bass = m_bass_percent;
+ int old_treble = m_treble_percent;
bool old_vm = m_vol_muted;
@@ -433,2 +541,4 @@ void VolumeControl::readConfig ( bool force )
m_mic_percent = cfg. readNumEntry ( "Mic", 50 );
+ m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 );
+ m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 );
m_vol_muted = cfg. readBoolEntry ( "Mute", 0 );
@@ -446,2 +556,7 @@ void VolumeControl::readConfig ( bool force )
alarmSlider-> setValue ( 100 - m_alarm_percent );
+ if ( force || ( m_bass_percent != old_bass ))
+ bassSlider-> setValue ( 100 - m_bass_percent );
+ if ( force || ( m_treble_percent != old_treble ))
+ trebleSlider-> setValue ( 100 - m_treble_percent );
+
@@ -551,2 +666,26 @@ void VolumeControl::alarmMoved ( int percent )
+void VolumeControl::bassMoved ( int percent )
+{
+ m_bass_percent = 100 - percent;
+
+ // clamp bass percent to be between 0 and 100
+ m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent );
+
+ writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass );
+}
+
+
+
+void VolumeControl::trebleMoved ( int percent )
+{
+ m_treble_percent = 100 - percent;
+
+ // clamp treble percent to be between 0 and 100
+ m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent );
+
+ writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble );
+}
+
+
+
void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
@@ -568,2 +707,11 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
}
+ case UPD_Bass: {
+ QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true;
+ break;
+ }
+ case UPD_Treble: {
+ QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true;
+ break;
+ }
+
case UPD_None:
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
@@ -57,2 +57,4 @@ private slots:
void alarmMoved ( int percent );
+ void bassMoved( int percent );
+ void trebleMoved( int percent );
@@ -73,3 +75,5 @@ private:
UPD_Vol,
- UPD_Mic
+ UPD_Mic,
+ UPD_Bass,
+ UPD_Treble
};
@@ -80,2 +84,4 @@ private:
QSlider *volSlider;
+ QSlider *bassSlider;
+ QSlider *trebleSlider;
QSlider *micSlider;
@@ -96,2 +102,4 @@ private:
int m_alarm_percent;
+ int m_bass_percent;
+ int m_treble_percent;
bool m_vol_muted;