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
@@ -35,6 +35,7 @@
#include <qlayout.h>
#include <qframe.h>
#include <qpixmap.h>
+#include <qvbox.h>
#include <qlabel.h>
#include <qtoolbutton.h>
@@ -123,6 +124,63 @@ 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 */
static const char * alarm_xpm[] = {
"20 20 33 1",
@@ -186,6 +244,8 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
m_icon = icon;
bool has_wav_alarm = true;
+ bool has_bass = true;
+ bool has_treble = true;
switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually
case Model_Zaurus_SL5000:
@@ -195,6 +255,11 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
break;
}
+ if ( !ODevice::series == Model_iPAQ ) {
+ has_bass = false;
+ has_treble = false;
+ }
+
setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
@@ -241,6 +306,42 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
grid-> addWidget ( volLed, 2, 1, AlignCenter );
+ 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 );
micSlider-> setRange ( 0, 100 );
micSlider-> setTickmarks ( QSlider::Both );
@@ -283,11 +384,11 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
alarmLed-> hide ( );
}
- 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 );
vbox = new QVBoxLayout ( );
vbox-> setSpacing ( 4 );
- grid-> addMultiCellLayout ( vbox, 1, 2, 4, 4 );
+ grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 );
tapBox = new QCheckBox ( tr( "Screen Taps" ), this );
tapBox-> setFocusPolicy ( QWidget::NoFocus );
@@ -324,6 +425,9 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int )));
connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int )));
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 )));
+
connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool )));
connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool )));
@@ -340,6 +444,8 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
// initialize the config file, in case some entries are missing
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 );
writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None );
writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None );
@@ -422,6 +528,8 @@ void VolumeControl::readConfig ( bool force )
int old_vp = m_vol_percent;
int old_mp = m_mic_percent;
+ int old_bass = m_bass_percent;
+ int old_treble = m_treble_percent;
bool old_vm = m_vol_muted;
bool old_mm = m_mic_muted;
bool old_sk = m_snd_key;
@@ -431,6 +539,8 @@ void VolumeControl::readConfig ( bool force )
m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 );
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 );
m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 );
m_snd_key = cfg. readBoolEntry ( "KeySound", 0 );
@@ -444,6 +554,11 @@ void VolumeControl::readConfig ( bool force )
micSlider-> setValue ( 100 - m_mic_percent );
if ( force || ( m_alarm_percent != old_ap ))
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 );
+
if ( force || ( m_vol_muted != old_vm ))
volLed-> setOn ( !m_vol_muted );
@@ -549,6 +664,30 @@ 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 )
{
Config cfg ( "qpe" );
@@ -566,6 +705,15 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted;
break;
}
+ case UPD_Bass: {
+ QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true;
+ break;
+ }
+ case UPD_Treble: {
+ QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true;
+ break;
+ }
+
case UPD_None:
break;
}
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:
void volMoved ( int percent );
void micMoved ( int percent );
void alarmMoved ( int percent );
+ void bassMoved( int percent );
+ void trebleMoved( int percent );
void volMuteToggled ( bool );
void micMuteToggled ( bool );
@@ -71,13 +73,17 @@ private:
enum eUpdate {
UPD_None,
UPD_Vol,
- UPD_Mic
+ UPD_Mic,
+ UPD_Bass,
+ UPD_Treble
};
void writeConfigEntry ( const char *entry, int val, eUpdate upd );
private:
QSlider *volSlider;
+ QSlider *bassSlider;
+ QSlider *trebleSlider;
QSlider *micSlider;
QSlider *alarmSlider;
OLedBox *volLed;
@@ -94,6 +100,8 @@ private:
int m_vol_percent;
int m_mic_percent;
int m_alarm_percent;
+ int m_bass_percent;
+ int m_treble_percent;
bool m_vol_muted;
bool m_mic_muted;
bool m_snd_alarm;