diff --git a/applet/contents/config/main.xml b/applet/contents/config/main.xml --- a/applet/contents/config/main.xml +++ b/applet/contents/config/main.xml @@ -12,6 +12,9 @@ 5 + + true + diff --git a/applet/contents/ui/ConfigGeneral.qml b/applet/contents/ui/ConfigGeneral.qml --- a/applet/contents/ui/ConfigGeneral.qml +++ b/applet/contents/ui/ConfigGeneral.qml @@ -25,35 +25,59 @@ Item { property alias cfg_maximumVolume: maximumVolume.value property alias cfg_volumeStep: volumeStep.value + property alias cfg_showOsd: showOsd.checked - GridLayout { - columns: 2 + ColumnLayout { Layout.fillWidth: true - Label { - Layout.alignment: Qt.AlignRight - text: i18n("Maximum volume:") - } + GroupBox { + Layout.fillWidth: true + flat: true + title: i18n("Volume") - SpinBox { - id: maximumVolume - minimumValue: 100 - maximumValue: 150 - stepSize: 1 - suffix: i18n("%") - } + GridLayout { + columns: 2 + Layout.fillWidth: true + + Label { + Layout.alignment: Qt.AlignRight + text: i18n("Maximum volume:") + } - Label { - Layout.alignment: Qt.AlignRight - text: i18n("Volume step:") + SpinBox { + id: maximumVolume + minimumValue: 100 + maximumValue: 150 + stepSize: 1 + suffix: i18n("%") + } + + Label { + Layout.alignment: Qt.AlignRight + text: i18n("Volume step:") + } + + SpinBox { + id: volumeStep + minimumValue: 1 + maximumValue: 100 + stepSize: 1 + suffix: i18n("%") + } + } } - SpinBox { - id: volumeStep - minimumValue: 1 - maximumValue: 100 - stepSize: 1 - suffix: i18n("%") + GroupBox { + Layout.fillWidth: true + flat: true + title: i18n("Behavior") + + ColumnLayout { + CheckBox { + id: showOsd + text: i18n("Show OSD") + } + } } } } diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -33,6 +33,7 @@ Item { id: main + property bool showOsd: Plasmoid.configuration.showOsd property int maxVolumePercent: Plasmoid.configuration.maximumVolume property int maxVolumeValue: Math.round(maxVolumePercent * PulseAudio.NormalVolume / 100.0) property int volumeStep: Math.round(Plasmoid.configuration.volumeStep * PulseAudio.NormalVolume / 100.0) @@ -68,7 +69,9 @@ var volume = boundVolume(sinkModel.defaultSink.volume + volumeStep); sinkModel.defaultSink.muted = false; sinkModel.defaultSink.volume = volume; - osd.show(volumePercent(volume, maxVolumeValue)); + if (showOsd) { + osd.show(volumePercent(volume, maxVolumeValue)); + } } function decreaseVolume() { @@ -78,16 +81,20 @@ var volume = boundVolume(sinkModel.defaultSink.volume - volumeStep); sinkModel.defaultSink.muted = false; sinkModel.defaultSink.volume = volume; - osd.show(volumePercent(volume, maxVolumeValue)); + if (showOsd) { + osd.show(volumePercent(volume, maxVolumeValue)); + } } function muteVolume() { if (!sinkModel.defaultSink) { return; } var toMute = !sinkModel.defaultSink.muted; sinkModel.defaultSink.muted = toMute; - osd.show(toMute ? 0 : volumePercent(sinkModel.defaultSink.volume, maxVolumeValue)); + if (showOsd) { + osd.show(toMute ? 0 : volumePercent(sinkModel.defaultSink.volume, maxVolumeValue)); + } } function increaseMicrophoneVolume() { @@ -97,7 +104,9 @@ var volume = boundVolume(sourceModel.defaultSource.volume + volumeStep); sourceModel.defaultSource.muted = false; sourceModel.defaultSource.volume = volume; - osd.showMicrophone(volumePercent(volume)); + if (showOsd) { + osd.showMicrophone(volumePercent(volume)); + } } function decreaseMicrophoneVolume() { @@ -107,16 +116,20 @@ var volume = boundVolume(sourceModel.defaultSource.volume - volumeStep); sourceModel.defaultSource.muted = false; sourceModel.defaultSource.volume = volume; - osd.showMicrophone(volumePercent(volume)); + if (showOsd) { + osd.showMicrophone(volumePercent(volume)); + } } function muteMicrophone() { if (!sourceModel.defaultSource) { return; } var toMute = !sourceModel.defaultSource.muted; sourceModel.defaultSource.muted = toMute; - osd.showMicrophone(toMute? 0 : volumePercent(sourceModel.defaultSource.volume)); + if (showOsd) { + osd.showMicrophone(toMute? 0 : volumePercent(sourceModel.defaultSource.volume)); + } } function beginMoveStream(type, stream) {