diff --git a/applet/contents/code/icon.js b/applet/contents/code/icon.js --- a/applet/contents/code/icon.js +++ b/applet/contents/code/icon.js @@ -18,17 +18,20 @@ License along with this library. If not, see . */ -function name(volume, muted) { +function name(volume, muted, prefix) { + if (!prefix) { + prefix = "audio-volume"; + } var icon = null; var percent = volume / maxVolumeValue; if (percent <= 0.0 || muted) { - icon = "audio-volume-muted"; + icon = prefix + "-muted"; } else if (percent <= 0.25) { - icon = "audio-volume-low"; + icon = prefix + "-low"; } else if (percent <= 0.75) { - icon = "audio-volume-medium"; + icon = prefix + "-medium"; } else { - icon = "audio-volume-high"; + icon = prefix + "-high"; } return icon; } diff --git a/applet/contents/ui/ListItemBase.qml b/applet/contents/ui/ListItemBase.qml --- a/applet/contents/ui/ListItemBase.qml +++ b/applet/contents/ui/ListItemBase.qml @@ -27,9 +27,10 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.draganddrop 2.0 as DragAndDrop - import org.kde.plasma.private.volume 0.1 +import "../code/icon.js" as Icon + PlasmaComponents.ListItem { id: item @@ -117,11 +118,11 @@ } RowLayout { - VolumeIcon { - Layout.maximumHeight: slider.height * 0.75 - Layout.maximumWidth: slider.height* 0.75 - volume: Volume - muted: Muted + PlasmaCore.IconItem { + readonly property bool isPlayback: type.substring(0, 4) == "sink" + Layout.maximumHeight: slider.height * 0.85 + Layout.maximumWidth: slider.height * 0.85 + source: Icon.name(Volume, Muted, isPlayback ? "audio-volume" : "microphone-sensitivity") MouseArea { anchors.fill: parent diff --git a/applet/contents/ui/VolumeIcon.qml b/applet/contents/ui/VolumeIcon.qml deleted file mode 100644 --- a/applet/contents/ui/VolumeIcon.qml +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright 2014-2015 Harald Sitter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 - -import org.kde.plasma.core 2.0 as PlasmaCore - -import org.kde.plasma.private.volume 0.1 - -import "../code/icon.js" as Icon - -PlasmaCore.SvgItem { - property int volume - property bool muted - - svg: PlasmaCore.Svg { imagePath: "icons/audio" } - elementId: Icon.name(volume, muted) -}