configoptions: use quickshell jsonadapter

This commit is contained in:
end-4
2025-06-30 14:27:26 +02:00
parent 22319ffccf
commit 7ca0f263ba
50 changed files with 455 additions and 546 deletions
@@ -16,10 +16,10 @@ ContentPage {
text: "Weeb"
}
ConfigSelectionArray {
currentValue: ConfigOptions.policies.weeb
currentValue: Config.options.policies.weeb
configOptionName: "policies.weeb"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("policies.weeb", newValue);
Config.options.policies.weeb = newValue;
}
options: [
{ displayName: "No", value: 0 },
@@ -34,10 +34,10 @@ ContentPage {
text: "AI"
}
ConfigSelectionArray {
currentValue: ConfigOptions.policies.ai
currentValue: Config.options.policies.ai
configOptionName: "policies.ai"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("policies.ai", newValue);
Config.options.policies.ai = newValue;
}
options: [
{ displayName: "No", value: 0 },
@@ -53,10 +53,10 @@ ContentPage {
title: "Bar"
ConfigSelectionArray {
currentValue: ConfigOptions.bar.cornerStyle
currentValue: Config.options.bar.cornerStyle
configOptionName: "bar.cornerStyle"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("bar.cornerStyle", newValue);
Config.options.bar.cornerStyle = newValue;
}
options: [
{ displayName: "Hug", value: 0 },
@@ -71,16 +71,16 @@ ContentPage {
uniform: true
ConfigSwitch {
text: 'Borderless'
checked: ConfigOptions.bar.borderless
checked: Config.options.bar.borderless
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.borderless", checked);
Config.options.bar.borderless = checked;
}
}
ConfigSwitch {
text: 'Show background'
checked: ConfigOptions.bar.showBackground
checked: Config.options.bar.showBackground
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.showBackground", checked);
Config.options.bar.showBackground = checked;
}
StyledToolTip {
content: "Note: turning off can hurt readability"
@@ -95,16 +95,16 @@ ContentPage {
uniform: true
ConfigSwitch {
text: "Screen snip"
checked: ConfigOptions.bar.utilButtons.showScreenSnip
checked: Config.options.bar.utilButtons.showScreenSnip
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showScreenSnip", checked);
Config.options.bar.utilButtons.showScreenSnip = checked;
}
}
ConfigSwitch {
text: "Color picker"
checked: ConfigOptions.bar.utilButtons.showColorPicker
checked: Config.options.bar.utilButtons.showColorPicker
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showColorPicker", checked);
Config.options.bar.utilButtons.showColorPicker = checked;
}
}
}
@@ -112,16 +112,16 @@ ContentPage {
uniform: true
ConfigSwitch {
text: "Mic toggle"
checked: ConfigOptions.bar.utilButtons.showMicToggle
checked: Config.options.bar.utilButtons.showMicToggle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showMicToggle", checked);
Config.options.bar.utilButtons.showMicToggle = checked;
}
}
ConfigSwitch {
text: "Keyboard toggle"
checked: ConfigOptions.bar.utilButtons.showKeyboardToggle
checked: Config.options.bar.utilButtons.showKeyboardToggle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showKeyboardToggle", checked);
Config.options.bar.utilButtons.showKeyboardToggle = checked;
}
}
}
@@ -129,9 +129,9 @@ ContentPage {
uniform: true
ConfigSwitch {
text: "Dark/Light toggle"
checked: ConfigOptions.bar.utilButtons.showDarkModeToggle
checked: Config.options.bar.utilButtons.showDarkModeToggle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showDarkModeToggle", checked);
Config.options.bar.utilButtons.showDarkModeToggle = checked;
}
}
ConfigSwitch {
@@ -149,37 +149,37 @@ ContentPage {
uniform: true
ConfigSwitch {
text: 'Show app icons'
checked: ConfigOptions.bar.workspaces.showAppIcons
checked: Config.options.bar.workspaces.showAppIcons
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.workspaces.showAppIcons", checked);
Config.options.bar.workspaces.showAppIcons = checked;
}
}
ConfigSwitch {
text: 'Always show numbers'
checked: ConfigOptions.bar.workspaces.alwaysShowNumbers
checked: Config.options.bar.workspaces.alwaysShowNumbers
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.workspaces.alwaysShowNumbers", checked);
Config.options.bar.workspaces.alwaysShowNumbers = checked;
}
}
}
ConfigSpinBox {
text: "Workspaces shown"
value: ConfigOptions.bar.workspaces.shown
value: Config.options.bar.workspaces.shown
from: 1
to: 30
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("bar.workspaces.shown", value);
Config.options.bar.workspaces.shown = value;
}
}
ConfigSpinBox {
text: "Number show delay when pressing Super (ms)"
value: ConfigOptions.bar.workspaces.showNumberDelay
value: Config.options.bar.workspaces.showNumberDelay
from: 0
to: 1000
stepSize: 50
onValueChanged: {
ConfigLoader.setConfigValueAndSave("bar.workspaces.showNumberDelay", value);
Config.options.bar.workspaces.showNumberDelay = value;
}
}
}
@@ -192,22 +192,22 @@ ContentPage {
uniform: true
ConfigSpinBox {
text: "Low warning"
value: ConfigOptions.battery.low
value: Config.options.battery.low
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.low", value);
Config.options.battery.low = value;
}
}
ConfigSpinBox {
text: "Critical warning"
value: ConfigOptions.battery.critical
value: Config.options.battery.critical
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.critical", value);
Config.options.battery.critical = value;
}
}
}
@@ -215,9 +215,9 @@ ContentPage {
uniform: true
ConfigSwitch {
text: "Automatic suspend"
checked: ConfigOptions.battery.automaticSuspend
checked: Config.options.battery.automaticSuspend
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("battery.automaticSuspend", checked);
Config.options.battery.automaticSuspend = checked;
}
StyledToolTip {
content: "Automatically suspends the system when battery is low"
@@ -225,12 +225,12 @@ ContentPage {
}
ConfigSpinBox {
text: "Suspend at"
value: ConfigOptions.battery.suspend
value: Config.options.battery.suspend
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.suspend", value);
Config.options.battery.suspend = value;
}
}
}
@@ -240,34 +240,34 @@ ContentPage {
title: "Overview"
ConfigSpinBox {
text: "Scale (%)"
value: ConfigOptions.overview.scale * 100
value: Config.options.overview.scale * 100
from: 1
to: 100
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("overview.scale", value / 100);
Config.options.overview.scale = value / 100;
}
}
ConfigRow {
uniform: true
ConfigSpinBox {
text: "Rows"
value: ConfigOptions.overview.rows
value: Config.options.overview.rows
from: 1
to: 20
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("overview.rows", value);
Config.options.overview.rows = value;
}
}
ConfigSpinBox {
text: "Columns"
value: ConfigOptions.overview.columns
value: Config.options.overview.columns
from: 1
to: 20
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("overview.columns", value);
Config.options.overview.columns = value;
}
}
}
@@ -13,9 +13,9 @@ ContentPage {
ConfigSwitch {
text: "Earbang protection"
checked: ConfigOptions.audio.protection.enable
checked: Config.options.audio.protection.enable
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.enable", checked);
Config.options.audio.protection.enable = checked;
}
StyledToolTip {
content: "Prevents abrupt increments and restricts volume limit"
@@ -25,22 +25,22 @@ ContentPage {
// uniform: true
ConfigSpinBox {
text: "Max allowed increase"
value: ConfigOptions.audio.protection.maxAllowedIncrease
value: Config.options.audio.protection.maxAllowedIncrease
from: 0
to: 100
stepSize: 2
onValueChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.maxAllowedIncrease", value);
Config.options.audio.protection.maxAllowedIncrease = value;
}
}
ConfigSpinBox {
text: "Volume limit"
value: ConfigOptions.audio.protection.maxAllowed
value: Config.options.audio.protection.maxAllowed
from: 0
to: 100
stepSize: 2
onValueChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.maxAllowed", value);
Config.options.audio.protection.maxAllowed = value;
}
}
}
@@ -50,11 +50,11 @@ ContentPage {
MaterialTextField {
Layout.fillWidth: true
placeholderText: "System prompt"
text: ConfigOptions.ai.systemPrompt
text: Config.options.ai.systemPrompt
wrapMode: TextEdit.Wrap
onTextChanged: {
Qt.callLater(() => {
ConfigLoader.setConfigValueAndSave("ai.systemPrompt", text);
Config.options.ai.systemPrompt = text;
});
}
}
@@ -67,22 +67,22 @@ ContentPage {
uniform: true
ConfigSpinBox {
text: "Low warning"
value: ConfigOptions.battery.low
value: Config.options.battery.low
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.low", value);
Config.options.battery.low = value;
}
}
ConfigSpinBox {
text: "Critical warning"
value: ConfigOptions.battery.critical
value: Config.options.battery.critical
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.critical", value);
Config.options.battery.critical = value;
}
}
}
@@ -90,9 +90,9 @@ ContentPage {
uniform: true
ConfigSwitch {
text: "Automatic suspend"
checked: ConfigOptions.battery.automaticSuspend
checked: Config.options.battery.automaticSuspend
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("battery.automaticSuspend", checked);
Config.options.battery.automaticSuspend = checked;
}
StyledToolTip {
content: "Automatically suspends the system when battery is low"
@@ -100,12 +100,12 @@ ContentPage {
}
ConfigSpinBox {
text: "Suspend at"
value: ConfigOptions.battery.suspend
value: Config.options.battery.suspend
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.suspend", value);
Config.options.battery.suspend = value;
}
}
}
@@ -116,10 +116,10 @@ ContentPage {
MaterialTextField {
Layout.fillWidth: true
placeholderText: "User agent (for services that require it)"
text: ConfigOptions.networking.userAgent
text: Config.options.networking.userAgent
wrapMode: TextEdit.Wrap
onTextChanged: {
ConfigLoader.setConfigValueAndSave("networking.userAgent", text);
Config.options.networking.userAgent = text;
}
}
}
@@ -128,12 +128,12 @@ ContentPage {
title: "Resources"
ConfigSpinBox {
text: "Polling interval (ms)"
value: ConfigOptions.resources.updateInterval
value: Config.options.resources.updateInterval
from: 100
to: 10000
stepSize: 100
onValueChanged: {
ConfigLoader.setConfigValueAndSave("resources.updateInterval", value);
Config.options.resources.updateInterval = value;
}
}
}
@@ -46,10 +46,10 @@ ContentPage {
ContentSubsection {
title: "Material palette"
ConfigSelectionArray {
currentValue: ConfigOptions.appearance.palette.type
currentValue: Config.options.appearance.palette.type
configOptionName: "appearance.palette.type"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("appearance.palette.type", newValue);
Config.options.appearance.palette.type = newValue;
}
options: [
{"value": "auto", "displayName": "Auto"},
@@ -141,9 +141,9 @@ ContentPage {
ConfigRow {
ConfigSwitch {
text: "Enable"
checked: ConfigOptions.appearance.transparency
checked: Config.options.appearance.transparency
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("appearance.transparency", checked);
Config.options.appearance.transparency = checked;
}
StyledToolTip {
content: "Might look ass. Unsupported."
@@ -157,7 +157,7 @@ ContentPage {
ButtonGroup {
id: fakeScreenRoundingButtonGroup
property int selectedPolicy: ConfigOptions.appearance.fakeScreenRounding
property int selectedPolicy: Config.options.appearance.fakeScreenRounding
spacing: 2
SelectionGroupButton {
property int value: 0
@@ -165,7 +165,7 @@ ContentPage {
buttonText: "No"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
Config.options.appearance.fakeScreenRounding = value;
}
}
SelectionGroupButton {
@@ -173,7 +173,7 @@ ContentPage {
buttonText: "Yes"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
Config.options.appearance.fakeScreenRounding = value;
}
}
SelectionGroupButton {
@@ -182,7 +182,7 @@ ContentPage {
buttonText: "When not fullscreen"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
Config.options.appearance.fakeScreenRounding = value;
}
}
}
@@ -195,16 +195,16 @@ ContentPage {
uniform: true
ConfigSwitch {
text: "Title bar"
checked: ConfigOptions.windows.showTitlebar
checked: Config.options.windows.showTitlebar
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("windows.showTitlebar", checked);
Config.options.windows.showTitlebar = checked;
}
}
ConfigSwitch {
text: "Center title"
checked: ConfigOptions.windows.centerTitle
checked: Config.options.windows.centerTitle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("windows.centerTitle", checked);
Config.options.windows.centerTitle = checked;
}
}
}