1
0
Fork 0
VideoPlayer/src/qml/ControlsBar.qml

103 lines
2.9 KiB
QML
Raw Normal View History

import QtQuick 2.0
2018-12-22 14:13:53 +00:00
import QtQuick.Controls 2.3
2018-12-22 14:26:34 +00:00
import QtQuick.Layouts 1.2
import player 1.0
Item {
id: controlsBarItem
2020-04-23 16:25:40 +01:00
property var combinedHeight: progressBar.height + controlsBackground.height
property bool controlsShowing: true
2020-04-24 17:06:14 +01:00
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
}
Connections {
target: globalConnections
onHideUI: function (force) {
controlsBarItem.controlsShowing = false
}
onShowUI: {
controlsBarItem.controlsShowing = true
}
}
Connections {
target: appearance
onThemeNameChanged: setControlsTheme(appearance.themeName)
}
function setControlsTheme(themeName) {
for (var i = 0; i < controlsBar.children.length; ++i) {
if (controlsBar.children[i].objectName == "buttonLayout") {
controlsBar.children[i].destroy()
}
}
var component = Qt.createComponent(themeName + "ButtonLayout.qml")
if (component.status == Component.Error) {
console.error("Error loading component: " + component.errorString())
}
component.createObject(controlsBar, {})
}
2020-04-24 17:06:14 +01:00
SubtitlesBar {
anchors.bottom: controlsBackground.top
}
VideoProgress {
id: progressBar
2020-04-24 17:06:14 +01:00
visible: controlsBarItem.controlsShowing && appearance.themeName != "RoosterTeeth"
bottomPadding: 0
rightPadding: 0
leftPadding: 0
z: 20
2020-04-24 17:06:14 +01:00
anchors {
bottom: controlsBackground.top
left: controlsBackground.left
right: controlsBackground.right
leftMargin: parent.width / 128
rightMargin: parent.width / 128
2020-04-24 17:06:14 +01:00
bottomMargin: 0
}
}
Rectangle {
id: controlsBackground
height: controlsBar.visible ? controlsBar.height
+ (appearance.themeName
== "RoosterTeeth" ? 0 : progressBar.topPadding) : 0
Layout.fillWidth: true
Layout.fillHeight: true
color: getAppearanceValueForTheme(appearance.themeName,
"mainBackground")
visible: controlsBarItem.controlsShowing
z: 10
2020-04-24 17:06:14 +01:00
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
}
}
2018-11-19 12:24:13 +00:00
Item {
id: controlsBar
height: controlsBar.visible ? mainWindow.virtualHeight / 20 : 0
visible: controlsBarItem.controlsShowing
z: 30
2020-04-24 17:06:14 +01:00
anchors {
right: parent.right
rightMargin: parent.width / 128
left: parent.left
leftMargin: parent.width / 128
bottom: parent.bottom
bottomMargin: 0
}
}
Component.onCompleted: {
setControlsTheme(appearance.themeName)
}
}