shell: sliding mpris player select ui
This commit is contained in:
parent
f6caa3e209
commit
789228079c
1 changed files with 23 additions and 8 deletions
|
@ -336,11 +336,29 @@ FullwidthMouseArea {
|
||||||
implicitHeight: playerSelector.implicitHeight + 20
|
implicitHeight: playerSelector.implicitHeight + 20
|
||||||
implicitWidth: playerSelector.implicitWidth
|
implicitWidth: playerSelector.implicitWidth
|
||||||
|
|
||||||
RowLayout { //ScrollView {
|
Rectangle {
|
||||||
id: playerSelector
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
implicitWidth: 50
|
||||||
|
implicitHeight: 50
|
||||||
|
radius: 5
|
||||||
|
color: "#20ceffff"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout { //ScrollView {
|
||||||
|
property Item selectedPlayerDisplay: null;
|
||||||
|
onSelectedPlayerDisplayChanged: console.log(selectedPlayerDisplay)
|
||||||
|
id: playerSelector
|
||||||
|
x: parent.width / 2 - (selectedPlayerDisplay ? selectedPlayerDisplay.x + selectedPlayerDisplay.width / 2 : 0)
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: Math.min(implicitWidth, playerSelectorContainment.width)
|
width: Math.min(implicitWidth, playerSelectorContainment.width)
|
||||||
|
|
||||||
|
Behavior on x {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 400
|
||||||
|
easing.type: Easing.OutExpo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//RowLayout {
|
//RowLayout {
|
||||||
Repeater {
|
Repeater {
|
||||||
model: Mpris.players
|
model: Mpris.players
|
||||||
|
@ -348,28 +366,25 @@ FullwidthMouseArea {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
required property MprisPlayer modelData;
|
required property MprisPlayer modelData;
|
||||||
readonly property bool selected: modelData == player;
|
readonly property bool selected: modelData == player;
|
||||||
|
onSelectedChanged: if (selected) playerSelector.selectedPlayerDisplay = this;
|
||||||
|
|
||||||
implicitWidth: childrenRect.width
|
implicitWidth: childrenRect.width
|
||||||
implicitHeight: childrenRect.height
|
implicitHeight: childrenRect.height
|
||||||
|
|
||||||
onClicked: MprisController.setActivePlayer(modelData);
|
onClicked: MprisController.setActivePlayer(modelData);
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
implicitWidth: 50
|
implicitWidth: 50
|
||||||
implicitHeight: 50
|
implicitHeight: 50
|
||||||
radius: 5
|
|
||||||
color: selected ? "#20ceffff" : "transparent"
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 5
|
anchors.margins: 5
|
||||||
// lazy and wont always work, but good enough until a desktop entry impl.
|
|
||||||
source: {
|
source: {
|
||||||
const entry = DesktopEntries.byId(modelData.desktopEntry);
|
const entry = DesktopEntries.byId(modelData.desktopEntry);
|
||||||
console.log(`ent ${entry} id ${modelData.desktopEntry}`)
|
console.log(`ent ${entry} id ${modelData.desktopEntry}`)
|
||||||
return Quickshell.iconPath(entry?.icon);
|
return Quickshell.iconPath(entry?.icon);
|
||||||
}
|
}
|
||||||
//asynchronous: true
|
|
||||||
|
|
||||||
sourceSize.width: 50
|
sourceSize.width: 50
|
||||||
sourceSize.height: 50
|
sourceSize.height: 50
|
||||||
|
@ -497,7 +512,7 @@ FullwidthMouseArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
CenteredText {
|
CenteredText {
|
||||||
Layout.topMargin: 25
|
Layout.topMargin: 20
|
||||||
text: track.artist
|
text: track.artist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue