From d4e0fd63d4446b1fc55617682e89f7390faaece2 Mon Sep 17 00:00:00 2001 From: Kitteh Date: Wed, 24 Oct 2018 17:41:41 +0100 Subject: [PATCH] [UI] Added configurable keybinds. --- src/main.cpp | 3 +++ src/qml/main.qml | 33 ++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b654403..9e1757a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,9 @@ int main( int argc, char *argv[] ) { QApplication app(argc, argv); + app.setOrganizationName("KittehPlayer"); + app.setOrganizationDomain("namedkitten.pw"); + app.setApplicationName("KittehPlayer"); for (int i = 1; i < argc; ++i) { if (!qstrcmp(argv[i], "--update")) { diff --git a/src/qml/main.qml b/src/qml/main.qml index da4fa52..9d3a97b 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -3,6 +3,7 @@ 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 player 1.0 import "codes.js" as LanguageCodes @@ -313,6 +314,20 @@ ApplicationWindow { } } + Settings { + id: keybinds + category: "Keybinds" + property string pause_play: "K" + property string forward_10: "L" + property string rewind_10: "J" + property string open_file: "Ctrl+O" + property string open_uri: "Ctrl+Shift+O" + property string quit: "Ctrl+Q" + property string fullscreen: "F" + property string tracks: "Ctrl+T" + property string stats_for_nerds: "I" + } + MenuBar { id: menuBar //width: parent.width @@ -363,18 +378,18 @@ ApplicationWindow { Action { text: "Open File" onTriggered: fileDialog.open() - shortcut: "Ctrl+O" + shortcut: keybinds.open_file } Action { text: "Open URI/URL" onTriggered: loadDialog.open() - shortcut: "Ctrl+Shift+O" + shortcut: keybinds.open_uri } Action { text: "Exit" onTriggered: Qt.quit() - shortcut: "Ctrl+Q" + shortcut: keybinds.quit } } @@ -396,7 +411,7 @@ ApplicationWindow { player.command(["cycle", "pause"]) updateControls() } - shortcut: "K,Space" + shortcut: String(keybinds.pause_play) } Action { text: "Rewind 10s" @@ -404,7 +419,7 @@ ApplicationWindow { player.command(["seek", "-10"]) updateControls() } - shortcut: "J" + shortcut: keybinds.rewind_10 } Action { text: "Forward 10s" @@ -412,7 +427,7 @@ ApplicationWindow { player.command(["seek", "10"]) updateControls() } - shortcut: "L" + shortcut: keybinds.forward_10 } } @@ -435,7 +450,7 @@ ApplicationWindow { subtitlesMenu.visible = !subtitlesMenu.visible subtitlesMenuBackground.visible = !subtitlesMenuBackground.visible } - shortcut: "Ctrl+T" + shortcut: keybinds.tracks } Action { @@ -443,7 +458,7 @@ ApplicationWindow { onTriggered: { toggleFullscreen() } - shortcut: "F" + shortcut: keybinds.fullscreen } Action { @@ -451,7 +466,7 @@ ApplicationWindow { onTriggered: { player.command(["script-binding", "stats/display-stats-toggle"]) } - shortcut: "I" + shortcut: keybinds.stats_for_nerds } }