diff --git a/src/python/config_files.py b/src/python/config_files.py index 4930c91a..70d174af 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -108,8 +108,8 @@ class UISettings(JSONConfigFile): "theme": "Default.qpl", "writeAliases": {}, "keys": { - "startDebugger": ["Alt+Shift+D"], - "reloadConfig": "Alt+Shift+R", + "startDebugger": "Alt+Shift+D", + "reloadConfig": "Alt+Shift+R", "scrollUp": ["Alt+Up", "Alt+K"], "scrollDown": ["Alt+Down", "Alt+J"], diff --git a/src/qml/Base/HShortcut.qml b/src/qml/Base/HShortcut.qml index 475a50d2..c50834df 100644 --- a/src/qml/Base/HShortcut.qml +++ b/src/qml/Base/HShortcut.qml @@ -5,7 +5,6 @@ QtObject { signal held(var event) signal released(var event) - property bool enabled: true - property var sequences: "" // string or array of strings + property var sequences: "" // shortcut string array of shortcut strings } diff --git a/src/qml/Base/HShortcutHandler.qml b/src/qml/Base/HShortcutHandler.qml index 0fb95987..b3a4c608 100644 --- a/src/qml/Base/HShortcutHandler.qml +++ b/src/qml/Base/HShortcutHandler.qml @@ -22,6 +22,25 @@ Item { }) + function match(event) { + for (let i = 0; i < shortcutHandler.resources.length; i++) { + let shortcut = shortcutHandler.resources[i] + + if (! shortcut.enabled) continue + + if (typeof(shortcut.sequences) == "string") { + shortcut.sequences = [shortcut.sequences] + } + + for (let i = 0; i < shortcut.sequences.length; i++) { + if (sequenceMatches(event, shortcut.sequences[i])) { + return shortcut + } + } + } + return null + } + function sequenceMatches(event, sequence) { let [key, ...mods] = sequence.split("+").reverse() @@ -37,23 +56,4 @@ Item { return true } - function match(event) { - for (let i = 0; i < shortcutHandler.resources.length; i++) { - let shortcut = shortcutHandler.resources[i] - - if (! shortcut.enabled) continue - - if (typeof(shortcut.sequences) == "string") { - return sequenceMatches(event, shortcut.sequences) ? - shortcut : null - } - - for (let i = 0; i < shortcut.sequences.length; i++) { - if (sequenceMatches(event, shortcut.sequences[i])) { - return shortcut - } - } - } - return null - } }