Implement smooth source select with Loaders, implement vertical tabbar for settings, add header

This commit is contained in:
Dark Steveneq
2025-10-13 02:55:16 +02:00
parent b48a29935d
commit 362166cc1f
7 changed files with 243 additions and 69 deletions

106
Main.qml
View File

@@ -2,6 +2,7 @@ import QtQuick 6.8
import QtQuick.Controls 6.8
import QtQuick.Controls.Basic 6.8
import QtQuick.Layouts 6.8
import QtQuick.Dialogs 6.10
import QYRComponents 1.0
@@ -10,54 +11,105 @@ ApplicationWindow {
height: 800
title: qsTr("QYouRadio")
Dialog {
id: dialogSettings
// modality: Qt.WindowModal
popupType: Popup.Window
title: qsTr("Settings")
ViewSettings {}
}
ColumnLayout {
anchors.fill: parent
anchors.margins: 10
TabBar {
id: tabbar
RowLayout {
Layout.fillWidth: true
spacing: 10
TabButton {
text: qsTr("Autoradio")
Label {
text: "QYR"
heading: "h3"
font.bold: true
}
// TabButton {
// text: qsTr("Live Mix")
// }
// TabButton {
// text: qsTr("Deep Bass")
// }
TabButton {
text: qsTr("Settings")
Item {
Layout.fillWidth: true
}
Label {
visible: Player.playing
text: "Playback active"
heading: "h4"
font.bold: true
}
Item {
Layout.fillWidth: true
}
TabBar {
id: tabbar
spacing: 10
TabButton {
text: qsTr("Autoradio")
}
TabButton {
text: qsTr("Live Mix")
}
TabButton {
text: qsTr("Deep Bass")
}
}
Button {
text: "S"
onClicked: function() {
dialogSettings.open()
}
}
}
StackLayout {
SwipeView {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: 10
interactive: false
currentIndex: tabbar.currentIndex
ViewPlayer {
title: qsTr("Autoradio")
streamURL: "https://youradio.nonamesoft.xyz/api/autoradio"
Loader {
active: tabbar.currentIndex == 0
asynchronous: true
visible: status == Loader.Ready
sourceComponent: ViewPlayer {
title: qsTr("Autoradio")
streamURL: "https://youradio.nonamesoft.xyz/api/autoradio"
}
}
// ViewPlayer {
// title: qsTr("Live Radio")
// streamURL: "https://youradio.nonamesoft.xyz/api/live"
// }
// ViewPlayer {
// title: qsTr("Deep Bass")
// streamURL: "https://youradio.nonamesoft.xyz/api/deepbass"
// }
ViewSettings {
Loader {
active: tabbar.currentIndex == 1
asynchronous: true
visible: status == Loader.Ready
sourceComponent: ViewPlayer {
title: qsTr("Live Mix")
streamURL: "https://youradio.nonamesoft.xyz/api/live"
}
}
Loader {
active: tabbar.currentIndex == 2
asynchronous: true
visible: status == Loader.Ready
sourceComponent: ViewPlayer {
title: qsTr("Deep Bass")
streamURL: "https://youradio.nonamesoft.xyz/api/deepbass"
}
}
}
YouAds {
Layout.fillWidth: false
Layout.alignment: Qt.AlignHCenter
visible: tabbar.currentIndex != 1
}
}
}