Files
qyouvideo/Main.qml
2025-10-20 02:53:30 +02:00

90 lines
2.3 KiB
QML
Executable File

import QtQuick 6.8
import QtQuick.Controls 6.8
import QtQuick.Controls.Basic 6.8
import QtQuick.Layouts 6.8
import QYRComponents 1.0
ApplicationWindow {
id: root
width: 1280
height: 800
title: qsTr("QYouVideo")
flags: Qt.Dialog
modality: Qt.ApplicationModal
header: Rectangle {
Layout.fillWidth: true
height: 43
color: Colors.surface0
RowLayout {
anchors.fill: parent
anchors.margins: 3
Button {
// visible: stack.depth > 1
text: "Back"
onClicked: stack.popCurrentItem()
}
Label {
id: logo
// visible: stack.currentItem.StackView.index == 0
Layout.leftMargin: 5
text: "QYouVideo"
heading: "h1"
clip: true
}
Item {
Layout.fillWidth: true
}
Button {
text: qsTr("Videos")
outlined: true
implicitWidth: 80
onClicked: if (!(stack.currentItem instanceof ViewVideoList)) stack.push(ComponentCache.viewVideoList.createObject(stack))
}
Button {
text: qsTr("About")
outlined: true
implicitWidth: 80
onClicked: if (!(stack.currentItem instanceof ViewAbout)) stack.push(ComponentCache.viewAbout.createObject(stack))
}
Button {
text: qsTr("Upload")
}
}
}
StackView {
id: stack
// __wheelAreaScrollSpeed: 50
anchors.fill: parent
anchors.margins: 20
initialItem: ViewVideoList {}
function openVideo(id) {
// if (stack.find((item, index) => {
// // If found player instance
// if (item.id == id) {
// // stack.pop(index, StackView.Immediate);
// stack.push(item)
// return true;
// }
// return false;
// }) == null) {
// If didn't find player instance
stack.push(ComponentCache.videoPlayer.createObject(stack, {id: id}));
// }
}
}
}