From 7dd808a93f00feadbe173b80eda96c5a686caee2 Mon Sep 17 00:00:00 2001 From: NamedKitten Date: Wed, 21 Nov 2018 10:26:39 +0000 Subject: [PATCH] [UI] Fix skipToNinth. --- src/qml/ControlsBar.qml | 1 + src/qml/MainMenu.qml | 28 ++++++++++++++++++---------- src/qml/main.qml | 8 -------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/qml/ControlsBar.qml b/src/qml/ControlsBar.qml index 581cdab..d662fd8 100644 --- a/src/qml/ControlsBar.qml +++ b/src/qml/ControlsBar.qml @@ -15,6 +15,7 @@ Item { property var background: controlsBackground property var progress: progressBar property var controls: controlsBar + property var duration: progressBar.to Item { id: subtitlesBar diff --git a/src/qml/MainMenu.qml b/src/qml/MainMenu.qml index ccbc796..93dc55f 100644 --- a/src/qml/MainMenu.qml +++ b/src/qml/MainMenu.qml @@ -493,44 +493,52 @@ MenuBar { } } + function skipToNinth(val) { + var skipto = 0 + if (val != 0) { + skipto = Math.floor(controlsBar.duration / 9 * val) + } + player.playerCommand(Enums.Commands.SeekAbsolute, skipto) + } + Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "1" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "2" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "3" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "4" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "5" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "6" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "7" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "8" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "9" } Action { - onTriggered: player.skipToNinth(parseInt(shortcut)) + onTriggered: skipToNinth(parseInt(shortcut)) shortcut: "0" } diff --git a/src/qml/main.qml b/src/qml/main.qml index 0e464df..5a390e8 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -183,14 +183,6 @@ ApplicationWindow { } } - function skipToNinth(val) { - var skipto = 0 - if (val != 0) { - skipto = Math.floor(controlsBar.controls.progress.to / 9 * val) - } - player.playerCommand(Enums.Commands.SeekAbsolute, skipto) - } - function hideControls(force) { if (!menuBar.anythingOpen() || force) { controlsShowing = false