mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
TemplateSubTab: visual overhaul
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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 {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user