Compare commits
No commits in common. "556a24774af1c6a9773a6460d750d1218462222b" and "8ee0f00ce508f965b18eeb7479b3683c3916cd49" have entirely different histories.
556a24774a
...
8ee0f00ce5
3 changed files with 16 additions and 33 deletions
|
|
@ -23,6 +23,19 @@ WrapperRectangle {
|
||||||
|
|
||||||
implicitWidth: 800
|
implicitWidth: 800
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: {
|
||||||
|
if (root.player.identity) {
|
||||||
|
const words = root.player.identity.split("-");
|
||||||
|
const capitalized = words.map(val => String(val).charAt(0).toUpperCase() + String(val).slice(1));
|
||||||
|
return capitalized.join(" ");
|
||||||
|
}
|
||||||
|
return root.player.desktopEntry ?? root.player.dbusName ?? "unknown";
|
||||||
|
}
|
||||||
|
font.pixelSize: 20
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: text
|
id: text
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
@ -64,17 +77,6 @@ WrapperRectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: {
|
|
||||||
function formatTime(num) {
|
|
||||||
return Math.floor(num).toString().padStart(2, "0");
|
|
||||||
}
|
|
||||||
return `${formatTime(root.player.position / 60)}:${formatTime(root.player.position % 60)} - ${formatTime(root.player.length / 60)}:${formatTime(root.player.length % 60)}`;
|
|
||||||
}
|
|
||||||
font.pixelSize: Dimensions.mpris.fontSize
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledSlider {
|
StyledSlider {
|
||||||
from: 0
|
from: 0
|
||||||
to: root.player.length ?? 0
|
to: root.player.length ?? 0
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ Drawer {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (control.edge == Qt.TopEdge) {
|
if (control.edge == Qt.TopEdge) {
|
||||||
radius = 8;
|
bottomLeftRadius = 8;
|
||||||
|
bottomRightRadius = 8;
|
||||||
} else if (control.edge == Qt.LeftEdge) {
|
} else if (control.edge == Qt.LeftEdge) {
|
||||||
topRightRadius = 8;
|
topRightRadius = 8;
|
||||||
bottomRightRadius = 8;
|
bottomRightRadius = 8;
|
||||||
|
|
|
||||||
|
|
@ -8,25 +8,5 @@ Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property list<MprisPlayer> players: Mpris.players.values
|
property list<MprisPlayer> players: Mpris.players.values
|
||||||
property MprisPlayer active: players[properties.currentIndex]
|
property MprisPlayer active: players.filter(player => player.isPlaying)[0] ?? players[0]
|
||||||
|
|
||||||
PersistentProperties {
|
|
||||||
id: properties
|
|
||||||
|
|
||||||
property int currentIndex: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function nextPlayer() {
|
|
||||||
if (players.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
properties.currentIndex = properties.currentIndex + 1 % players.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function previousPlayer() {
|
|
||||||
if (players.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
properties.currentIndex = properties.currentIndex - 1 % players.length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue