summaryrefslogtreecommitdiff
path: root/modules/controlcenter
diff options
context:
space:
mode:
Diffstat (limited to 'modules/controlcenter')
-rw-r--r--modules/controlcenter/appearance/AppearancePane.qml78
-rw-r--r--modules/controlcenter/launcher/LauncherPane.qml45
2 files changed, 25 insertions, 98 deletions
diff --git a/modules/controlcenter/appearance/AppearancePane.qml b/modules/controlcenter/appearance/AppearancePane.qml
index cfe5b56..68e2e2d 100644
--- a/modules/controlcenter/appearance/AppearancePane.qml
+++ b/modules/controlcenter/appearance/AppearancePane.qml
@@ -263,38 +263,11 @@ RowLayout {
root.collapseAllSections(themeModeSection);
}
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: modeToggle.implicitHeight + Appearance.padding.large * 2
-
- radius: Appearance.rounding.normal
- color: Colours.tPalette.m3surfaceContainer
-
- Behavior on implicitHeight {
- Anim {}
- }
-
- RowLayout {
- id: modeToggle
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: Appearance.padding.large
-
- spacing: Appearance.spacing.normal
-
- StyledText {
- Layout.fillWidth: true
- text: qsTr("Dark mode")
- }
-
- StyledSwitch {
- checked: !Colours.currentLight
- onToggled: {
- Colours.setMode(checked ? "dark" : "light");
- }
- }
+ SwitchRow {
+ label: qsTr("Dark mode")
+ checked: !Colours.currentLight
+ onToggled: checked => {
+ Colours.setMode(checked ? "dark" : "light");
}
}
}
@@ -803,39 +776,14 @@ RowLayout {
}
}
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: fontSizeScaleRow.implicitHeight + Appearance.padding.large * 2
- radius: Appearance.rounding.normal
- color: Colours.tPalette.m3surfaceContainer
-
- Behavior on implicitHeight {
- Anim {}
- }
-
- RowLayout {
- id: fontSizeScaleRow
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: Appearance.padding.large
- spacing: Appearance.spacing.normal
-
- StyledText {
- Layout.fillWidth: true
- text: qsTr("Font size scale")
- }
-
- CustomSpinBox {
- id: fontSizeScaleSpinBox
- min: 0.1
- max: 5
- value: root.fontSizeScale
- onValueModified: value => {
- root.fontSizeScale = value;
- root.saveConfig();
- }
- }
+ SpinBoxRow {
+ label: qsTr("Font size scale")
+ min: 0.1
+ max: 5
+ value: root.fontSizeScale
+ onValueModified: value => {
+ root.fontSizeScale = value;
+ root.saveConfig();
}
}
}
diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml
index 82e145a..9b2570a 100644
--- a/modules/controlcenter/launcher/LauncherPane.qml
+++ b/modules/controlcenter/launcher/LauncherPane.qml
@@ -22,6 +22,7 @@ RowLayout {
required property Session session
property var selectedApp: null
+ property bool hideFromLauncherChecked: false
anchors.fill: parent
@@ -45,7 +46,7 @@ RowLayout {
function updateToggleState() {
if (!root.selectedApp || !configFile.loaded) {
- hideFromLauncherSwitch.checked = false;
+ root.hideFromLauncherChecked = false;
return;
}
@@ -54,16 +55,16 @@ RowLayout {
const appId = root.selectedApp.id || root.selectedApp.entry?.id;
if (config.launcher && config.launcher.hiddenApps) {
- hideFromLauncherSwitch.checked = config.launcher.hiddenApps.includes(appId);
+ root.hideFromLauncherChecked = config.launcher.hiddenApps.includes(appId);
} else {
- hideFromLauncherSwitch.checked = false;
+ root.hideFromLauncherChecked = false;
}
} catch (e) {
console.error("Failed to update toggle state:", e);
}
}
- function saveHiddenApps() {
+ function saveHiddenApps(isHidden) {
if (!configFile.loaded || !root.selectedApp) {
return;
}
@@ -76,7 +77,6 @@ RowLayout {
if (!config.launcher.hiddenApps) config.launcher.hiddenApps = [];
const hiddenApps = config.launcher.hiddenApps;
- const isHidden = hideFromLauncherSwitch.checked;
if (isHidden) {
// Add to hiddenApps if not already there
@@ -288,35 +288,14 @@ RowLayout {
anchors.top: parent.top
spacing: Appearance.spacing.normal
- StyledRect {
- Layout.fillWidth: true
+ SwitchRow {
Layout.topMargin: Appearance.spacing.normal
- implicitHeight: hideToggleRow.implicitHeight + Appearance.padding.large * 2
- color: Colours.tPalette.m3surfaceContainer
- radius: Appearance.rounding.normal
-
- RowLayout {
- id: hideToggleRow
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: Appearance.padding.large
- spacing: Appearance.spacing.normal
-
- StyledText {
- Layout.fillWidth: true
- text: qsTr("Hide from launcher")
- font.pointSize: Appearance.font.size.normal
- }
-
- StyledSwitch {
- id: hideFromLauncherSwitch
- checked: false
- enabled: root.selectedApp !== null && configFile.loaded
- onToggled: {
- root.saveHiddenApps();
- }
- }
+ label: qsTr("Hide from launcher")
+ checked: root.hideFromLauncherChecked
+ enabled: root.selectedApp !== null && configFile.loaded
+ onToggled: checked => {
+ root.hideFromLauncherChecked = checked;
+ root.saveHiddenApps(checked);
}
}