From 0ef0537a31eef06575e442ff6e2b7f6dc1c2d649 Mon Sep 17 00:00:00 2001 From: namedkitten Date: Wed, 22 Apr 2020 14:31:13 +0100 Subject: [PATCH] Add seeking! --- src/qml/main.qml | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/qml/main.qml b/src/qml/main.qml index 51a4c84..a74e1d3 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -67,6 +67,8 @@ Window { property double scaleFactor: 1.0 property int subtitlesFontSize: 18 property int uiFadeTimer: 1000 + property bool doubleTapToSeek: false + property double doubleTapToSeekBy: 5 property bool maximizeInsteadOfFullscreen: false } @@ -345,9 +347,37 @@ Window { anchors.top: titleBar.bottom anchors.topMargin: 0 hoverEnabled: true - onDoubleClicked: { - player.playerCommand(Enums.Commands.TogglePlayPause) - toggleFullscreen() + + Timer{ + id: mouseTapTimer + interval: 200 + onTriggered: { + if (appearance.clickToPause) { + player.playerCommand(Enums.Commands.TogglePlayPause) + } + } + } + + function doubleMouseClick(mouse) { + if (appearance.doubleTapToSeek) { + if (mouse.x > (mouseAreaPlayer.width / 2)) { + player.playerCommand(Enums.Commands.Seek, String(appearance.doubleTapToSeekBy)) + } else { + player.playerCommand(Enums.Commands.Seek,"-" + String(appearance.doubleTapToSeekBy)) + } + } else { + toggleFullscreen() + } + } + + + onClicked: function(mouse) { + if(mouseTapTimer.running) { + doubleMouseClick(mouse) + mouseTapTimer.stop() + } else { + mouseTapTimer.restart() + } } Action { onTriggered: { @@ -355,11 +385,7 @@ Window { } shortcut: "Esc" } - onClicked: { - if (appearance.clickToPause) { - player.playerCommand(Enums.Commands.TogglePlayPause) - } - } + Timer { id: mouseAreaPlayerTimer interval: appearance.uiFadeTimer