Commit 1651d9b8 authored by Giusy Margarita's avatar Giusy Margarita Committed by Jonathan Marten
Browse files

Add ability to configure volume step percentage in the GUI

The setting [Global]VolumePercentageStep has been available for some
time, but there is no GUI.  A suitable step varies with hardware,
so add a setting to the Configure KMix - General page.

Differential Revision: https://phabricator.kde.org/D29663
parent a9d496e9
......@@ -1285,4 +1285,3 @@ void KMixWindow::newMixerShown(int /*tabIndex*/)
action->setVisible(!view->isDynamic());
}
}
......@@ -31,6 +31,7 @@ GlobalConfig::GlobalConfig() :
addItemBool("Labels", data.showLabels, true);
addItemBool("VolumeOverdrive", data.volumeOverdrive, false);
addItemBool("VolumeFeedback", data.beepOnVolumeChange, true);
addItemString("VolumePercentageStep", data.VolumePercentageStep, "5");
// ItemString* is =
addItemString("Orientation", data.orientationMainGUIString, "Vertical");
// qCDebug(KMIX_LOG) << is->name() << is->value();
......
......@@ -42,6 +42,7 @@ public:
bool volumeOverdrive; // whether more than recommended volume (typically 0dB) is allowed
bool beepOnVolumeChange;
QString VolumePercentageStep;
// Startup
bool allowAutostart;
......
......@@ -24,6 +24,7 @@
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlabel.h>
#include <qradiobutton.h>
#include <qgroupbox.h>
......@@ -209,6 +210,7 @@ void KMixPrefDlg::createGeneralTab()
m_volumeOverdrive = new QCheckBox(i18n("Volume overdrive"), grp);
addWidgetToLayout(m_volumeOverdrive, behaviorLayout, 10, i18nc("@info:tooltip", "Raise the maximum volume to 150%"), "VolumeOverdrive");
// Volume Feedback Warning
volumeFeedbackWarning = new KMessageWidget(
i18n("Volume feedback and volume overdrive are only available for PulseAudio."), grp);
volumeFeedbackWarning->setIcon(QIcon::fromTheme("dialog-warning"));
......@@ -218,8 +220,27 @@ void KMixPrefDlg::createGeneralTab()
volumeFeedbackWarning->setVisible(false);
addWidgetToLayout(volumeFeedbackWarning, behaviorLayout, 2, "", "");
// Volume Step Grid
QGridLayout* horizontalGrid = new QGridLayout();
horizontalGrid->setHorizontalSpacing(DialogBase::horizontalSpacing());
// Volume Step SpinBox
m_volumeStep = new QSpinBox(grp);
m_volumeStep->setSuffix(" %");
m_volumeStep->setRange(1, 50);
// Register SpinBox for KConfig
m_volumeStep->setObjectName("kcfg_VolumePercentageStep");
horizontalGrid->addWidget(new QLabel(i18n("Volume step:"), m_generalTab), 0, 0, Qt::AlignLeft);
horizontalGrid->addWidget(m_volumeStep, 0, 1, Qt::AlignLeft);
horizontalGrid->addItem(new QSpacerItem(1 ,1 , QSizePolicy::Expanding), 0, 2);
// Add grid to behavior layout
behaviorLayout->addLayout(horizontalGrid);
// Volume Step and Overdrive Warning
volumeOverdriveWarning = new KMessageWidget(
i18n("KMix must be restarted for the Volume Overdrive setting to take effect."), grp);
i18n("KMix must be restarted for the Volume Step and Overdrive settings to take effect."), grp);
volumeOverdriveWarning->setIcon(QIcon::fromTheme("dialog-information"));
volumeOverdriveWarning->setMessageType(KMessageWidget::Information);
volumeOverdriveWarning->setCloseButtonVisible(false);
......@@ -465,7 +486,3 @@ void KMixPrefDlg::replaceBackendsInTab()
dvcSpacerBelow = new QSpacerItem(1,1);
layoutControlsTab->addItem(dvcSpacerBelow);
}
......@@ -28,6 +28,7 @@ class KMixPrefWidget;
class QBoxLayout;
class QCheckBox;
class QSpinBox;
class QFrame;
class QGridLayout;
class QRadioButton;
......@@ -110,6 +111,7 @@ private:
KMessageWidget *allowAutostartWarning;
QCheckBox *m_beepOnVolumeChange;
QCheckBox *m_volumeOverdrive;
QSpinBox *m_volumeStep;
KMessageWidget *volumeFeedbackWarning;
KMessageWidget *volumeOverdriveWarning;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment