summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-30 00:24:42 (UTC)
committer sandman <sandman>2002-06-30 00:24:42 (UTC)
commit2e3c599f9b2498ecd9c2332d38a0ae293954b570 (patch) (side-by-side diff)
tree1a5f95206bba7ca896b09558cf1b46ac6e03f205
parent0235faab30f436ae3fbfed21e9f07486181bb0dd (diff)
downloadopie-2e3c599f9b2498ecd9c2332d38a0ae293954b570.zip
opie-2e3c599f9b2498ecd9c2332d38a0ae293954b570.tar.gz
opie-2e3c599f9b2498ecd9c2332d38a0ae293954b570.tar.bz2
Some fixes (keeping vol/mute in sync with other apps)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp49
-rw-r--r--core/applets/volumeapplet/volume.h2
2 files changed, 22 insertions, 29 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index b047877..eedc749 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -184,18 +184,9 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
m_icon = icon;
- bool has_wav_alarm = false;
+ bool has_wav_alarm = true;
switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually
- case OMODEL_iPAQ_H31xx:
- case OMODEL_iPAQ_H36xx:
- case OMODEL_iPAQ_H37xx:
- case OMODEL_iPAQ_H38xx:
- has_wav_alarm = true;
- break;
case OMODEL_Zaurus_SL5000:
- has_wav_alarm = false; //poor guys probably feeling left out...
- break;
- default:
- has_wav_alarm = true; //lets just presume
+ has_wav_alarm = false; //poor guys probably feeling left out...
break;
}
@@ -409,6 +400,4 @@ void VolumeControl::show ( bool /*showMic*/ )
QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 ));
- printf ( "SHOW AT : %d/%d\n", curPos.x(), curPos.y());
- printf ( "SIZEHINT: %d/%d\n", sizeHint().width(),sizeHint().height());
int w = sizeHint ( ). width ( );
@@ -418,5 +407,4 @@ void VolumeControl::show ( bool /*showMic*/ )
x = QPEApplication::desktop ( )-> width ( ) - w;
-
move ( x, curPos. y ( ) - sizeHint ( ). height ( ));
QFrame::show ( );
@@ -472,19 +460,14 @@ void VolumeControl::readConfig ( bool force )
void VolumeControl::volumeChanged ( bool nowMuted )
{
- int previousVolume = m_vol_percent;
+ int prevVol = m_vol_percent;
+ bool prevMute = m_vol_muted;
- if ( !nowMuted )
- readConfig ( );
+ readConfig ( );
// Handle case where muting it toggled
- if ( m_vol_muted != nowMuted ) {
- m_vol_muted = nowMuted;
- m_icon-> repaint ( true );
- }
- else if ( previousVolume != m_vol_percent ) {
- // Avoid over repainting
- m_icon-> repaint( 2, height ( ) - 3, width ( ) - 4, 2, false );
- }
-
+ if ( m_vol_muted != prevMute )
+ m_icon-> redraw ( true );
+ else if ( prevVol != m_vol_percent ) // Avoid over repainting
+ m_icon-> redraw ( false );
}
@@ -518,5 +501,5 @@ void VolumeControl::volMuteToggled ( bool b )
m_vol_muted = !b;
- m_icon-> repaint ( !m_vol_muted ); // clear if removing mute
+ m_icon-> redraw ( true );
writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol );
@@ -537,6 +520,6 @@ void VolumeControl::volMoved ( int percent )
m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent );
// repaint just the little volume rectangle
- repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false );
-
+ m_icon-> redraw ( false );
+
writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol );
}
@@ -615,4 +598,12 @@ void VolumeApplet::mousePressEvent ( QMouseEvent * )
}
+void VolumeApplet::redraw ( bool all )
+{
+ if ( all )
+ repaint ( true );
+ else
+ repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false );
+}
+
void VolumeApplet::paintEvent ( QPaintEvent * )
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h
index ff5c64a..4d988ac 100644
--- a/core/applets/volumeapplet/volume.h
+++ b/core/applets/volumeapplet/volume.h
@@ -111,4 +111,6 @@ public:
~VolumeApplet ( );
+ void redraw ( bool all = true );
+
protected:
virtual void mousePressEvent ( QMouseEvent * );