From 6e82a5c5d1bff27ca2504f767d8f752c8e557c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20O=2E=20Cordero=20P=C3=A9rez?= Date: Fri, 27 Sep 2024 08:38:23 -0400 Subject: [PATCH] Add key input for setting 10 velocity This way 0 can be set to 10 and an alternative character be used for 0 velocity. --- src/kirigami_ui/InputsOverlay.qml | 17 +++++++++++++++++ src/prompter/Prompter.qml | 13 ++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/kirigami_ui/InputsOverlay.qml b/src/kirigami_ui/InputsOverlay.qml index 9a6e3d8a..10579d96 100644 --- a/src/kirigami_ui/InputsOverlay.qml +++ b/src/kirigami_ui/InputsOverlay.qml @@ -72,6 +72,7 @@ Kirigami.OverlaySheet { keyInputSetVelocity7.setSource("KeyInputButton.qml", { "text": qmlutil.keyToString(prompter.keys.setVelocity7, prompter.keys.setVelocity7Modifiers) }); keyInputSetVelocity8.setSource("KeyInputButton.qml", { "text": qmlutil.keyToString(prompter.keys.setVelocity8, prompter.keys.setVelocity8Modifiers) }); keyInputSetVelocity9.setSource("KeyInputButton.qml", { "text": qmlutil.keyToString(prompter.keys.setVelocity9, prompter.keys.setVelocity9Modifiers) }); + keyInputSetVelocity10.setSource("KeyInputButton.qml", { "text": qmlutil.keyToString(prompter.keys.setVelocity10, prompter.keys.setVelocity10Modifiers) }); } Connections { target: keyInputTogglePrompter.item @@ -249,6 +250,14 @@ Kirigami.OverlaySheet { prompter.keys.setVelocity9Modifiers = modifiers; } } + Connections { + target: keyInputSetVelocity10.item + function onToggleButtonsOff() { buttonGrid.toggleButtonsOff(); } + function onSetKey(key, modifiers) { + prompter.keys.setVelocity10 = key; + prompter.keys.setVelocity10Modifiers = modifiers; + } + } Label { text: i18n("Toggle Prompter State") @@ -465,6 +474,14 @@ Kirigami.OverlaySheet { asynchronous: true Layout.fillWidth: true } + Label { + text: i18nc("Hotkey that sets velocity to a fixed value.", "Set velocity to 10") + } + Loader { + id: keyInputSetVelocity10 + asynchronous: true + Layout.fillWidth: true + } QmlUtil { diff --git a/src/prompter/Prompter.qml b/src/prompter/Prompter.qml index 78c53b2f..786dad5e 100644 --- a/src/prompter/Prompter.qml +++ b/src/prompter/Prompter.qml @@ -214,7 +214,7 @@ Flickable { property int markerToggleModifiers: Qt.ControlModifier property int namedMarkerToggle: Qt.Key_M property int namedMarkerToggleModifiers: Qt.ControlModifier | Qt.ShiftModifier - property int setVelocity0: Qt.Key_0 + property int setVelocity0: 16781904 // Key: ` property int setVelocity0Modifiers: Qt.NoModifier property int setVelocity1: Qt.Key_1 property int setVelocity1Modifiers: Qt.NoModifier @@ -234,6 +234,8 @@ Flickable { property int setVelocity8Modifiers: Qt.NoModifier property int setVelocity9: Qt.Key_9 property int setVelocity9Modifiers: Qt.NoModifier + property int setVelocity10: Qt.Key_0 + property int setVelocity10Modifiers: Qt.NoModifier property int setVelocityModifier: Qt.AltModifier } Settings { @@ -1150,6 +1152,7 @@ Flickable { case keys.setVelocity7: case keys.setVelocity8: case keys.setVelocity9: + case keys.setVelocity10: case keys.toggle: // If in edit while prompting mode, ensure arrow keys and space bar don't float up to prompter so editor can make proper use of them. if ((Qt.Key_Left <= event.key && event.key <= Qt.Key_Down) || (Qt.Key_Space <= event.key && event.key <= Qt.Key_Dead_Longsolidusoverlay)) { @@ -1643,6 +1646,14 @@ Flickable { setVelocity(-9, event); return; } + else if (event.key===keys.setVelocity10 && event.modifiers===keys.setVelocity10Modifiers) { + setVelocity(10, event); + return; + } + else if (event.key===keys.setVelocity10 && event.modifiers===(keys.setVelocity10Modifiers ^ keys.setVelocityModifier)) { + setVelocity(-10, event); + return; + } else if (event.key===keys.reverse && event.modifiers===keys.reverseModifiers) { // Reverse __i = -__i;