Blame SOURCES/0002-Use-a-fixed-volume-step-of-n-instead-of-honoring-mou.patch

3fe5b5
From 207fa53763d83e8031be622c9006e41b97195d48 Mon Sep 17 00:00:00 2001
3fe5b5
From: Christian Esken <esken@kde.org>
3fe5b5
Date: Mon, 4 Feb 2013 23:30:47 +0100
3fe5b5
Subject: [PATCH 2/8] Use a fixed volume step of n% instead of honoring mouse
3fe5b5
 delta (which is more appropriate for text documents). Also Mouse Wheel now
3fe5b5
 only affects EITHER playback OR capture CCBUGS: 313579 CCBUGS: 300783
3fe5b5
3fe5b5
---
3fe5b5
 apps/kmix.cpp          |   2 +-
3fe5b5
 core/mixdevice.cpp     |   1 -
3fe5b5
 core/mixer.cpp         |  28 ++++++------
3fe5b5
 core/mixer.h           |   3 --
3fe5b5
 core/volume.cpp        |  37 ++++++++++++----
3fe5b5
 core/volume.h          |   7 ++-
3fe5b5
 gui/kmixdockwidget.cpp |  18 ++++----
3fe5b5
 gui/ksmallslider.cpp   |  16 ++++---
3fe5b5
 gui/mdwslider.cpp      | 113 +++++++++++++++++++++++++++++--------------------
3fe5b5
 gui/mdwslider.h        |   4 +-
3fe5b5
 10 files changed, 136 insertions(+), 93 deletions(-)
3fe5b5
3fe5b5
diff --git a/apps/kmix.cpp b/apps/kmix.cpp
3fe5b5
index 189bb50..dd2861a 100644
3fe5b5
--- a/apps/kmix.cpp
3fe5b5
+++ b/apps/kmix.cpp
3fe5b5
@@ -576,7 +576,7 @@ KMixWindow::loadBaseConfig()
3fe5b5
     {
3fe5b5
       float volumePercentageStep = volumePercentageStepString.toFloat();
3fe5b5
       if (volumePercentageStep > 0 && volumePercentageStep <= 100)
3fe5b5
-        Mixer::VOLUME_STEP_DIVISOR = (100 / volumePercentageStep);
3fe5b5
+        Volume::VOLUME_STEP_DIVISOR = (100 / volumePercentageStep);
3fe5b5
     }
3fe5b5
 
3fe5b5
 
3fe5b5
diff --git a/core/mixdevice.cpp b/core/mixdevice.cpp
3fe5b5
index 6687f38..662fd85 100644
3fe5b5
--- a/core/mixdevice.cpp
3fe5b5
+++ b/core/mixdevice.cpp
3fe5b5
@@ -186,7 +186,6 @@ void MixDevice::addPlaybackVolume(Volume &playbackVol)
3fe5b5
    // Hint: "_playbackVolume" gets COPIED from "playbackVol", because the copy-constructor actually copies the volume levels.
3fe5b5
    _playbackVolume = playbackVol;
3fe5b5
    _playbackVolume.setSwitchType(Volume::PlaybackSwitch);
3fe5b5
-    playbackVol.hasSwitchDisallowRead(); // Only allowed to read once, and only here during migrating the switch back to MixDevice
3fe5b5
 }
3fe5b5
 
3fe5b5
 void MixDevice::addCaptureVolume (Volume &captureVol)
3fe5b5
diff --git a/core/mixer.cpp b/core/mixer.cpp
3fe5b5
index ebbeb9c..77c7dbc 100644
3fe5b5
--- a/core/mixer.cpp
3fe5b5
+++ b/core/mixer.cpp
3fe5b5
@@ -39,8 +39,6 @@
3fe5b5
 QList<Mixer *> Mixer::s_mixers;
3fe5b5
 MasterControl Mixer::_globalMasterCurrent;
3fe5b5
 MasterControl Mixer::_globalMasterPreferred;
3fe5b5
-float Mixer::VOLUME_STEP_DIVISOR = 20;
3fe5b5
-float Mixer::VOLUME_PAGESTEP_DIVISOR = 10;
3fe5b5
 bool Mixer::m_beepOnVolumeChange = false;
3fe5b5
 
3fe5b5
 int Mixer::numDrivers()
3fe5b5
@@ -639,6 +637,14 @@ void Mixer::decreaseVolume( const QString& mixdeviceID )
3fe5b5
 	increaseOrDecreaseVolume(mixdeviceID, true);
3fe5b5
 }
3fe5b5
 
3fe5b5
+/**
3fe5b5
+ * Increase or decrease all playback and capture channels of the given control.
3fe5b5
+ * This method is very similar to MDWSlider::increaseOrDecreaseVolume(), but it will
3fe5b5
+ * NOT auto-unmute.
3fe5b5
+ *
3fe5b5
+ * @param mixdeviceID The control name
3fe5b5
+ * @param decrease true for decrease. false for increase
3fe5b5
+ */
3fe5b5
 void Mixer::increaseOrDecreaseVolume( const QString& mixdeviceID, bool decrease )
3fe5b5
 {
3fe5b5
 
3fe5b5
@@ -646,21 +652,15 @@ void Mixer::increaseOrDecreaseVolume( const QString& mixdeviceID, bool decrease
3fe5b5
     if (md.get() != 0)
3fe5b5
     {
3fe5b5
         Volume& volP=md->playbackVolume();
3fe5b5
-        if ( volP.hasVolume() ) {
3fe5b5
-        	long volSpan = volP.volumeSpan();
3fe5b5
-           double step = volSpan / Mixer::VOLUME_STEP_DIVISOR;
3fe5b5
-           if ( step < 1 ) step = 1;
3fe5b5
-           if ( decrease ) step = -step;
3fe5b5
-           volP.changeAllVolumes(step);
3fe5b5
+        if ( volP.hasVolume() )
3fe5b5
+        {
3fe5b5
+           volP.changeAllVolumes(volP.volumeStep(decrease));
3fe5b5
         }
3fe5b5
         
3fe5b5
         Volume& volC=md->captureVolume();
3fe5b5
-        if ( volC.hasVolume() ) {
3fe5b5
-        	long volSpan = volC.volumeSpan();
3fe5b5
-           double step = volSpan / Mixer::VOLUME_STEP_DIVISOR;
3fe5b5
-           if ( step < 1 ) step = 1;
3fe5b5
-           if ( decrease ) step = -step;
3fe5b5
-           volC.changeAllVolumes(step);
3fe5b5
+        if ( volC.hasVolume() )
3fe5b5
+        {
3fe5b5
+           volC.changeAllVolumes(volC.volumeStep(decrease));
3fe5b5
         }
3fe5b5
 
3fe5b5
         _mixerBackend->writeVolumeToHW(mixdeviceID, md);
3fe5b5
diff --git a/core/mixer.h b/core/mixer.h
3fe5b5
index 961eed9..97e2775 100644
3fe5b5
--- a/core/mixer.h
3fe5b5
+++ b/core/mixer.h
3fe5b5
@@ -163,9 +163,6 @@ public:
3fe5b5
     /// get the actual MixSet
3fe5b5
     MixSet& getMixSet();
3fe5b5
 
3fe5b5
-    static float VOLUME_STEP_DIVISOR;     // The divisor for defining volume control steps (for mouse-wheel, DBUS and Normal step for Sliders )
3fe5b5
-    static float VOLUME_PAGESTEP_DIVISOR; // The divisor for defining volume control steps (page-step for sliders)
3fe5b5
-
3fe5b5
     /// DBUS oriented methods
3fe5b5
     virtual void increaseVolume( const QString& mixdeviceID );
3fe5b5
     virtual void decreaseVolume( const QString& mixdeviceID );
3fe5b5
diff --git a/core/volume.cpp b/core/volume.cpp
3fe5b5
index 418f5cc..f978709 100644
3fe5b5
--- a/core/volume.cpp
3fe5b5
+++ b/core/volume.cpp
3fe5b5
@@ -26,6 +26,10 @@
3fe5b5
 
3fe5b5
 #include <kdebug.h>
3fe5b5
 
3fe5b5
+float Volume::VOLUME_STEP_DIVISOR = 20;
3fe5b5
+float Volume::VOLUME_PAGESTEP_DIVISOR = 10;
3fe5b5
+
3fe5b5
+
3fe5b5
 int Volume::_channelMaskEnum[9] =
3fe5b5
 { MLEFT, MRIGHT, MCENTER,
3fe5b5
 		MWOOFER,
3fe5b5
@@ -62,7 +66,6 @@ Volume::Volume()
3fe5b5
 	_switchType = None;
3fe5b5
 	_isCapture = false;
3fe5b5
 	_chmask = MNONE;
3fe5b5
-	disallowSwitchDisallowRead = false;
3fe5b5
 }
3fe5b5
 
3fe5b5
 // IIRC we need the default constructor implicitly for a Collection operation
3fe5b5
@@ -111,7 +114,6 @@ void Volume::init( ChannelMask chmask, long maxVolume, long minVolume, bool hasS
3fe5b5
 	// a) Physical switches will be updated after start from the hardware.
3fe5b5
 	// b) Emulated virtual/switches will not receive updates from the hardware, so they shouldn't disable the channels.
3fe5b5
 	_switchActivated = true;
3fe5b5
-	disallowSwitchDisallowRead = false;
3fe5b5
 }
3fe5b5
 
3fe5b5
 QMap<Volume::ChannelID, VolumeChannel> Volume::getVolumesWhenActive() const
3fe5b5
@@ -122,14 +124,33 @@ QMap<Volume::ChannelID, VolumeChannel> Volume::getVolumesWhenActive() const
3fe5b5
 QMap<Volume::ChannelID, VolumeChannel> Volume::getVolumes() const
3fe5b5
 {
3fe5b5
 	return _volumesL;
3fe5b5
-//	if ( isSwitchActivated() )
3fe5b5
-//		return _volumesL;
3fe5b5
-//	else
3fe5b5
-//	{
3fe5b5
-//		return _volumesMuted;
3fe5b5
-//	}
3fe5b5
 }
3fe5b5
 
3fe5b5
+/**
3fe5b5
+ * Returns the absolute change to do one "step" for this volume. This is similar to a page step in a slider,
3fe5b5
+ * namely a fixed percentage of the range.
3fe5b5
+ * One step is the percentage given by 100/VOLUME_STEP_DIVISOR. The
3fe5b5
+ * default VOLUME_STEP_DIVISOR is 20, so default change is 5% of the volumeSpan().
3fe5b5
+ *
3fe5b5
+ * This method guarantees a minimum absolute change of 1, zero is never returned.
3fe5b5
+ *
3fe5b5
+ * It is NOT verified, that such a volume change would actually be possible. You might hit the upper or lower bounds
3fe5b5
+ * of the volume range.
3fe5b5
+ *
3fe5b5
+ *
3fe5b5
+ * @param decrease true, if you want a volume step that decreases the volume by one page step
3fe5b5
+ * @return The volume step. It will be negative if you have used decrease==true
3fe5b5
+ *
3fe5b5
+ */
3fe5b5
+long Volume::volumeStep(bool decrease)
3fe5b5
+{
3fe5b5
+  	long inc = volumeSpan() / Volume::VOLUME_STEP_DIVISOR;
3fe5b5
+	if ( inc == 0 )	inc = 1;
3fe5b5
+	if ( decrease ) inc *= -1;
3fe5b5
+	return inc;
3fe5b5
+}
3fe5b5
+
3fe5b5
+
3fe5b5
 // @ compatibility
3fe5b5
 void Volume::setAllVolumes(long vol)
3fe5b5
 {
3fe5b5
diff --git a/core/volume.h b/core/volume.h
3fe5b5
index e6efea4..19d500d 100644
3fe5b5
--- a/core/volume.h
3fe5b5
+++ b/core/volume.h
3fe5b5
@@ -80,6 +80,8 @@ friend class MixDevice;
3fe5b5
 
3fe5b5
     enum VolumeType { PlaybackVT = 0 , CaptureVT = 1 };
3fe5b5
 
3fe5b5
+    enum VolumeTypeFlag { Playback = 1, Capture = 2, Both = 3 };
3fe5b5
+
3fe5b5
     // regular constructor (old, deprecsted)
3fe5b5
     //Volume( ChannelMask chmask, long maxVolume, long minVolume, bool hasSwitch, bool isCapture );
3fe5b5
     // regular constructor
3fe5b5
@@ -144,8 +146,11 @@ friend class MixDevice;
3fe5b5
     static int    _channelMaskEnum[9];
3fe5b5
     QMap<Volume::ChannelID, VolumeChannel> getVolumes() const;
3fe5b5
     QMap<Volume::ChannelID, VolumeChannel> getVolumesWhenActive() const;
3fe5b5
-    void hasSwitchDisallowRead() { disallowSwitchDisallowRead = true; };
3fe5b5
+    long volumeStep(bool decrease);
3fe5b5
     
3fe5b5
+    static float VOLUME_STEP_DIVISOR;     // The divisor for defining volume control steps (for mouse-wheel, DBUS and Normal step for Sliders )
3fe5b5
+    static float VOLUME_PAGESTEP_DIVISOR; // The divisor for defining volume control steps (page-step for sliders)
3fe5b5
+
3fe5b5
 protected:
3fe5b5
     long          _chmask;
3fe5b5
     QMap<Volume::ChannelID, VolumeChannel> _volumesL;
3fe5b5
diff --git a/gui/kmixdockwidget.cpp b/gui/kmixdockwidget.cpp
3fe5b5
index 3bda22e..ad8d21b 100644
3fe5b5
--- a/gui/kmixdockwidget.cpp
3fe5b5
+++ b/gui/kmixdockwidget.cpp
3fe5b5
@@ -342,19 +342,19 @@ KMixDockWidget::trayWheelEvent(int delta,Qt::Orientation wheelOrientation)
3fe5b5
 		return;
3fe5b5
 
3fe5b5
 
3fe5b5
-      Volume &vol = ( md->playbackVolume().hasVolume() ) ?  md->playbackVolume() : md->captureVolume();
3fe5b5
-      int inc = vol.volumeSpan() / Mixer::VOLUME_STEP_DIVISOR;
3fe5b5
+	Volume &vol = ( md->playbackVolume().hasVolume() ) ?  md->playbackVolume() : md->captureVolume();
3fe5b5
+	// bko313579 Do not use "delta", as that is setting more related to documents (Editor, Browser). KMix should
3fe5b5
+	//           simply always use its own VOLUME_STEP_DIVISOR as a base for percentage change.
3fe5b5
+	bool decrease = delta < 0;
3fe5b5
+	if (wheelOrientation == Qt::Horizontal) // Reverse horizontal scroll: bko228780
3fe5b5
+	decrease = !decrease;
3fe5b5
+	long cv = vol.volumeStep(decrease);
3fe5b5
 
3fe5b5
-    if ( inc < 1 ) inc = 1;
3fe5b5
-
3fe5b5
-    if (wheelOrientation == Qt::Horizontal) // Reverse horizontal scroll: bko228780 
3fe5b5
-    	delta = -delta;
3fe5b5
-
3fe5b5
-    long int cv = inc * (delta / 120 );
3fe5b5
     bool isInactive =  vol.isCapture() ? !md->isRecSource() : md->isMuted();
3fe5b5
     kDebug() << "Operating on capture=" << vol.isCapture() << ", isInactive=" << isInactive;
3fe5b5
 	if ( cv > 0 && isInactive)
3fe5b5
-	{   // increasing from muted state: unmute and start with a low volume level
3fe5b5
+	{
3fe5b5
+		// increasing from muted state: unmute and start with a low volume level
3fe5b5
 		if ( vol.isCapture())
3fe5b5
 			md->setRecSource(true);
3fe5b5
 		else
3fe5b5
diff --git a/gui/ksmallslider.cpp b/gui/ksmallslider.cpp
3fe5b5
index ee9788d..a681b4f 100644
3fe5b5
--- a/gui/ksmallslider.cpp
3fe5b5
+++ b/gui/ksmallslider.cpp
3fe5b5
@@ -311,18 +311,20 @@ void KSmallSlider::mouseMoveEvent( QMouseEvent *e )
3fe5b5
 void KSmallSlider::wheelEvent( QWheelEvent * qwe)
3fe5b5
 {
3fe5b5
 //    kDebug(67100) << "KSmallslider::wheelEvent()";
3fe5b5
-    int inc = ( maximum() - minimum() ) / Mixer::VOLUME_STEP_DIVISOR;
3fe5b5
+	// bko313579 Do not use "delta", as that is setting more related to documents (Editor, Browser). KMix should
3fe5b5
+	//           simply always use its own VOLUME_STEP_DIVISOR as a base for percentage change.
3fe5b5
+	bool decrease = qwe->delta() < 0;
3fe5b5
+	if (qwe->orientation() == Qt::Horizontal) // Reverse horizontal scroll: bko228780
3fe5b5
+		decrease = !decrease;
3fe5b5
+
3fe5b5
+    int inc = ( maximum() - minimum() ) / Volume::VOLUME_STEP_DIVISOR;
3fe5b5
     if ( inc < 1)
3fe5b5
-	inc = 1;
3fe5b5
+    	inc = 1;
3fe5b5
 
3fe5b5
     //kDebug(67100) << "KSmallslider::wheelEvent() inc=" << inc << "delta=" << e->delta();
3fe5b5
 	int newVal;
3fe5b5
 
3fe5b5
-	bool increase = (qwe->delta() > 0);
3fe5b5
-	if (qwe->orientation() == Qt::Horizontal) // Reverse horizontal scroll: bko228780 
3fe5b5
-		increase = !increase;
3fe5b5
-
3fe5b5
-    if ( increase ) {
3fe5b5
+    if ( !decrease ) {
3fe5b5
        newVal = QAbstractSlider::value() + inc;
3fe5b5
     }
3fe5b5
     else {
3fe5b5
diff --git a/gui/mdwslider.cpp b/gui/mdwslider.cpp
3fe5b5
index af6e725..7c14673 100644
3fe5b5
--- a/gui/mdwslider.cpp
3fe5b5
+++ b/gui/mdwslider.cpp
3fe5b5
@@ -548,14 +548,14 @@ void MDWSlider::addSliders( QBoxLayout *volLayout, char type, Volume& vol, QList
3fe5b5
 		QAbstractSlider* slider;
3fe5b5
 		if ( m_small )
3fe5b5
 		{
3fe5b5
-			slider = new KSmallSlider( minvol, maxvol, (maxvol-minvol+1) / Mixer::VOLUME_PAGESTEP_DIVISOR,
3fe5b5
+			slider = new KSmallSlider( minvol, maxvol, (maxvol-minvol+1) / Volume::VOLUME_PAGESTEP_DIVISOR,
3fe5b5
 				                           vol.getVolume( vc.chid ), _orientation, this );
3fe5b5
 		} // small
3fe5b5
 		else  {
3fe5b5
 			slider = new VolumeSlider( _orientation, this );
3fe5b5
 			slider->setMinimum(minvol);
3fe5b5
 			slider->setMaximum(maxvol);
3fe5b5
-			slider->setPageStep(maxvol / Mixer::VOLUME_PAGESTEP_DIVISOR);
3fe5b5
+			slider->setPageStep(maxvol / Volume::VOLUME_PAGESTEP_DIVISOR);
3fe5b5
 			slider->setValue(  vol.getVolume( vc.chid ) );
3fe5b5
 			volumeValues.push_back( vol.getVolume( vc.chid ) );
3fe5b5
 			
3fe5b5
@@ -959,54 +959,67 @@ void MDWSlider::setDisabled( bool value )
3fe5b5
 
3fe5b5
 
3fe5b5
 /**
3fe5b5
-   This slot is called on a MouseWheel event. Also it is called by any other
3fe5b5
-    associated KAction like the context menu.
3fe5b5
+ * This slot is called on a Keyboard Shortcut event.
3fe5b5
  */
3fe5b5
 void MDWSlider::increaseVolume()
3fe5b5
 {
3fe5b5
-  increaseOrDecreaseVolume(false);
3fe5b5
+  increaseOrDecreaseVolume(false, Volume::Both);
3fe5b5
 }
3fe5b5
 
3fe5b5
 /**
3fe5b5
- * TOOD This should go to the Volume class, so we can use it anywhere,
3fe5b5
- * like mouse wheel, OSD, Keyboard Shortcuts
3fe5b5
+ * This slot is called on a Keyboard Shortcut event.
3fe5b5
  */
3fe5b5
-long MDWSlider::calculateStepIncrement ( Volume&vol, bool decrease )
3fe5b5
+void MDWSlider::decreaseVolume()
3fe5b5
 {
3fe5b5
-  	long inc = vol.volumeSpan() / Mixer::VOLUME_STEP_DIVISOR;
3fe5b5
-	if ( inc == 0 )	inc = 1;
3fe5b5
-	if ( decrease ) inc *= -1;
3fe5b5
-	return inc;
3fe5b5
+  increaseOrDecreaseVolume(true, Volume::Both);
3fe5b5
 }
3fe5b5
 
3fe5b5
-void MDWSlider::increaseOrDecreaseVolume(bool decrease)
3fe5b5
+/**
3fe5b5
+ * Increase or decrease all playback and capture channels of the given control.
3fe5b5
+ * This method is very similar to Mixer::increaseOrDecreaseVolume(), but it will
3fe5b5
+ * auto-unmute on increase.
3fe5b5
+ *
3fe5b5
+ * @param mixdeviceID The control name
3fe5b5
+ * @param decrease true for decrease. false for increase
3fe5b5
+ */
3fe5b5
+void MDWSlider::increaseOrDecreaseVolume(bool decrease, Volume::VolumeTypeFlag volumeType)
3fe5b5
 {
3fe5b5
-	Volume& volP = m_mixdevice->playbackVolume();
3fe5b5
-	long inc = calculateStepIncrement(volP, decrease);
3fe5b5
+	kDebug() << "VolumeType=" << volumeType;
3fe5b5
+	if (volumeType & Volume::Playback)
3fe5b5
+	{
3fe5b5
+		kDebug() << "VolumeType=" << volumeType << "   p";
3fe5b5
+		Volume& volP = m_mixdevice->playbackVolume();
3fe5b5
+		long inc = volP.volumeStep(decrease);
3fe5b5
 
3fe5b5
-	if ( mixDevice()->id() == "PCM:0" )
3fe5b5
-	  kDebug() << ( decrease ? "decrease by " : "increase by " ) << inc ;
3fe5b5
+		if ( mixDevice()->id() == "PCM:0" )
3fe5b5
+		  kDebug() << ( decrease ? "decrease by " : "increase by " ) << inc ;
3fe5b5
 
3fe5b5
-	if (!decrease && m_mixdevice->isMuted())
3fe5b5
-	{
3fe5b5
-		// increasing from muted state: unmute and start with a low volume level
3fe5b5
-		if (mixDevice()->id() == "PCM:0")
3fe5b5
-			kDebug() << "set all to " << inc << "muted old=" << m_mixdevice->isMuted();
3fe5b5
+		if (!decrease && m_mixdevice->isMuted())
3fe5b5
+		{
3fe5b5
+			// increasing from muted state: unmute and start with a low volume level
3fe5b5
+			if (mixDevice()->id() == "PCM:0")
3fe5b5
+				kDebug() << "set all to " << inc << "muted old=" << m_mixdevice->isMuted();
3fe5b5
 
3fe5b5
-		m_mixdevice->setMuted(false);
3fe5b5
-		volP.setAllVolumes(inc);
3fe5b5
+			m_mixdevice->setMuted(false);
3fe5b5
+			volP.setAllVolumes(inc);
3fe5b5
+		}
3fe5b5
+		else
3fe5b5
+		{
3fe5b5
+			volP.changeAllVolumes(inc);
3fe5b5
+			if (mixDevice()->id() == "PCM:0")
3fe5b5
+				kDebug()
3fe5b5
+				<< (decrease ? "decrease by " : "increase by ") << inc;
3fe5b5
+		}
3fe5b5
 	}
3fe5b5
-	else
3fe5b5
+
3fe5b5
+	if (volumeType & Volume::Capture)
3fe5b5
 	{
3fe5b5
-		volP.changeAllVolumes(inc);
3fe5b5
-		if (mixDevice()->id() == "PCM:0")
3fe5b5
-			kDebug()
3fe5b5
-			<< (decrease ? "decrease by " : "increase by ") << inc;
3fe5b5
-	}
3fe5b5
+		kDebug() << "VolumeType=" << volumeType << "   c";
3fe5b5
 
3fe5b5
-	Volume& volC = m_mixdevice->captureVolume();
3fe5b5
-	inc = calculateStepIncrement(volC, decrease);
3fe5b5
-	volC.changeAllVolumes(inc);
3fe5b5
+		Volume& volC = m_mixdevice->captureVolume();
3fe5b5
+		long inc = volC.volumeStep(decrease);
3fe5b5
+		volC.changeAllVolumes(inc);
3fe5b5
+	}
3fe5b5
 
3fe5b5
 	// I should possibly not block, as the changes that come back from the Soundcard
3fe5b5
 	//      will be ignored (e.g. because of capture groups)
3fe5b5
@@ -1017,14 +1030,6 @@ void MDWSlider::increaseOrDecreaseVolume(bool decrease)
3fe5b5
 // 	m_view->blockSignals(oldViewBlockSignalState);
3fe5b5
 }
3fe5b5
 
3fe5b5
-/**
3fe5b5
-   This slot is called on a MouseWheel event. Also it is called by any other
3fe5b5
-    associated KAction like the context menu.
3fe5b5
- */
3fe5b5
-void MDWSlider::decreaseVolume()
3fe5b5
-{
3fe5b5
-  increaseOrDecreaseVolume(true);
3fe5b5
-}
3fe5b5
 
3fe5b5
 
3fe5b5
 void MDWSlider::moveStreamAutomatic()
3fe5b5
@@ -1262,12 +1267,28 @@ bool MDWSlider::eventFilter( QObject* obj, QEvent* e )
3fe5b5
 		if (qwe->orientation() == Qt::Horizontal) // Reverse horizontal scroll: bko228780 
3fe5b5
 			increase = !increase;
3fe5b5
 
3fe5b5
-		if (increase) {
3fe5b5
-			increaseVolume();
3fe5b5
-		}
3fe5b5
-		else {
3fe5b5
-			decreaseVolume();
3fe5b5
+		Volume::VolumeTypeFlag volumeType = Volume::Playback;
3fe5b5
+		QSlider *slider = static_cast<QSlider*>(obj);
3fe5b5
+		if (slider != 0)
3fe5b5
+		{
3fe5b5
+			kDebug();
3fe5b5
+			kDebug();
3fe5b5
+			kDebug() << "----------------------------- Slider is " << slider;
3fe5b5
+			// Mouse is over a slider. So lets apply the wheel event to playback or capture only
3fe5b5
+			if(m_slidersCapture.contains(slider))
3fe5b5
+			{
3fe5b5
+				kDebug() << "Slider is capture " << slider;
3fe5b5
+				volumeType = Volume::Capture;
3fe5b5
+			}
3fe5b5
 		}
3fe5b5
+
3fe5b5
+		increaseOrDecreaseVolume(!increase, volumeType);
3fe5b5
+//		if (increase) {
3fe5b5
+//			increaseVolume();
3fe5b5
+//		}
3fe5b5
+//		else {
3fe5b5
+//			decreaseVolume();
3fe5b5
+//		}
3fe5b5
 		
3fe5b5
 		Volume& volP = m_mixdevice->playbackVolume();
3fe5b5
 		volumeValues.push_back(volP.getVolume(extraData((QAbstractSlider*)obj).getChid()));
3fe5b5
diff --git a/gui/mdwslider.h b/gui/mdwslider.h
3fe5b5
index 3299859..a9b056f 100644
3fe5b5
--- a/gui/mdwslider.h
3fe5b5
+++ b/gui/mdwslider.h
3fe5b5
@@ -101,7 +101,7 @@ public slots:
3fe5b5
     void update();
3fe5b5
     void showMoveMenu();
3fe5b5
     virtual void showContextMenu( const QPoint &pos = QCursor::pos() );
3fe5b5
-    void increaseOrDecreaseVolume(bool arg1);
3fe5b5
+    void increaseOrDecreaseVolume(bool arg1, Volume::VolumeTypeFlag volumeType);
3fe5b5
     VolumeSliderExtraData& extraData(QAbstractSlider *slider);
3fe5b5
     void addMediaControls(QBoxLayout* arg1);
3fe5b5
 
3fe5b5
@@ -174,8 +174,6 @@ private:
3fe5b5
     bool m_sliderInWork;
3fe5b5
     int m_waitForSoundSetComplete;
3fe5b5
     QList<int> volumeValues;
3fe5b5
-
3fe5b5
-    long calculateStepIncrement ( Volume&vol, bool decrease );
3fe5b5
 };
3fe5b5
 
3fe5b5
 #endif
3fe5b5
-- 
3fe5b5
1.8.1.4
3fe5b5