[UI] Added configurable keybinds.
This commit is contained in:
parent
ad2449c134
commit
d4e0fd63d4
|
@ -24,6 +24,9 @@
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
app.setOrganizationName("KittehPlayer");
|
||||||
|
app.setOrganizationDomain("namedkitten.pw");
|
||||||
|
app.setApplicationName("KittehPlayer");
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!qstrcmp(argv[i], "--update")) {
|
if (!qstrcmp(argv[i], "--update")) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import QtQuick.Controls 2.4
|
||||||
import QtQuick.Dialogs 1.3
|
import QtQuick.Dialogs 1.3
|
||||||
import QtQuick.Layouts 1.11
|
import QtQuick.Layouts 1.11
|
||||||
import QtQuick.Window 2.11
|
import QtQuick.Window 2.11
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
import player 1.0
|
import player 1.0
|
||||||
|
|
||||||
import "codes.js" as LanguageCodes
|
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 {
|
MenuBar {
|
||||||
id: menuBar
|
id: menuBar
|
||||||
//width: parent.width
|
//width: parent.width
|
||||||
|
@ -363,18 +378,18 @@ ApplicationWindow {
|
||||||
Action {
|
Action {
|
||||||
text: "Open File"
|
text: "Open File"
|
||||||
onTriggered: fileDialog.open()
|
onTriggered: fileDialog.open()
|
||||||
shortcut: "Ctrl+O"
|
shortcut: keybinds.open_file
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Open URI/URL"
|
text: "Open URI/URL"
|
||||||
onTriggered: loadDialog.open()
|
onTriggered: loadDialog.open()
|
||||||
shortcut: "Ctrl+Shift+O"
|
shortcut: keybinds.open_uri
|
||||||
|
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Exit"
|
text: "Exit"
|
||||||
onTriggered: Qt.quit()
|
onTriggered: Qt.quit()
|
||||||
shortcut: "Ctrl+Q"
|
shortcut: keybinds.quit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +411,7 @@ ApplicationWindow {
|
||||||
player.command(["cycle", "pause"])
|
player.command(["cycle", "pause"])
|
||||||
updateControls()
|
updateControls()
|
||||||
}
|
}
|
||||||
shortcut: "K,Space"
|
shortcut: String(keybinds.pause_play)
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Rewind 10s"
|
text: "Rewind 10s"
|
||||||
|
@ -404,7 +419,7 @@ ApplicationWindow {
|
||||||
player.command(["seek", "-10"])
|
player.command(["seek", "-10"])
|
||||||
updateControls()
|
updateControls()
|
||||||
}
|
}
|
||||||
shortcut: "J"
|
shortcut: keybinds.rewind_10
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Forward 10s"
|
text: "Forward 10s"
|
||||||
|
@ -412,7 +427,7 @@ ApplicationWindow {
|
||||||
player.command(["seek", "10"])
|
player.command(["seek", "10"])
|
||||||
updateControls()
|
updateControls()
|
||||||
}
|
}
|
||||||
shortcut: "L"
|
shortcut: keybinds.forward_10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +450,7 @@ ApplicationWindow {
|
||||||
subtitlesMenu.visible = !subtitlesMenu.visible
|
subtitlesMenu.visible = !subtitlesMenu.visible
|
||||||
subtitlesMenuBackground.visible = !subtitlesMenuBackground.visible
|
subtitlesMenuBackground.visible = !subtitlesMenuBackground.visible
|
||||||
}
|
}
|
||||||
shortcut: "Ctrl+T"
|
shortcut: keybinds.tracks
|
||||||
}
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
|
@ -443,7 +458,7 @@ ApplicationWindow {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
}
|
}
|
||||||
shortcut: "F"
|
shortcut: keybinds.fullscreen
|
||||||
}
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
|
@ -451,7 +466,7 @@ ApplicationWindow {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
player.command(["script-binding", "stats/display-stats-toggle"])
|
player.command(["script-binding", "stats/display-stats-toggle"])
|
||||||
}
|
}
|
||||||
shortcut: "I"
|
shortcut: keybinds.stats_for_nerds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue