1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-08 22:45:38 -05:00

fix modal unloading

This commit is contained in:
bbedward
2025-08-13 16:15:57 -04:00
parent 141dd7c66b
commit 79d69ed2b8
2 changed files with 1092 additions and 1087 deletions

View File

@@ -27,21 +27,23 @@ PanelWindow {
property real borderWidth: 1 property real borderWidth: 1
property real cornerRadius: Theme.cornerRadius property real cornerRadius: Theme.cornerRadius
property bool enableShadow: false property bool enableShadow: false
// Expose the focusScope for external access
property alias modalFocusScope: focusScope
signal opened signal opened()
signal dialogClosed signal dialogClosed()
signal backgroundClicked signal backgroundClicked()
function open() { function open() {
visible = true visible = true;
} }
function close() { function close() {
visible = false visible = false;
} }
function toggle() { function toggle() {
visible = !visible visible = !visible;
} }
color: "transparent" color: "transparent"
@@ -50,22 +52,22 @@ PanelWindow {
WlrLayershell.keyboardFocus: { WlrLayershell.keyboardFocus: {
switch (root.keyboardFocus) { switch (root.keyboardFocus) {
case "exclusive": case "exclusive":
return WlrKeyboardFocus.Exclusive return WlrKeyboardFocus.Exclusive;
case "none": case "none":
return WlrKeyboardFocus.None return WlrKeyboardFocus.None;
default: default:
return WlrKeyboardFocus.OnDemand return WlrKeyboardFocus.OnDemand;
} }
} }
onVisibleChanged: { onVisibleChanged: {
if (root.visible) { if (root.visible) {
opened() opened();
} else { } else {
if (Qt.inputMethod) { if (Qt.inputMethod) {
Qt.inputMethod.hide() Qt.inputMethod.hide();
Qt.inputMethod.reset() Qt.inputMethod.reset();
} }
dialogClosed() dialogClosed();
} }
} }
@@ -87,12 +89,11 @@ PanelWindow {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: root.closeOnBackgroundClick enabled: root.closeOnBackgroundClick
onClicked: mouse => { onClicked: (mouse) => {
var localPos = mapToItem(contentContainer, mouse.x, mouse.y) var localPos = mapToItem(contentContainer, mouse.x, mouse.y);
if (localPos.x < 0 || localPos.x > contentContainer.width if (localPos.x < 0 || localPos.x > contentContainer.width || localPos.y < 0 || localPos.y > contentContainer.height)
|| localPos.y < 0 root.backgroundClicked();
|| localPos.y > contentContainer.height)
root.backgroundClicked()
} }
} }
@@ -101,7 +102,9 @@ PanelWindow {
duration: root.animationDuration duration: root.animationDuration
easing.type: root.animationEasing easing.type: root.animationEasing
} }
} }
} }
Rectangle { Rectangle {
@@ -112,18 +115,17 @@ PanelWindow {
anchors.centerIn: positioning === "center" ? parent : undefined anchors.centerIn: positioning === "center" ? parent : undefined
x: { x: {
if (positioning === "top-right") if (positioning === "top-right")
return Math.max(Theme.spacingL, return Math.max(Theme.spacingL, root.screenWidth - width - Theme.spacingL);
root.screenWidth - width - Theme.spacingL)
else if (positioning === "custom") else if (positioning === "custom")
return root.customPosition.x return root.customPosition.x;
return 0 // Will be overridden by anchors.centerIn when positioning === "center" return 0; // Will be overridden by anchors.centerIn when positioning === "center"
} }
y: { y: {
if (positioning === "top-right") if (positioning === "top-right")
return Theme.barHeight + Theme.spacingXS return Theme.barHeight + Theme.spacingXS;
else if (positioning === "custom") else if (positioning === "custom")
return root.customPosition.y return root.customPosition.y;
return 0 // Will be overridden by anchors.centerIn when positioning === "center" return 0; // Will be overridden by anchors.centerIn when positioning === "center"
} }
color: root.backgroundColor color: root.backgroundColor
radius: root.cornerRadius radius: root.cornerRadius
@@ -133,9 +135,9 @@ PanelWindow {
opacity: root.visible ? 1 : 0 opacity: root.visible ? 1 : 0
scale: { scale: {
if (root.animationType === "scale") if (root.animationType === "scale")
return root.visible ? 1 : 0.9 return root.visible ? 1 : 0.9;
return 1 return 1;
} }
transform: root.animationType === "slide" ? slideTransform : null transform: root.animationType === "slide" ? slideTransform : null
@@ -150,7 +152,7 @@ PanelWindow {
id: contentLoader id: contentLoader
anchors.fill: parent anchors.fill: parent
active: true active: root.visible
asynchronous: false asynchronous: false
} }
@@ -159,6 +161,7 @@ PanelWindow {
duration: root.animationDuration duration: root.animationDuration
easing.type: root.animationEasing easing.type: root.animationEasing
} }
} }
Behavior on scale { Behavior on scale {
@@ -168,6 +171,7 @@ PanelWindow {
duration: root.animationDuration duration: root.animationDuration
easing.type: root.animationEasing easing.type: root.animationEasing
} }
} }
layer.effect: MultiEffect { layer.effect: MultiEffect {
@@ -178,31 +182,29 @@ PanelWindow {
shadowColor: Theme.shadowStrong shadowColor: Theme.shadowStrong
shadowOpacity: 0.3 shadowOpacity: 0.3
} }
} }
FocusScope { FocusScope {
id: focusScope id: focusScope
objectName: "modalFocusScope"
objectName: "modalFocusScope"
anchors.fill: parent anchors.fill: parent
visible: root.visible // Only active when the modal is visible visible: root.visible // Only active when the modal is visible
focus: root.visible focus: root.visible
Keys.onEscapePressed: event => { Keys.onEscapePressed: (event) => {
if (root.closeOnEscapeKey) { if (root.closeOnEscapeKey) {
root.visible = false root.visible = false;
event.accepted = true event.accepted = true;
} }
} }
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible)
Qt.callLater(function () { Qt.callLater(function() {
focusScope.forceActiveFocus() focusScope.forceActiveFocus();
}) });
}
} }
} }
// Expose the focusScope for external access
property alias modalFocusScope: focusScope
} }

View File

@@ -8,6 +8,10 @@ import qs.Widgets
Item { Item {
id: appearanceTab id: appearanceTab
property var cachedFontFamilies: []
property var cachedMonoFamilies: []
property bool fontsEnumerated: false
DankFlickable { DankFlickable {
anchors.fill: parent anchors.fill: parent
anchors.topMargin: Theme.spacingL anchors.topMargin: Theme.spacingL
@@ -18,18 +22,68 @@ Item {
Column { Column {
id: mainColumn id: mainColumn
function enumerateFonts() {
var fonts = ["Default (" + SettingsData.defaultFontFamily + ")"];
var availableFonts = Qt.fontFamilies();
var rootFamilies = [];
var seenFamilies = new Set();
for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i];
if (fontName.startsWith("."))
continue;
if (fontName === SettingsData.defaultFontFamily)
continue;
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) {
return match;
}).trim();
if (!seenFamilies.has(rootName) && rootName !== "") {
seenFamilies.add(rootName);
rootFamilies.push(rootName);
}
}
cachedFontFamilies = fonts.concat(rootFamilies.sort());
var monoFonts = ["Default"];
var monoFamilies = [];
var seenMonoFamilies = new Set();
for (var j = 0; j < availableFonts.length; j++) {
var fontName2 = availableFonts[j];
if (fontName2.startsWith("."))
continue;
if (fontName2 === SettingsData.defaultMonoFontFamily)
continue;
var lowerName = fontName2.toLowerCase();
if (lowerName.includes("mono") || lowerName.includes("code") || lowerName.includes("console") || lowerName.includes("terminal") || lowerName.includes("courier") || lowerName.includes("dejavu sans mono") || lowerName.includes("jetbrains") || lowerName.includes("fira") || lowerName.includes("hack") || lowerName.includes("source code") || lowerName.includes("ubuntu mono") || lowerName.includes("cascadia")) {
var rootName2 = fontName2.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").trim();
if (!seenMonoFamilies.has(rootName2) && rootName2 !== "") {
seenMonoFamilies.add(rootName2);
monoFamilies.push(rootName2);
}
}
}
cachedMonoFamilies = monoFonts.concat(monoFamilies.sort());
}
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
Component.onCompleted: {
if (!fontsEnumerated) {
enumerateFonts();
fontsEnumerated = true;
}
}
// Display Settings // Display Settings
StyledRect { StyledRect {
width: parent.width width: parent.width
height: displaySection.implicitHeight + Theme.spacingL * 2 height: displaySection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -57,29 +111,33 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankToggle { DankToggle {
id: nightModeToggle id: nightModeToggle
width: parent.width width: parent.width
text: "Night Mode" text: "Night Mode"
description: "Apply warm color temperature to reduce eye strain" description: "Apply warm color temperature to reduce eye strain"
checked: BrightnessService.nightModeActive checked: BrightnessService.nightModeActive
onToggled: checked => { onToggled: (checked) => {
if (checked !== BrightnessService.nightModeActive) { if (checked !== BrightnessService.nightModeActive) {
if (checked) if (checked)
BrightnessService.enableNightMode() BrightnessService.enableNightMode();
else else
BrightnessService.disableNightMode() BrightnessService.disableNightMode();
} }
} }
Connections { Connections {
target: BrightnessService
function onNightModeActiveChanged() { function onNightModeActiveChanged() {
nightModeToggle.checked = BrightnessService.nightModeActive nightModeToggle.checked = BrightnessService.nightModeActive;
} }
target: BrightnessService
} }
} }
DankDropdown { DankDropdown {
@@ -87,7 +145,7 @@ Item {
text: "Night Mode Temperature" text: "Night Mode Temperature"
description: BrightnessService.nightModeActive ? "Disable night mode to adjust" : "Set temperature for night mode" description: BrightnessService.nightModeActive ? "Disable night mode to adjust" : "Set temperature for night mode"
enabled: !BrightnessService.nightModeActive enabled: !BrightnessService.nightModeActive
opacity: !BrightnessService.nightModeActive ? 1.0 : 0.6 opacity: !BrightnessService.nightModeActive ? 1 : 0.6
currentValue: SessionData.nightModeTemperature + "K" currentValue: SessionData.nightModeTemperature + "K"
options: { options: {
var temps = []; var temps = [];
@@ -96,7 +154,7 @@ Item {
} }
return temps; return temps;
} }
onValueChanged: value => { onValueChanged: (value) => {
var temp = parseInt(value.replace("K", "")); var temp = parseInt(value.replace("K", ""));
SessionData.setNightModeTemperature(temp); SessionData.setNightModeTemperature(temp);
} }
@@ -107,10 +165,10 @@ Item {
text: "Light Mode" text: "Light Mode"
description: "Use light theme instead of dark theme" description: "Use light theme instead of dark theme"
checked: SessionData.isLightMode checked: SessionData.isLightMode
onToggled: checked => { onToggled: (checked) => {
SessionData.setLightMode(checked) SessionData.setLightMode(checked);
Theme.isLightMode = checked Theme.isLightMode = checked;
PortalService.setLightMode(checked) PortalService.setLightMode(checked);
} }
} }
@@ -123,16 +181,14 @@ Item {
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: { options: {
SettingsData.detectAvailableIconThemes() SettingsData.detectAvailableIconThemes();
return SettingsData.availableIconThemes return SettingsData.availableIconThemes;
} }
onValueChanged: value => { onValueChanged: (value) => {
SettingsData.setIconTheme(value) SettingsData.setIconTheme(value);
if (value !== "System Default" if (value !== "System Default" && !SettingsData.qt5ctAvailable && !SettingsData.qt6ctAvailable)
&& !SettingsData.qt5ctAvailable ToastService.showWarning("qt5ct or qt6ct not found - Qt app themes may not update without these tools");
&& !SettingsData.qt6ctAvailable)
ToastService.showWarning(
"qt5ct or qt6ct not found - Qt app themes may not update without these tools")
} }
} }
@@ -142,48 +198,19 @@ Item {
description: "Select system font family" description: "Select system font family"
currentValue: { currentValue: {
if (SettingsData.fontFamily === SettingsData.defaultFontFamily) if (SettingsData.fontFamily === SettingsData.defaultFontFamily)
return "Default (" + SettingsData.defaultFontFamily + ")" return "Default (" + SettingsData.defaultFontFamily + ")";
else else
return SettingsData.fontFamily return SettingsData.fontFamily || "Default (" + SettingsData.defaultFontFamily + ")";
|| "Default (" + SettingsData.defaultFontFamily + ")"
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: { options: cachedFontFamilies
var fonts = ["Default (" + SettingsData.defaultFontFamily + ")"] onValueChanged: (value) => {
var availableFonts = Qt.fontFamilies()
var rootFamilies = []
var seenFamilies = new Set()
for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i]
if (fontName.startsWith("."))
continue
if (fontName === SettingsData.defaultFontFamily)
continue
var rootName = fontName.replace(
/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i,
"").replace(
/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i,
"").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i,
function (match, suffix) {
return match
}).trim()
if (!seenFamilies.has(rootName) && rootName !== "") {
seenFamilies.add(rootName)
rootFamilies.push(rootName)
}
}
return fonts.concat(rootFamilies.sort())
}
onValueChanged: value => {
if (value.startsWith("Default (")) if (value.startsWith("Default ("))
SettingsData.setFontFamily( SettingsData.setFontFamily(SettingsData.defaultFontFamily);
SettingsData.defaultFontFamily)
else else
SettingsData.setFontFamily(value) SettingsData.setFontFamily(value);
} }
} }
@@ -194,63 +221,63 @@ Item {
currentValue: { currentValue: {
switch (SettingsData.fontWeight) { switch (SettingsData.fontWeight) {
case Font.Thin: case Font.Thin:
return "Thin" return "Thin";
case Font.ExtraLight: case Font.ExtraLight:
return "Extra Light" return "Extra Light";
case Font.Light: case Font.Light:
return "Light" return "Light";
case Font.Normal: case Font.Normal:
return "Regular" return "Regular";
case Font.Medium: case Font.Medium:
return "Medium" return "Medium";
case Font.DemiBold: case Font.DemiBold:
return "Demi Bold" return "Demi Bold";
case Font.Bold: case Font.Bold:
return "Bold" return "Bold";
case Font.ExtraBold: case Font.ExtraBold:
return "Extra Bold" return "Extra Bold";
case Font.Black: case Font.Black:
return "Black" return "Black";
default: default:
return "Regular" return "Regular";
} }
} }
options: ["Thin", "Extra Light", "Light", "Regular", "Medium", "Demi Bold", "Bold", "Extra Bold", "Black"] options: ["Thin", "Extra Light", "Light", "Regular", "Medium", "Demi Bold", "Bold", "Extra Bold", "Black"]
onValueChanged: value => { onValueChanged: (value) => {
var weight var weight;
switch (value) { switch (value) {
case "Thin": case "Thin":
weight = Font.Thin weight = Font.Thin;
break break;
case "Extra Light": case "Extra Light":
weight = Font.ExtraLight weight = Font.ExtraLight;
break break;
case "Light": case "Light":
weight = Font.Light weight = Font.Light;
break break;
case "Regular": case "Regular":
weight = Font.Normal weight = Font.Normal;
break break;
case "Medium": case "Medium":
weight = Font.Medium weight = Font.Medium;
break break;
case "Demi Bold": case "Demi Bold":
weight = Font.DemiBold weight = Font.DemiBold;
break break;
case "Bold": case "Bold":
weight = Font.Bold weight = Font.Bold;
break break;
case "Extra Bold": case "Extra Bold":
weight = Font.ExtraBold weight = Font.ExtraBold;
break break;
case "Black": case "Black":
weight = Font.Black weight = Font.Black;
break break;
default: default:
weight = Font.Normal weight = Font.Normal;
break break;
} }
SettingsData.setFontWeight(weight) SettingsData.setFontWeight(weight);
} }
} }
@@ -260,59 +287,24 @@ Item {
description: "Select monospace font for process list and technical displays" description: "Select monospace font for process list and technical displays"
currentValue: { currentValue: {
if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily) if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily)
return "Default" return "Default";
return SettingsData.monoFontFamily || "Default" return SettingsData.monoFontFamily || "Default";
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: { options: cachedMonoFamilies
var fonts = ["Default"] onValueChanged: (value) => {
var availableFonts = Qt.fontFamilies()
var monoFamilies = []
var seenFamilies = new Set()
for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i]
if (fontName.startsWith("."))
continue
if (fontName === SettingsData.defaultMonoFontFamily)
continue
var lowerName = fontName.toLowerCase()
if (lowerName.includes("mono") || lowerName.includes(
"code") || lowerName.includes(
"console") || lowerName.includes(
"terminal") || lowerName.includes(
"courier") || lowerName.includes(
"dejavu sans mono") || lowerName.includes(
"jetbrains") || lowerName.includes(
"fira") || lowerName.includes("hack") || lowerName.includes(
"source code") || lowerName.includes(
"ubuntu mono") || lowerName.includes("cascadia")) {
var rootName = fontName.replace(
/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i,
"").replace(
/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i,
"").trim()
if (!seenFamilies.has(rootName) && rootName !== "") {
seenFamilies.add(rootName)
monoFamilies.push(rootName)
}
}
}
return fonts.concat(monoFamilies.sort())
}
onValueChanged: value => {
if (value === "Default") if (value === "Default")
SettingsData.setMonoFontFamily( SettingsData.setMonoFontFamily(SettingsData.defaultMonoFontFamily);
SettingsData.defaultMonoFontFamily)
else else
SettingsData.setMonoFontFamily(value) SettingsData.setMonoFontFamily(value);
} }
} }
} }
} }
// Transparency Settings // Transparency Settings
@@ -320,10 +312,8 @@ Item {
width: parent.width width: parent.width
height: transparencySection.implicitHeight + Theme.spacingL * 2 height: transparencySection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -351,6 +341,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Column { Column {
@@ -372,11 +363,11 @@ Item {
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: newValue => { onSliderValueChanged: (newValue) => {
SettingsData.setTopBarTransparency( SettingsData.setTopBarTransparency(newValue / 100);
newValue / 100)
} }
} }
} }
Column { Column {
@@ -398,11 +389,11 @@ Item {
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: newValue => { onSliderValueChanged: (newValue) => {
SettingsData.setTopBarWidgetTransparency( SettingsData.setTopBarWidgetTransparency(newValue / 100);
newValue / 100)
} }
} }
} }
Column { Column {
@@ -424,13 +415,15 @@ Item {
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: newValue => { onSliderValueChanged: (newValue) => {
SettingsData.setPopupTransparency( SettingsData.setPopupTransparency(newValue / 100);
newValue / 100)
} }
} }
} }
} }
} }
// Corner Radius // Corner Radius
@@ -438,10 +431,8 @@ Item {
width: parent.width width: parent.width
height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2 height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -469,6 +460,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Column { Column {
@@ -490,12 +482,15 @@ Item {
maximum: 32 maximum: 32
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: newValue => { onSliderValueChanged: (newValue) => {
SettingsData.setCornerRadius(newValue) SettingsData.setCornerRadius(newValue);
} }
} }
} }
} }
} }
// Theme Color // Theme Color
@@ -503,10 +498,8 @@ Item {
width: parent.width width: parent.width
height: themeSection.implicitHeight + Theme.spacingL * 2 height: themeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -534,6 +527,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Column { Column {
@@ -551,10 +545,10 @@ Item {
StyledText { StyledText {
text: { text: {
if (Theme.isDynamicTheme) if (Theme.isDynamicTheme)
return "Wallpaper-based dynamic colors" return "Wallpaper-based dynamic colors";
var descriptions = ["Material blue inspired by modern interfaces", "Deep blue inspired by material 3", "Rich purple tones for BB elegance", "Natural green for productivity", "Energetic orange for creativity", "Bold red for impact", "Cool cyan for tranquility", "Vibrant pink for expression", "Warm amber for comfort", "Soft coral for gentle warmth"] var descriptions = ["Material blue inspired by modern interfaces", "Deep blue inspired by material 3", "Rich purple tones for BB elegance", "Natural green for productivity", "Energetic orange for creativity", "Bold red for impact", "Cool cyan for tranquility", "Vibrant pink for expression", "Warm amber for comfort", "Soft coral for gentle warmth"];
return descriptions[Theme.currentThemeIndex] || "Select a theme" return descriptions[Theme.currentThemeIndex] || "Select a theme";
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
@@ -563,6 +557,7 @@ Item {
width: Math.min(parent.width, 400) width: Math.min(parent.width, 400)
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }
Column { Column {
@@ -582,10 +577,8 @@ Item {
radius: 16 radius: 16
color: Theme.themes[index].primary color: Theme.themes[index].primary
border.color: Theme.outline border.color: Theme.outline
border.width: (Theme.currentThemeIndex === index border.width: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 2 : 1
&& !Theme.isDynamicTheme) ? 2 : 1 scale: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 1.1 : 1
scale: (Theme.currentThemeIndex === index
&& !Theme.isDynamicTheme) ? 1.1 : 1
Rectangle { Rectangle {
width: nameText.contentWidth + Theme.spacingS * 2 width: nameText.contentWidth + Theme.spacingS * 2
@@ -607,6 +600,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
MouseArea { MouseArea {
@@ -616,7 +610,7 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Theme.switchTheme(index, false) Theme.switchTheme(index, false);
} }
} }
@@ -625,6 +619,7 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
Behavior on border.width { Behavior on border.width {
@@ -632,9 +627,13 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
} }
} }
Row { Row {
@@ -650,8 +649,7 @@ Item {
width: 32 width: 32
height: 32 height: 32
radius: 16 radius: 16
color: themeIndex color: themeIndex < Theme.themes.length ? Theme.themes[themeIndex].primary : "transparent"
< Theme.themes.length ? Theme.themes[themeIndex].primary : "transparent"
border.color: Theme.outline border.color: Theme.outline
border.width: Theme.currentThemeIndex === themeIndex ? 2 : 1 border.width: Theme.currentThemeIndex === themeIndex ? 2 : 1
visible: themeIndex < Theme.themes.length visible: themeIndex < Theme.themes.length
@@ -667,8 +665,7 @@ Item {
anchors.bottom: parent.top anchors.bottom: parent.top
anchors.bottomMargin: Theme.spacingXS anchors.bottomMargin: Theme.spacingXS
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: mouseArea2.containsMouse visible: mouseArea2.containsMouse && themeIndex < Theme.themes.length
&& themeIndex < Theme.themes.length
StyledText { StyledText {
id: nameText2 id: nameText2
@@ -678,6 +675,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
MouseArea { MouseArea {
@@ -688,7 +686,8 @@ Item {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (themeIndex < Theme.themes.length) if (themeIndex < Theme.themes.length)
Theme.switchTheme(themeIndex) Theme.switchTheme(themeIndex);
} }
} }
@@ -697,6 +696,7 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
Behavior on border.width { Behavior on border.width {
@@ -704,9 +704,13 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
} }
} }
Item { Item {
@@ -720,22 +724,18 @@ Item {
radius: 20 radius: 20
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: { color: {
if (ToastService.wallpaperErrorStatus === "error" if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|| ToastService.wallpaperErrorStatus === "matugen_missing") return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.12)
else else
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3);
Theme.surfaceVariant.b, 0.3)
} }
border.color: { border.color: {
if (ToastService.wallpaperErrorStatus === "error" if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|| ToastService.wallpaperErrorStatus === "matugen_missing") return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.5);
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.5)
else if (Theme.isDynamicTheme) else if (Theme.isDynamicTheme)
return Theme.primary return Theme.primary;
else else
return Theme.outline return Theme.outline;
} }
border.width: Theme.isDynamicTheme ? 2 : 1 border.width: Theme.isDynamicTheme ? 2 : 1
scale: Theme.isDynamicTheme ? 1.1 : (autoMouseArea.containsMouse ? 1.02 : 1) scale: Theme.isDynamicTheme ? 1.1 : (autoMouseArea.containsMouse ? 1.02 : 1)
@@ -746,19 +746,17 @@ Item {
DankIcon { DankIcon {
name: { name: {
if (ToastService.wallpaperErrorStatus === "error" if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|| ToastService.wallpaperErrorStatus === "matugen_missing") return "error";
return "error"
else else
return "palette" return "palette";
} }
size: 16 size: 16
color: { color: {
if (ToastService.wallpaperErrorStatus === "error" if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|| ToastService.wallpaperErrorStatus === "matugen_missing") return Theme.error;
return Theme.error
else else
return Theme.surfaceText return Theme.surfaceText;
} }
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@@ -766,23 +764,23 @@ Item {
StyledText { StyledText {
text: { text: {
if (ToastService.wallpaperErrorStatus === "error") if (ToastService.wallpaperErrorStatus === "error")
return "Error" return "Error";
else if (ToastService.wallpaperErrorStatus === "matugen_missing") else if (ToastService.wallpaperErrorStatus === "matugen_missing")
return "No matugen" return "No matugen";
else else
return "Auto" return "Auto";
} }
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: { color: {
if (ToastService.wallpaperErrorStatus === "error" if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
|| ToastService.wallpaperErrorStatus === "matugen_missing") return Theme.error;
return Theme.error
else else
return Theme.surfaceText return Theme.surfaceText;
} }
font.weight: Font.Medium font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -793,13 +791,11 @@ Item {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "matugen_missing")
ToastService.showError( ToastService.showError("matugen not found - install matugen package for dynamic theming");
"matugen not found - install matugen package for dynamic theming")
else if (ToastService.wallpaperErrorStatus === "error") else if (ToastService.wallpaperErrorStatus === "error")
ToastService.showError( ToastService.showError("Wallpaper processing failed - check wallpaper path");
"Wallpaper processing failed - check wallpaper path")
else else
Theme.switchTheme(10, true) Theme.switchTheme(10, true);
} }
} }
@@ -813,29 +809,25 @@ Item {
anchors.bottom: parent.top anchors.bottom: parent.top
anchors.bottomMargin: Theme.spacingS anchors.bottomMargin: Theme.spacingS
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: autoMouseArea.containsMouse visible: autoMouseArea.containsMouse && (!Theme.isDynamicTheme || ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing")
&& (!Theme.isDynamicTheme
|| ToastService.wallpaperErrorStatus === "error"
|| ToastService.wallpaperErrorStatus === "matugen_missing")
StyledText { StyledText {
id: autoTooltipText id: autoTooltipText
text: { text: {
if (ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "matugen_missing")
return "Install matugen package for dynamic themes" return "Install matugen package for dynamic themes";
else else
return "Dynamic wallpaper-based colors" return "Dynamic wallpaper-based colors";
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: (ToastService.wallpaperErrorStatus === "error" color: (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") ? Theme.error : Theme.surfaceText
|| ToastService.wallpaperErrorStatus
=== "matugen_missing") ? Theme.error : Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: Math.min(implicitWidth, 250) width: Math.min(implicitWidth, 250)
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }
Behavior on scale { Behavior on scale {
@@ -843,6 +835,7 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
Behavior on color { Behavior on color {
@@ -850,6 +843,7 @@ Item {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
Behavior on border.color { Behavior on border.color {
@@ -857,10 +851,15 @@ Item {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
} }
} }
} }
// System App Theming // System App Theming
@@ -868,10 +867,8 @@ Item {
width: parent.width width: parent.width
height: systemThemingSection.implicitHeight + Theme.spacingL * 2 height: systemThemingSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
visible: Theme.isDynamicTheme && Colors.matugenAvailable visible: Theme.isDynamicTheme && Colors.matugenAvailable
@@ -900,6 +897,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankToggle { DankToggle {
@@ -908,10 +906,11 @@ Item {
description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)" description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)"
enabled: Colors.gtkThemingEnabled enabled: Colors.gtkThemingEnabled
checked: Colors.gtkThemingEnabled && SettingsData.gtkThemingEnabled checked: Colors.gtkThemingEnabled && SettingsData.gtkThemingEnabled
onToggled: function (checked) { onToggled: function(checked) {
SettingsData.setGtkThemingEnabled(checked) SettingsData.setGtkThemingEnabled(checked);
if (checked && Theme.isDynamicTheme) if (checked && Theme.isDynamicTheme)
Colors.generateGtkThemes() Colors.generateGtkThemes();
} }
} }
@@ -921,16 +920,20 @@ Item {
description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)" description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)"
enabled: Colors.qtThemingEnabled enabled: Colors.qtThemingEnabled
checked: Colors.qtThemingEnabled && SettingsData.qtThemingEnabled checked: Colors.qtThemingEnabled && SettingsData.qtThemingEnabled
onToggled: function (checked) { onToggled: function(checked) {
SettingsData.setQtThemingEnabled(checked) SettingsData.setQtThemingEnabled(checked);
if (checked && Theme.isDynamicTheme) if (checked && Theme.isDynamicTheme)
Colors.generateQtThemes() Colors.generateQtThemes();
}
}
}
}
} }
} }
}
}
}
}
} }