diff --git a/app/qml/mpris.qml b/app/qml/mpris.qml --- a/app/qml/mpris.qml +++ b/app/qml/mpris.qml @@ -29,6 +29,16 @@ property QtObject pluginInterface title: i18n("Multimedia Controls") + function soundState(volume) + { + if (volume <= 25) { + return "audio-volume-low" + } else if (volume <= 75) { + return "audio-volume-medium" + } else { + return "audio-volume-high" + } + } Label { id: noPlayersText text: i18n("No players available") @@ -103,11 +113,22 @@ } RowLayout { Layout.fillWidth: true - Label { text: i18n("Volume:") } + Button { + id: muteButton + onClicked: { + root.pluginInterface.volume = root.pluginInterface.volume ? 0 : 100 + muteButton.icon.name = soundState(root.pluginInterface.volume) + } + Component.onCompleted: muteButton.icon.name = soundState(root.pluginInterface.volume) + } Slider { value: root.pluginInterface.volume to: 100 Layout.fillWidth: true + onValueChanged: { + root.pluginInterface.volume = value + muteButton.icon.name = soundState(root.pluginInterface.volume) + } } } Item { Layout.fillHeight: true }