Commit 86038b5b authored by Nate Graham's avatar Nate Graham
Browse files

Simplify display when there's only a single input device and a single output device

Summary: The Audio Volume plasmoid has always seemed a bit too heavy and complicated for the common use case of a single input device and a single output device, or apps playing audio but not also recording audio. This patch presents a simplified UI for those use cases.

Test Plan:
Before, Devices tab, single devices:
{F5746567}

After, Devices tab, single devices:
{F5746568}

After, Applications tab, only playback streams:
{F5752982}

As I lack the hardware to test the multi-device use case, testing by others would be appreciated.

Reviewers: #plasma, drosca, #vdg

Reviewed By: drosca

Subscribers: mart, Zren, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11166
parent 359ec78c
......@@ -22,9 +22,21 @@ import QtQuick 2.0
ListItemBase {
readonly property var currentPort: Ports[ActivePortIndex]
property bool onlyOne: false
draggable: false
label: currentPort ? i18nc("label of device items", "%1 (%2)", currentPort.description, Description) : Description
label: {
if (!currentPort) {
return Description
} else {
if (onlyOne) {
return currentPort.description
} else {
return i18nc("label of device items", "%1 (%2)", currentPort.description, Description)
}
}
}
labelOpacity: onlyOne ? 1 : 0.6
icon: {
switch(FormFactor) {
case "internal":
......
......@@ -35,6 +35,7 @@ PlasmaComponents.ListItem {
id: item
property alias label: textLabel.text
property alias labelOpacity: textLabel.opacity
property alias draggable: dragArea.enabled
property alias icon: clientIcon.source
property string type
......
......@@ -25,6 +25,19 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.private.volume 0.1
ListItemBase {
label: Client ? i18nc("label of stream items", "%1: %2", Client.name, Name) : Name
property bool onlyOne: false
label: {
if (! Client) {
return Name
} else {
if (onlyOne) {
return Client.name
} else {
return i18nc("label of stream items", "%1 (%2)", Client.name, Name)
}
}
}
labelOpacity: onlyOne ? 1 : 0.6
icon: IconName
}
......@@ -330,13 +330,14 @@ Item {
ColumnLayout {
id: streamsView
visible: tabBar.currentTab == streamsTab
readonly property bool simpleMode: (sinkInputView.count >= 1 && sourceOutputView.count == 0) || (sinkInputView.count == 0 && sourceOutputView.count >= 1)
property int maximumWidth: scrollView.viewport.width
width: maximumWidth
Layout.maximumWidth: maximumWidth
Header {
Layout.fillWidth: true
visible: sinkInputView.count > 0
visible: sinkInputView.count > 0 && !streamsView.simpleMode
text: i18n("Playback Streams")
}
ListView {
......@@ -354,12 +355,13 @@ Item {
delegate: StreamListItem {
type: "sink-input"
draggable: sinkView.count > 1
onlyOne: streamsView.simpleMode
}
}
Header {
Layout.fillWidth: true
visible: sourceOutputView.count > 0
visible: sourceOutputView.count > 0 && !streamsView.simpleMode
text: i18n("Capture Streams")
}
ListView {
......@@ -377,6 +379,7 @@ Item {
delegate: StreamListItem {
type: "source-input"
draggable: sourceView.count > 1
onlyOne: streamsView.simpleMode
}
}
}
......@@ -384,6 +387,7 @@ Item {
ColumnLayout {
id: devicesView
visible: tabBar.currentTab == devicesTab
readonly property bool simpleMode: sinkView.count == 1 && sourceView.count == 1
property int maximumWidth: scrollView.viewport.width
width: maximumWidth
Layout.maximumWidth: maximumWidth
......@@ -391,7 +395,7 @@ Item {
Header {
id: sinkViewHeader
Layout.fillWidth: true
visible: sinkView.count > 0
visible: sinkView.count > 0 && !devicesView.simpleMode
text: i18n("Playback Devices")
}
ListView {
......@@ -409,13 +413,14 @@ Item {
boundsBehavior: Flickable.StopAtBounds;
delegate: DeviceListItem {
type: "sink"
onlyOne: devicesView.simpleMode
}
}
Header {
id: sourceViewHeader
Layout.fillWidth: true
visible: sourceView.count > 0
visible: sourceView.count > 0 && !devicesView.simpleMode
text: i18n("Capture Devices")
}
ListView {
......@@ -433,6 +438,7 @@ Item {
boundsBehavior: Flickable.StopAtBounds;
delegate: DeviceListItem {
type: "source"
onlyOne: devicesView.simpleMode
}
}
}
......
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