TemplateSubTab: visual overhaul

This commit is contained in:
Ly-sec
2026-01-14 16:20:57 +01:00
parent 80933a5ed3
commit 45f160137f
22 changed files with 737 additions and 790 deletions
+43
View File
@@ -0,0 +1,43 @@
import QtQuick
QtObject {
id: root
// List of all template IDs that existed as booleans in the old format
readonly property var templateIds: ["gtk", "qt", "kcolorscheme", "alacritty", "kitty", "ghostty", "foot", "wezterm", "fuzzel", "discord", "pywalfox", "vicinae", "walker", "code", "spicetify", "telegram", "cava", "yazi", "emacs", "niri", "hyprland", "mango", "zed", "helix", "zenBrowser"]
function migrate(adapter, logger, rawJson) {
logger.i("Migration39", "Migrating templates from boolean format to activeTemplates array");
// Check if old format exists (any boolean template property)
const oldTemplates = rawJson?.templates;
if (!oldTemplates) {
logger.d("Migration39", "No templates section found, skipping migration");
return true;
}
// Check if already migrated (has activeTemplates array)
if (Array.isArray(oldTemplates.activeTemplates)) {
logger.d("Migration39", "Already has activeTemplates array, skipping migration");
return true;
}
// Build the new activeTemplates array from old boolean values
const activeTemplates = [];
for (const templateId of templateIds) {
if (oldTemplates[templateId] === true) {
activeTemplates.push({
"id": templateId,
"enabled": true
});
logger.d("Migration39", "Migrated enabled template: " + templateId);
}
}
// Write the new format
adapter.templates.activeTemplates = activeTemplates;
logger.i("Migration39", "Migrated " + activeTemplates.length + " templates to new array format");
return true;
}
}
+3 -1
View File
@@ -14,7 +14,8 @@ QtObject {
35: migration35Component,
36: migration36Component,
37: migration37Component,
38: migration38Component
38: migration38Component,
39: migration39Component
})
// Migration components
@@ -26,4 +27,5 @@ QtObject {
property Component migration36Component: Migration36 {}
property Component migration37Component: Migration37 {}
property Component migration38Component: Migration38 {}
property Component migration39Component: Migration39 {}
}