mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Wallpaper: renamed/migrated randomEnabled => automationEnabled.
This commit is contained in:
@@ -145,7 +145,7 @@
|
||||
"fillColor": "#000000",
|
||||
"useSolidColor": false,
|
||||
"solidColor": "#1a1a2e",
|
||||
"randomEnabled": false,
|
||||
"automationEnabled": false,
|
||||
"wallpaperChangeMode": "random",
|
||||
"randomIntervalSec": 300,
|
||||
"transitionDuration": 1500,
|
||||
|
||||
@@ -30,13 +30,13 @@ QtObject {
|
||||
"id": templateId,
|
||||
"enabled": true
|
||||
});
|
||||
logger.d("Migration39", "Migrated enabled template: " + templateId);
|
||||
logger.d("Migration40", "Migrated enabled template: " + templateId);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the new format
|
||||
adapter.templates.activeTemplates = activeTemplates;
|
||||
logger.i("Migration39", "Migrated " + activeTemplates.length + " templates to new array format");
|
||||
logger.i("Migration40", "Migrated " + activeTemplates.length + " templates to new array format");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
function migrate(adapter, logger, rawJson) {
|
||||
logger.i("Migration42", "Migrating randomEnabled to automationEnabled");
|
||||
|
||||
const wallpaper = rawJson?.wallpaper;
|
||||
if (!wallpaper) {
|
||||
logger.d("Migration42", "No wallpaper section found, skipping migration");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if already migrated (has automationEnabled)
|
||||
if (wallpaper.automationEnabled !== undefined) {
|
||||
logger.d("Migration42", "Already has automationEnabled, skipping migration");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Migrate randomEnabled to automationEnabled
|
||||
const oldValue = wallpaper.randomEnabled ?? false;
|
||||
adapter.wallpaper.automationEnabled = oldValue;
|
||||
logger.i("Migration42", "Migrated randomEnabled=" + oldValue + " to automationEnabled=" + oldValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ QtObject {
|
||||
36: migration36Component,
|
||||
37: migration37Component,
|
||||
38: migration38Component,
|
||||
40: migration39Component
|
||||
40: migration40Component,
|
||||
42: migration42Component
|
||||
})
|
||||
|
||||
// Migration components
|
||||
@@ -27,5 +28,6 @@ QtObject {
|
||||
property Component migration36Component: Migration36 {}
|
||||
property Component migration37Component: Migration37 {}
|
||||
property Component migration38Component: Migration38 {}
|
||||
property Component migration39Component: Migration40 {}
|
||||
property Component migration40Component: Migration40 {}
|
||||
property Component migration42Component: Migration42 {}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Singleton {
|
||||
- Default cache directory: ~/.cache/noctalia
|
||||
*/
|
||||
readonly property alias data: adapter // Used to access via Settings.data.xxx.yyy
|
||||
readonly property int settingsVersion: 41
|
||||
readonly property int settingsVersion: 42
|
||||
readonly property bool isDebug: Quickshell.env("NOCTALIA_DEBUG") === "1"
|
||||
readonly property string shellName: "noctalia"
|
||||
readonly property string configDir: Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/"
|
||||
@@ -348,7 +348,7 @@ Singleton {
|
||||
property color fillColor: "#000000"
|
||||
property bool useSolidColor: false
|
||||
property color solidColor: "#1a1a2e"
|
||||
property bool randomEnabled: false // Deprecated: use wallpaperChangeMode instead
|
||||
property bool automationEnabled: false
|
||||
property string wallpaperChangeMode: "random" // "random" or "alphabetical"
|
||||
property int randomIntervalSec: 300 // 5 min
|
||||
property int transitionDuration: 1500 // 1500 ms
|
||||
|
||||
@@ -14,12 +14,12 @@ ColumnLayout {
|
||||
NToggle {
|
||||
label: I18n.tr("panels.wallpaper.automation-scheduled-change-label")
|
||||
description: I18n.tr("panels.wallpaper.automation-scheduled-change-description")
|
||||
checked: Settings.data.wallpaper.randomEnabled
|
||||
onToggled: checked => Settings.data.wallpaper.randomEnabled = checked
|
||||
checked: Settings.data.wallpaper.automationEnabled
|
||||
onToggled: checked => Settings.data.wallpaper.automationEnabled = checked
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
enabled: Settings.data.wallpaper.randomEnabled
|
||||
enabled: Settings.data.wallpaper.automationEnabled
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
||||
@@ -356,13 +356,13 @@ Item {
|
||||
}
|
||||
|
||||
function toggleAutomation() {
|
||||
Settings.data.wallpaper.randomEnabled = !Settings.data.wallpaper.randomEnabled;
|
||||
Settings.data.wallpaper.automationEnabled = !Settings.data.wallpaper.automationEnabled;
|
||||
}
|
||||
function disableAutomation() {
|
||||
Settings.data.wallpaper.randomEnabled = false;
|
||||
Settings.data.wallpaper.automationEnabled = false;
|
||||
}
|
||||
function enableAutomation() {
|
||||
Settings.data.wallpaper.randomEnabled = true;
|
||||
Settings.data.wallpaper.automationEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ Singleton {
|
||||
root.wallpaperDirectoryChanged(screenName, root.getMonitorDirectory(screenName));
|
||||
}
|
||||
}
|
||||
function onRandomEnabledChanged() {
|
||||
function onAutomationEnabledChanged() {
|
||||
root.toggleRandomWallpaper();
|
||||
}
|
||||
function onRandomIntervalSecChanged() {
|
||||
@@ -86,7 +86,7 @@ Singleton {
|
||||
function onWallpaperChangeModeChanged() {
|
||||
// Reset alphabetical indices when mode changes
|
||||
root.alphabeticalIndices = {};
|
||||
if (Settings.data.wallpaper.randomEnabled) {
|
||||
if (Settings.data.wallpaper.automationEnabled) {
|
||||
root.restartRandomWallpaperTimer();
|
||||
root.setNextWallpaper();
|
||||
}
|
||||
@@ -444,7 +444,7 @@ Singleton {
|
||||
// -------------------------------------------------------------------
|
||||
function toggleRandomWallpaper() {
|
||||
Logger.d("Wallpaper", "toggleRandomWallpaper");
|
||||
if (Settings.data.wallpaper.randomEnabled) {
|
||||
if (Settings.data.wallpaper.automationEnabled) {
|
||||
restartRandomWallpaperTimer();
|
||||
setNextWallpaper();
|
||||
}
|
||||
@@ -462,7 +462,7 @@ Singleton {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
function restartRandomWallpaperTimer() {
|
||||
if (Settings.data.wallpaper.randomEnabled) {
|
||||
if (Settings.data.wallpaper.automationEnabled) {
|
||||
randomWallpaperTimer.restart();
|
||||
}
|
||||
}
|
||||
@@ -613,7 +613,7 @@ Singleton {
|
||||
Timer {
|
||||
id: randomWallpaperTimer
|
||||
interval: Settings.data.wallpaper.randomIntervalSec * 1000
|
||||
running: Settings.data.wallpaper.randomEnabled
|
||||
running: Settings.data.wallpaper.automationEnabled
|
||||
repeat: true
|
||||
onTriggered: setNextWallpaper()
|
||||
triggeredOnStart: false
|
||||
|
||||
Reference in New Issue
Block a user