Settings: add Enter as 2nd default keybind

This commit is contained in:
Lysec
2026-03-01 14:42:29 +01:00
parent 1fd249164b
commit 5b484e2714
4 changed files with 35 additions and 4 deletions
+28
View File
@@ -0,0 +1,28 @@
import QtQuick
QtObject {
id: root
// Add numpad Enter as a second default keybind for keyEnter
function migrate(adapter, logger, rawJson) {
logger.i("Settings", "Migrating settings to v54");
const keybinds = rawJson?.general?.keybinds;
if (!keybinds)
return true;
const keyEnter = keybinds.keyEnter;
if (!keyEnter || !Array.isArray(keyEnter))
return true;
// Only add "Enter" if the first entry is "Return" and "Enter" isn't already present
if (keyEnter[0] === "Return" && !keyEnter.includes("Enter")) {
var updated = Array.from(keyEnter);
updated.splice(1, 0, "Enter");
adapter.general.keybinds.keyEnter = updated;
logger.i("Settings", "Added 'Enter' (numpad) as second default keybind for keyEnter");
}
return true;
}
}
+3 -1
View File
@@ -25,7 +25,8 @@ QtObject {
48: migration48Component,
49: migration49Component,
50: migration50Component,
53: migration53Component
53: migration53Component,
54: migration54Component
})
// Migration components
@@ -48,4 +49,5 @@ QtObject {
property Component migration49Component: Migration49 {}
property Component migration50Component: Migration50 {}
property Component migration53Component: Migration53 {}
property Component migration54Component: Migration54 {}
}