Commit d915cbd6 authored by Arjen Hiemstra's avatar Arjen Hiemstra Committed by Nate Graham
Browse files

Applet: Hide virtual devices by default

Virtual devices are generally created by filters and other special
handling. It doesn't usually make sense to show these, especially when
they are vendor-provided. However, there are use cases to have them
visible, so make it configurable.
parent 57b0485f
Pipeline #157111 failed with stage
in 50 seconds
......@@ -41,6 +41,9 @@
<entry name="globalMuteDevices" type="StringList">
<label>Devices that were not muted with global mute, and will remain muted afterwards.</label>
</entry>
<entry name="showVirtualDevices" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -19,6 +19,7 @@ Kirigami.FormLayout {
property alias cfg_micOsd: micOsd.checked
property alias cfg_muteOsd: muteOsd.checked
property alias cfg_outputChangeOsd: outputChangeOsd.checked
property alias cfg_showVirtualDevices: showVirtualDevices.checked
VolumeFeedback {
id: feedback
......@@ -45,7 +46,6 @@ Kirigami.FormLayout {
}
}
Item {
Kirigami.FormData.isSection: true
}
......@@ -84,4 +84,14 @@ Kirigami.FormLayout {
id: outputChangeOsd
text: i18n("Default output device")
}
Item {
Kirigami.FormData.isSection: true
}
QQC2.CheckBox {
id: showVirtualDevices
Kirigami.FormData.label: i18nc("@title", "Display:")
text: i18n("Show virtual devices")
}
}
......@@ -28,6 +28,8 @@ Item {
property string displayName: i18n("Audio Volume")
property QtObject draggedStream: null
property bool showVirtualDevices: Plasmoid.configuration.showVirtualDevices
// DEFAULT_SINK_NAME in module-always-sink.c
readonly property string dummyOutputName: "auto_null"
......@@ -270,6 +272,7 @@ Item {
sortRole: "SortByDefault"
sortOrder: Qt.DescendingOrder
filterOutInactiveDevices: true
filterVirtualDevices: main.showVirtualDevices
sourceModel: paSinkModel
}
......@@ -279,6 +282,7 @@ Item {
sortRole: "SortByDefault"
sortOrder: Qt.DescendingOrder
filterOutInactiveDevices: true
filterVirtualDevices: main.showVirtualDevices
sourceModel: paSourceModel
}
......
......@@ -5,6 +5,11 @@ import org.kde.plasma.private.volume 0.1
PlasmaCore.SortFilterModel {
property var filters: []
property bool filterOutInactiveDevices: false
property bool filterVirtualDevices: false
onFilterVirtualDevicesChanged: {
invalidate()
}
function role(name) {
return sourceModel.role(name);
......@@ -36,6 +41,11 @@ PlasmaCore.SortFilterModel {
return false;
}
}
if (filterVirtualDevices && sourceModel.data(idx, sourceModel.role("PulseObject")).virtualDevice) {
return false;
}
return true;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment