initial commit for settings revamp
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 15s
Python / lint-format (pull_request) Successful in 29s
Python / test (pull_request) Successful in 54s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m34s

This commit is contained in:
2026-06-23 16:22:56 +02:00
parent 80d5f13663
commit ea4d5376f6
36 changed files with 3693 additions and 15 deletions
+137
View File
@@ -0,0 +1,137 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import ZShell.Components
import qs.Helpers
import qs.Components
import qs.Config
import qs.Modules.SettingsNew
import qs.Modules.SettingsNew.Common
PageBase {
id: root
title: qsTr("Screenshot effects")
ColumnLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
spacing: Appearance.spacing.large
width: root.cappedWidth
ToggleRow {
checked: Config.screenshot.enable_pp
first: true
text: qsTr("Enable effects")
onToggled: Config.screenshot.enable_pp = checked
}
SelectRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
active: Config.screenshot.mode === "manual" ? menuItems[0] : menuItems[1]
enabled: Config.screenshot.enable_pp
last: true
subtext: qsTr("Automatic or manual effect values")
text: qsTr("Effects mode")
menuItems: [
MenuItem {
icon: "build"
text: qsTr("Manual")
value: "manual"
},
MenuItem {
icon: "rotate_auto"
text: qsTr("Auto")
value: "auto"
}
]
onSelected: item => {
Config.screenshot.mode = item.value;
Config.save();
}
}
ToggleRow {
checked: Config.screenshot.rounding
enabled: Config.screenshot.enable_pp && Config.screenshot.mode === "manual"
first: true
text: qsTr("Enable rounded corners")
onToggled: Config.screenshot.rounding = checked
}
SpinRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
enabled: Config.screenshot.enable_pp && Config.screenshot.mode === "manual" && Config.screenshot.rounding
from: 0
stepSize: 1
text: qsTr("Corner radius")
to: 50
value: Config.screenshot.radius
onMoved: value => {
const newVal = Math.floor(value);
Config.screenshot.radius = newVal;
}
}
ToggleRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
checked: Config.screenshot.shadow
enabled: Config.screenshot.enable_pp && Config.screenshot.mode === "manual"
text: qsTr("Enable shadow")
onToggled: Config.screenshot.shadow = checked
}
SpinRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
enabled: Config.screenshot.enable_pp && Config.screenshot.mode === "manual" && Config.screenshot.shadow
from: 0
stepSize: 1
text: qsTr("Shadow blur amount")
to: 100
value: Config.screenshot.shadow_blur
onMoved: value => {
const newVal = Math.floor(value);
Config.screenshot.shadow_blur = newVal;
}
}
SpinRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
enabled: Config.screenshot.enable_pp && Config.screenshot.mode === "manual" && Config.screenshot.shadow
from: -100
stepSize: 10
text: qsTr("Shadow horizontal offset")
to: 100
value: Config.screenshot.shadow_offset_x
onMoved: value => {
const newVal = Math.floor(value);
Config.screenshot.shadow_offset_x = newVal;
}
}
SpinRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
enabled: Config.screenshot.enable_pp && Config.screenshot.mode === "manual" && Config.screenshot.shadow
from: -100
last: true
stepSize: 10
text: qsTr("Shadow vertical offset")
to: 100
value: Config.screenshot.shadow_offset_y
onMoved: value => {
const newVal = Math.floor(value);
Config.screenshot.shadow_offset_y = newVal;
}
}
}
}
+220
View File
@@ -0,0 +1,220 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import ZShell.Components
import qs.Helpers
import qs.Components
import qs.Config
import qs.Modules.SettingsNew
import qs.Modules.SettingsNew.Common
PageBase {
id: root
title: qsTr("Wallpaper & style")
ColumnLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
spacing: Appearance.spacing.large
width: root.cappedWidth
CustomClippingRect {
id: wallWrapper
Layout.alignment: Qt.AlignHCenter
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: {
const screen = root.sState.screen;
const cWidth = root.cappedWidth;
return Math.min(Math.round(cWidth * 0.4), cWidth / screen.width * screen.height);
}
implicitWidth: {
const screen = root.sState.screen;
return implicitHeight / screen.height * screen.width;
}
radius: Appearance.rounding.large
Loader {
active: opacity > 0
anchors.centerIn: parent
opacity: Config.background.enabled ? 0 : 1
Behavior on opacity {
Anim {
type: Anim.SlowEffects
}
}
sourceComponent: ColumnLayout {
spacing: Appearance.spacing.extraSmall
MaterialIcon {
Layout.alignment: Qt.AlignHCenter
color: DynamicColors.palette.m3onSurfaceVariant
text: "hide_image"
}
CustomText {
Layout.alignment: Qt.AlignHCenter
color: DynamicColors.palette.m3onSurfaceVariant
text: qsTr("Wallpaper disabled")
}
}
}
Item {
anchors.fill: parent
opacity: Config.background.enabled ? 1 : 0
Behavior on opacity {
Anim {
type: Anim.SlowEffects
}
}
Loader {
id: wallIndicatorLoader
active: opacity > 0
anchors.fill: parent
opacity: 0
Behavior on opacity {
Anim {
type: Anim.DefaultEffects
}
}
sourceComponent: CustomRect {
color: DynamicColors.palette.m3primaryContainer
radius: Appearance.rounding.normal
}
}
Timer {
id: wallLoadDebounceTimer
interval: 100
onTriggered: {
if (wallImg.status !== Image.Ready)
wallIndicatorLoader.opacity = 1;
}
}
FadeImage {
id: wallImg
anchors.fill: parent
fadeInAnim: Anim.SlowEffects
fadeOutAnim: Anim.DefaultEffects
preventInit: wallIndicatorLoader.opacity > 0
source: Wallpapers.current
onSourceChanged: wallLoadDebounceTimer.restart()
onStatusChanged: {
if (status === Image.Ready) {
wallLoadDebounceTimer.stop();
wallIndicatorLoader.opacity = 0;
}
}
}
}
}
IconTextButton {
Layout.alignment: Qt.AlignHCenter
enabled: Config.background.enabled
horizontalPadding: Appearance.padding.extraLarge
icon: "wallpaper"
isRound: true
shapeMorph: true
text: qsTr("Wallpapers")
type: IconTextButton.Tonal
verticalPadding: Appearance.padding.normal
onClicked: root.sState.openSubPage(1) // Wallpaper page
}
ToggleRow {
checked: Config.background.enabled
first: true
text: qsTr("Display wallpaper")
onToggled: Config.background.enabled = checked
}
ToggleRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
checked: DynamicColors.transparency.enabled
subtext: qsTr("Base %1, layers %2").arg(DynamicColors.transparency.base).arg(DynamicColors.transparency.layers)
text: qsTr("Transparency")
onToggled: Config.appearance.transparency.enabled = checked
}
ToggleRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
checked: !DynamicColors.light
last: true
text: qsTr("Dark theme")
onToggled: DynamicColors.setMode(checked ? "dark" : "light")
}
PopupRow {
checked: Config.general.color.scheduleDark
first: true
subtext: qsTr("Dark mode will turn on at %1, and turn off at %2.").arg(Config.general.color.scheduleDarkStart).arg(Config.general.color.scheduleDarkEnd)
text: qsTr("Schedule dark mode")
popup: Component {
TimeInput {
object: Config.general.color
settings: ["scheduleDark", "scheduleDarkStart", "scheduleDarkEnd"]
onApplySettings: (start, end) => {
Config.general.color.scheduleDarkStart = start;
Config.general.color.scheduleDarkEnd = end;
Config.save();
ModeScheduler.checkStartup();
PopupManager.requestClose();
}
onClose: PopupManager.requestClose()
}
}
onClicked: value => {
Config.general.color.scheduleDark = value;
}
}
PopupRow {
Layout.topMargin: Appearance.spacing.extraSmall / 2 - parent.spacing
checked: Config.general.color.scheduleHyprsunset
last: true
subtext: qsTr("Hyprsunset will turn on at %1, and turn off at %2.").arg(Config.general.color.scheduleHyprsunsetStart).arg(Config.general.color.scheduleHyprsunsetEnd)
text: qsTr("Schedule hyprsunset")
popup: Component {
TimeInput {
object: Config.general.color
settings: ["scheduleHyprsunset", "scheduleHyprsunsetStart", "scheduleHyprsunsetEnd"]
onApplySettings: (start, end) => {
Config.general.color.scheduleHyprsunsetStart = start;
Config.general.color.scheduleHyprsunsetEnd = end;
Config.save();
Hyprsunset.checkStartup();
PopupManager.requestClose();
}
onClose: PopupManager.requestClose()
}
}
onClicked: value => {
Config.general.color.scheduleHyprsunset = value;
}
}
}
}
@@ -0,0 +1,135 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import ZShell.Models
import qs.Paths
import qs.Helpers
import qs.Components
import qs.Config
import qs.Modules.SettingsNew.Common
PageBase {
id: root
isSubPage: true
title: qsTr("Wallpapers")
Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
implicitHeight: childrenRect.height
WallpaperCropper {
id: cropper
}
ColumnLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: Appearance.spacing.normal
anchors.top: cropper.bottom
spacing: Appearance.spacing.small
width: root.cappedWidth
CustomText {
Layout.topMargin: Appearance.spacing.large
font.pointSize: Appearance.font.size.large
text: qsTr("Wallpapers")
}
GridLayout {
Layout.fillWidth: true
columnSpacing: Appearance.spacing.extraSmall
columns: 4
rowSpacing: Appearance.spacing.extraSmall
visible: localWalls.count > 0
Repeater {
id: localWalls
model: {
const walls = Wallpapers.list;
var baseDir = Paths.wallsdir;
const categories = {};
const list = [];
for (const w of walls) {
var parentDir = w.parentDir;
if (!parentDir.endsWith("/"))
parentDir = parentDir + "/";
if (!baseDir.endsWith("/"))
baseDir = baseDir + "/";
if (parentDir !== baseDir) {
const category = Wallpapers.getCategoryFor(w);
if (category && (!(category in categories) || categories[category].name.localeCompare(w.name) > 0))
categories[category] = w;
} else {
list.push(w);
}
}
list.push(...Object.values(categories));
list.sort((a, b) => ((a.parentDir === baseDir) - (b.parentDir === baseDir)) || a.name.localeCompare(b.name));
while (list.length < 4)
list.push(null);
return list;
}
WallItem {
required property FileSystemEntry modelData
enabled: modelData
// Empty placeholders for sizing
opacity: modelData ? 1 : 0
source: String(modelData?.path ?? "")
onClicked: {
if (modelData.parentDir !== Paths.wallsdir) {
root.sState.selectedWallpaperCategory = Wallpapers.getCategoryFor(modelData);
root.sState.openSubPage(2); // Category page
} else {
Wallpapers.setWallpaper(modelData.path);
root.sState.closeSubPage();
}
}
}
}
}
Loader {
Layout.fillWidth: true
active: localWalls.count === 0
asynchronous: true
visible: active
sourceComponent: CustomRect {
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: noWallsLayout.implicitHeight + Appearance.padding.extraLarge * 3
radius: Appearance.rounding.large
ColumnLayout {
id: noWallsLayout
anchors.centerIn: parent
spacing: Appearance.spacing.extraSmall
MaterialIcon {
Layout.alignment: Qt.AlignHCenter
color: DynamicColors.palette.m3outline
text: "hide_image"
}
CustomText {
Layout.alignment: Qt.AlignHCenter
color: DynamicColors.palette.m3outline
text: qsTr("No local wallpapers found")
}
}
}
}
}
}
}