1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

settings: refactor for maintainability

This commit is contained in:
bbedward
2025-11-04 12:58:50 -05:00
parent bca5ee0c0d
commit 20116b3933
27 changed files with 959 additions and 1628 deletions

View File

@@ -18,7 +18,7 @@ Item {
browserType: "generic"
filterExtensions: ["*.svg", "*.png", "*.jpg", "*.jpeg", "*.webp"]
onFileSelected: path => {
SettingsData.setLauncherLogoCustomPath(path.replace("file://", ""))
SettingsData.set("launcherLogoCustomPath", path.replace("file://", ""))
}
}
@@ -112,15 +112,15 @@ Item {
onSelectionChanged: (index, selected) => {
if (!selected) return
if (index === 0) {
SettingsData.setLauncherLogoMode("apps")
SettingsData.set("launcherLogoMode", "apps")
} else if (index === 1) {
SettingsData.setLauncherLogoMode("os")
SettingsData.set("launcherLogoMode", "os")
} else if (index === 2) {
SettingsData.setLauncherLogoMode("dank")
SettingsData.set("launcherLogoMode", "dank")
} else if (index === 3) {
SettingsData.setLauncherLogoMode("compositor")
SettingsData.set("launcherLogoMode", "compositor")
} else if (index === 4) {
SettingsData.setLauncherLogoMode("custom")
SettingsData.set("launcherLogoMode", "custom")
}
}
}
@@ -210,16 +210,16 @@ Item {
onSelectionChanged: (index, selected) => {
if (!selected) return
if (index === 0) {
SettingsData.setLauncherLogoColorOverride("")
SettingsData.set("launcherLogoColorOverride", "")
} else if (index === 1) {
SettingsData.setLauncherLogoColorOverride("primary")
SettingsData.set("launcherLogoColorOverride", "primary")
} else if (index === 2) {
SettingsData.setLauncherLogoColorOverride("surface")
SettingsData.set("launcherLogoColorOverride", "surface")
} else if (index === 3) {
const currentOverride = SettingsData.launcherLogoColorOverride
const isPreset = currentOverride === "" || currentOverride === "primary" || currentOverride === "surface"
if (isPreset) {
SettingsData.setLauncherLogoColorOverride("#ffffff")
SettingsData.set("launcherLogoColorOverride", "#ffffff")
}
}
}
@@ -252,7 +252,7 @@ Item {
PopoutService.colorPickerModal.selectedColor = SettingsData.launcherLogoColorOverride
PopoutService.colorPickerModal.pickerTitle = I18n.tr("Choose Launcher Logo Color")
PopoutService.colorPickerModal.onColorSelectedCallback = function(selectedColor) {
SettingsData.setLauncherLogoColorOverride(selectedColor)
SettingsData.set("launcherLogoColorOverride", selectedColor)
}
PopoutService.colorPickerModal.show()
}
@@ -291,7 +291,7 @@ Item {
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
anchors.horizontalCenter: parent.horizontalCenter
onSliderValueChanged: newValue => {
SettingsData.setLauncherLogoSizeOffset(newValue)
SettingsData.set("launcherLogoSizeOffset", newValue)
}
}
}
@@ -342,7 +342,7 @@ Item {
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
anchors.horizontalCenter: parent.horizontalCenter
onSliderValueChanged: newValue => {
SettingsData.setLauncherLogoBrightness(newValue / 100)
SettingsData.set("launcherLogoBrightness", newValue / 100)
}
}
}
@@ -371,7 +371,7 @@ Item {
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
anchors.horizontalCenter: parent.horizontalCenter
onSliderValueChanged: newValue => {
SettingsData.setLauncherLogoContrast(newValue / 100)
SettingsData.set("launcherLogoContrast", newValue / 100)
}
}
}
@@ -394,7 +394,7 @@ Item {
checked: SettingsData.launcherLogoColorInvertOnMode
anchors.horizontalCenter: parent.horizontalCenter
onToggled: checked => {
SettingsData.setLauncherLogoColorInvertOnMode(checked)
SettingsData.set("launcherLogoColorInvertOnMode", checked)
}
}
}
@@ -453,7 +453,7 @@ Item {
text: SettingsData.launchPrefix
placeholderText: I18n.tr("Enter launch prefix (e.g., 'uwsm-app')")
onTextEdited: {
SettingsData.setLaunchPrefix(text)
SettingsData.set("launchPrefix", text)
}
}
}
@@ -509,7 +509,7 @@ Item {
checked: SettingsData.sortAppsAlphabetically
anchors.verticalCenter: parent.verticalCenter
onToggled: checked => {
SettingsData.setSortAppsAlphabetically(checked)
SettingsData.set("sortAppsAlphabetically", checked)
}
}
}