1
0
Fork 0

Add mouse movement stop to hide controls.

This commit is contained in:
NamedKitten 2018-10-13 19:57:17 +01:00
parent a30f44b196
commit 18b672d2fd

View file

@ -123,7 +123,8 @@ ApplicationWindow {
var args = Qt.application.arguments
var len = Qt.application.arguments.length
var argNo = 0
renderer.setOption("ytdl-format", "bestvideo[width<=" + Screen.width + "][height<=" + Screen.height + "]+bestaudio")
renderer.setOption("ytdl-format", "bestvideo[width<=" + Screen.width
+ "][height<=" + Screen.height + "]+bestaudio")
if (len > 1) {
for (argNo = 0; argNo < len; argNo++) {
var argument = args[argNo]
@ -170,6 +171,22 @@ ApplicationWindow {
function setTitle() {
titleLabel.text = renderer.getProperty("media-title")
}
function hideControls() {
controlsBar.visible = false
controlsBackground.visible = false
titleBar.visible = false
titleBackground.visible = false
controlsBar.height = 0
}
function showControls() {
updateControls()
controlsBar.visible = true
controlsBackground.visible = true
titleBar.visible = true
titleBackground.visible = true
controlsBar.height = renderer.height / 16
}
Dialog {
@ -199,12 +216,7 @@ ApplicationWindow {
anchors.bottomMargin: 0
hoverEnabled: true
onEntered: {
updateControls()
controlsBar.visible = true
controlsBackground.visible = true
titleBar.visible = true
titleBackground.visible = true
controlsBar.height = 35
mouseAreaPlayerTimer.stop()
}
}
@ -221,17 +233,19 @@ ApplicationWindow {
anchors.topMargin: 0
hoverEnabled: true
onClicked: loadDialog.open()
onEntered: {
if (subtitlesMenu.visible) {
return
} else {
controlsBar.visible = false
controlsBackground.visible = false
titleBar.visible = false
titleBackground.visible = false
controlsBar.height = 0
Timer {
id: mouseAreaPlayerTimer
interval: 2000
running: false
repeat: false
onTriggered: {
renderer.hideControls()
}
}
onPositionChanged: {
renderer.showControls()
mouseAreaPlayerTimer.restart()
}
}
Rectangle {
@ -281,7 +295,8 @@ ApplicationWindow {
Rectangle {
id: controlsBackground
height: controlsBar.height + (progressBar.topPadding * 2) - (progressBackground.height * 2)
height: controlsBar.height + (progressBar.topPadding * 2)
- (progressBackground.height * 2)
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
@ -346,8 +361,8 @@ ApplicationWindow {
id: audioModel
}
onActivated: {
renderer.command(["set", "aid", String(audioModel.get(
index).value)])
renderer.command(["set", "aid", String(
audioModel.get(index).value)])
}
opacity: 1
}
@ -372,8 +387,8 @@ ApplicationWindow {
id: subModel
}
onActivated: {
renderer.command(["set", "sid", String(subModel.get(
index).value)])
renderer.command(["set", "sid", String(
subModel.get(index).value)])
}
opacity: 1
}
@ -398,8 +413,8 @@ ApplicationWindow {
id: vidModel
}
onActivated: {
renderer.command(["set", "vid", String(vidModel.get(
index).value)])
renderer.command(["set", "vid", String(
vidModel.get(index).value)])
}
opacity: 1
}
@ -635,5 +650,5 @@ ApplicationWindow {
//}
}
}
}