[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdemultimedia/kmix
From: Christian Esken <esken () kde ! org>
Date: 2011-08-09 21:31:06
Message-ID: 20110809213106.4647CAC871 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1246058 by esken:
FEATURE: 189995
Percentage of a volume change (MouseWheel, DBUS) can be configured in kmixrc (e.g. \
VolumePercentageStep=2.5)
M +9 -0 apps/kmix.cpp
M +5 -4 core/mixer.cpp
M +1 -0 core/mixer.h
M +1 -1 gui/kmixdockwidget.cpp
M +2 -1 gui/ksmallslider.cpp
M +2 -2 gui/mdwslider.cpp
--- trunk/KDE/kdemultimedia/kmix/apps/kmix.cpp #1246057:1246058
@@ -434,6 +434,15 @@
//}
QString mixerIgnoreExpression = config.readEntry( "MixerIgnoreExpression", \
"Modem" );
MixerToolBox::instance()->setMixerIgnoreExpression(mixerIgnoreExpression);
+
+ QString volumePercentageStepString = config.readEntry( "VolumePercentageStep" );
+ if ( ! volumePercentageStepString.isNull())
+ {
+ float volumePercentageStep = volumePercentageStepString.toFloat();
+ if ( volumePercentageStep > 0 && volumePercentageStep <= 100)
+ Mixer::VOLUME_STEP_DIVISOR = (100 / volumePercentageStep);
+ }
+
m_backendFilter = config.readEntry<>( "Backends", QList<QString>() );
kDebug() << "Backends: " << m_backendFilter;
--- trunk/KDE/kdemultimedia/kmix/core/mixer.cpp #1246057:1246058
@@ -38,6 +38,7 @@
QList<Mixer *> Mixer::s_mixers;
MasterControl Mixer::_globalMasterCurrent;
MasterControl Mixer::_globalMasterPreferred;
+float Mixer::VOLUME_STEP_DIVISOR = 20;
int Mixer::numDrivers()
@@ -538,14 +539,14 @@
if (md != 0) {
Volume& volP=md->playbackVolume();
if ( volP.hasVolume() ) {
- double step = (volP.maxVolume()-volP.minVolume()+1) / 20;
+ double step = (volP.maxVolume()-volP.minVolume()+1) / \
Mixer::VOLUME_STEP_DIVISOR; if ( step < 1 ) step = 1;
volP.changeAllVolumes(step);
}
Volume& volC=md->captureVolume();
if ( volC.hasVolume() ) {
- double step = (volC.maxVolume()-volC.minVolume()+1) / 20;
+ double step = (volC.maxVolume()-volC.minVolume()+1) / \
Mixer::VOLUME_STEP_DIVISOR; if ( step < 1 ) step = 1;
volC.changeAllVolumes(step);
}
@@ -566,14 +567,14 @@
if (md != 0) {
Volume& volP=md->playbackVolume();
if ( volP.hasVolume() ) {
- double step = (volP.maxVolume()-volP.minVolume()+1) / 20;
+ double step = (volP.maxVolume()-volP.minVolume()+1) / \
Mixer::VOLUME_STEP_DIVISOR; if ( step < 1 ) step = 1;
volP.changeAllVolumes(-step);
}
Volume& volC=md->captureVolume();
if ( volC.hasVolume() ) {
- double step = (volC.maxVolume()-volC.minVolume()+1) / 20;
+ double step = (volC.maxVolume()-volC.minVolume()+1) / \
Mixer::VOLUME_STEP_DIVISOR; if ( step < 1 ) step = 1;
volC.changeAllVolumes(-step);
}
--- trunk/KDE/kdemultimedia/kmix/core/mixer.h #1246057:1246058
@@ -158,6 +158,7 @@
/// get the actual MixSet
MixSet getMixSet();
+ static float VOLUME_STEP_DIVISOR;
/// DBUS oriented methods
virtual void increaseVolume( const QString& mixdeviceID );
--- trunk/KDE/kdemultimedia/kmix/gui/kmixdockwidget.cpp #1246057:1246058
@@ -389,7 +389,7 @@
if ( md != 0 )
{
Volume &vol = ( md->playbackVolume().hasVolume() ) ? md->playbackVolume() : \
md->captureVolume();
- int inc = vol.maxVolume() / 20;
+ int inc = vol.maxVolume() / Mixer::VOLUME_STEP_DIVISOR;
if ( inc < 1 ) inc = 1;
--- trunk/KDE/kdemultimedia/kmix/gui/ksmallslider.cpp #1246057:1246058
@@ -34,6 +34,7 @@
#include "kglobalsettings.h"
#include "ksmallslider.h"
+#include "core/mixer.h"
KSmallSlider::KSmallSlider( int minValue, int maxValue, int pageStep,
int value, Qt::Orientation orientation,
@@ -309,7 +310,7 @@
void KSmallSlider::wheelEvent( QWheelEvent * e)
{
// kDebug(67100) << "KSmallslider::wheelEvent()";
- int inc = ( maximum() - minimum() ) / 20;
+ int inc = ( maximum() - minimum() ) / Mixer::VOLUME_STEP_DIVISOR;
if ( inc < 1)
inc = 1;
--- trunk/KDE/kdemultimedia/kmix/gui/mdwslider.cpp #1246057:1246058
@@ -991,7 +991,7 @@
void MDWSlider::increaseOrDecreaseVolume(bool decrease)
{
Volume& volP = m_mixdevice->playbackVolume();
- long inc = volP.maxVolume() / 20;
+ long inc = volP.maxVolume() / Mixer::VOLUME_STEP_DIVISOR;
if ( inc == 0 ) inc = 1;
if ( decrease ) inc *= -1;
if ( mixDevice()->id() == "Headphone:0" )
@@ -1007,7 +1007,7 @@
volP.changeAllVolumes(inc);
Volume& volC = m_mixdevice->captureVolume();
- inc = volC.maxVolume() / 20;
+ inc = volC.maxVolume() / Mixer::VOLUME_STEP_DIVISOR;
if ( inc == 0 ) inc = 1;
if ( decrease ) inc *= -1;
volC.changeAllVolumes(inc);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic