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