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

@@ -11,6 +11,10 @@ ApplicationWindow {
height: 800
title: qsTr("QYouRadio")
Component.onCompleted: function() {
console.log(Player.stations)
}
ColumnLayout {
anchors.fill: parent
@@ -45,21 +49,21 @@ ApplicationWindow {
clip: true
NumberAnimation {
running: Player.currentIndex != null
running: Player.playing && tabbar.currentIndex != Player.currentIndex && nowplaying_root.anchors.bottomMargin >= 42
target: nowplaying_root
property: "anchors.bottomMargin"
from: 42
to: 0
duration: 160
duration: 145
}
NumberAnimation {
running: Player.currentIndex == null
running: !Player.playing || (tabbar.currentIndex == Player.currentIndex && nowplaying_root.anchors.bottomMargin < 42)
target: nowplaying_root
property: "anchors.bottomMargin"
from: 0
to: 42
duration: 160
duration: 145
}
Label {
@@ -69,7 +73,7 @@ ApplicationWindow {
anchors.topMargin: 1
anchors.leftMargin: 4
anchors.rightMargin: 4
text: (Player.loading ? "Loading " : "Playing ") + (Player.currentIndex != null ? qsTr(Player.currentStream.name) : "")
text: (Player.loading ? "Loading " : "Playing ") + qsTr(Player.currentStation.name)
heading: "h5"
}
@@ -81,7 +85,7 @@ ApplicationWindow {
anchors.bottomMargin: 1
anchors.leftMargin: 4
// anchors.rightMargin: 4
text: (Player.currentIndex != null ? qsTr(Player.currentStream.title) : "")
text: qsTr(Player.currentStation.songTitle)
heading: "h3"
@@ -124,7 +128,6 @@ ApplicationWindow {
}
}
SwipeView {
Layout.fillWidth: true
Layout.fillHeight: true
@@ -134,7 +137,8 @@ ApplicationWindow {
currentIndex: tabbar.currentIndex
Loader {
active: tabbar.currentIndex == 0
// active: tabbar.currentIndex == 0
active: true
asynchronous: true
visible: status == Loader.Ready
sourceComponent: ViewPlayer {
@@ -142,7 +146,8 @@ ApplicationWindow {
}
}
Loader {
active: tabbar.currentIndex == 1
// active: tabbar.currentIndex == 1
active: true
asynchronous: true
visible: status == Loader.Ready
sourceComponent: ViewPlayer {
@@ -150,18 +155,47 @@ ApplicationWindow {
}
}
Loader {
active: tabbar.currentIndex == 2
// active: tabbar.currentIndex == 2
active: true
asynchronous: true
visible: status == Loader.Ready
sourceComponent: ViewPlayer {
index: 2
}
}
Component.onCompleted: contentItem.highlightMoveDuration = 160;
}
YouAds {
RowLayout {
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 30
Layout.bottomMargin: 30
width: 220
Button {
Layout.rightMargin: 5
text: Player.loading ? "Loading" : (Player.playing ? "Pause" : "Play")
onClicked: function() {
if (Player.playing) {
Player.stopPlaying();
} else {
Player.startPlaying(tabbar.currentIndex);
}
}
}
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
}
}
}
}