1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

qmlfmt with 4 space

This commit is contained in:
bbedward
2025-08-20 00:05:14 -04:00
parent 6e0977c719
commit b688bbfe83
154 changed files with 28809 additions and 27639 deletions

View File

@@ -17,56 +17,75 @@ Item {
property bool fontsEnumerated: false
function enumerateFonts() {
var fonts = ["Default"];
var availableFonts = Qt.fontFamilies();
var rootFamilies = [];
var seenFamilies = new Set();
var fonts = ["Default"]
var availableFonts = Qt.fontFamilies()
var rootFamilies = []
var seenFamilies = new Set()
for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i];
var fontName = availableFonts[i]
if (fontName.startsWith("."))
continue;
continue
if (fontName === SettingsData.defaultFontFamily)
continue;
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();
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);
seenFamilies.add(rootName)
rootFamilies.push(rootName)
}
}
cachedFontFamilies = fonts.concat(rootFamilies.sort());
var monoFonts = ["Default"];
var monoFamilies = [];
var seenMonoFamilies = new Set();
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];
var fontName2 = availableFonts[j]
if (fontName2.startsWith("."))
continue;
continue
if (fontName2 === SettingsData.defaultMonoFontFamily)
continue;
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();
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);
seenMonoFamilies.add(rootName2)
monoFamilies.push(rootName2)
}
}
}
cachedMonoFamilies = monoFonts.concat(monoFamilies.sort());
cachedMonoFamilies = monoFonts.concat(monoFamilies.sort())
}
Component.onCompleted: {
// Access WallpaperCyclingService to ensure it's initialized
WallpaperCyclingService.cyclingActive;
WallpaperCyclingService.cyclingActive
if (!fontsEnumerated) {
enumerateFonts();
fontsEnumerated = true;
enumerateFonts()
fontsEnumerated = true
}
}
@@ -83,14 +102,15 @@ Item {
width: parent.width
spacing: Theme.spacingXL
// Wallpaper Section
StyledRect {
width: parent.width
height: wallpaperSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
@@ -118,7 +138,6 @@ Item {
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
@@ -148,7 +167,6 @@ Item {
maskThresholdMin: 0.5
maskSpreadAtMin: 1
}
}
Rectangle {
@@ -169,7 +187,6 @@ Item {
color: Theme.surfaceVariantText
visible: SessionData.wallpaperPath === ""
}
}
Column {
@@ -178,7 +195,9 @@ Item {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split('/').pop() : "No wallpaper selected"
text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split(
'/').pop(
) : "No wallpaper selected"
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
elide: Text.ElideMiddle
@@ -222,7 +241,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
@@ -230,13 +248,12 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: {
if (parentModal) {
parentModal.allowFocusOverride = true;
parentModal.shouldHaveFocus = false;
parentModal.allowFocusOverride = true
parentModal.shouldHaveFocus = false
}
wallpaperBrowser.open();
wallpaperBrowser.open()
}
}
}
StyledRect {
@@ -263,7 +280,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
@@ -271,16 +287,12 @@ Item {
enabled: SessionData.wallpaperPath !== ""
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
SessionData.setWallpaper("");
SessionData.setWallpaper("")
}
}
}
}
}
}
// Wallpaper Cycling Section - Full Width
@@ -309,7 +321,8 @@ Item {
}
Column {
width: parent.width - Theme.iconSize - Theme.spacingM - controlsRow.width - Theme.spacingM
width: parent.width - Theme.iconSize - Theme.spacingM
- controlsRow.width - Theme.spacingM
spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
@@ -326,7 +339,6 @@ Item {
color: Theme.surfaceVariantText
width: parent.width
}
}
Row {
@@ -339,7 +351,11 @@ Item {
width: 60
height: 32
radius: Theme.cornerRadius
color: prevButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.8) : Theme.primary
color: prevButtonArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.8) : Theme.primary
opacity: SessionData.wallpaperPath ? 1 : 0.5
Row {
@@ -359,7 +375,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
@@ -370,17 +385,20 @@ Item {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true
onClicked: {
WallpaperCyclingService.cyclePrevManually();
WallpaperCyclingService.cyclePrevManually()
}
}
}
StyledRect {
width: 60
height: 32
radius: Theme.cornerRadius
color: nextButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.8) : Theme.primary
color: nextButtonArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.8) : Theme.primary
opacity: SessionData.wallpaperPath ? 1 : 0.5
Row {
@@ -400,7 +418,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
@@ -411,10 +428,9 @@ Item {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true
onClicked: {
WallpaperCyclingService.cycleNextManually();
WallpaperCyclingService.cycleNextManually()
}
}
}
DankToggle {
@@ -422,13 +438,12 @@ Item {
anchors.verticalCenter: parent.verticalCenter
checked: SessionData.wallpaperCyclingEnabled
onToggled: (toggled) => {
return SessionData.setWallpaperCyclingEnabled(toggled);
}
onToggled: toggled => {
return SessionData.setWallpaperCyclingEnabled(
toggled)
}
}
}
}
// Cycling mode and settings
@@ -455,16 +470,17 @@ Item {
width: 200
height: 32
model: [{
"text": "Interval"
}, {
"text": "Time"
}]
currentIndex: SessionData.wallpaperCyclingMode === "time" ? 1 : 0
onTabClicked: (index) => {
SessionData.setWallpaperCyclingMode(index === 1 ? "time" : "interval");
}
"text": "Interval"
}, {
"text": "Time"
}]
currentIndex: SessionData.wallpaperCyclingMode
=== "time" ? 1 : 0
onTabClicked: index => {
SessionData.setWallpaperCyclingMode(
index === 1 ? "time" : "interval")
}
}
}
// Interval settings
@@ -478,16 +494,18 @@ Item {
description: "How often to change wallpaper"
options: intervalOptions
currentValue: {
const currentSeconds = SessionData.wallpaperCyclingInterval;
const index = intervalValues.indexOf(currentSeconds);
return index >= 0 ? intervalOptions[index] : "5 minutes";
}
onValueChanged: (value) => {
const index = intervalOptions.indexOf(value);
if (index >= 0)
SessionData.setWallpaperCyclingInterval(intervalValues[index]);
const currentSeconds = SessionData.wallpaperCyclingInterval
const index = intervalValues.indexOf(
currentSeconds)
return index >= 0 ? intervalOptions[index] : "5 minutes"
}
onValueChanged: value => {
const index = intervalOptions.indexOf(
value)
if (index >= 0)
SessionData.setWallpaperCyclingInterval(
intervalValues[index])
}
}
// Time settings
@@ -512,25 +530,28 @@ Item {
topPadding: Theme.spacingS
bottomPadding: Theme.spacingS
onAccepted: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text);
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(
text)
if (isValid)
SessionData.setWallpaperCyclingTime(text);
SessionData.setWallpaperCyclingTime(
text)
else
text = SessionData.wallpaperCyclingTime;
text = SessionData.wallpaperCyclingTime
}
onEditingFinished: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text);
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(
text)
if (isValid)
SessionData.setWallpaperCyclingTime(text);
SessionData.setWallpaperCyclingTime(
text)
else
text = SessionData.wallpaperCyclingTime;
text = SessionData.wallpaperCyclingTime
}
anchors.verticalCenter: parent.verticalCenter
validator: RegularExpressionValidator {
regularExpression: /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/
}
}
StyledText {
@@ -539,15 +560,10 @@ Item {
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
}
}
}
}
// Dynamic Theme Section
@@ -555,8 +571,10 @@ Item {
width: parent.width
height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
@@ -578,7 +596,8 @@ Item {
}
Column {
width: parent.width - Theme.iconSize - Theme.spacingM - toggle.width - Theme.spacingM
width: parent.width - Theme.iconSize - Theme.spacingM
- toggle.width - Theme.spacingM
spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
@@ -596,7 +615,6 @@ Item {
wrapMode: Text.WordWrap
width: parent.width
}
}
DankToggle {
@@ -605,14 +623,13 @@ Item {
anchors.verticalCenter: parent.verticalCenter
checked: Theme.isDynamicTheme
enabled: ToastService.wallpaperErrorStatus !== "matugen_missing"
onToggled: (toggled) => {
if (toggled)
Theme.switchTheme(10, true);
else
Theme.switchTheme(0);
}
onToggled: toggled => {
if (toggled)
Theme.switchTheme(10, true)
else
Theme.switchTheme(0)
}
}
}
StyledText {
@@ -623,9 +640,7 @@ Item {
width: parent.width
leftPadding: Theme.iconSize + Theme.spacingM
}
}
}
// Display Settings
@@ -633,8 +648,10 @@ Item {
width: parent.width
height: displaySection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
@@ -662,7 +679,6 @@ Item {
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
DankToggle {
@@ -672,23 +688,22 @@ Item {
text: "Night Mode"
description: "Apply warm color temperature to reduce eye strain"
checked: BrightnessService.nightModeActive
onToggled: (checked) => {
if (checked !== BrightnessService.nightModeActive) {
if (checked)
BrightnessService.enableNightMode();
else
BrightnessService.disableNightMode();
}
}
onToggled: checked => {
if (checked !== BrightnessService.nightModeActive) {
if (checked)
BrightnessService.enableNightMode()
else
BrightnessService.disableNightMode()
}
}
Connections {
function onNightModeActiveChanged() {
nightModeToggle.checked = BrightnessService.nightModeActive;
nightModeToggle.checked = BrightnessService.nightModeActive
}
target: BrightnessService
}
}
DankDropdown {
@@ -699,16 +714,18 @@ Item {
opacity: !BrightnessService.nightModeActive ? 1 : 0.6
currentValue: SessionData.nightModeTemperature + "K"
options: {
var temps = [];
var temps = []
for (var i = 2500; i <= 6000; i += 500) {
temps.push(i + "K");
temps.push(i + "K")
}
return temps;
}
onValueChanged: (value) => {
var temp = parseInt(value.replace("K", ""));
SessionData.setNightModeTemperature(temp);
return temps
}
onValueChanged: value => {
var temp = parseInt(
value.replace("K", ""))
SessionData.setNightModeTemperature(
temp)
}
}
DankToggle {
@@ -716,15 +733,13 @@ Item {
text: "Light Mode"
description: "Use light theme instead of dark theme"
checked: SessionData.isLightMode
onToggled: (checked) => {
SessionData.setLightMode(checked);
Theme.isLightMode = checked;
PortalService.setLightMode(checked);
}
onToggled: checked => {
SessionData.setLightMode(checked)
Theme.isLightMode = checked
PortalService.setLightMode(checked)
}
}
}
}
// Font Settings
@@ -732,8 +747,10 @@ Item {
width: parent.width
height: fontSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
@@ -761,7 +778,6 @@ Item {
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
DankDropdown {
@@ -770,20 +786,21 @@ Item {
description: "Select system font family"
currentValue: {
if (SettingsData.fontFamily === SettingsData.defaultFontFamily)
return "Default";
return "Default"
else
return SettingsData.fontFamily || "Default";
return SettingsData.fontFamily || "Default"
}
enableFuzzySearch: true
popupWidthOffset: 100
maxPopupHeight: 400
options: cachedFontFamilies
onValueChanged: (value) => {
if (value.startsWith("Default"))
SettingsData.setFontFamily(SettingsData.defaultFontFamily);
else
SettingsData.setFontFamily(value);
}
onValueChanged: value => {
if (value.startsWith("Default"))
SettingsData.setFontFamily(
SettingsData.defaultFontFamily)
else
SettingsData.setFontFamily(value)
}
}
DankDropdown {
@@ -793,64 +810,64 @@ Item {
currentValue: {
switch (SettingsData.fontWeight) {
case Font.Thin:
return "Thin";
return "Thin"
case Font.ExtraLight:
return "Extra Light";
return "Extra Light"
case Font.Light:
return "Light";
return "Light"
case Font.Normal:
return "Regular";
return "Regular"
case Font.Medium:
return "Medium";
return "Medium"
case Font.DemiBold:
return "Demi Bold";
return "Demi Bold"
case Font.Bold:
return "Bold";
return "Bold"
case Font.ExtraBold:
return "Extra Bold";
return "Extra Bold"
case Font.Black:
return "Black";
return "Black"
default:
return "Regular";
return "Regular"
}
}
options: ["Thin", "Extra Light", "Light", "Regular", "Medium", "Demi Bold", "Bold", "Extra Bold", "Black"]
onValueChanged: (value) => {
var weight;
switch (value) {
case "Thin":
weight = Font.Thin;
break;
case "Extra Light":
weight = Font.ExtraLight;
break;
case "Light":
weight = Font.Light;
break;
case "Regular":
weight = Font.Normal;
break;
case "Medium":
weight = Font.Medium;
break;
case "Demi Bold":
weight = Font.DemiBold;
break;
case "Bold":
weight = Font.Bold;
break;
case "Extra Bold":
weight = Font.ExtraBold;
break;
case "Black":
weight = Font.Black;
break;
default:
weight = Font.Normal;
break;
}
SettingsData.setFontWeight(weight);
}
onValueChanged: value => {
var weight
switch (value) {
case "Thin":
weight = Font.Thin
break
case "Extra Light":
weight = Font.ExtraLight
break
case "Light":
weight = Font.Light
break
case "Regular":
weight = Font.Normal
break
case "Medium":
weight = Font.Medium
break
case "Demi Bold":
weight = Font.DemiBold
break
case "Bold":
weight = Font.Bold
break
case "Extra Bold":
weight = Font.ExtraBold
break
case "Black":
weight = Font.Black
break
default:
weight = Font.Normal
break
}
SettingsData.setFontWeight(weight)
}
}
DankDropdown {
@@ -859,24 +876,24 @@ Item {
description: "Select monospace font for process list and technical displays"
currentValue: {
if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily)
return "Default";
return "Default"
return SettingsData.monoFontFamily || "Default";
return SettingsData.monoFontFamily || "Default"
}
enableFuzzySearch: true
popupWidthOffset: 100
maxPopupHeight: 400
options: cachedMonoFamilies
onValueChanged: (value) => {
if (value === "Default")
SettingsData.setMonoFontFamily(SettingsData.defaultMonoFontFamily);
else
SettingsData.setMonoFontFamily(value);
}
onValueChanged: value => {
if (value === "Default")
SettingsData.setMonoFontFamily(
SettingsData.defaultMonoFontFamily)
else
SettingsData.setMonoFontFamily(
value)
}
}
}
}
// Corner Radius
@@ -884,8 +901,10 @@ Item {
width: parent.width
height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
@@ -934,19 +953,17 @@ Item {
maximum: 32
unit: ""
showValue: true
onSliderValueChanged: (newValue) => {
SettingsData.setCornerRadius(newValue);
}
onSliderValueChanged: newValue => {
SettingsData.setCornerRadius(
newValue)
}
}
}
}
}
}
}
FileBrowserModal {
id: wallpaperBrowser
@@ -954,18 +971,17 @@ Item {
browserIcon: "wallpaper"
browserType: "wallpaper"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: (path) => {
SessionData.setWallpaper(path);
close();
}
onFileSelected: path => {
SessionData.setWallpaper(path)
close()
}
onDialogClosed: {
if (parentModal) {
parentModal.allowFocusOverride = false;
parentModal.allowFocusOverride = false
parentModal.shouldHaveFocus = Qt.binding(() => {
return parentModal.shouldBeVisible;
});
return parentModal.shouldBeVisible
})
}
}
}
}