diff --git a/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml b/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml index 2f89d33cc9ab6b1b05a57243e583c1b7d18e0d4b..5a76f5640582ea8b557f1b79a922f5b4efaf43f1 100644 --- a/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml +++ b/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml @@ -29,7 +29,7 @@ import org.kde.kcoreaddons 1.0 as KCoreAddons import org.kde.kirigami 2.4 as Kirigami import QtGraphicalEffects 1.0 -Item { +PlasmaComponents3.Page { id: expandedRepresentation Layout.minimumWidth: units.gridUnit * 14 @@ -455,32 +455,46 @@ Item { } } } + } - PlasmaComponents3.ComboBox { - Layout.fillWidth: true - Layout.leftMargin: units.gridUnit*2 - Layout.rightMargin: units.gridUnit*2 - - id: playerCombo - textRole: "text" - visible: model.length > 2 // more than one player, @multiplex is always there - model: root.mprisSourcesModel - - onModelChanged: { - // if model changes, ComboBox resets, so we try to find the current player again... - for (var i = 0, length = model.length; i < length; ++i) { - if (model[i].source === mpris2Source.current) { - currentIndex = i - break + footer: PlasmaExtras.PlasmoidHeading { + location: PlasmaExtras.PlasmoidHeading.Location.Footer + visible: playerList.model.length > 2 // more than one player, @multiplex is always there + + RowLayout { + anchors.fill: parent + + PlasmaComponents3.TabBar { + id: playerSelector + position: PlasmaComponents3.TabBar.Footer + + Layout.fillWidth: true + implicitHeight: contentHeight + + Repeater { + id: playerList + model: root.mprisSourcesModel + + delegate: PlasmaComponents3.TabButton { + icon.name: modelData["icon"] + icon.height: PlasmaCore.Units.iconSizes.smallMedium + Accessible.name: modelData["text"] + PlasmaComponents3.ToolTip { + text: modelData["text"] + } + onClicked: { + disablePositionUpdate = true + mpris2Source.current = modelData["source"]; + disablePositionUpdate = false + } } - } - } - onActivated: { - disablePositionUpdate = true - // ComboBox has currentIndex and currentText, why doesn't it have currentItem/currentModelValue? - mpris2Source.current = model[index].source - disablePositionUpdate = false + onModelChanged: { + playerSelector.currentIndex = model.findIndex( + (data) => { return data.source === mpris2Source.current } + ) + } + } } } } diff --git a/applets/mediacontroller/contents/ui/main.qml b/applets/mediacontroller/contents/ui/main.qml index 23ad8f759812e452cb07bbc570cd63d153827ba4..a12c8a2178c187ffef8a96dcf52525a07505310b 100644 --- a/applets/mediacontroller/contents/ui/main.qml +++ b/applets/mediacontroller/contents/ui/main.qml @@ -293,7 +293,7 @@ Item { model.push({ 'text': mpris2Source.data[source]["Identity"], - 'icon': mpris2Source.data[source]["Desktop Icon Name"] || mpris2Source.data[source]["Desktop Entry"] || source, + 'icon': mpris2Source.data[source]["Desktop Icon Name"] || mpris2Source.data[source]["DesktopEntry"] || "emblem-music-symbolic", 'source': source }); }