Compare commits
No commits in common. "e74c3ce04bcfca51122478a9e106a477e587516a" and "760558d214ad2f1385b20d923ad98934c0611051" have entirely different histories.
e74c3ce04b
...
760558d214
@ -6,42 +6,43 @@ import qs.settings
|
|||||||
import qs.reusables
|
import qs.reusables
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: container
|
||||||
visible: root.spotify != null
|
visible: root.spotify != null
|
||||||
radius: implicitHeight / 2
|
radius: implicitHeight / 2
|
||||||
|
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||||
|
implicitWidth: root.implicitWidth + 20
|
||||||
implicitHeight: Settings.config.barHeight - 10
|
implicitHeight: Settings.config.barHeight - 10
|
||||||
color: clickHandler.containsMouse ? Colors.primary : Colors.surfaceContainer
|
Item {
|
||||||
implicitWidth: statusRow.width + 20
|
id: root
|
||||||
|
|
||||||
property var spotify: root.getSpotify()
|
|
||||||
function getSpotify() {
|
|
||||||
for (let i = 0; i < Mpris.players.values.length; i++) {
|
|
||||||
if (Mpris.players.values[i].identity.toLowerCase() === "spotify") {
|
|
||||||
return Mpris.players.values[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: statusRow
|
|
||||||
spacing: 5
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
property var spotify: root.getSpotify()
|
||||||
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
function getSpotify() {
|
||||||
CustomText {
|
for (let i = 0; i < Mpris.players.values.length; i++) {
|
||||||
id: mprisText
|
if (Mpris.players.values[i].identity.toLowerCase() === "spotify") {
|
||||||
Layout.maximumWidth: 300
|
return Mpris.players.values[i];
|
||||||
Layout.topMargin: 2
|
}
|
||||||
text: root.spotify != null ? parent.combinedText : ""
|
}
|
||||||
elide: Text.ElideRight
|
return null;
|
||||||
color: clickHandler.containsMouse ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
|
||||||
}
|
}
|
||||||
CustomIcon {
|
implicitWidth: statusRow.implicitWidth
|
||||||
id: mprisStatus
|
implicitHeight: statusRow.implicitHeight
|
||||||
color: clickHandler.containsMouse ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
|
||||||
Layout.topMargin: 2
|
RowLayout {
|
||||||
text: root.spotify != null ? parent.status : ""
|
id: statusRow
|
||||||
|
spacing: 5
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
||||||
|
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
||||||
|
CustomText {
|
||||||
|
id: mprisText
|
||||||
|
Layout.topMargin: 2
|
||||||
|
text: root.spotify != null ? parent.combinedText : ""
|
||||||
|
}
|
||||||
|
CustomIcon {
|
||||||
|
id: mprisStatus
|
||||||
|
Layout.topMargin: 2
|
||||||
|
text: root.spotify != null ? parent.status : ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user