mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Settings: migration for shellstate is now handled in Settings.qml
This commit is contained in:
@@ -113,8 +113,8 @@ Singleton {
|
||||
displayScalesLoaded = true;
|
||||
Logger.d("CompositorService", "Loaded display scales from ShellState");
|
||||
} else {
|
||||
// Try to migrate from old display.json if it exists
|
||||
migrateFromOldDisplayFile();
|
||||
// Migration is now handled in Settings.qml
|
||||
displayScalesLoaded = true;
|
||||
}
|
||||
} catch (error) {
|
||||
Logger.e("CompositorService", "Failed to load display scales:", error);
|
||||
@@ -122,34 +122,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// Migration from old display.json file
|
||||
function migrateFromOldDisplayFile() {
|
||||
const oldDisplayPath = Settings.cacheDir + "display.json";
|
||||
const migrationFileView = Qt.createQmlObject(`
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
FileView {
|
||||
id: migrationView
|
||||
path: "${oldDisplayPath}"
|
||||
printErrors: false
|
||||
adapter: JsonAdapter {
|
||||
property var displays: ({})
|
||||
}
|
||||
onLoaded: {
|
||||
parent.displayScales = adapter.displays || {};
|
||||
parent.displayScalesLoaded = true;
|
||||
parent.saveDisplayScalesToCache();
|
||||
Logger.i("CompositorService", "Migrated display.json to ShellState");
|
||||
migrationView.destroy();
|
||||
}
|
||||
onLoadFailed: {
|
||||
parent.displayScalesLoaded = true;
|
||||
migrationView.destroy();
|
||||
}
|
||||
}
|
||||
`, root, "migrationFileView");
|
||||
}
|
||||
|
||||
// Hyprland backend component
|
||||
Component {
|
||||
id: hyprlandComponent
|
||||
|
||||
@@ -319,17 +319,7 @@ Singleton {
|
||||
const changelog = ShellState.getChangelogState();
|
||||
changelogLastSeenVersion = changelog.lastSeenVersion || "";
|
||||
|
||||
if (!changelogLastSeenVersion) {
|
||||
// Try to migrate from old changelog-state.json
|
||||
migrateFromOldChangelogFile();
|
||||
// Also try settings migration
|
||||
if (!changelogLastSeenVersion && Settings.data && Settings.data.changelog && Settings.data.changelog.lastSeenVersion) {
|
||||
changelogLastSeenVersion = Settings.data.changelog.lastSeenVersion;
|
||||
debouncedSaveChangelogState();
|
||||
Logger.i("UpdateService", "Migrated changelog lastSeenVersion from settings to ShellState");
|
||||
}
|
||||
}
|
||||
|
||||
// Migration is now handled in Settings.qml
|
||||
Logger.d("UpdateService", "Loaded changelog state from ShellState");
|
||||
} catch (error) {
|
||||
Logger.e("UpdateService", "Failed to load changelog state:", error);
|
||||
@@ -341,31 +331,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function migrateFromOldChangelogFile() {
|
||||
const oldChangelogPath = Settings.cacheDir + "changelog-state.json";
|
||||
const migrationFileView = Qt.createQmlObject(`
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
FileView {
|
||||
id: migrationView
|
||||
path: "${oldChangelogPath}"
|
||||
printErrors: false
|
||||
adapter: JsonAdapter {
|
||||
property string lastSeenVersion: ""
|
||||
}
|
||||
onLoaded: {
|
||||
parent.changelogLastSeenVersion = adapter.lastSeenVersion || "";
|
||||
parent.debouncedSaveChangelogState();
|
||||
Logger.i("UpdateService", "Migrated changelog-state.json to ShellState");
|
||||
migrationView.destroy();
|
||||
}
|
||||
onLoadFailed: {
|
||||
migrationView.destroy();
|
||||
}
|
||||
}
|
||||
`, root, "changelogMigrationView");
|
||||
}
|
||||
|
||||
function debouncedSaveChangelogState() {
|
||||
// Queue a save and restart the debounce timer
|
||||
pendingSave = true;
|
||||
|
||||
@@ -547,48 +547,13 @@ Singleton {
|
||||
const notifState = ShellState.getNotificationsState();
|
||||
root.lastSeenTs = notifState.lastSeenTs || 0;
|
||||
|
||||
if (root.lastSeenTs === 0) {
|
||||
// Try to migrate from old notifications-state.json
|
||||
migrateFromOldStateFile();
|
||||
// Also try settings migration
|
||||
if (root.lastSeenTs === 0 && Settings.data.notifications && Settings.data.notifications.lastSeenTs) {
|
||||
root.lastSeenTs = Settings.data.notifications.lastSeenTs;
|
||||
saveState();
|
||||
Logger.i("Notifications", "Migrated lastSeenTs from settings to ShellState");
|
||||
}
|
||||
}
|
||||
|
||||
// Migration is now handled in Settings.qml
|
||||
Logger.d("Notifications", "Loaded state from ShellState");
|
||||
} catch (e) {
|
||||
Logger.e("Notifications", "Load state failed:", e);
|
||||
}
|
||||
}
|
||||
|
||||
function migrateFromOldStateFile() {
|
||||
const oldStatePath = Settings.cacheDir + "notifications-state.json";
|
||||
const migrationFileView = Qt.createQmlObject(`
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
FileView {
|
||||
id: migrationView
|
||||
path: "${oldStatePath}"
|
||||
printErrors: false
|
||||
adapter: JsonAdapter {
|
||||
property real lastSeenTs: 0
|
||||
}
|
||||
onLoaded: {
|
||||
parent.lastSeenTs = adapter.lastSeenTs || 0;
|
||||
parent.saveState();
|
||||
Logger.i("Notifications", "Migrated notifications-state.json to ShellState");
|
||||
migrationView.destroy();
|
||||
}
|
||||
onLoadFailed: {
|
||||
migrationView.destroy();
|
||||
}
|
||||
}
|
||||
`, root, "notificationMigrationView");
|
||||
}
|
||||
|
||||
function saveState() {
|
||||
try {
|
||||
ShellState.setNotificationsState({
|
||||
|
||||
@@ -213,6 +213,7 @@ Singleton {
|
||||
FileView {
|
||||
id: colorsWriter
|
||||
path: colorsJsonFilePath
|
||||
printErrors: false
|
||||
onSaved:
|
||||
|
||||
// Logger.i("ColorScheme", "Colors saved")
|
||||
|
||||
@@ -114,11 +114,7 @@ Singleton {
|
||||
}
|
||||
Logger.d("Wallpaper", "Loaded wallpapers from Settings");
|
||||
|
||||
// Migrate to ShellState if we loaded from Settings
|
||||
if (typeof ShellState !== 'undefined' && ShellState.isLoaded && Object.keys(currentWallpapers).length > 0) {
|
||||
ShellState.setWallpapers(currentWallpapers);
|
||||
Logger.i("Wallpaper", "Migrated wallpaper paths from Settings to ShellState");
|
||||
}
|
||||
// Migration is now handled in Settings.qml
|
||||
}
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user