fix mpris text
This commit is contained in:
parent
fcaf744efc
commit
e74c3ce04b
@ -6,16 +6,12 @@ import qs.settings
|
|||||||
import qs.reusables
|
import qs.reusables
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: container
|
id: root
|
||||||
visible: root.spotify != null
|
visible: root.spotify != null
|
||||||
radius: implicitHeight / 2
|
radius: implicitHeight / 2
|
||||||
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
|
||||||
implicitHeight: Settings.config.barHeight - 10
|
implicitHeight: Settings.config.barHeight - 10
|
||||||
implicitWidth: 400
|
color: clickHandler.containsMouse ? Colors.primary : Colors.surfaceContainer
|
||||||
Item {
|
implicitWidth: statusRow.width + 20
|
||||||
id: root
|
|
||||||
width: Math.min(statusRow.implicitWidth, parent.width - 20)
|
|
||||||
anchors.centerIn: parent
|
|
||||||
|
|
||||||
property var spotify: root.getSpotify()
|
property var spotify: root.getSpotify()
|
||||||
function getSpotify() {
|
function getSpotify() {
|
||||||
@ -26,33 +22,28 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
implicitWidth: statusRow.implicitWidth
|
|
||||||
implicitHeight: statusRow.implicitHeight
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: statusRow
|
id: statusRow
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 5
|
spacing: 5
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.centerIn: parent
|
||||||
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
||||||
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
||||||
CustomText {
|
CustomText {
|
||||||
id: mprisText
|
id: mprisText
|
||||||
Layout.leftMargin: 10
|
Layout.maximumWidth: 300
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 2
|
Layout.topMargin: 2
|
||||||
text: root.spotify != null ? parent.combinedText : ""
|
text: root.spotify != null ? parent.combinedText : ""
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
clip: true
|
color: clickHandler.containsMouse ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
}
|
}
|
||||||
CustomIcon {
|
CustomIcon {
|
||||||
id: mprisStatus
|
id: mprisStatus
|
||||||
|
color: clickHandler.containsMouse ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
||||||
Layout.topMargin: 2
|
Layout.topMargin: 2
|
||||||
text: root.spotify != null ? parent.status : ""
|
text: root.spotify != null ? parent.status : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: clickHandler
|
id: clickHandler
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user