diff --git a/applet/contents/ui/DeviceListItem.qml b/applet/contents/ui/DeviceListItem.qml --- a/applet/contents/ui/DeviceListItem.qml +++ b/applet/contents/ui/DeviceListItem.qml @@ -22,9 +22,21 @@ 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": 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 @@ -35,6 +35,7 @@ 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 diff --git a/applet/contents/ui/StreamListItem.qml b/applet/contents/ui/StreamListItem.qml --- a/applet/contents/ui/StreamListItem.qml +++ b/applet/contents/ui/StreamListItem.qml @@ -25,6 +25,19 @@ 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 } diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -330,13 +330,14 @@ 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 @@ 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,21 +379,23 @@ delegate: StreamListItem { type: "source-input" draggable: sourceView.count > 1 + onlyOne: streamsView.simpleMode } } } 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 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 @@ 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 @@ boundsBehavior: Flickable.StopAtBounds; delegate: DeviceListItem { type: "source" + onlyOne: devicesView.simpleMode } } }