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 @@ -24,6 +24,7 @@ import org.kde.kquickcontrolsaddons 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 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 @@ -52,12 +53,15 @@ RowLayout { id: rowLayout - width: parent.width + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: LayoutMirroring.enabled ? 0 : units.smallSpacing + anchors.leftMargin: LayoutMirroring.enabled ? units.smallSpacing : 0 spacing: units.smallSpacing PlasmaCore.IconItem { id: clientIcon - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.preferredHeight: column.height * 0.75 Layout.preferredWidth: Layout.preferredHeight source: "unknown" @@ -116,6 +120,7 @@ wrapMode: Text.NoWrap elide: Text.ElideRight } + SmallToolButton { id: contextMenuButton icon: "application-menu" @@ -214,6 +219,24 @@ text: i18nc("only used for sizing, should be widest possible string", "100%") } } + + RowLayout { + Layout.fillWidth: true + + Item { + Layout.fillWidth: true + } + + PlasmaComponents3.Button { + id: defaultButton + text: i18n("Default Device") + icon.name: "favorite" + checkable: true + checked: PulseObject.default + visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1) + onClicked: PulseObject.default = true; + } + } } } @@ -265,28 +288,6 @@ function loadDynamicActions() { contextMenu.clearMenuItems(); - // Mute - var menuItem = newMenuItem(); - menuItem.text = i18nc("Checkable switch for (un-)muting sound output.", "Mute"); - menuItem.checkable = true; - menuItem.checked = Muted; - menuItem.clicked.connect(function() { - Muted = !Muted - }); - contextMenu.addMenuItem(menuItem); - - // Default - if (typeof PulseObject.default === "boolean") { - var menuItem = newMenuItem(); - menuItem.text = i18nc("Checkable switch to change the current default output.", "Default"); - menuItem.checkable = true; - menuItem.checked = PulseObject.default - menuItem.clicked.connect(function() { - PulseObject.default = true - }); - contextMenu.addMenuItem(menuItem); - } - // Raise max volume menuItem = newMenuItem(); menuItem.text = i18n("Raise maximum volume"); diff --git a/src/kcm/package/contents/ui/DefaultDeviceButton.qml b/src/kcm/package/contents/ui/DefaultDeviceButton.qml deleted file mode 100644 --- a/src/kcm/package/contents/ui/DefaultDeviceButton.qml +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright 2016 David Rosca - - 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.Controls 1.0 - -RadioButton { - property bool isDefault: true - - checked: isDefault - text: checked ? i18nd("kcm_pulseaudio", "Default") : "" - onIsDefaultChanged: checked = isDefault -} diff --git a/src/kcm/package/contents/ui/DeviceListItem.qml b/src/kcm/package/contents/ui/DeviceListItem.qml --- a/src/kcm/package/contents/ui/DeviceListItem.qml +++ b/src/kcm/package/contents/ui/DeviceListItem.qml @@ -44,17 +44,16 @@ text: Description } - DefaultDeviceButton { + Button { + text: i18n("Default device") + icon.name: "favorite" visible: delegate.ListView.view.count > 1 - isDefault: Default - onCheckedChanged: { - if (!checked) { - // Cannot unset default device - checked = isDefault; - } else { - Default = true; - } - } + checkable: true + // FIXME: this binding doesn't seem to have any effect; after the + // default device changes, but old device's button doesn't become + // unchecked + checked: Default + onClicked: Default = true; } MuteButton { diff --git a/src/kcm/package/contents/ui/MuteButton.qml b/src/kcm/package/contents/ui/MuteButton.qml --- a/src/kcm/package/contents/ui/MuteButton.qml +++ b/src/kcm/package/contents/ui/MuteButton.qml @@ -21,7 +21,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.0 -ToolButton { +Button { property bool muted: true iconName: 'audio-volume-muted'