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/main.qml b/applet/contents/ui/main.qml --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -391,7 +391,7 @@ Header { id: sinkViewHeader Layout.fillWidth: true - visible: sinkView.count > 0 + visible: sinkView.count > 1 text: i18n("Playback Devices") } ListView { @@ -409,13 +409,14 @@ boundsBehavior: Flickable.StopAtBounds; delegate: DeviceListItem { type: "sink" + onlyOne: sinkView.count == 1 } } Header { id: sourceViewHeader Layout.fillWidth: true - visible: sourceView.count > 0 + visible: sourceView.count > 1 text: i18n("Capture Devices") } ListView { @@ -433,6 +434,7 @@ boundsBehavior: Flickable.StopAtBounds; delegate: DeviceListItem { type: "source" + onlyOne: sourceView.count == 1 } } }