Merge settings window to main #23

Merged
Zacharias-Brohn merged 48 commits from settingsWindow into main 2026-03-18 16:27:50 +01:00
8 changed files with 139 additions and 57 deletions
Showing only changes of commit b7ca2f5c93 - Show all commits
+3 -2
View File
@@ -1,12 +1,13 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import qs.Config
Button { Button {
id: control id: control
required property color bgColor property color bgColor: DynamicColors.palette.m3primary
property int radius: 4 property int radius: 4
required property color textColor property color textColor: DynamicColors.palette.m3onPrimary
background: CustomRect { background: CustomRect {
color: control.bgColor color: control.bgColor
+2
View File
@@ -30,10 +30,12 @@ JsonObject {
component Idle: JsonObject { component Idle: JsonObject {
property list<var> timeouts: [ property list<var> timeouts: [
{ {
name: "Lock",
timeout: 180, timeout: 180,
idleAction: "lock" idleAction: "lock"
}, },
{ {
name: "Screen",
timeout: 300, timeout: 300,
idleAction: "dpms off", idleAction: "dpms off",
activeAction: "dpms on" activeAction: "dpms on"
+1
View File
@@ -143,6 +143,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
panels: root panels: root
screen: root.screen
visibilities: root.visibilities visibilities: root.visibilities
} }
+5 -6
View File
@@ -5,12 +5,15 @@ import QtQuick.Layouts
import qs.Components import qs.Components
import qs.Modules as Modules import qs.Modules as Modules
import qs.Modules.Settings.Controls import qs.Modules.Settings.Controls
import qs.Modules.Settings.Categories.Appearance
import qs.Config import qs.Config
import qs.Helpers import qs.Helpers
CustomRect { CustomFlickable {
id: root id: root
contentHeight: clayout.implicitHeight
ColumnLayout { ColumnLayout {
id: clayout id: clayout
@@ -108,17 +111,13 @@ CustomRect {
Layout.preferredHeight: idleLayout.implicitHeight + Appearance.padding.normal * 2 Layout.preferredHeight: idleLayout.implicitHeight + Appearance.padding.normal * 2
color: DynamicColors.tPalette.m3surfaceContainer color: DynamicColors.tPalette.m3surfaceContainer
ColumnLayout { Idle {
id: idleLayout id: idleLayout
anchors.left: parent.left anchors.left: parent.left
anchors.margins: Appearance.padding.large anchors.margins: Appearance.padding.large
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Settings {
name: "Idle"
}
} }
} }
} }
@@ -0,0 +1,57 @@
import QtQuick
import QtQuick.Layouts
import qs.Components
import qs.Config
import qs.Modules.Settings.Controls
ColumnLayout {
id: root
function addTimeoutEntry() {
let list = [...Config.general.idle.timeouts];
list.push({
name: "New Entry",
timeout: 600,
idleAction: "lock"
});
Config.general.idle.timeouts = list;
Config.save();
}
function updateTimeoutEntry(i, key, value) {
const list = [...Config.general.idle.timeouts];
let entry = list[i];
entry[key] = value;
list[i] = entry;
Config.general.idle.timeouts = list;
Config.save();
}
Layout.fillWidth: true
spacing: Appearance.spacing.smaller
Repeater {
model: Config.general.idle.timeouts
SettingList {
Layout.fillWidth: true
onAddActiveActionRequested: {
root.updateTimeoutEntry(index, "activeAction", "");
}
onFieldEdited: function (key, value) {
root.updateTimeoutEntry(index, key, value);
}
}
}
CustomButton {
text: qsTr("Add timeout entry")
onClicked: root.addTimeoutEntry()
}
}
+3 -2
View File
@@ -12,8 +12,9 @@ Item {
id: root id: root
property string currentCategory: "general" property string currentCategory: "general"
readonly property real nonAnimHeight: view.implicitHeight + viewWrapper.anchors.margins * 2 readonly property real nonAnimHeight: (screen.height - 400) + viewWrapper.anchors.margins * 2
readonly property real nonAnimWidth: view.implicitWidth + 700 + viewWrapper.anchors.margins * 2 readonly property real nonAnimWidth: view.implicitWidth + (screen.width - 400 * 2) + viewWrapper.anchors.margins * 2
required property ShellScreen screen
required property PersistentProperties visibilities required property PersistentProperties visibilities
implicitHeight: nonAnimHeight implicitHeight: nonAnimHeight
+56 -41
View File
@@ -6,12 +6,25 @@ import qs.Config
Item { Item {
id: root id: root
required property list<var> modelData required property int index
required property string name required property var modelData
signal addActiveActionRequested
signal fieldEdited(string key, var value)
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: row.implicitHeight + Appearance.padding.smaller * 2 Layout.preferredHeight: row.implicitHeight + Appearance.padding.smaller * 2
CustomRect {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: -(Appearance.spacing.smaller / 2)
color: DynamicColors.tPalette.m3outlineVariant
implicitHeight: 1
visible: root.index !== 0
}
RowLayout { RowLayout {
id: row id: row
@@ -19,14 +32,13 @@ Item {
anchors.margins: Appearance.padding.small anchors.margins: Appearance.padding.small
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Appearance.spacing.large
CustomText { CustomText {
id: text
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true Layout.preferredWidth: root.width / 2
font.pointSize: Appearance.font.size.larger font.pointSize: Appearance.font.size.larger
text: root.name text: root.modelData.name
} }
VSeparator { VSeparator {
@@ -35,21 +47,17 @@ Item {
ColumnLayout { ColumnLayout {
id: cLayout id: cLayout
RowLayout { Layout.fillWidth: true
id: timeLayout
RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
CustomText { CustomText {
id: timeText
Layout.fillWidth: true Layout.fillWidth: true
text: root.modelData.name text: qsTr("Timeout")
} }
CustomRect { CustomRect {
id: timeRect
Layout.preferredHeight: 33 Layout.preferredHeight: 33
Layout.preferredWidth: Math.max(Math.min(timeField.contentWidth + Appearance.padding.normal * 3, 200), 50) Layout.preferredWidth: Math.max(Math.min(timeField.contentWidth + Appearance.padding.normal * 3, 200), 50)
color: DynamicColors.tPalette.m3surface color: DynamicColors.tPalette.m3surface
@@ -60,11 +68,10 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: root.modelData.timeout text: String(root.modelData.timeout ?? "")
onEditingFinished: { onEditingFinished: {
root.modelData.timeout = timeField.text; root.fieldEdited("timeout", Number(text));
Config.save();
} }
} }
} }
@@ -74,20 +81,14 @@ Item {
} }
RowLayout { RowLayout {
id: idleLayout
Layout.fillWidth: true Layout.fillWidth: true
CustomText { CustomText {
id: idleText
Layout.fillWidth: true Layout.fillWidth: true
text: root.modelData.name text: qsTr("Idle Action")
} }
CustomRect { CustomRect {
id: idleRect
Layout.preferredHeight: 33 Layout.preferredHeight: 33
Layout.preferredWidth: Math.max(Math.min(idleField.contentWidth + Appearance.padding.normal * 3, 200), 50) Layout.preferredWidth: Math.max(Math.min(idleField.contentWidth + Appearance.padding.normal * 3, 200), 50)
color: DynamicColors.tPalette.m3surface color: DynamicColors.tPalette.m3surface
@@ -98,11 +99,10 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: root.modelData.idleAction text: root.modelData.idleAction ?? ""
onEditingFinished: { onEditingFinished: {
root.modelData.idleAction = idleField.text; root.fieldEdited("idleAction", text);
Config.save();
} }
} }
} }
@@ -111,25 +111,23 @@ Item {
Separator { Separator {
} }
Loader { Item {
id: loader
Layout.fillWidth: true Layout.fillWidth: true
active: root.modelData.activeAction ?? false implicitHeight: activeActionRow.visible ? activeActionRow.implicitHeight : addButtonRow.implicitHeight
RowLayout { RowLayout {
id: actionLayout id: activeActionRow
anchors.left: parent.left
anchors.right: parent.right
visible: root.modelData.activeAction !== undefined
CustomText { CustomText {
id: actionText
Layout.fillWidth: true Layout.fillWidth: true
text: root.modelData.name text: qsTr("Active Action")
} }
CustomRect { CustomRect {
id: actionRect
Layout.preferredHeight: 33 Layout.preferredHeight: 33
Layout.preferredWidth: Math.max(Math.min(actionField.contentWidth + Appearance.padding.normal * 3, 200), 50) Layout.preferredWidth: Math.max(Math.min(actionField.contentWidth + Appearance.padding.normal * 3, 200), 50)
color: DynamicColors.tPalette.m3surface color: DynamicColors.tPalette.m3surface
@@ -140,13 +138,30 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: root.modelData.activeAction text: root.modelData.activeAction ?? ""
onEditingFinished: { onEditingFinished: {
root.modelData.activeAction = actionField.text; root.fieldEdited("activeAction", text);
Config.save(); }
} }
} }
}
RowLayout {
id: addButtonRow
anchors.left: parent.left
anchors.right: parent.right
visible: root.modelData.activeAction === undefined
Item {
Layout.fillWidth: true
}
CustomButton {
text: qsTr("Add active action")
onClicked: root.addActiveActionRequested()
} }
} }
} }
+6
View File
@@ -8,6 +8,7 @@ Item {
id: root id: root
required property var panels required property var panels
required property ShellScreen screen
required property PersistentProperties visibilities required property PersistentProperties visibilities
implicitHeight: 0 implicitHeight: 0
@@ -46,6 +47,9 @@ Item {
} }
] ]
CustomClippingRect {
anchors.fill: parent
Loader { Loader {
id: content id: content
@@ -55,7 +59,9 @@ Item {
visible: true visible: true
sourceComponent: Content { sourceComponent: Content {
screen: root.screen
visibilities: root.visibilities visibilities: root.visibilities
} }
} }
} }
}