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
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
id: container
|
||||
visible: root.spotify != null
|
||||
radius: implicitHeight / 2
|
||||
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||
implicitWidth: root.implicitWidth + 20
|
||||
implicitHeight: Settings.config.barHeight - 10
|
||||
color: clickHandler.containsMouse ? Colors.primary : Colors.surfaceContainer
|
||||
implicitWidth: statusRow.width + 20
|
||||
|
||||
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
|
||||
Item {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
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.maximumWidth: 300
|
||||
Layout.topMargin: 2
|
||||
text: root.spotify != null ? parent.combinedText : ""
|
||||
elide: Text.ElideRight
|
||||
color: clickHandler.containsMouse ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
||||
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;
|
||||
}
|
||||
CustomIcon {
|
||||
id: mprisStatus
|
||||
color: clickHandler.containsMouse ? Colors.onPrimaryColor : Colors.onSurfaceColor
|
||||
Layout.topMargin: 2
|
||||
text: root.spotify != null ? parent.status : ""
|
||||
implicitWidth: statusRow.implicitWidth
|
||||
implicitHeight: statusRow.implicitHeight
|
||||
|
||||
RowLayout {
|
||||
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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user