summaryrefslogtreecommitdiff
path: root/core/applets/volumeapplet/volume.cpp
Side-by-side diff
Diffstat (limited to 'core/applets/volumeapplet/volume.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp49
1 files changed, 20 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
@@ -185,16 +185,7 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa
- 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;
@@ -410,4 +401,2 @@ 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());
@@ -419,3 +408,2 @@ void VolumeControl::show ( bool /*showMic*/ )
-
move ( x, curPos. y ( ) - sizeHint ( ). height ( ));
@@ -473,17 +461,12 @@ 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 );
}
@@ -519,3 +502,3 @@ void VolumeControl::volMuteToggled ( bool b )
- m_icon-> repaint ( !m_vol_muted ); // clear if removing mute
+ m_icon-> redraw ( true );
@@ -538,4 +521,4 @@ void VolumeControl::volMoved ( int 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 );
@@ -616,2 +599,10 @@ void VolumeApplet::mousePressEvent ( QMouseEvent * )
+void VolumeApplet::redraw ( bool all )
+{
+ if ( all )
+ repaint ( true );
+ else
+ repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false );
+}
+