1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-14 09:42:10 -04:00

settings: allow custom json to render all theme options

This commit is contained in:
bbedward
2026-03-12 17:58:42 -04:00
parent 86c0064ff9
commit 4ae334f60f

View File

@@ -2,7 +2,6 @@ import QtCore
import QtQuick import QtQuick
import QtQuick.Effects import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.Io
import qs.Common import qs.Common
import qs.Modals.FileBrowser import qs.Modals.FileBrowser
import qs.Services import qs.Services
@@ -742,6 +741,24 @@ Item {
} }
} }
StyledText {
text: I18n.tr("No themes installed. Browse themes to install from the registry.", "no registry themes installed hint")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
visible: themeColorsTab.installedRegistryThemes.length === 0
horizontalAlignment: Text.AlignHCenter
}
DankButton {
text: I18n.tr("Browse Themes", "browse themes button")
iconName: "store"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: showThemeBrowser()
}
}
Column { Column {
id: variantSelector id: variantSelector
width: parent.width width: parent.width
@@ -749,7 +766,9 @@ Item {
visible: activeThemeId !== "" && activeThemeVariants !== null && (isMultiVariant || (activeThemeVariants.options && activeThemeVariants.options.length > 0)) visible: activeThemeId !== "" && activeThemeVariants !== null && (isMultiVariant || (activeThemeVariants.options && activeThemeVariants.options.length > 0))
property string activeThemeId: { property string activeThemeId: {
if (Theme.currentThemeCategory !== "registry" || Theme.currentTheme !== "custom") switch (Theme.currentThemeCategory) {
case "registry":
if (Theme.currentTheme !== "custom")
return ""; return "";
for (var i = 0; i < themeColorsTab.installedRegistryThemes.length; i++) { for (var i = 0; i < themeColorsTab.installedRegistryThemes.length; i++) {
var t = themeColorsTab.installedRegistryThemes[i]; var t = themeColorsTab.installedRegistryThemes[i];
@@ -757,16 +776,28 @@ Item {
return t.id; return t.id;
} }
return ""; return "";
case "custom":
return Theme.currentThemeId || "";
default:
return "";
}
} }
property var activeThemeVariants: { property var activeThemeVariants: {
if (!activeThemeId) if (!activeThemeId)
return null; return null;
switch (Theme.currentThemeCategory) {
case "registry":
for (var i = 0; i < themeColorsTab.installedRegistryThemes.length; i++) { for (var i = 0; i < themeColorsTab.installedRegistryThemes.length; i++) {
var t = themeColorsTab.installedRegistryThemes[i]; var t = themeColorsTab.installedRegistryThemes[i];
if (t.id === activeThemeId && t.hasVariants) if (t.id === activeThemeId && t.hasVariants)
return t.variants; return t.variants;
} }
return null; return null;
case "custom":
return Theme.currentThemeVariants || null;
default:
return null;
}
} }
property bool isMultiVariant: activeThemeVariants?.type === "multi" property bool isMultiVariant: activeThemeVariants?.type === "multi"
property string colorMode: Theme.isLightMode ? "light" : "dark" property string colorMode: Theme.isLightMode ? "light" : "dark"
@@ -883,7 +914,7 @@ Item {
width: accentColorsGrid.dotSize width: accentColorsGrid.dotSize
height: accentColorsGrid.dotSize height: accentColorsGrid.dotSize
radius: width / 2 radius: width / 2
color: modelData.color || Theme.primary color: modelData.color || modelData[variantSelector.selectedFlavor]?.primary || Theme.primary
border.color: Theme.outline border.color: Theme.outline
border.width: isSelected ? 2 : 1 border.width: isSelected ? 2 : 1
scale: isSelected ? 1.1 : 1 scale: isSelected ? 1.1 : 1
@@ -969,24 +1000,6 @@ Item {
} }
} }
} }
StyledText {
text: I18n.tr("No themes installed. Browse themes to install from the registry.", "no registry themes installed hint")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
visible: themeColorsTab.installedRegistryThemes.length === 0
horizontalAlignment: Text.AlignHCenter
}
DankButton {
text: I18n.tr("Browse Themes", "browse themes button")
iconName: "store"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: showThemeBrowser()
}
}
} }
} }