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 @@ -15,6 +15,18 @@ true + + + true + + + + true + + + + true + 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 @@ -29,6 +29,9 @@ Kirigami.FormLayout { property alias cfg_volumeStep: volumeStep.value property alias cfg_volumeFeedback: volumeFeedback.checked + property alias cfg_volumeOsd: volumeOsd.checked + property alias cfg_micOsd: micOsd.checked + property alias cfg_muteOsd: muteOsd.checked property alias cfg_outputChangeOsd: outputChangeOsd.checked VolumeFeedback { @@ -62,14 +65,34 @@ QQC2.CheckBox { id: volumeFeedback - Kirigami.FormData.label: i18n("Feedback:") + Kirigami.FormData.label: i18n("Play audio feedback for changes to:") - text: i18n("Play sound when volume changes") + text: i18n("Audio volume") enabled: feedback.valid } + Item { + Kirigami.FormData.isSection: true + } + + QQC2.CheckBox { + id: volumeOsd + Kirigami.FormData.label: i18n("Show visual feedback for changes to:") + text: i18n("Audio volume") + } + + QQC2.CheckBox { + id: micOsd + text: i18n("Microphone sensitivity") + } + + QQC2.CheckBox { + id: muteOsd + text: i18n("Mute state") + } + QQC2.CheckBox { id: outputChangeOsd - text: i18n("Display notification when default output device changes") + text: i18n("Default output device") } } 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 @@ -101,7 +101,7 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSinkModel.preferredSink.muted = percent == 0; paSinkModel.preferredSink.volume = volume; - osd.show(percent); + osd.showVolume(percent); playFeedback(); } @@ -113,7 +113,7 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSinkModel.preferredSink.muted = percent == 0; paSinkModel.preferredSink.volume = volume; - osd.show(percent); + osd.showVolume(percent); playFeedback(); } @@ -124,13 +124,13 @@ var toMute = !paSinkModel.preferredSink.muted; if (toMute) { enableGlobalMute(); - osd.show(0); + osd.showMute(0); } else { if (globalMute) { disableGlobalMute(); } paSinkModel.preferredSink.muted = toMute; - osd.show(volumePercent(paSinkModel.preferredSink.volume, currentMaxVolumeValue)); + osd.showMute(volumePercent(paSinkModel.preferredSink.volume, currentMaxVolumeValue)); playFeedback(); } } @@ -143,7 +143,7 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSourceModel.defaultSource.muted = percent == 0; paSourceModel.defaultSource.volume = volume; - osd.showMicrophone(percent); + osd.showMic(percent); } function decreaseMicrophoneVolume() { @@ -154,16 +154,16 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSourceModel.defaultSource.muted = percent == 0; paSourceModel.defaultSource.volume = volume; - osd.showMicrophone(percent); + osd.showMic(percent); } function muteMicrophone() { if (!paSourceModel.defaultSource) { return; } var toMute = !paSourceModel.defaultSource.muted; paSourceModel.defaultSource.muted = toMute; - osd.showMicrophone(toMute? 0 : volumePercent(paSourceModel.defaultSource.volume, currentMaxVolumeValue)); + osd.showMicMute(toMute? 0 : volumePercent(paSourceModel.defaultSource.volume, currentMaxVolumeValue)); } function playFeedback(sinkIndex) { @@ -176,6 +176,7 @@ feedback.play(sinkIndex); } + function enableGlobalMute() { var role = paSinkModel.role("Muted"); var rowCount = paSinkModel.rowCount(); @@ -358,6 +359,30 @@ VolumeOSD { id: osd + + function showVolume(text) { + if (!main.Plasmoid.configuration.volumeOsd) + return + show(text) + } + + function showMute(text) { + if (!main.Plasmoid.configuration.muteOsd) + return + show(text) + } + + function showMic(text) { + if (!main.Plasmoid.configuration.micOsd) + return + showMicrophone(text) + } + + function showMicMute(text) { + if (!main.Plasmoid.configuration.muteOsd) + return + showMicrophone(text) + } } VolumeFeedback {