Mostly reimplement Player, begin implementing ViewPlayer UI design

This commit is contained in:
Dark Steveneq
2025-10-17 22:29:12 +02:00
parent c99efcf9e3
commit 63d9c21e98
6 changed files with 158 additions and 86 deletions

View File

@@ -5,7 +5,6 @@ import QtQuick.Layouts 6.8
import QYRComponents 1.0
ColumnLayout {
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
property var index: null
@@ -13,62 +12,40 @@ ColumnLayout {
Label {
Layout.fillWidth: true
Layout.bottomMargin: 20
text: index != null ? Player.streams[index].name : "Invalid station"
text: qsTr(Player.stations[index].name)
font.bold: true
heading: "h2"
horizontalAlignment: Text.AlignHCenter
}
Label {
Layout.fillWidth: true
text: "Title: " + (index != null ? Player.streams[index].title : "")
heading: "h3"
horizontalAlignment: Text.AlignHCenter
}
Label {
Layout.fillWidth: true
text: "Listeners: " + (index != null ? Player.streams[index].listeners : 0)
heading: "h3"
horizontalAlignment: Text.AlignHCenter
}
Label {
Layout.topMargin: 20
text: (Player.currentIndex != null && Player.currentIndex != parent.index) ? qsTr("Another station is currently playing") : ""
heading: "h2"
horizontalAlignment: Text.AlignHCenter
}
RowLayout {
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
width: 220
Button {
Layout.rightMargin: 5
text: Player.loading ? "Loading" : (Player.playing ? "Pause" : "Play")
onClicked: function() {
if (Player.playing) {
Player.stopPlaying();
} else {
Player.startPlaying(parent.parent.index);
}
}
}
Slider {
Layout.fillWidth: true
Layout.leftMargin: 5
from: 0.1
to: 1.1
stepSize: 0.05
value: Player.volume + 0.1
onMoved: Player.volume = value - 0.1
}
}
Item {
Layout.fillHeight: true
}
}
Label {
Layout.fillWidth: true
text: Player.stations[index].songTitle
font.pixelSize: 72
horizontalAlignment: Text.AlignHCenter
}
Label {
Layout.fillWidth: true
text: "Listening: " + Player.stations[index].listeners
heading: "h2"
horizontalAlignment: Text.AlignHCenter
}
Item {
Layout.fillHeight: true
}
Label {
Layout.fillWidth: true
Layout.topMargin: 20
visible: (Player.currentIndex > -1 && Player.currentIndex != parent.index)
text: qsTr("Another station is currently playing")
heading: "h2"
horizontalAlignment: Text.AlignHCenter
}
}