2018-11-10 19:55:59 +00:00
|
|
|
import QtQuick 2.11
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
import QtQuick.Layouts 1.11
|
|
|
|
import QtQuick.Window 2.11
|
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
import Qt.labs.platform 1.0 as LabsPlatform
|
|
|
|
import player 1.0
|
|
|
|
|
|
|
|
Item {
|
2018-11-28 18:41:54 +00:00
|
|
|
id: controlsBarItem
|
2018-11-10 19:55:59 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
property var background: controlsBackground
|
|
|
|
property var progress: progressBar
|
|
|
|
property var controls: controlsBar
|
2018-11-21 10:26:39 +00:00
|
|
|
property var duration: progressBar.to
|
2018-11-10 19:55:59 +00:00
|
|
|
|
2018-11-28 18:41:54 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
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")
|
2018-11-29 08:25:54 +00:00
|
|
|
component.createObject(controlsBar, {})
|
2018-11-28 18:41:54 +00:00
|
|
|
}
|
|
|
|
|
2018-11-19 12:24:13 +00:00
|
|
|
Item {
|
2018-11-10 19:55:59 +00:00
|
|
|
id: subtitlesBar
|
|
|
|
visible: !appearance.useMpvSubs
|
|
|
|
height: player.height / 8
|
|
|
|
anchors.bottom: controlsBackground.top
|
|
|
|
anchors.bottomMargin: 5
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: nativeSubtitles
|
|
|
|
visible: true
|
|
|
|
anchors.left: subtitlesBar.left
|
|
|
|
anchors.right: subtitlesBar.right
|
|
|
|
height: childrenRect.height
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 10
|
|
|
|
|
2018-11-19 12:24:13 +00:00
|
|
|
Item {
|
2018-11-10 19:55:59 +00:00
|
|
|
id: subsContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.rightMargin: 0
|
|
|
|
Layout.leftMargin: 0
|
|
|
|
Layout.maximumWidth: nativeSubtitles.width
|
|
|
|
height: childrenRect.height
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: nativeSubs
|
|
|
|
objectName: "nativeSubs"
|
|
|
|
onWidthChanged: {
|
|
|
|
|
|
|
|
if (width > parent.width - 10)
|
|
|
|
width = parent.width - 10
|
|
|
|
}
|
|
|
|
onTextChanged: if (width <= parent.width - 10)
|
|
|
|
width = undefined
|
|
|
|
color: "white"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
|
|
|
font.pixelSize: Screen.height / 24
|
|
|
|
font.family: appearance.fontName
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
opacity: 1
|
|
|
|
background: Rectangle {
|
|
|
|
id: subsBackground
|
2018-11-19 04:26:08 +00:00
|
|
|
color: appearance.mainBackground
|
2018-11-10 19:55:59 +00:00
|
|
|
width: subsContainer.childrenRect.width
|
|
|
|
height: subsContainer.childrenRect.height
|
|
|
|
}
|
2018-11-28 18:41:54 +00:00
|
|
|
Connections {
|
|
|
|
target: player
|
|
|
|
enabled: true
|
|
|
|
onSubtitlesChanged: function (subtitles) {
|
|
|
|
nativeSubs.text = subtitles
|
|
|
|
}
|
2018-11-17 15:45:21 +00:00
|
|
|
}
|
2018-11-10 19:55:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: controlsBackground
|
2018-11-28 18:41:54 +00:00
|
|
|
height: controlsBar.visible ? controlsBar.height + progressBar.topPadding
|
|
|
|
+ (fun.nyanCat ? 0 : 1) : 0
|
2018-11-10 19:55:59 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2018-11-19 04:26:08 +00:00
|
|
|
color: appearance.mainBackground
|
2018-11-28 20:35:14 +00:00
|
|
|
visible: controlsOverlay.controlsShowing
|
2018-11-10 19:55:59 +00:00
|
|
|
}
|
|
|
|
|
2018-11-19 12:24:13 +00:00
|
|
|
Item {
|
2018-11-10 19:55:59 +00:00
|
|
|
id: controlsBar
|
|
|
|
height: controlsBar.visible ? Screen.height / 24 : 0
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: parent.width / 128
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: parent.width / 128
|
|
|
|
anchors.bottom: parent.bottom
|
2018-11-22 17:20:58 +00:00
|
|
|
anchors.bottomMargin: 2
|
2018-11-28 20:35:14 +00:00
|
|
|
visible: controlsOverlay.controlsShowing
|
2018-11-28 18:41:54 +00:00
|
|
|
VideoProgress {
|
2018-11-10 19:55:59 +00:00
|
|
|
id: progressBar
|
|
|
|
anchors.bottom: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottomMargin: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|