From 9d7f0c48cebec02aaf2ca780b89a763ce91f8624 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:21:44 +1100 Subject: internal: format --- components/ConnectionHeader.qml | 1 - components/ConnectionInfoSection.qml | 1 - components/PropertyRow.qml | 1 - components/SectionContainer.qml | 5 +- components/SectionHeader.qml | 1 - components/controls/CollapsibleSection.qml | 5 +- components/controls/SpinBoxRow.qml | 3 +- components/controls/SplitButtonRow.qml | 18 +- components/controls/StyledInputField.qml | 29 +- components/controls/SwitchRow.qml | 3 +- components/controls/ToggleButton.qml | 1 - components/controls/ToggleRow.qml | 1 - components/controls/Tooltip.qml | 43 +- config/Config.qml | 20 +- modules/background/Background.qml | 48 +- modules/bar/components/Settings.qml | 3 - modules/bar/components/SettingsIcon.qml | 3 - modules/bar/components/StatusIcons.qml | 2 +- modules/bar/components/workspaces/OccupiedBg.qml | 3 +- modules/bar/popouts/Content.qml | 5 +- modules/bar/popouts/WirelessPassword.qml | 1 - modules/bar/popouts/Wrapper.qml | 4 +- modules/bar/popouts/kblayout/KbLayout.qml | 75 +- modules/bar/popouts/kblayout/KbLayoutModel.qml | 60 +- modules/controlcenter/ControlCenter.qml | 4 +- modules/controlcenter/PaneRegistry.qml | 1 - modules/controlcenter/Panes.qml | 16 +- modules/controlcenter/Session.qml | 3 +- .../controlcenter/appearance/AppearancePane.qml | 162 ++--- .../appearance/sections/AnimationsSection.qml | 12 +- .../appearance/sections/BackgroundSection.qml | 125 ++-- .../appearance/sections/BorderSection.qml | 23 +- .../appearance/sections/ColorSchemeSection.qml | 1 - .../appearance/sections/ColorVariantSection.qml | 1 - .../appearance/sections/FontsSection.qml | 12 +- .../appearance/sections/ScalesSection.qml | 34 +- .../appearance/sections/ThemeModeSection.qml | 1 - .../appearance/sections/TransparencySection.qml | 31 +- modules/controlcenter/audio/AudioPane.qml | 773 +++++++++++---------- modules/controlcenter/bluetooth/BtPane.qml | 2 +- modules/controlcenter/components/DeviceDetails.qml | 15 +- modules/controlcenter/components/DeviceList.qml | 9 +- .../controlcenter/components/PaneTransition.qml | 13 +- .../controlcenter/components/SettingsHeader.qml | 1 - modules/controlcenter/components/SliderInput.qml | 29 +- .../controlcenter/components/SplitPaneLayout.qml | 5 +- .../components/SplitPaneWithDetails.qml | 89 +-- modules/controlcenter/components/WallpaperGrid.qml | 308 ++++---- modules/controlcenter/launcher/LauncherPane.qml | 355 +++++----- modules/controlcenter/launcher/Settings.qml | 1 - modules/controlcenter/network/EthernetDetails.qml | 2 +- modules/controlcenter/network/EthernetList.qml | 2 +- modules/controlcenter/network/EthernetPane.qml | 2 +- modules/controlcenter/network/EthernetSettings.qml | 2 +- modules/controlcenter/network/NetworkSettings.qml | 13 +- modules/controlcenter/network/NetworkingPane.qml | 35 +- modules/controlcenter/network/VpnSettings.qml | 6 +- modules/controlcenter/network/WirelessDetails.qml | 5 +- modules/controlcenter/network/WirelessList.qml | 10 +- modules/controlcenter/network/WirelessPane.qml | 2 +- .../network/WirelessPasswordDialog.qml | 3 +- modules/controlcenter/network/WirelessSettings.qml | 2 +- modules/controlcenter/state/BluetoothState.qml | 1 - modules/controlcenter/state/EthernetState.qml | 1 - modules/controlcenter/state/LauncherState.qml | 1 - modules/controlcenter/state/NetworkState.qml | 1 - .../controlcenter/taskbar/ConnectedButtonGroup.qml | 9 +- modules/controlcenter/taskbar/TaskbarPane.qml | 304 ++++---- modules/dashboard/Content.qml | 3 +- modules/utilities/cards/Toggles.qml | 1 - services/Audio.qml | 3 +- services/Network.qml | 80 ++- services/VPN.qml | 6 +- utils/NetworkConnection.qml | 56 +- 74 files changed, 1515 insertions(+), 1397 deletions(-) diff --git a/components/ConnectionHeader.qml b/components/ConnectionHeader.qml index 3f77fd9..12b4276 100644 --- a/components/ConnectionHeader.qml +++ b/components/ConnectionHeader.qml @@ -29,4 +29,3 @@ ColumnLayout { font.bold: true } } - diff --git a/components/ConnectionInfoSection.qml b/components/ConnectionInfoSection.qml index 88c6b3a..927ef28 100644 --- a/components/ConnectionInfoSection.qml +++ b/components/ConnectionInfoSection.qml @@ -57,4 +57,3 @@ ColumnLayout { Layout.maximumWidth: parent.width } } - diff --git a/components/PropertyRow.qml b/components/PropertyRow.qml index 697830a..640d5f7 100644 --- a/components/PropertyRow.qml +++ b/components/PropertyRow.qml @@ -24,4 +24,3 @@ ColumnLayout { font.pointSize: Appearance.font.size.small } } - diff --git a/components/SectionContainer.qml b/components/SectionContainer.qml index f133e19..2b653a5 100644 --- a/components/SectionContainer.qml +++ b/components/SectionContainer.qml @@ -16,9 +16,7 @@ StyledRect { implicitHeight: contentColumn.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal - color: Colours.transparency.enabled - ? Colours.layer(Colours.palette.m3surfaceContainer, 2) - : Colours.palette.m3surfaceContainerHigh + color: Colours.transparency.enabled ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : Colours.palette.m3surfaceContainerHigh ColumnLayout { id: contentColumn @@ -32,4 +30,3 @@ StyledRect { spacing: root.contentSpacing } } - diff --git a/components/SectionHeader.qml b/components/SectionHeader.qml index 897e63a..502e918 100644 --- a/components/SectionHeader.qml +++ b/components/SectionHeader.qml @@ -25,4 +25,3 @@ ColumnLayout { color: Colours.palette.m3outline } } - diff --git a/components/controls/CollapsibleSection.qml b/components/controls/CollapsibleSection.qml index 8940884..e3d8eef 100644 --- a/components/controls/CollapsibleSection.qml +++ b/components/controls/CollapsibleSection.qml @@ -88,9 +88,7 @@ ColumnLayout { id: backgroundRect anchors.fill: parent radius: Appearance.rounding.normal - color: Colours.transparency.enabled - ? Colours.layer(Colours.palette.m3surfaceContainer, root.nested ? 3 : 2) - : (root.nested ? Colours.palette.m3surfaceContainerHigh : Colours.palette.m3surfaceContainer) + color: Colours.transparency.enabled ? Colours.layer(Colours.palette.m3surfaceContainer, root.nested ? 3 : 2) : (root.nested ? Colours.palette.m3surfaceContainerHigh : Colours.palette.m3surfaceContainer) opacity: root.showBackground && root.expanded ? 1.0 : 0.0 visible: root.showBackground @@ -132,4 +130,3 @@ ColumnLayout { } } } - diff --git a/components/controls/SpinBoxRow.qml b/components/controls/SpinBoxRow.qml index 4902627..fe6a198 100644 --- a/components/controls/SpinBoxRow.qml +++ b/components/controls/SpinBoxRow.qml @@ -14,7 +14,7 @@ StyledRect { required property real min required property real max property real step: 1 - property var onValueModified: function(value) {} + property var onValueModified: function (value) {} Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 @@ -50,4 +50,3 @@ StyledRect { } } } - diff --git a/components/controls/SplitButtonRow.qml b/components/controls/SplitButtonRow.qml index 4ecc8bf..db9925f 100644 --- a/components/controls/SplitButtonRow.qml +++ b/components/controls/SplitButtonRow.qml @@ -14,20 +14,20 @@ StyledRect { required property string label property int expandedZ: 100 property bool enabled: true - + property alias menuItems: splitButton.menuItems property alias active: splitButton.active property alias expanded: splitButton.expanded property alias type: splitButton.type - + signal selected(item: MenuItem) Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - - clip: false + + clip: false z: splitButton.menu.implicitHeight > 0 ? expandedZ : 1 opacity: enabled ? 1.0 : 0.5 @@ -47,14 +47,14 @@ StyledRect { id: splitButton enabled: root.enabled type: SplitButton.Filled - + menu.z: 1 - + stateLayer.onClicked: { - splitButton.expanded = !splitButton.expanded + splitButton.expanded = !splitButton.expanded; } - - menu.onItemSelected: (item) => { + + menu.onItemSelected: item => { root.selected(item); } } diff --git a/components/controls/StyledInputField.qml b/components/controls/StyledInputField.qml index fcd0a33..0d199c7 100644 --- a/components/controls/StyledInputField.qml +++ b/components/controls/StyledInputField.qml @@ -15,12 +15,12 @@ Item { property int horizontalAlignment: TextInput.AlignHCenter property int implicitWidth: 70 property bool enabled: true - + // Expose activeFocus through alias to avoid FINAL property override readonly property alias hasFocus: inputField.activeFocus - + signal textEdited(string text) - signal editingFinished() + signal editingFinished implicitHeight: inputField.implicitHeight + Appearance.padding.small * 2 @@ -28,18 +28,18 @@ Item { id: container anchors.fill: parent - color: inputHover.containsMouse || inputField.activeFocus - ? Colours.layer(Colours.palette.m3surfaceContainer, 3) - : Colours.layer(Colours.palette.m3surfaceContainer, 2) + color: inputHover.containsMouse || inputField.activeFocus ? Colours.layer(Colours.palette.m3surfaceContainer, 3) : Colours.layer(Colours.palette.m3surfaceContainer, 2) radius: Appearance.rounding.small border.width: 1 - border.color: inputField.activeFocus - ? Colours.palette.m3primary - : Qt.alpha(Colours.palette.m3outline, 0.3) + border.color: inputField.activeFocus ? Colours.palette.m3primary : Qt.alpha(Colours.palette.m3outline, 0.3) opacity: root.enabled ? 1 : 0.5 - Behavior on color { CAnim {} } - Behavior on border.color { CAnim {} } + Behavior on color { + CAnim {} + } + Behavior on border.color { + CAnim {} + } MouseArea { id: inputHover @@ -58,23 +58,22 @@ Item { validator: root.validator readOnly: root.readOnly enabled: root.enabled - + Binding { target: inputField property: "text" value: root.text when: !inputField.activeFocus } - + onTextChanged: { root.text = text; root.textEdited(text); } - + onEditingFinished: { root.editingFinished(); } } } } - diff --git a/components/controls/SwitchRow.qml b/components/controls/SwitchRow.qml index 7fa3e1b..6dda3f0 100644 --- a/components/controls/SwitchRow.qml +++ b/components/controls/SwitchRow.qml @@ -12,7 +12,7 @@ StyledRect { required property string label required property bool checked property bool enabled: true - property var onToggled: function(checked) {} + property var onToggled: function (checked) {} Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 @@ -46,4 +46,3 @@ StyledRect { } } } - diff --git a/components/controls/ToggleButton.qml b/components/controls/ToggleButton.qml index 8bdcb04..98c7564 100644 --- a/components/controls/ToggleButton.qml +++ b/components/controls/ToggleButton.qml @@ -122,4 +122,3 @@ StyledRect { Layout.minimumHeight: 0 } } - diff --git a/components/controls/ToggleRow.qml b/components/controls/ToggleRow.qml index 23dc2a2..269d3d6 100644 --- a/components/controls/ToggleRow.qml +++ b/components/controls/ToggleRow.qml @@ -26,4 +26,3 @@ RowLayout { cLayer: 2 } } - diff --git a/components/controls/Tooltip.qml b/components/controls/Tooltip.qml index d665083..b129a37 100644 --- a/components/controls/Tooltip.qml +++ b/components/controls/Tooltip.qml @@ -55,33 +55,47 @@ Popup { } Connections { target: root.target - function onXChanged() { if (root.tooltipVisible) root.updatePosition(); } - function onYChanged() { if (root.tooltipVisible) root.updatePosition(); } - function onWidthChanged() { if (root.tooltipVisible) root.updatePosition(); } - function onHeightChanged() { if (root.tooltipVisible) root.updatePosition(); } + function onXChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } + function onYChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } + function onWidthChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } + function onHeightChanged() { + if (root.tooltipVisible) + root.updatePosition(); + } } function updatePosition() { - if (!target || !parent) return; - + if (!target || !parent) + return; + // Wait for tooltipRect to have its size calculated Qt.callLater(() => { - if (!target || !parent || !tooltipRect) return; - + if (!target || !parent || !tooltipRect) + return; + // Get target position in parent's coordinate system const targetPos = target.mapToItem(parent, 0, 0); const targetCenterX = targetPos.x + target.width / 2; - + // Get tooltip size (use width/height if available, otherwise implicit) const tooltipWidth = tooltipRect.width > 0 ? tooltipRect.width : tooltipRect.implicitWidth; const tooltipHeight = tooltipRect.height > 0 ? tooltipRect.height : tooltipRect.implicitHeight; - + // Center tooltip horizontally on target let newX = targetCenterX - tooltipWidth / 2; - + // Position tooltip above target let newY = targetPos.y - tooltipHeight - Appearance.spacing.small; - + // Keep within bounds const padding = Appearance.padding.normal; if (newX < padding) { @@ -89,7 +103,7 @@ Popup { } else if (newX + tooltipWidth > (parent.width - padding)) { newX = parent.width - tooltipWidth - padding; } - + // Update popup position x = newX; y = newY; @@ -156,7 +170,7 @@ Popup { id: tooltipText anchors.centerIn: parent - + text: root.text color: Colours.palette.m3onSurface font.pointSize: Appearance.font.size.small @@ -169,4 +183,3 @@ Popup { } } } - diff --git a/config/Config.qml b/config/Config.qml index bebfe4d..c48a1ec 100644 --- a/config/Config.qml +++ b/config/Config.qml @@ -101,9 +101,15 @@ Singleton { function serializeAppearance(): var { return { - rounding: { scale: appearance.rounding.scale }, - spacing: { scale: appearance.spacing.scale }, - padding: { scale: appearance.padding.scale }, + rounding: { + scale: appearance.rounding.scale + }, + spacing: { + scale: appearance.spacing.scale + }, + padding: { + scale: appearance.padding.scale + }, font: { family: { sans: appearance.font.family.sans, @@ -111,10 +117,14 @@ Singleton { material: appearance.font.family.material, clock: appearance.font.family.clock }, - size: { scale: appearance.font.size.scale } + size: { + scale: appearance.font.size.scale + } }, anim: { - durations: { scale: appearance.anim.durations.scale } + durations: { + scale: appearance.anim.durations.scale + } }, transparency: { enabled: appearance.transparency.enabled, diff --git a/modules/background/Background.qml b/modules/background/Background.qml index 69e070b..f8484e1 100644 --- a/modules/background/Background.qml +++ b/modules/background/Background.qml @@ -46,82 +46,82 @@ Loader { } } - Loader { id: clockLoader active: Config.background.desktopClock.enabled anchors.margins: Appearance.padding.large * 2 anchors.leftMargin: Appearance.padding.large * 2 + Config.bar.sizes.innerWidth + Math.max(Appearance.padding.smaller, Config.border.thickness) - + state: Config.background.desktopClock.position states: [ State { name: "top-left" - AnchorChanges { - target: clockLoader - anchors.top: parent.top - anchors.left: parent.left + AnchorChanges { + target: clockLoader + anchors.top: parent.top + anchors.left: parent.left } }, State { name: "top-center" - AnchorChanges { + AnchorChanges { target: clockLoader - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter } }, State { name: "top-right" - AnchorChanges { + AnchorChanges { target: clockLoader - anchors.top: parent.top - anchors.right: parent.right } + anchors.top: parent.top + anchors.right: parent.right + } }, State { name: "middle-left" - AnchorChanges { + AnchorChanges { target: clockLoader anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left + anchors.left: parent.left } }, State { name: "middle-center" - AnchorChanges { - target: clockLoader + AnchorChanges { + target: clockLoader anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter } }, State { name: "middle-right" - AnchorChanges { + AnchorChanges { target: clockLoader anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right + anchors.right: parent.right } }, State { name: "bottom-left" - AnchorChanges { + AnchorChanges { target: clockLoader anchors.bottom: parent.bottom - anchors.left: parent.left + anchors.left: parent.left } }, State { name: "bottom-center" - AnchorChanges { + AnchorChanges { target: clockLoader - anchors.bottom: parent.bottom + anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter } }, State { name: "bottom-right" - AnchorChanges { + AnchorChanges { target: clockLoader anchors.bottom: parent.bottom anchors.right: parent.right @@ -130,7 +130,7 @@ Loader { ] transitions: Transition { - AnchorAnimation { + AnchorAnimation { duration: Appearance.anim.durations.expressiveDefaultSpatial easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial } diff --git a/modules/bar/components/Settings.qml b/modules/bar/components/Settings.qml index 7cd18be..5d562ce 100644 --- a/modules/bar/components/Settings.qml +++ b/modules/bar/components/Settings.qml @@ -39,6 +39,3 @@ Item { font.pointSize: Appearance.font.size.normal } } - - - diff --git a/modules/bar/components/SettingsIcon.qml b/modules/bar/components/SettingsIcon.qml index 7cd18be..5d562ce 100644 --- a/modules/bar/components/SettingsIcon.qml +++ b/modules/bar/components/SettingsIcon.qml @@ -39,6 +39,3 @@ Item { font.pointSize: Appearance.font.size.normal } } - - - diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml index 442bd2c..ca7dc2e 100644 --- a/modules/bar/components/StatusIcons.qml +++ b/modules/bar/components/StatusIcons.qml @@ -143,7 +143,7 @@ StyledRect { // Network icon WrappedLoader { name: "network" - active: Config.bar.status.showNetwork && (! Nmcli.activeEthernet || Config.bar.status.showWifi) + active: Config.bar.status.showNetwork && (!Nmcli.activeEthernet || Config.bar.status.showWifi) sourceComponent: MaterialIcon { animate: true diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml index da6fa55..56b215e 100644 --- a/modules/bar/components/workspaces/OccupiedBg.qml +++ b/modules/bar/components/workspaces/OccupiedBg.qml @@ -16,7 +16,8 @@ Item { property list pills: [] onOccupiedChanged: { - if (!occupied) return; + if (!occupied) + return; let count = 0; const start = groupOffset; const end = start + Config.bar.workspaces.shown; diff --git a/modules/bar/popouts/Content.qml b/modules/bar/popouts/Content.qml index c9a7c5d..4076844 100644 --- a/modules/bar/popouts/Content.qml +++ b/modules/bar/popouts/Content.qml @@ -58,7 +58,7 @@ Item { wrapper: root.wrapper network: networkPopout.item?.passwordNetwork ?? null } - + Connections { target: root.wrapper function onCurrentNameChanged() { @@ -79,7 +79,7 @@ Item { } } } - + Connections { target: networkPopout function onItemChanged() { @@ -121,7 +121,6 @@ Item { } } - Popout { name: "lockstatus" sourceComponent: LockStatus {} diff --git a/modules/bar/popouts/WirelessPassword.qml b/modules/bar/popouts/WirelessPassword.qml index 5da50b6..96639e7 100644 --- a/modules/bar/popouts/WirelessPassword.qml +++ b/modules/bar/popouts/WirelessPassword.qml @@ -603,4 +603,3 @@ ColumnLayout { } } } - diff --git a/modules/bar/popouts/Wrapper.qml b/modules/bar/popouts/Wrapper.qml index fc74222..05a1d3c 100644 --- a/modules/bar/popouts/Wrapper.qml +++ b/modules/bar/popouts/Wrapper.qml @@ -67,7 +67,7 @@ Item { } close(); } - + Keys.onPressed: event => { // Don't intercept keys when password popout is active - let it handle them if (currentName === "wirelesspassword") { @@ -88,7 +88,7 @@ Item { property: "WlrLayershell.keyboardFocus" value: WlrKeyboardFocus.OnDemand } - + Binding { when: root.hasCurrent && root.currentName === "wirelesspassword" diff --git a/modules/bar/popouts/kblayout/KbLayout.qml b/modules/bar/popouts/kblayout/KbLayout.qml index f612f58..94b6f7e 100644 --- a/modules/bar/popouts/kblayout/KbLayout.qml +++ b/modules/bar/popouts/kblayout/KbLayout.qml @@ -19,9 +19,13 @@ ColumnLayout { spacing: Appearance.spacing.small width: Config.bar.sizes.kbLayoutWidth - KbLayoutModel { id: kb } + KbLayoutModel { + id: kb + } - function refresh() { kb.refresh() } + function refresh() { + kb.refresh(); + } Component.onCompleted: kb.start() StyledText { @@ -46,12 +50,39 @@ ColumnLayout { spacing: Appearance.spacing.small add: Transition { - NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 140 } - NumberAnimation { properties: "y"; duration: 180; easing.type: Easing.OutCubic } + NumberAnimation { + properties: "opacity" + from: 0 + to: 1 + duration: 140 + } + NumberAnimation { + properties: "y" + duration: 180 + easing.type: Easing.OutCubic + } + } + remove: Transition { + NumberAnimation { + properties: "opacity" + to: 0 + duration: 100 + } + } + move: Transition { + NumberAnimation { + properties: "y" + duration: 180 + easing.type: Easing.OutCubic + } + } + displaced: Transition { + NumberAnimation { + properties: "y" + duration: 180 + easing.type: Easing.OutCubic + } } - remove: Transition { NumberAnimation { properties: "opacity"; to: 0; duration: 100 } } - move: Transition { NumberAnimation { properties: "y"; duration: 180; easing.type: Easing.OutCubic } } - displaced: Transition { NumberAnimation { properties: "y"; duration: 180; easing.type: Easing.OutCubic } } delegate: Item { required property int layoutIndex @@ -145,13 +176,35 @@ ColumnLayout { running: false ParallelAnimation { - NumberAnimation { target: activeRow; property: "opacity"; to: 0.0; duration: 70 } - NumberAnimation { target: activeRow; property: "scale"; to: 0.92; duration: 70 } + NumberAnimation { + target: activeRow + property: "opacity" + to: 0.0 + duration: 70 + } + NumberAnimation { + target: activeRow + property: "scale" + to: 0.92 + duration: 70 + } } ParallelAnimation { - NumberAnimation { target: activeRow; property: "opacity"; to: 1.0; duration: 160; easing.type: Easing.OutCubic } - NumberAnimation { target: activeRow; property: "scale"; to: 1.0; duration: 220; easing.type: Easing.OutBack } + NumberAnimation { + target: activeRow + property: "opacity" + to: 1.0 + duration: 160 + easing.type: Easing.OutCubic + } + NumberAnimation { + target: activeRow + property: "scale" + to: 1.0 + duration: 220 + easing.type: Easing.OutBack + } } } } diff --git a/modules/bar/popouts/kblayout/KbLayoutModel.qml b/modules/bar/popouts/kblayout/KbLayoutModel.qml index 41e45b3..4371095 100644 --- a/modules/bar/popouts/kblayout/KbLayoutModel.qml +++ b/modules/bar/popouts/kblayout/KbLayoutModel.qml @@ -12,7 +12,9 @@ Item { id: model visible: false - ListModel { id: _visibleModel } + ListModel { + id: _visibleModel + } property alias visibleModel: _visibleModel property string activeLabel: "" @@ -33,7 +35,9 @@ Item { _switchProc.running = true; } - ListModel { id: _layoutsModel } + ListModel { + id: _layoutsModel + } property var _xkbMap: ({}) property bool _notifiedLimit: false @@ -41,14 +45,19 @@ Item { Process { id: _xkbXmlBase command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/base.xml"] - stdout: StdioCollector { onStreamFinished: _buildXmlMap(text) } - onRunningChanged: if (!running && (typeof exitCode !== "undefined") && exitCode !== 0) _xkbXmlEvdev.running = true + stdout: StdioCollector { + onStreamFinished: _buildXmlMap(text) + } + onRunningChanged: if (!running && (typeof exitCode !== "undefined") && exitCode !== 0) + _xkbXmlEvdev.running = true } Process { id: _xkbXmlEvdev command: ["xmllint", "--xpath", "//layout/configItem[name and description]", "/usr/share/X11/xkb/rules/evdev.xml"] - stdout: StdioCollector { onStreamFinished: _buildXmlMap(text) } + stdout: StdioCollector { + onStreamFinished: _buildXmlMap(text) + } } function _buildXmlMap(xml) { @@ -60,7 +69,8 @@ Item { while ((m = re.exec(xml)) !== null) { const code = (m[1] || "").trim(); const desc = (m[2] || "").trim(); - if (!code || !desc) continue; + if (!code || !desc) + continue; map[code] = _short(desc); } @@ -73,7 +83,11 @@ Item { const tmp = []; for (let i = 0; i < _layoutsModel.count; i++) { const it = _layoutsModel.get(i); - tmp.push({ layoutIndex: it.layoutIndex, token: it.token, label: _pretty(it.token) }); + tmp.push({ + layoutIndex: it.layoutIndex, + token: it.token, + label: _pretty(it.token) + }); } _layoutsModel.clear(); tmp.forEach(t => _layoutsModel.append(t)); @@ -83,7 +97,8 @@ Item { function _short(desc) { const m = desc.match(/^(.*)\((.*)\)$/); - if (!m) return desc; + if (!m) + return desc; const lang = m[1].trim(); const region = m[2].trim(); const code = (region.split(/[,\s-]/)[0] || region).slice(0, 2).toUpperCase(); @@ -118,7 +133,8 @@ Item { const dev = JSON.parse(text); const kb = dev?.keyboards?.find(k => k.main) || dev?.keyboards?.[0]; const raw = (kb?.layout || "").trim(); - if (raw.length) _setLayouts(raw); + if (raw.length) + _setLayouts(raw); } catch (e) {} _fetchActiveLayouts.running = true; } @@ -136,10 +152,7 @@ Item { const idx = kb?.active_layout_index ?? -1; activeIndex = idx >= 0 ? idx : -1; - activeLabel = - (idx >= 0 && idx < _layoutsModel.count) - ? _layoutsModel.get(idx).label - : ""; + activeLabel = (idx >= 0 && idx < _layoutsModel.count) ? _layoutsModel.get(idx).label : ""; } catch (e) { activeIndex = -1; activeLabel = ""; @@ -152,7 +165,8 @@ Item { Process { id: _switchProc - onRunningChanged: if (!running) _fetchActiveLayouts.running = true + onRunningChanged: if (!running) + _fetchActiveLayouts.running = true } function _setLayouts(raw) { @@ -163,9 +177,14 @@ Item { let idx = 0; for (const p of parts) { - if (seen.has(p)) continue; + if (seen.has(p)) + continue; seen.add(p); - _layoutsModel.append({ layoutIndex: idx, token: p, label: _pretty(p) }); + _layoutsModel.append({ + layoutIndex: idx, + token: p, + label: _pretty(p) + }); idx++; } } @@ -184,17 +203,14 @@ Item { return; if (_layoutsModel.count > 4) { - Toaster.toast( - qsTr("Keyboard layout limit"), - qsTr("XKB supports only 4 layouts at a time"), - "warning" - ); + Toaster.toast(qsTr("Keyboard layout limit"), qsTr("XKB supports only 4 layouts at a time"), "warning"); } } function _pretty(token) { const code = token.replace(/\(.*\)$/, "").trim(); - if (_xkbMap[code]) return code.toUpperCase() + " - " + _xkbMap[code]; + if (_xkbMap[code]) + return code.toUpperCase() + " - " + _xkbMap[code]; return code.toUpperCase() + " - " + code; } } diff --git a/modules/controlcenter/ControlCenter.qml b/modules/controlcenter/ControlCenter.qml index 043e7e1..4aacfad 100644 --- a/modules/controlcenter/ControlCenter.qml +++ b/modules/controlcenter/ControlCenter.qml @@ -67,7 +67,7 @@ Item { if (!panes.initialOpeningComplete) { return; } - + if (event.angleDelta.y < 0) root.session.activeIndex = Math.min(root.session.activeIndex + 1, root.session.panes.length - 1); else if (event.angleDelta.y > 0) @@ -95,6 +95,6 @@ Item { session: root.session } } - + readonly property bool initialOpeningComplete: panes.initialOpeningComplete } diff --git a/modules/controlcenter/PaneRegistry.qml b/modules/controlcenter/PaneRegistry.qml index d8bf45e..c2a0f38 100644 --- a/modules/controlcenter/PaneRegistry.qml +++ b/modules/controlcenter/PaneRegistry.qml @@ -84,4 +84,3 @@ QtObject { return null; } } - diff --git a/modules/controlcenter/Panes.qml b/modules/controlcenter/Panes.qml index c239b91..4a4460c 100644 --- a/modules/controlcenter/Panes.qml +++ b/modules/controlcenter/Panes.qml @@ -29,7 +29,7 @@ ClippingRectangle { MouseArea { anchors.fill: parent z: -1 - onPressed: function(mouse) { + onPressed: function (mouse) { root.focus = true; mouse.accepted = false; } @@ -103,7 +103,7 @@ ClippingRectangle { implicitHeight: root.height property bool hasBeenLoaded: false - + function updateActive(): void { const diff = Math.abs(root.session.activeIndex - pane.paneIndex); const isActivePane = diff === 0; @@ -130,37 +130,37 @@ ClippingRectangle { anchors.fill: parent clip: false active: false - + Component.onCompleted: { Qt.callLater(pane.updateActive); } - + onActiveChanged: { if (active && !pane.hasBeenLoaded) { pane.hasBeenLoaded = true; } - + if (active && !item) { loader.setSource(pane.componentPath, { "session": root.session }); } } - + onItemChanged: { if (item) { pane.hasBeenLoaded = true; } } } - + Connections { target: root.session function onActiveIndexChanged(): void { pane.updateActive(); } } - + Connections { target: layout function onInitialOpeningCompleteChanged(): void { diff --git a/modules/controlcenter/Session.qml b/modules/controlcenter/Session.qml index e77cd34..8a8545f 100644 --- a/modules/controlcenter/Session.qml +++ b/modules/controlcenter/Session.qml @@ -18,5 +18,6 @@ QtObject { readonly property VpnState vpn: VpnState {} onActiveChanged: activeIndex = Math.max(0, panes.indexOf(active)) - onActiveIndexChanged: if (panes[activeIndex]) active = panes[activeIndex] + onActiveIndexChanged: if (panes[activeIndex]) + active = panes[activeIndex] } diff --git a/modules/controlcenter/appearance/AppearancePane.qml b/modules/controlcenter/appearance/AppearancePane.qml index 218433b..4251167 100644 --- a/modules/controlcenter/appearance/AppearancePane.qml +++ b/modules/controlcenter/appearance/AppearancePane.qml @@ -73,15 +73,15 @@ Item { Config.background.desktopClock.enabled = root.desktopClockEnabled; Config.background.enabled = root.backgroundEnabled; - Config.background.desktopClock.scale = root.desktopClockScale - Config.background.desktopClock.position = root.desktopClockPosition - Config.background.desktopClock.shadow.enabled = root.desktopClockShadowEnabled - Config.background.desktopClock.shadow.opacity = root.desktopClockShadowOpacity - Config.background.desktopClock.shadow.blur = root.desktopClockShadowBlur - Config.background.desktopClock.background.enabled = root.desktopClockBackgroundEnabled - Config.background.desktopClock.background.opacity = root.desktopClockBackgroundOpacity - Config.background.desktopClock.background.blur = root.desktopClockBackgroundBlur - Config.background.desktopClock.invertColors = root.desktopClockInvertColors + Config.background.desktopClock.scale = root.desktopClockScale; + Config.background.desktopClock.position = root.desktopClockPosition; + Config.background.desktopClock.shadow.enabled = root.desktopClockShadowEnabled; + Config.background.desktopClock.shadow.opacity = root.desktopClockShadowOpacity; + Config.background.desktopClock.shadow.blur = root.desktopClockShadowBlur; + Config.background.desktopClock.background.enabled = root.desktopClockBackgroundEnabled; + Config.background.desktopClock.background.opacity = root.desktopClockBackgroundOpacity; + Config.background.desktopClock.background.blur = root.desktopClockBackgroundBlur; + Config.background.desktopClock.invertColors = root.desktopClockInvertColors; Config.background.visualiser.enabled = root.visualiserEnabled; Config.background.visualiser.autoHide = root.visualiserAutoHide; @@ -116,11 +116,11 @@ Item { Loader { id: wallpaperLoader - + Layout.fillWidth: true Layout.fillHeight: true Layout.bottomMargin: -Appearance.padding.large * 2 - + active: { const isActive = root.session.activeIndex === 3; const isAdjacent = Math.abs(root.session.activeIndex - 3) === 1; @@ -129,13 +129,13 @@ Item { const shouldActivate = loader && loader.item !== null && (isActive || isAdjacent); return shouldActivate; } - + onStatusChanged: { if (status === Loader.Error) { console.error("[AppearancePane] Wallpaper loader error!"); } } - + sourceComponent: WallpaperGrid { session: root.session } @@ -155,7 +155,6 @@ Item { flickableDirection: Flickable.VerticalFlick contentHeight: sidebarLayout.height - StyledScrollBar.vertical: StyledScrollBar { flickable: sidebarFlickable } @@ -165,96 +164,87 @@ Item { anchors.left: parent.left anchors.right: parent.right spacing: Appearance.spacing.small - + readonly property var rootPane: sidebarFlickable.rootPane - readonly property bool allSectionsExpanded: - themeModeSection.expanded && - colorVariantSection.expanded && - colorSchemeSection.expanded && - animationsSection.expanded && - fontsSection.expanded && - scalesSection.expanded && - transparencySection.expanded && - borderSection.expanded && - backgroundSection.expanded - - RowLayout { - spacing: Appearance.spacing.smaller - - StyledText { - text: qsTr("Appearance") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } + readonly property bool allSectionsExpanded: themeModeSection.expanded && colorVariantSection.expanded && colorSchemeSection.expanded && animationsSection.expanded && fontsSection.expanded && scalesSection.expanded && transparencySection.expanded && borderSection.expanded && backgroundSection.expanded - Item { - Layout.fillWidth: true - } + RowLayout { + spacing: Appearance.spacing.smaller - IconButton { - icon: sidebarLayout.allSectionsExpanded ? "unfold_less" : "unfold_more" - type: IconButton.Text - label.animate: true - onClicked: { - const shouldExpand = !sidebarLayout.allSectionsExpanded; - themeModeSection.expanded = shouldExpand; - colorVariantSection.expanded = shouldExpand; - colorSchemeSection.expanded = shouldExpand; - animationsSection.expanded = shouldExpand; - fontsSection.expanded = shouldExpand; - scalesSection.expanded = shouldExpand; - transparencySection.expanded = shouldExpand; - borderSection.expanded = shouldExpand; - backgroundSection.expanded = shouldExpand; + StyledText { + text: qsTr("Appearance") + font.pointSize: Appearance.font.size.large + font.weight: 500 + } + + Item { + Layout.fillWidth: true + } + + IconButton { + icon: sidebarLayout.allSectionsExpanded ? "unfold_less" : "unfold_more" + type: IconButton.Text + label.animate: true + onClicked: { + const shouldExpand = !sidebarLayout.allSectionsExpanded; + themeModeSection.expanded = shouldExpand; + colorVariantSection.expanded = shouldExpand; + colorSchemeSection.expanded = shouldExpand; + animationsSection.expanded = shouldExpand; + fontsSection.expanded = shouldExpand; + scalesSection.expanded = shouldExpand; + transparencySection.expanded = shouldExpand; + borderSection.expanded = shouldExpand; + backgroundSection.expanded = shouldExpand; + } } } - } - ThemeModeSection { - id: themeModeSection - } + ThemeModeSection { + id: themeModeSection + } - ColorVariantSection { - id: colorVariantSection - } + ColorVariantSection { + id: colorVariantSection + } - ColorSchemeSection { - id: colorSchemeSection - } + ColorSchemeSection { + id: colorSchemeSection + } - AnimationsSection { - id: animationsSection - rootPane: sidebarFlickable.rootPane - } + AnimationsSection { + id: animationsSection + rootPane: sidebarFlickable.rootPane + } - FontsSection { - id: fontsSection - rootPane: sidebarFlickable.rootPane - } + FontsSection { + id: fontsSection + rootPane: sidebarFlickable.rootPane + } - ScalesSection { - id: scalesSection - rootPane: sidebarFlickable.rootPane - } + ScalesSection { + id: scalesSection + rootPane: sidebarFlickable.rootPane + } - TransparencySection { - id: transparencySection - rootPane: sidebarFlickable.rootPane - } + TransparencySection { + id: transparencySection + rootPane: sidebarFlickable.rootPane + } - BorderSection { - id: borderSection - rootPane: sidebarFlickable.rootPane - } + BorderSection { + id: borderSection + rootPane: sidebarFlickable.rootPane + } - BackgroundSection { - id: backgroundSection - rootPane: sidebarFlickable.rootPane + BackgroundSection { + id: backgroundSection + rootPane: sidebarFlickable.rootPane + } } } } - } rightContent: appearanceRightContentComponent } diff --git a/modules/controlcenter/appearance/sections/AnimationsSection.qml b/modules/controlcenter/appearance/sections/AnimationsSection.qml index 03fc2b1..0cba5ce 100644 --- a/modules/controlcenter/appearance/sections/AnimationsSection.qml +++ b/modules/controlcenter/appearance/sections/AnimationsSection.qml @@ -23,20 +23,22 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Animation duration scale") value: rootPane.animDurationsScale from: 0.1 to: 5.0 decimals: 1 suffix: "×" - validator: DoubleValidator { bottom: 0.1; top: 5.0 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.1 + top: 5.0 + } + + onValueModified: newValue => { rootPane.animDurationsScale = newValue; rootPane.saveConfig(); } } } } - diff --git a/modules/controlcenter/appearance/sections/BackgroundSection.qml b/modules/controlcenter/appearance/sections/BackgroundSection.qml index d5c16d4..2f75c9e 100644 --- a/modules/controlcenter/appearance/sections/BackgroundSection.qml +++ b/modules/controlcenter/appearance/sections/BackgroundSection.qml @@ -45,7 +45,7 @@ CollapsibleSection { SectionContainer { id: posContainer - + contentSpacing: Appearance.spacing.small z: 1 @@ -67,16 +67,29 @@ CollapsibleSection { SplitButtonRow { label: qsTr("Vertical Position") enabled: rootPane.desktopClockEnabled - + menuItems: [ - MenuItem { text: qsTr("Top"); icon: "vertical_align_top"; property string val: "top" }, - MenuItem { text: qsTr("Middle"); icon: "vertical_align_center"; property string val: "middle" }, - MenuItem { text: qsTr("Bottom"); icon: "vertical_align_bottom"; property string val: "bottom" } + MenuItem { + text: qsTr("Top") + icon: "vertical_align_top" + property string val: "top" + }, + MenuItem { + text: qsTr("Middle") + icon: "vertical_align_center" + property string val: "middle" + }, + MenuItem { + text: qsTr("Bottom") + icon: "vertical_align_bottom" + property string val: "bottom" + } ] Component.onCompleted: { - for(let i=0; i < menuItems.length; i++) { - if(menuItems[i].val === posContainer.currentV) active = menuItems[i]; + for (let i = 0; i < menuItems.length; i++) { + if (menuItems[i].val === posContainer.currentV) + active = menuItems[i]; } } @@ -88,16 +101,29 @@ CollapsibleSection { label: qsTr("Horizontal Position") enabled: rootPane.desktopClockEnabled expandedZ: 99 - + menuItems: [ - MenuItem { text: qsTr("Left"); icon: "align_horizontal_left"; property string val: "left" }, - MenuItem { text: qsTr("Center"); icon: "align_horizontal_center"; property string val: "center" }, - MenuItem { text: qsTr("Right"); icon: "align_horizontal_right"; property string val: "right" } + MenuItem { + text: qsTr("Left") + icon: "align_horizontal_left" + property string val: "left" + }, + MenuItem { + text: qsTr("Center") + icon: "align_horizontal_center" + property string val: "center" + }, + MenuItem { + text: qsTr("Right") + icon: "align_horizontal_right" + property string val: "right" + } ] Component.onCompleted: { - for(let i=0; i < menuItems.length; i++) { - if(menuItems[i].val === posContainer.currentH) active = menuItems[i]; + for (let i = 0; i < menuItems.length; i++) { + if (menuItems[i].val === posContainer.currentH) + active = menuItems[i]; } } @@ -137,17 +163,20 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Opacity") value: rootPane.desktopClockShadowOpacity * 100 from: 0 to: 100 suffix: "%" - validator: IntValidator { bottom: 0; top: 100 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) - - onValueModified: (newValue) => { + validator: IntValidator { + bottom: 0 + top: 100 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) + + onValueModified: newValue => { rootPane.desktopClockShadowOpacity = newValue / 100; rootPane.saveConfig(); } @@ -159,17 +188,20 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Blur") value: rootPane.desktopClockShadowBlur * 100 from: 0 to: 100 suffix: "%" - validator: IntValidator { bottom: 0; top: 100 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) - - onValueModified: (newValue) => { + validator: IntValidator { + bottom: 0 + top: 100 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) + + onValueModified: newValue => { rootPane.desktopClockShadowBlur = newValue / 100; rootPane.saveConfig(); } @@ -209,17 +241,20 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Opacity") value: rootPane.desktopClockBackgroundOpacity * 100 from: 0 to: 100 suffix: "%" - validator: IntValidator { bottom: 0; top: 100 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) - - onValueModified: (newValue) => { + validator: IntValidator { + bottom: 0 + top: 100 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) + + onValueModified: newValue => { rootPane.desktopClockBackgroundOpacity = newValue / 100; rootPane.saveConfig(); } @@ -227,7 +262,6 @@ CollapsibleSection { } } - StyledText { Layout.topMargin: Appearance.spacing.normal text: qsTr("Visualiser") @@ -258,17 +292,20 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Visualiser rounding") value: rootPane.visualiserRounding from: 0 to: 10 stepSize: 1 - validator: IntValidator { bottom: 0; top: 10 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) - - onValueModified: (newValue) => { + validator: IntValidator { + bottom: 0 + top: 10 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) + + onValueModified: newValue => { rootPane.visualiserRounding = Math.round(newValue); rootPane.saveConfig(); } @@ -280,18 +317,20 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Visualiser spacing") value: rootPane.visualiserSpacing from: 0 to: 2 - validator: DoubleValidator { bottom: 0; top: 2 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0 + top: 2 + } + + onValueModified: newValue => { rootPane.visualiserSpacing = newValue; rootPane.saveConfig(); } } } } - diff --git a/modules/controlcenter/appearance/sections/BorderSection.qml b/modules/controlcenter/appearance/sections/BorderSection.qml index dae26c3..9532d70 100644 --- a/modules/controlcenter/appearance/sections/BorderSection.qml +++ b/modules/controlcenter/appearance/sections/BorderSection.qml @@ -23,16 +23,19 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Border rounding") value: rootPane.borderRounding from: 0.1 to: 100 decimals: 1 suffix: "px" - validator: DoubleValidator { bottom: 0.1; top: 100 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.1 + top: 100 + } + + onValueModified: newValue => { rootPane.borderRounding = newValue; rootPane.saveConfig(); } @@ -44,20 +47,22 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Border thickness") value: rootPane.borderThickness from: 0.1 to: 100 decimals: 1 suffix: "px" - validator: DoubleValidator { bottom: 0.1; top: 100 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.1 + top: 100 + } + + onValueModified: newValue => { rootPane.borderThickness = newValue; rootPane.saveConfig(); } } } } - diff --git a/modules/controlcenter/appearance/sections/ColorSchemeSection.qml b/modules/controlcenter/appearance/sections/ColorSchemeSection.qml index 691d908..95cb4b7 100644 --- a/modules/controlcenter/appearance/sections/ColorSchemeSection.qml +++ b/modules/controlcenter/appearance/sections/ColorSchemeSection.qml @@ -143,4 +143,3 @@ CollapsibleSection { } } } - diff --git a/modules/controlcenter/appearance/sections/ColorVariantSection.qml b/modules/controlcenter/appearance/sections/ColorVariantSection.qml index 98c3d7c..3aa17dd 100644 --- a/modules/controlcenter/appearance/sections/ColorVariantSection.qml +++ b/modules/controlcenter/appearance/sections/ColorVariantSection.qml @@ -89,4 +89,3 @@ CollapsibleSection { } } } - diff --git a/modules/controlcenter/appearance/sections/FontsSection.qml b/modules/controlcenter/appearance/sections/FontsSection.qml index ef807b1..3988863 100644 --- a/modules/controlcenter/appearance/sections/FontsSection.qml +++ b/modules/controlcenter/appearance/sections/FontsSection.qml @@ -261,20 +261,22 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Font size scale") value: rootPane.fontSizeScale from: 0.7 to: 1.5 decimals: 2 suffix: "×" - validator: DoubleValidator { bottom: 0.7; top: 1.5 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.7 + top: 1.5 + } + + onValueModified: newValue => { rootPane.fontSizeScale = newValue; rootPane.saveConfig(); } } } } - diff --git a/modules/controlcenter/appearance/sections/ScalesSection.qml b/modules/controlcenter/appearance/sections/ScalesSection.qml index f74923b..b0e6e38 100644 --- a/modules/controlcenter/appearance/sections/ScalesSection.qml +++ b/modules/controlcenter/appearance/sections/ScalesSection.qml @@ -23,16 +23,19 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Padding scale") value: rootPane.paddingScale from: 0.5 to: 2.0 decimals: 1 suffix: "×" - validator: DoubleValidator { bottom: 0.5; top: 2.0 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.5 + top: 2.0 + } + + onValueModified: newValue => { rootPane.paddingScale = newValue; rootPane.saveConfig(); } @@ -44,16 +47,19 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Rounding scale") value: rootPane.roundingScale from: 0.1 to: 5.0 decimals: 1 suffix: "×" - validator: DoubleValidator { bottom: 0.1; top: 5.0 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.1 + top: 5.0 + } + + onValueModified: newValue => { rootPane.roundingScale = newValue; rootPane.saveConfig(); } @@ -65,20 +71,22 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Spacing scale") value: rootPane.spacingScale from: 0.1 to: 2.0 decimals: 1 suffix: "×" - validator: DoubleValidator { bottom: 0.1; top: 2.0 } - - onValueModified: (newValue) => { + validator: DoubleValidator { + bottom: 0.1 + top: 2.0 + } + + onValueModified: newValue => { rootPane.spacingScale = newValue; rootPane.saveConfig(); } } } } - diff --git a/modules/controlcenter/appearance/sections/ThemeModeSection.qml b/modules/controlcenter/appearance/sections/ThemeModeSection.qml index c136437..04eed91 100644 --- a/modules/controlcenter/appearance/sections/ThemeModeSection.qml +++ b/modules/controlcenter/appearance/sections/ThemeModeSection.qml @@ -21,4 +21,3 @@ CollapsibleSection { } } } - diff --git a/modules/controlcenter/appearance/sections/TransparencySection.qml b/modules/controlcenter/appearance/sections/TransparencySection.qml index c9dbfb8..9a48629 100644 --- a/modules/controlcenter/appearance/sections/TransparencySection.qml +++ b/modules/controlcenter/appearance/sections/TransparencySection.qml @@ -32,17 +32,20 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Transparency base") value: rootPane.transparencyBase * 100 from: 0 to: 100 suffix: "%" - validator: IntValidator { bottom: 0; top: 100 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) - - onValueModified: (newValue) => { + validator: IntValidator { + bottom: 0 + top: 100 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) + + onValueModified: newValue => { rootPane.transparencyBase = newValue / 100; rootPane.saveConfig(); } @@ -54,21 +57,23 @@ CollapsibleSection { SliderInput { Layout.fillWidth: true - + label: qsTr("Transparency layers") value: rootPane.transparencyLayers * 100 from: 0 to: 100 suffix: "%" - validator: IntValidator { bottom: 0; top: 100 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) - - onValueModified: (newValue) => { + validator: IntValidator { + bottom: 0 + top: 100 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) + + onValueModified: newValue => { rootPane.transparencyLayers = newValue / 100; rootPane.saveConfig(); } } } } - diff --git a/modules/controlcenter/audio/AudioPane.qml b/modules/controlcenter/audio/AudioPane.qml index e4a1a64..01d90be 100644 --- a/modules/controlcenter/audio/AudioPane.qml +++ b/modules/controlcenter/audio/AudioPane.qml @@ -40,179 +40,179 @@ Item { anchors.right: parent.right spacing: Appearance.spacing.normal - RowLayout { - Layout.fillWidth: true - spacing: Appearance.spacing.smaller - - StyledText { - text: qsTr("Audio") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } - - Item { + RowLayout { Layout.fillWidth: true - } - } + spacing: Appearance.spacing.smaller - CollapsibleSection { - id: outputDevicesSection + StyledText { + text: qsTr("Audio") + font.pointSize: Appearance.font.size.large + font.weight: 500 + } - Layout.fillWidth: true - title: qsTr("Output devices") - expanded: true + Item { + Layout.fillWidth: true + } + } + + CollapsibleSection { + id: outputDevicesSection - ColumnLayout { Layout.fillWidth: true - spacing: Appearance.spacing.small + title: qsTr("Output devices") + expanded: true - RowLayout { + ColumnLayout { Layout.fillWidth: true spacing: Appearance.spacing.small - StyledText { - text: qsTr("Devices (%1)").arg(Audio.sinks.length) - font.pointSize: Appearance.font.size.normal - font.weight: 500 + RowLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small + + StyledText { + text: qsTr("Devices (%1)").arg(Audio.sinks.length) + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } } - } - StyledText { - Layout.fillWidth: true - text: qsTr("All available output devices") - color: Colours.palette.m3outline - } + StyledText { + Layout.fillWidth: true + text: qsTr("All available output devices") + color: Colours.palette.m3outline + } - Repeater { - Layout.fillWidth: true - model: Audio.sinks + Repeater { + Layout.fillWidth: true + model: Audio.sinks - delegate: StyledRect { - required property var modelData + delegate: StyledRect { + required property var modelData - Layout.fillWidth: true + Layout.fillWidth: true - color: Audio.sink?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" - radius: Appearance.rounding.normal + color: Audio.sink?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + radius: Appearance.rounding.normal - StateLayer { - function onClicked(): void { - Audio.setAudioSink(modelData); + StateLayer { + function onClicked(): void { + Audio.setAudioSink(modelData); + } } - } - RowLayout { - id: outputRowLayout + RowLayout { + id: outputRowLayout - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Appearance.padding.normal - spacing: Appearance.spacing.normal + spacing: Appearance.spacing.normal - MaterialIcon { - text: Audio.sink?.id === modelData.id ? "speaker" : "speaker_group" - font.pointSize: Appearance.font.size.large - fill: Audio.sink?.id === modelData.id ? 1 : 0 - } + MaterialIcon { + text: Audio.sink?.id === modelData.id ? "speaker" : "speaker_group" + font.pointSize: Appearance.font.size.large + fill: Audio.sink?.id === modelData.id ? 1 : 0 + } - StyledText { - Layout.fillWidth: true - elide: Text.ElideRight - maximumLineCount: 1 + StyledText { + Layout.fillWidth: true + elide: Text.ElideRight + maximumLineCount: 1 - text: modelData.description || qsTr("Unknown") - font.weight: Audio.sink?.id === modelData.id ? 500 : 400 + text: modelData.description || qsTr("Unknown") + font.weight: Audio.sink?.id === modelData.id ? 500 : 400 + } } - } - implicitHeight: outputRowLayout.implicitHeight + Appearance.padding.normal * 2 + implicitHeight: outputRowLayout.implicitHeight + Appearance.padding.normal * 2 + } } } } - } - CollapsibleSection { - id: inputDevicesSection + CollapsibleSection { + id: inputDevicesSection - Layout.fillWidth: true - title: qsTr("Input devices") - expanded: true - - ColumnLayout { Layout.fillWidth: true - spacing: Appearance.spacing.small + title: qsTr("Input devices") + expanded: true - RowLayout { + ColumnLayout { Layout.fillWidth: true spacing: Appearance.spacing.small - StyledText { - text: qsTr("Devices (%1)").arg(Audio.sources.length) - font.pointSize: Appearance.font.size.normal - font.weight: 500 + RowLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small + + StyledText { + text: qsTr("Devices (%1)").arg(Audio.sources.length) + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } } - } - StyledText { - Layout.fillWidth: true - text: qsTr("All available input devices") - color: Colours.palette.m3outline - } + StyledText { + Layout.fillWidth: true + text: qsTr("All available input devices") + color: Colours.palette.m3outline + } - Repeater { - Layout.fillWidth: true - model: Audio.sources + Repeater { + Layout.fillWidth: true + model: Audio.sources - delegate: StyledRect { - required property var modelData + delegate: StyledRect { + required property var modelData - Layout.fillWidth: true + Layout.fillWidth: true - color: Audio.source?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" - radius: Appearance.rounding.normal + color: Audio.source?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + radius: Appearance.rounding.normal - StateLayer { - function onClicked(): void { - Audio.setAudioSource(modelData); + StateLayer { + function onClicked(): void { + Audio.setAudioSource(modelData); + } } - } - RowLayout { - id: inputRowLayout + RowLayout { + id: inputRowLayout - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Appearance.padding.normal - spacing: Appearance.spacing.normal + spacing: Appearance.spacing.normal - MaterialIcon { - text: "mic" - font.pointSize: Appearance.font.size.large - fill: Audio.source?.id === modelData.id ? 1 : 0 - } + MaterialIcon { + text: "mic" + font.pointSize: Appearance.font.size.large + fill: Audio.source?.id === modelData.id ? 1 : 0 + } - StyledText { - Layout.fillWidth: true - elide: Text.ElideRight - maximumLineCount: 1 + StyledText { + Layout.fillWidth: true + elide: Text.ElideRight + maximumLineCount: 1 - text: modelData.description || qsTr("Unknown") - font.weight: Audio.source?.id === modelData.id ? 500 : 400 + text: modelData.description || qsTr("Unknown") + font.weight: Audio.source?.id === modelData.id ? 500 : 400 + } } - } - implicitHeight: inputRowLayout.implicitHeight + Appearance.padding.normal * 2 + implicitHeight: inputRowLayout.implicitHeight + Appearance.padding.normal * 2 + } } } } } } } - } rightContent: Component { StyledFlickable { @@ -232,381 +232,390 @@ Item { anchors.top: parent.top spacing: Appearance.spacing.normal - SettingsHeader { - icon: "volume_up" - title: qsTr("Audio Settings") - } + SettingsHeader { + icon: "volume_up" + title: qsTr("Audio Settings") + } - SectionHeader { - title: qsTr("Output volume") - description: qsTr("Control the volume of your output device") - } + SectionHeader { + title: qsTr("Output volume") + description: qsTr("Control the volume of your output device") + } + + SectionContainer { + contentSpacing: Appearance.spacing.normal - SectionContainer { - contentSpacing: Appearance.spacing.normal + ColumnLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small - ColumnLayout { + RowLayout { Layout.fillWidth: true - spacing: Appearance.spacing.small + spacing: Appearance.spacing.normal - RowLayout { + StyledText { + text: qsTr("Volume") + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } + + Item { Layout.fillWidth: true - spacing: Appearance.spacing.normal + } - StyledText { - text: qsTr("Volume") - font.pointSize: Appearance.font.size.normal - font.weight: 500 + StyledInputField { + id: outputVolumeInput + Layout.preferredWidth: 70 + validator: IntValidator { + bottom: 0 + top: 100 } + enabled: !Audio.muted - Item { - Layout.fillWidth: true + Component.onCompleted: { + text = Math.round(Audio.volume * 100).toString(); } - StyledInputField { - id: outputVolumeInput - Layout.preferredWidth: 70 - validator: IntValidator { bottom: 0; top: 100 } - enabled: !Audio.muted - - Component.onCompleted: { - text = Math.round(Audio.volume * 100).toString(); - } - - Connections { - target: Audio - function onVolumeChanged() { - if (!outputVolumeInput.hasFocus) { - outputVolumeInput.text = Math.round(Audio.volume * 100).toString(); - } - } - } - - onTextEdited: (text) => { - if (hasFocus) { - const val = parseInt(text); - if (!isNaN(val) && val >= 0 && val <= 100) { - Audio.setVolume(val / 100); - } + Connections { + target: Audio + function onVolumeChanged() { + if (!outputVolumeInput.hasFocus) { + outputVolumeInput.text = Math.round(Audio.volume * 100).toString(); } } - - onEditingFinished: { + } + + onTextEdited: text => { + if (hasFocus) { const val = parseInt(text); - if (isNaN(val) || val < 0 || val > 100) { - text = Math.round(Audio.volume * 100).toString(); + if (!isNaN(val) && val >= 0 && val <= 100) { + Audio.setVolume(val / 100); } } } - StyledText { - text: "%" - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.normal - opacity: Audio.muted ? 0.5 : 1 + onEditingFinished: { + const val = parseInt(text); + if (isNaN(val) || val < 0 || val > 100) { + text = Math.round(Audio.volume * 100).toString(); + } } + } + + StyledText { + text: "%" + color: Colours.palette.m3outline + font.pointSize: Appearance.font.size.normal + opacity: Audio.muted ? 0.5 : 1 + } - StyledRect { - implicitWidth: implicitHeight - implicitHeight: muteIcon.implicitHeight + Appearance.padding.normal * 2 + StyledRect { + implicitWidth: implicitHeight + implicitHeight: muteIcon.implicitHeight + Appearance.padding.normal * 2 - radius: Appearance.rounding.normal - color: Audio.muted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + radius: Appearance.rounding.normal + color: Audio.muted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer - StateLayer { - function onClicked(): void { - if (Audio.sink?.audio) { - Audio.sink.audio.muted = !Audio.sink.audio.muted; - } + StateLayer { + function onClicked(): void { + if (Audio.sink?.audio) { + Audio.sink.audio.muted = !Audio.sink.audio.muted; } } + } - MaterialIcon { - id: muteIcon + MaterialIcon { + id: muteIcon - anchors.centerIn: parent - text: Audio.muted ? "volume_off" : "volume_up" - color: Audio.muted ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer - } + anchors.centerIn: parent + text: Audio.muted ? "volume_off" : "volume_up" + color: Audio.muted ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer } } + } - StyledSlider { - id: outputVolumeSlider - Layout.fillWidth: true - implicitHeight: Appearance.padding.normal * 3 - - value: Audio.volume - enabled: !Audio.muted - opacity: enabled ? 1 : 0.5 - onMoved: { - Audio.setVolume(value); - if (!outputVolumeInput.hasFocus) { - outputVolumeInput.text = Math.round(value * 100).toString(); - } + StyledSlider { + id: outputVolumeSlider + Layout.fillWidth: true + implicitHeight: Appearance.padding.normal * 3 + + value: Audio.volume + enabled: !Audio.muted + opacity: enabled ? 1 : 0.5 + onMoved: { + Audio.setVolume(value); + if (!outputVolumeInput.hasFocus) { + outputVolumeInput.text = Math.round(value * 100).toString(); } } } } + } - SectionHeader { - title: qsTr("Input volume") - description: qsTr("Control the volume of your input device") - } + SectionHeader { + title: qsTr("Input volume") + description: qsTr("Control the volume of your input device") + } + + SectionContainer { + contentSpacing: Appearance.spacing.normal - SectionContainer { - contentSpacing: Appearance.spacing.normal + ColumnLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small - ColumnLayout { + RowLayout { Layout.fillWidth: true - spacing: Appearance.spacing.small + spacing: Appearance.spacing.normal - RowLayout { + StyledText { + text: qsTr("Volume") + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } + + Item { Layout.fillWidth: true - spacing: Appearance.spacing.normal + } - StyledText { - text: qsTr("Volume") - font.pointSize: Appearance.font.size.normal - font.weight: 500 + StyledInputField { + id: inputVolumeInput + Layout.preferredWidth: 70 + validator: IntValidator { + bottom: 0 + top: 100 } + enabled: !Audio.sourceMuted - Item { - Layout.fillWidth: true + Component.onCompleted: { + text = Math.round(Audio.sourceVolume * 100).toString(); } - StyledInputField { - id: inputVolumeInput - Layout.preferredWidth: 70 - validator: IntValidator { bottom: 0; top: 100 } - enabled: !Audio.sourceMuted - - Component.onCompleted: { - text = Math.round(Audio.sourceVolume * 100).toString(); - } - - Connections { - target: Audio - function onSourceVolumeChanged() { - if (!inputVolumeInput.hasFocus) { - inputVolumeInput.text = Math.round(Audio.sourceVolume * 100).toString(); - } + Connections { + target: Audio + function onSourceVolumeChanged() { + if (!inputVolumeInput.hasFocus) { + inputVolumeInput.text = Math.round(Audio.sourceVolume * 100).toString(); } } - - onTextEdited: (text) => { - if (hasFocus) { - const val = parseInt(text); - if (!isNaN(val) && val >= 0 && val <= 100) { - Audio.setSourceVolume(val / 100); - } - } - } - - onEditingFinished: { + } + + onTextEdited: text => { + if (hasFocus) { const val = parseInt(text); - if (isNaN(val) || val < 0 || val > 100) { - text = Math.round(Audio.sourceVolume * 100).toString(); + if (!isNaN(val) && val >= 0 && val <= 100) { + Audio.setSourceVolume(val / 100); } } } - StyledText { - text: "%" - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.normal - opacity: Audio.sourceMuted ? 0.5 : 1 + onEditingFinished: { + const val = parseInt(text); + if (isNaN(val) || val < 0 || val > 100) { + text = Math.round(Audio.sourceVolume * 100).toString(); + } } + } + + StyledText { + text: "%" + color: Colours.palette.m3outline + font.pointSize: Appearance.font.size.normal + opacity: Audio.sourceMuted ? 0.5 : 1 + } - StyledRect { - implicitWidth: implicitHeight - implicitHeight: muteInputIcon.implicitHeight + Appearance.padding.normal * 2 + StyledRect { + implicitWidth: implicitHeight + implicitHeight: muteInputIcon.implicitHeight + Appearance.padding.normal * 2 - radius: Appearance.rounding.normal - color: Audio.sourceMuted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + radius: Appearance.rounding.normal + color: Audio.sourceMuted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer - StateLayer { - function onClicked(): void { - if (Audio.source?.audio) { - Audio.source.audio.muted = !Audio.source.audio.muted; - } + StateLayer { + function onClicked(): void { + if (Audio.source?.audio) { + Audio.source.audio.muted = !Audio.source.audio.muted; } } + } - MaterialIcon { - id: muteInputIcon + MaterialIcon { + id: muteInputIcon - anchors.centerIn: parent - text: "mic_off" - color: Audio.sourceMuted ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer - } + anchors.centerIn: parent + text: "mic_off" + color: Audio.sourceMuted ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer } } + } - StyledSlider { - id: inputVolumeSlider - Layout.fillWidth: true - implicitHeight: Appearance.padding.normal * 3 - - value: Audio.sourceVolume - enabled: !Audio.sourceMuted - opacity: enabled ? 1 : 0.5 - onMoved: { - Audio.setSourceVolume(value); - if (!inputVolumeInput.hasFocus) { - inputVolumeInput.text = Math.round(value * 100).toString(); - } + StyledSlider { + id: inputVolumeSlider + Layout.fillWidth: true + implicitHeight: Appearance.padding.normal * 3 + + value: Audio.sourceVolume + enabled: !Audio.sourceMuted + opacity: enabled ? 1 : 0.5 + onMoved: { + Audio.setSourceVolume(value); + if (!inputVolumeInput.hasFocus) { + inputVolumeInput.text = Math.round(value * 100).toString(); } } } } + } - SectionHeader { - title: qsTr("Applications") - description: qsTr("Control volume for individual applications") - } + SectionHeader { + title: qsTr("Applications") + description: qsTr("Control volume for individual applications") + } + + SectionContainer { + contentSpacing: Appearance.spacing.normal - SectionContainer { - contentSpacing: Appearance.spacing.normal + ColumnLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small - ColumnLayout { + Repeater { + model: Audio.streams Layout.fillWidth: true - spacing: Appearance.spacing.small - Repeater { - model: Audio.streams - Layout.fillWidth: true + delegate: ColumnLayout { + required property var modelData + required property int index - delegate: ColumnLayout { - required property var modelData - required property int index + Layout.fillWidth: true + spacing: Appearance.spacing.smaller + RowLayout { Layout.fillWidth: true - spacing: Appearance.spacing.smaller + spacing: Appearance.spacing.normal - RowLayout { + MaterialIcon { + text: "apps" + font.pointSize: Appearance.font.size.normal + fill: 0 + } + + StyledText { Layout.fillWidth: true - spacing: Appearance.spacing.normal + elide: Text.ElideRight + maximumLineCount: 1 + text: Audio.getStreamName(modelData) + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } - MaterialIcon { - text: "apps" - font.pointSize: Appearance.font.size.normal - fill: 0 + StyledInputField { + id: streamVolumeInput + Layout.preferredWidth: 70 + validator: IntValidator { + bottom: 0 + top: 100 } + enabled: !Audio.getStreamMuted(modelData) - StyledText { - Layout.fillWidth: true - elide: Text.ElideRight - maximumLineCount: 1 - text: Audio.getStreamName(modelData) - font.pointSize: Appearance.font.size.normal - font.weight: 500 + Component.onCompleted: { + text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); } - StyledInputField { - id: streamVolumeInput - Layout.preferredWidth: 70 - validator: IntValidator { bottom: 0; top: 100 } - enabled: !Audio.getStreamMuted(modelData) - - Component.onCompleted: { - text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); - } - - Connections { - target: modelData - function onAudioChanged() { - if (!streamVolumeInput.hasFocus && modelData?.audio) { - streamVolumeInput.text = Math.round(modelData.audio.volume * 100).toString(); - } - } - } - - onTextEdited: (text) => { - if (hasFocus) { - const val = parseInt(text); - if (!isNaN(val) && val >= 0 && val <= 100) { - Audio.setStreamVolume(modelData, val / 100); - } + Connections { + target: modelData + function onAudioChanged() { + if (!streamVolumeInput.hasFocus && modelData?.audio) { + streamVolumeInput.text = Math.round(modelData.audio.volume * 100).toString(); } } - - onEditingFinished: { + } + + onTextEdited: text => { + if (hasFocus) { const val = parseInt(text); - if (isNaN(val) || val < 0 || val > 100) { - text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); + if (!isNaN(val) && val >= 0 && val <= 100) { + Audio.setStreamVolume(modelData, val / 100); } } } - StyledText { - text: "%" - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.normal - opacity: Audio.getStreamMuted(modelData) ? 0.5 : 1 + onEditingFinished: { + const val = parseInt(text); + if (isNaN(val) || val < 0 || val > 100) { + text = Math.round(Audio.getStreamVolume(modelData) * 100).toString(); + } } + } - StyledRect { - implicitWidth: implicitHeight - implicitHeight: streamMuteIcon.implicitHeight + Appearance.padding.normal * 2 + StyledText { + text: "%" + color: Colours.palette.m3outline + font.pointSize: Appearance.font.size.normal + opacity: Audio.getStreamMuted(modelData) ? 0.5 : 1 + } - radius: Appearance.rounding.normal - color: Audio.getStreamMuted(modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + StyledRect { + implicitWidth: implicitHeight + implicitHeight: streamMuteIcon.implicitHeight + Appearance.padding.normal * 2 - StateLayer { - function onClicked(): void { - Audio.setStreamMuted(modelData, !Audio.getStreamMuted(modelData)); - } + radius: Appearance.rounding.normal + color: Audio.getStreamMuted(modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + + StateLayer { + function onClicked(): void { + Audio.setStreamMuted(modelData, !Audio.getStreamMuted(modelData)); } + } - MaterialIcon { - id: streamMuteIcon + MaterialIcon { + id: streamMuteIcon - anchors.centerIn: parent - text: Audio.getStreamMuted(modelData) ? "volume_off" : "volume_up" - color: Audio.getStreamMuted(modelData) ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer - } + anchors.centerIn: parent + text: Audio.getStreamMuted(modelData) ? "volume_off" : "volume_up" + color: Audio.getStreamMuted(modelData) ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer } } + } - StyledSlider { - Layout.fillWidth: true - implicitHeight: Appearance.padding.normal * 3 - - value: Audio.getStreamVolume(modelData) - enabled: !Audio.getStreamMuted(modelData) - opacity: enabled ? 1 : 0.5 - onMoved: { - Audio.setStreamVolume(modelData, value); - if (!streamVolumeInput.hasFocus) { - streamVolumeInput.text = Math.round(value * 100).toString(); - } + StyledSlider { + Layout.fillWidth: true + implicitHeight: Appearance.padding.normal * 3 + + value: Audio.getStreamVolume(modelData) + enabled: !Audio.getStreamMuted(modelData) + opacity: enabled ? 1 : 0.5 + onMoved: { + Audio.setStreamVolume(modelData, value); + if (!streamVolumeInput.hasFocus) { + streamVolumeInput.text = Math.round(value * 100).toString(); } + } - Connections { - target: modelData - function onAudioChanged() { - if (modelData?.audio) { - value = modelData.audio.volume; - } + Connections { + target: modelData + function onAudioChanged() { + if (modelData?.audio) { + value = modelData.audio.volume; } } } } } + } - StyledText { - Layout.fillWidth: true - visible: Audio.streams.length === 0 - text: qsTr("No applications currently playing audio") - color: Colours.palette.m3outline - font.pointSize: Appearance.font.size.small - horizontalAlignment: Text.AlignHCenter - } + StyledText { + Layout.fillWidth: true + visible: Audio.streams.length === 0 + text: qsTr("No applications currently playing audio") + color: Colours.palette.m3outline + font.pointSize: Appearance.font.size.small + horizontalAlignment: Text.AlignHCenter } } } } } } - } \ No newline at end of file + } +} diff --git a/modules/controlcenter/bluetooth/BtPane.qml b/modules/controlcenter/bluetooth/BtPane.qml index a987e75..7d3b9ca 100644 --- a/modules/controlcenter/bluetooth/BtPane.qml +++ b/modules/controlcenter/bluetooth/BtPane.qml @@ -19,7 +19,7 @@ SplitPaneWithDetails { anchors.fill: parent activeItem: session.bt.active - paneIdGenerator: function(item) { + paneIdGenerator: function (item) { return item ? (item.address || "") : ""; } diff --git a/modules/controlcenter/components/DeviceDetails.qml b/modules/controlcenter/components/DeviceDetails.qml index 8cc9177..a5d0647 100644 --- a/modules/controlcenter/components/DeviceDetails.qml +++ b/modules/controlcenter/components/DeviceDetails.qml @@ -14,10 +14,10 @@ Item { property Session session property var device: null - + property Component headerComponent: null property list sections: [] - + property Component topContent: null property Component bottomContent: null @@ -34,7 +34,7 @@ Item { Loader { id: headerLoader - + Layout.fillWidth: true sourceComponent: root.headerComponent visible: root.headerComponent !== null @@ -42,7 +42,7 @@ Item { Loader { id: topContentLoader - + Layout.fillWidth: true sourceComponent: root.topContent visible: root.topContent !== null @@ -50,10 +50,10 @@ Item { Repeater { model: root.sections - + Loader { required property Component modelData - + Layout.fillWidth: true sourceComponent: modelData } @@ -61,11 +61,10 @@ Item { Loader { id: bottomContentLoader - + Layout.fillWidth: true sourceComponent: root.bottomContent visible: root.bottomContent !== null } } } - diff --git a/modules/controlcenter/components/DeviceList.qml b/modules/controlcenter/components/DeviceList.qml index 75dd913..722f9a1 100644 --- a/modules/controlcenter/components/DeviceList.qml +++ b/modules/controlcenter/components/DeviceList.qml @@ -16,21 +16,21 @@ ColumnLayout { property Session session: null property var model: null property Component delegate: null - + property string title: "" property string description: "" property var activeItem: null property Component headerComponent: null property Component titleSuffix: null property bool showHeader: true - + signal itemSelected(var item) spacing: Appearance.spacing.small Loader { id: headerLoader - + Layout.fillWidth: true sourceComponent: root.headerComponent visible: root.headerComponent !== null && root.showHeader @@ -58,7 +58,7 @@ ColumnLayout { Layout.fillWidth: true } } - + property alias view: view StyledText { @@ -82,4 +82,3 @@ ColumnLayout { clip: false } } - diff --git a/modules/controlcenter/components/PaneTransition.qml b/modules/controlcenter/components/PaneTransition.qml index d1814b5..5d80dbe 100644 --- a/modules/controlcenter/components/PaneTransition.qml +++ b/modules/controlcenter/components/PaneTransition.qml @@ -8,12 +8,12 @@ SequentialAnimation { required property Item target property list propertyActions - + property real scaleFrom: 1.0 property real scaleTo: 0.8 property real opacityFrom: 1.0 property real opacityTo: 0.0 - + ParallelAnimation { NumberAnimation { target: root.target @@ -24,7 +24,7 @@ SequentialAnimation { easing.type: Easing.BezierSpline easing.bezierCurve: Appearance.anim.curves.standardAccel } - + NumberAnimation { target: root.target property: "scale" @@ -35,7 +35,7 @@ SequentialAnimation { easing.bezierCurve: Appearance.anim.curves.standardAccel } } - + ScriptAction { script: { for (let i = 0; i < root.propertyActions.length; i++) { @@ -46,7 +46,7 @@ SequentialAnimation { } } } - + ParallelAnimation { NumberAnimation { target: root.target @@ -57,7 +57,7 @@ SequentialAnimation { easing.type: Easing.BezierSpline easing.bezierCurve: Appearance.anim.curves.standardDecel } - + NumberAnimation { target: root.target property: "scale" @@ -69,4 +69,3 @@ SequentialAnimation { } } } - diff --git a/modules/controlcenter/components/SettingsHeader.qml b/modules/controlcenter/components/SettingsHeader.qml index c1ba148..0dc190c 100644 --- a/modules/controlcenter/components/SettingsHeader.qml +++ b/modules/controlcenter/components/SettingsHeader.qml @@ -35,4 +35,3 @@ Item { } } } - diff --git a/modules/controlcenter/components/SliderInput.qml b/modules/controlcenter/components/SliderInput.qml index 7348368..11b3f70 100644 --- a/modules/controlcenter/components/SliderInput.qml +++ b/modules/controlcenter/components/SliderInput.qml @@ -21,7 +21,7 @@ ColumnLayout { property int decimals: 1 // Number of decimal places to show (default: 1) property var formatValueFunction: null // Optional custom format function property var parseValueFunction: null // Optional custom parse function - + function formatValue(val: real): string { if (formatValueFunction) { return formatValueFunction(val); @@ -34,7 +34,7 @@ ColumnLayout { // For DoubleValidator or no validator, use the decimals property return val.toFixed(root.decimals); } - + function parseValue(text: string): real { if (parseValueFunction) { return parseValueFunction(text); @@ -48,13 +48,13 @@ ColumnLayout { } return parseFloat(text); } - + signal valueModified(real newValue) property bool _initialized: false spacing: Appearance.spacing.small - + Component.onCompleted: { // Set initialized flag after a brief delay to allow component to fully load Qt.callLater(() => { @@ -80,13 +80,13 @@ ColumnLayout { id: inputField Layout.preferredWidth: 70 validator: root.validator - + Component.onCompleted: { // Initialize text without triggering valueModified signal text = root.formatValue(root.value); } - - onTextEdited: (text) => { + + onTextEdited: text => { if (hasFocus) { const val = root.parseValue(text); if (!isNaN(val)) { @@ -100,14 +100,14 @@ ColumnLayout { isValid = false; } } - + if (isValid) { root.valueModified(val); } } } } - + onEditingFinished: { const val = root.parseValue(text); let isValid = true; @@ -119,7 +119,7 @@ ColumnLayout { isValid = false; } } - + if (isNaN(val) || !isValid) { text = root.formatValue(root.value); } @@ -143,7 +143,7 @@ ColumnLayout { from: root.from to: root.to stepSize: root.stepSize - + // Use Binding to allow slider to move freely during dragging Binding { target: slider @@ -151,7 +151,7 @@ ColumnLayout { value: root.value when: !slider.pressed } - + onValueChanged: { // Update input field text in real-time as slider moves during dragging // Always update when slider value changes (during dragging or external updates) @@ -160,7 +160,7 @@ ColumnLayout { inputField.text = root.formatValue(newValue); } } - + onMoved: { const newValue = root.stepSize > 0 ? Math.round(value / root.stepSize) * root.stepSize : value; root.valueModified(newValue); @@ -169,7 +169,7 @@ ColumnLayout { } } } - + // Update input field when value changes externally (slider is already bound) onValueChanged: { // Only update if component is initialized to avoid issues during creation @@ -178,4 +178,3 @@ ColumnLayout { } } } - diff --git a/modules/controlcenter/components/SplitPaneLayout.qml b/modules/controlcenter/components/SplitPaneLayout.qml index 3609a74..89504a0 100644 --- a/modules/controlcenter/components/SplitPaneLayout.qml +++ b/modules/controlcenter/components/SplitPaneLayout.qml @@ -14,12 +14,12 @@ RowLayout { property Component leftContent: null property Component rightContent: null - + property real leftWidthRatio: 0.4 property int leftMinimumWidth: 420 property var leftLoaderProperties: ({}) property var rightLoaderProperties: ({}) - + property alias leftLoader: leftLoader property alias rightLoader: rightLoader @@ -107,4 +107,3 @@ RowLayout { } } } - diff --git a/modules/controlcenter/components/SplitPaneWithDetails.qml b/modules/controlcenter/components/SplitPaneWithDetails.qml index 5db5bdb..ce8c9d0 100644 --- a/modules/controlcenter/components/SplitPaneWithDetails.qml +++ b/modules/controlcenter/components/SplitPaneWithDetails.qml @@ -15,10 +15,12 @@ Item { required property Component leftContent required property Component rightDetailsComponent required property Component rightSettingsComponent - + property var activeItem: null - property var paneIdGenerator: function(item) { return item ? String(item) : ""; } - + property var paneIdGenerator: function (item) { + return item ? String(item) : ""; + } + property Component overlayComponent: null SplitPaneLayout { @@ -29,64 +31,63 @@ Item { leftContent: root.leftContent rightContent: Component { - Item { - id: rightPaneItem - - property var pane: root.activeItem - property string paneId: root.paneIdGenerator(pane) - property Component targetComponent: root.rightSettingsComponent - property Component nextComponent: root.rightSettingsComponent - - function getComponentForPane() { - return pane ? root.rightDetailsComponent : root.rightSettingsComponent; - } + Item { + id: rightPaneItem - Component.onCompleted: { - targetComponent = getComponentForPane(); - nextComponent = targetComponent; - } + property var pane: root.activeItem + property string paneId: root.paneIdGenerator(pane) + property Component targetComponent: root.rightSettingsComponent + property Component nextComponent: root.rightSettingsComponent - Loader { - id: rightLoader + function getComponentForPane() { + return pane ? root.rightDetailsComponent : root.rightSettingsComponent; + } - anchors.fill: parent + Component.onCompleted: { + targetComponent = getComponentForPane(); + nextComponent = targetComponent; + } - opacity: 1 - scale: 1 - transformOrigin: Item.Center + Loader { + id: rightLoader - clip: false - sourceComponent: rightPaneItem.targetComponent - } + anchors.fill: parent - Behavior on paneId { - PaneTransition { - target: rightLoader - propertyActions: [ - PropertyAction { - target: rightPaneItem - property: "targetComponent" - value: rightPaneItem.nextComponent - } - ] + opacity: 1 + scale: 1 + transformOrigin: Item.Center + + clip: false + sourceComponent: rightPaneItem.targetComponent + } + + Behavior on paneId { + PaneTransition { + target: rightLoader + propertyActions: [ + PropertyAction { + target: rightPaneItem + property: "targetComponent" + value: rightPaneItem.nextComponent + } + ] + } } - } - onPaneChanged: { - nextComponent = getComponentForPane(); - paneId = root.paneIdGenerator(pane); + onPaneChanged: { + nextComponent = getComponentForPane(); + paneId = root.paneIdGenerator(pane); + } } } - } } Loader { id: overlayLoader - + anchors.fill: parent z: 1000 sourceComponent: root.overlayComponent active: root.overlayComponent !== null } } - diff --git a/modules/controlcenter/components/WallpaperGrid.qml b/modules/controlcenter/components/WallpaperGrid.qml index 5eab5b8..ed6bb40 100644 --- a/modules/controlcenter/components/WallpaperGrid.qml +++ b/modules/controlcenter/components/WallpaperGrid.qml @@ -24,7 +24,7 @@ GridView { model: Wallpapers.list clip: true - + StyledScrollBar.vertical: StyledScrollBar { flickable: root } @@ -40,189 +40,117 @@ GridView { readonly property real itemMargin: Appearance.spacing.normal / 2 readonly property real itemRadius: Appearance.rounding.normal - StateLayer { - anchors.fill: parent - anchors.leftMargin: itemMargin - anchors.rightMargin: itemMargin - anchors.topMargin: itemMargin - anchors.bottomMargin: itemMargin - radius: itemRadius - - function onClicked(): void { - Wallpapers.setWallpaper(modelData.path); - } - } + StateLayer { + anchors.fill: parent + anchors.leftMargin: itemMargin + anchors.rightMargin: itemMargin + anchors.topMargin: itemMargin + anchors.bottomMargin: itemMargin + radius: itemRadius - StyledClippingRect { - id: image - - anchors.fill: parent - anchors.leftMargin: itemMargin - anchors.rightMargin: itemMargin - anchors.topMargin: itemMargin - anchors.bottomMargin: itemMargin - color: Colours.tPalette.m3surfaceContainer - radius: itemRadius - antialiasing: true - layer.enabled: true - layer.smooth: true - - CachingImage { - id: cachingImage - - path: modelData.path - anchors.fill: parent - fillMode: Image.PreserveAspectCrop - cache: true - visible: opacity > 0 - antialiasing: true - smooth: true - sourceSize: Qt.size(width, height) - - opacity: status === Image.Ready ? 1 : 0 - - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutQuad - } - } - } + function onClicked(): void { + Wallpapers.setWallpaper(modelData.path); + } + } - // Fallback if CachingImage fails to load - Image { - id: fallbackImage - - anchors.fill: parent - source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? modelData.path : "" - asynchronous: true - fillMode: Image.PreserveAspectCrop - cache: true - visible: opacity > 0 - antialiasing: true - smooth: true - sourceSize: Qt.size(width, height) - - opacity: status === Image.Ready && cachingImage.status !== Image.Ready ? 1 : 0 - - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutQuad - } - } - } + StyledClippingRect { + id: image - Timer { - id: fallbackTimer + anchors.fill: parent + anchors.leftMargin: itemMargin + anchors.rightMargin: itemMargin + anchors.topMargin: itemMargin + anchors.bottomMargin: itemMargin + color: Colours.tPalette.m3surfaceContainer + radius: itemRadius + antialiasing: true + layer.enabled: true + layer.smooth: true - property bool triggered: false - interval: 800 - running: cachingImage.status === Image.Loading || cachingImage.status === Image.Null - onTriggered: triggered = true - } + CachingImage { + id: cachingImage - // Gradient overlay for filename - Rectangle { - id: filenameOverlay - - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - - implicitHeight: filenameText.implicitHeight + Appearance.padding.normal * 1.5 - radius: 0 - - gradient: Gradient { - GradientStop { - position: 0.0 - color: Qt.rgba(Colours.palette.m3surface.r, - Colours.palette.m3surface.g, - Colours.palette.m3surface.b, 0) - } - GradientStop { - position: 0.3 - color: Qt.rgba(Colours.palette.m3surface.r, - Colours.palette.m3surface.g, - Colours.palette.m3surface.b, 0.7) - } - GradientStop { - position: 0.6 - color: Qt.rgba(Colours.palette.m3surface.r, - Colours.palette.m3surface.g, - Colours.palette.m3surface.b, 0.9) - } - GradientStop { - position: 1.0 - color: Qt.rgba(Colours.palette.m3surface.r, - Colours.palette.m3surface.g, - Colours.palette.m3surface.b, 0.95) - } - } - - opacity: 0 + path: modelData.path + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + cache: true + visible: opacity > 0 + antialiasing: true + smooth: true + sourceSize: Qt.size(width, height) - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutCubic - } - } + opacity: status === Image.Ready ? 1 : 0 - Component.onCompleted: { - opacity = 1; + Behavior on opacity { + NumberAnimation { + duration: 1000 + easing.type: Easing.OutQuad } } } - Rectangle { + // Fallback if CachingImage fails to load + Image { + id: fallbackImage + anchors.fill: parent - anchors.leftMargin: itemMargin - anchors.rightMargin: itemMargin - anchors.topMargin: itemMargin - anchors.bottomMargin: itemMargin - color: "transparent" - radius: itemRadius + border.width - border.width: isCurrent ? 2 : 0 - border.color: Colours.palette.m3primary + source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? modelData.path : "" + asynchronous: true + fillMode: Image.PreserveAspectCrop + cache: true + visible: opacity > 0 antialiasing: true smooth: true + sourceSize: Qt.size(width, height) + + opacity: status === Image.Ready && cachingImage.status !== Image.Ready ? 1 : 0 - Behavior on border.width { + Behavior on opacity { NumberAnimation { - duration: 150 + duration: 1000 easing.type: Easing.OutQuad } } + } - MaterialIcon { - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: Appearance.padding.small + Timer { + id: fallbackTimer - visible: isCurrent - text: "check_circle" - color: Colours.palette.m3primary - font.pointSize: Appearance.font.size.large - } + property bool triggered: false + interval: 800 + running: cachingImage.status === Image.Loading || cachingImage.status === Image.Null + onTriggered: triggered = true } - StyledText { - id: filenameText + // Gradient overlay for filename + Rectangle { + id: filenameOverlay + anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.leftMargin: Appearance.padding.normal + Appearance.spacing.normal / 2 - anchors.rightMargin: Appearance.padding.normal + Appearance.spacing.normal / 2 - anchors.bottomMargin: Appearance.padding.normal - - text: modelData.name - font.pointSize: Appearance.font.size.smaller - font.weight: 500 - color: isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface - elide: Text.ElideMiddle - maximumLineCount: 1 - horizontalAlignment: Text.AlignHCenter + + implicitHeight: filenameText.implicitHeight + Appearance.padding.normal * 1.5 + radius: 0 + + gradient: Gradient { + GradientStop { + position: 0.0 + color: Qt.rgba(Colours.palette.m3surface.r, Colours.palette.m3surface.g, Colours.palette.m3surface.b, 0) + } + GradientStop { + position: 0.3 + color: Qt.rgba(Colours.palette.m3surface.r, Colours.palette.m3surface.g, Colours.palette.m3surface.b, 0.7) + } + GradientStop { + position: 0.6 + color: Qt.rgba(Colours.palette.m3surface.r, Colours.palette.m3surface.g, Colours.palette.m3surface.b, 0.9) + } + GradientStop { + position: 1.0 + color: Qt.rgba(Colours.palette.m3surface.r, Colours.palette.m3surface.g, Colours.palette.m3surface.b, 0.95) + } + } opacity: 0 @@ -238,4 +166,68 @@ GridView { } } } + + Rectangle { + anchors.fill: parent + anchors.leftMargin: itemMargin + anchors.rightMargin: itemMargin + anchors.topMargin: itemMargin + anchors.bottomMargin: itemMargin + color: "transparent" + radius: itemRadius + border.width + border.width: isCurrent ? 2 : 0 + border.color: Colours.palette.m3primary + antialiasing: true + smooth: true + + Behavior on border.width { + NumberAnimation { + duration: 150 + easing.type: Easing.OutQuad + } + } + + MaterialIcon { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: Appearance.padding.small + + visible: isCurrent + text: "check_circle" + color: Colours.palette.m3primary + font.pointSize: Appearance.font.size.large + } + } + + StyledText { + id: filenameText + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.leftMargin: Appearance.padding.normal + Appearance.spacing.normal / 2 + anchors.rightMargin: Appearance.padding.normal + Appearance.spacing.normal / 2 + anchors.bottomMargin: Appearance.padding.normal + + text: modelData.name + font.pointSize: Appearance.font.size.smaller + font.weight: 500 + color: isCurrent ? Colours.palette.m3primary : Colours.palette.m3onSurface + elide: Text.ElideMiddle + maximumLineCount: 1 + horizontalAlignment: Text.AlignHCenter + + opacity: 0 + + Behavior on opacity { + NumberAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } + } + + Component.onCompleted: { + opacity = 1; + } + } } +} diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml index fabe75e..0dd464f 100644 --- a/modules/controlcenter/launcher/LauncherPane.qml +++ b/modules/controlcenter/launcher/LauncherPane.qml @@ -79,7 +79,6 @@ Item { Config.save(); } - AppDb { id: allAppsDb @@ -118,9 +117,7 @@ Item { scoreFn: r => r[0].score }); - return results - .sort((a, b) => b._score - a._score) - .map(r => r.obj._item); + return results.sort((a, b) => b._score - a._score).map(r => r.obj._item); } property list filteredApps: [] @@ -156,214 +153,214 @@ Item { spacing: Appearance.spacing.small RowLayout { - spacing: Appearance.spacing.smaller + spacing: Appearance.spacing.smaller - StyledText { - text: qsTr("Launcher") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } + StyledText { + text: qsTr("Launcher") + font.pointSize: Appearance.font.size.large + font.weight: 500 + } - Item { - Layout.fillWidth: true - } + Item { + Layout.fillWidth: true + } - ToggleButton { - toggled: !root.session.launcher.active - icon: "settings" - accent: "Primary" - iconSize: Appearance.font.size.normal - horizontalPadding: Appearance.padding.normal - verticalPadding: Appearance.padding.smaller - tooltip: qsTr("Launcher settings") - - onClicked: { - if (root.session.launcher.active) { - root.session.launcher.active = null; - } else { - if (root.filteredApps.length > 0) { - root.session.launcher.active = root.filteredApps[0]; + ToggleButton { + toggled: !root.session.launcher.active + icon: "settings" + accent: "Primary" + iconSize: Appearance.font.size.normal + horizontalPadding: Appearance.padding.normal + verticalPadding: Appearance.padding.smaller + tooltip: qsTr("Launcher settings") + + onClicked: { + if (root.session.launcher.active) { + root.session.launcher.active = null; + } else { + if (root.filteredApps.length > 0) { + root.session.launcher.active = root.filteredApps[0]; + } } } } } - } - StyledText { - Layout.topMargin: Appearance.spacing.large - text: qsTr("Applications (%1)").arg(root.searchText ? root.filteredApps.length : allAppsDb.apps.length) - font.pointSize: Appearance.font.size.normal - font.weight: 500 - } + StyledText { + Layout.topMargin: Appearance.spacing.large + text: qsTr("Applications (%1)").arg(root.searchText ? root.filteredApps.length : allAppsDb.apps.length) + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } - StyledText { - text: qsTr("All applications available in the launcher") - color: Colours.palette.m3outline - } + StyledText { + text: qsTr("All applications available in the launcher") + color: Colours.palette.m3outline + } - StyledRect { - Layout.fillWidth: true - Layout.topMargin: Appearance.spacing.normal - Layout.bottomMargin: Appearance.spacing.small + StyledRect { + Layout.fillWidth: true + Layout.topMargin: Appearance.spacing.normal + Layout.bottomMargin: Appearance.spacing.small - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - radius: Appearance.rounding.full + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) + radius: Appearance.rounding.full - implicitHeight: Math.max(searchIcon.implicitHeight, searchField.implicitHeight, clearIcon.implicitHeight) + implicitHeight: Math.max(searchIcon.implicitHeight, searchField.implicitHeight, clearIcon.implicitHeight) - MaterialIcon { - id: searchIcon + MaterialIcon { + id: searchIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Appearance.padding.normal + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: Appearance.padding.normal - text: "search" - color: Colours.palette.m3onSurfaceVariant - } + text: "search" + color: Colours.palette.m3onSurfaceVariant + } - StyledTextField { - id: searchField + StyledTextField { + id: searchField - anchors.left: searchIcon.right - anchors.right: clearIcon.left - anchors.leftMargin: Appearance.spacing.small - anchors.rightMargin: Appearance.spacing.small + anchors.left: searchIcon.right + anchors.right: clearIcon.left + anchors.leftMargin: Appearance.spacing.small + anchors.rightMargin: Appearance.spacing.small - topPadding: Appearance.padding.normal - bottomPadding: Appearance.padding.normal + topPadding: Appearance.padding.normal + bottomPadding: Appearance.padding.normal - placeholderText: qsTr("Search applications...") + placeholderText: qsTr("Search applications...") - onTextChanged: { - root.searchText = text; + onTextChanged: { + root.searchText = text; + } } - } - MaterialIcon { - id: clearIcon - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Appearance.padding.normal - - width: searchField.text ? implicitWidth : implicitWidth / 2 - opacity: { - if (!searchField.text) - return 0; - if (clearMouse.pressed) - return 0.7; - if (clearMouse.containsMouse) - return 0.8; - return 1; - } + MaterialIcon { + id: clearIcon - text: "close" - color: Colours.palette.m3onSurfaceVariant + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Appearance.padding.normal + + width: searchField.text ? implicitWidth : implicitWidth / 2 + opacity: { + if (!searchField.text) + return 0; + if (clearMouse.pressed) + return 0.7; + if (clearMouse.containsMouse) + return 0.8; + return 1; + } - MouseArea { - id: clearMouse + text: "close" + color: Colours.palette.m3onSurfaceVariant - anchors.fill: parent - hoverEnabled: true - cursorShape: searchField.text ? Qt.PointingHandCursor : undefined + MouseArea { + id: clearMouse - onClicked: searchField.text = "" - } + anchors.fill: parent + hoverEnabled: true + cursorShape: searchField.text ? Qt.PointingHandCursor : undefined - Behavior on width { - Anim { - duration: Appearance.anim.durations.small + onClicked: searchField.text = "" } - } - Behavior on opacity { - Anim { - duration: Appearance.anim.durations.small + Behavior on width { + Anim { + duration: Appearance.anim.durations.small + } + } + + Behavior on opacity { + Anim { + duration: Appearance.anim.durations.small + } } } } - } - Loader { - id: appsListLoader - Layout.fillWidth: true - Layout.fillHeight: true - active: true - - sourceComponent: StyledListView { - id: appsListView - + Loader { + id: appsListLoader Layout.fillWidth: true Layout.fillHeight: true + active: true - model: root.filteredApps - spacing: Appearance.spacing.small / 2 - clip: true + sourceComponent: StyledListView { + id: appsListView - StyledScrollBar.vertical: StyledScrollBar { - flickable: parent - } + Layout.fillWidth: true + Layout.fillHeight: true - delegate: StyledRect { - required property var modelData + model: root.filteredApps + spacing: Appearance.spacing.small / 2 + clip: true - width: parent ? parent.width : 0 + StyledScrollBar.vertical: StyledScrollBar { + flickable: parent + } - readonly property bool isSelected: root.selectedApp === modelData + delegate: StyledRect { + required property var modelData - color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" - radius: Appearance.rounding.normal + width: parent ? parent.width : 0 - opacity: 0 + readonly property bool isSelected: root.selectedApp === modelData - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutCubic + color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + radius: Appearance.rounding.normal + + opacity: 0 + + Behavior on opacity { + NumberAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } } - } - Component.onCompleted: { - opacity = 1; - } + Component.onCompleted: { + opacity = 1; + } - StateLayer { - function onClicked(): void { - root.session.launcher.active = modelData; + StateLayer { + function onClicked(): void { + root.session.launcher.active = modelData; + } } - } - RowLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Appearance.padding.normal - spacing: Appearance.spacing.normal + spacing: Appearance.spacing.normal - IconImage { - Layout.alignment: Qt.AlignVCenter - implicitSize: 32 - source: { - const entry = modelData.entry; - return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; + IconImage { + Layout.alignment: Qt.AlignVCenter + implicitSize: 32 + source: { + const entry = modelData.entry; + return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; + } } - } - StyledText { - Layout.fillWidth: true - text: modelData.name || modelData.entry?.name || qsTr("Unknown") - font.pointSize: Appearance.font.size.normal + StyledText { + Layout.fillWidth: true + text: modelData.name || modelData.entry?.name || qsTr("Unknown") + font.pointSize: Appearance.font.size.normal + } } - } - implicitHeight: 40 + implicitHeight: 40 + } } } } } - } rightContent: Component { Item { @@ -518,7 +515,8 @@ Item { implicitSize: Appearance.font.size.extraLarge * 3 * 2 source: { const app = appDetailsLayout.displayedApp; - if (!app) return "image-missing"; + if (!app) + return "image-missing"; const entry = app.entry; if (entry && entry.icon) { return Quickshell.iconPath(entry.icon, "image-missing"); @@ -561,35 +559,34 @@ Item { anchors.top: parent.top spacing: Appearance.spacing.normal - SwitchRow { - Layout.topMargin: Appearance.spacing.normal - visible: appDetailsLayout.displayedApp !== null - label: qsTr("Hide from launcher") - checked: root.hideFromLauncherChecked - enabled: appDetailsLayout.displayedApp !== null - onToggled: checked => { - root.hideFromLauncherChecked = checked; - const app = appDetailsLayout.displayedApp; - if (app) { - const appId = app.id || app.entry?.id; - const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; - if (checked) { - if (!hiddenApps.includes(appId)) { - hiddenApps.push(appId); - } - } else { - const index = hiddenApps.indexOf(appId); - if (index !== -1) { - hiddenApps.splice(index, 1); + SwitchRow { + Layout.topMargin: Appearance.spacing.normal + visible: appDetailsLayout.displayedApp !== null + label: qsTr("Hide from launcher") + checked: root.hideFromLauncherChecked + enabled: appDetailsLayout.displayedApp !== null + onToggled: checked => { + root.hideFromLauncherChecked = checked; + const app = appDetailsLayout.displayedApp; + if (app) { + const appId = app.id || app.entry?.id; + const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; + if (checked) { + if (!hiddenApps.includes(appId)) { + hiddenApps.push(appId); + } + } else { + const index = hiddenApps.indexOf(appId); + if (index !== -1) { + hiddenApps.splice(index, 1); + } } + Config.launcher.hiddenApps = hiddenApps; + Config.save(); } - Config.launcher.hiddenApps = hiddenApps; - Config.save(); } } } - - } } } } diff --git a/modules/controlcenter/launcher/Settings.qml b/modules/controlcenter/launcher/Settings.qml index 161221e..5eaf6e0 100644 --- a/modules/controlcenter/launcher/Settings.qml +++ b/modules/controlcenter/launcher/Settings.qml @@ -215,4 +215,3 @@ ColumnLayout { } } } - diff --git a/modules/controlcenter/network/EthernetDetails.qml b/modules/controlcenter/network/EthernetDetails.qml index 1cd6c0a..4e60b3d 100644 --- a/modules/controlcenter/network/EthernetDetails.qml +++ b/modules/controlcenter/network/EthernetDetails.qml @@ -16,7 +16,7 @@ DeviceDetails { required property Session session readonly property var ethernetDevice: root.session.ethernet.active - + device: ethernetDevice Component.onCompleted: { diff --git a/modules/controlcenter/network/EthernetList.qml b/modules/controlcenter/network/EthernetList.qml index 4f4dc8a..d1eb957 100644 --- a/modules/controlcenter/network/EthernetList.qml +++ b/modules/controlcenter/network/EthernetList.qml @@ -171,7 +171,7 @@ DeviceList { } } - onItemSelected: function(item) { + onItemSelected: function (item) { session.ethernet.active = item; } } diff --git a/modules/controlcenter/network/EthernetPane.qml b/modules/controlcenter/network/EthernetPane.qml index 126535a..59d82bb 100644 --- a/modules/controlcenter/network/EthernetPane.qml +++ b/modules/controlcenter/network/EthernetPane.qml @@ -16,7 +16,7 @@ SplitPaneWithDetails { anchors.fill: parent activeItem: session.ethernet.active - paneIdGenerator: function(item) { + paneIdGenerator: function (item) { return item ? (item.interface || "") : ""; } diff --git a/modules/controlcenter/network/EthernetSettings.qml b/modules/controlcenter/network/EthernetSettings.qml index f0f66b4..90bfcf4 100644 --- a/modules/controlcenter/network/EthernetSettings.qml +++ b/modules/controlcenter/network/EthernetSettings.qml @@ -73,4 +73,4 @@ ColumnLayout { } } } -} \ No newline at end of file +} diff --git a/modules/controlcenter/network/NetworkSettings.qml b/modules/controlcenter/network/NetworkSettings.qml index 04746af..bda7cb1 100644 --- a/modules/controlcenter/network/NetworkSettings.qml +++ b/modules/controlcenter/network/NetworkSettings.qml @@ -138,30 +138,30 @@ ColumnLayout { Popup { id: vpnSettingsDialog - + parent: Overlay.overlay anchors.centerIn: parent width: Math.min(600, parent.width - Appearance.padding.large * 2) height: Math.min(700, parent.height - Appearance.padding.large * 2) - + modal: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - + background: StyledRect { color: Colours.palette.m3surface radius: Appearance.rounding.large } - + StyledFlickable { anchors.fill: parent anchors.margins: Appearance.padding.large * 1.5 flickableDirection: Flickable.VerticalFlick contentHeight: vpnSettingsContent.height clip: true - + VpnSettings { id: vpnSettingsContent - + anchors.left: parent.left anchors.right: parent.right session: root.session @@ -169,4 +169,3 @@ ColumnLayout { } } } - diff --git a/modules/controlcenter/network/NetworkingPane.qml b/modules/controlcenter/network/NetworkingPane.qml index 23e795e..26cdbfa 100644 --- a/modules/controlcenter/network/NetworkingPane.qml +++ b/modules/controlcenter/network/NetworkingPane.qml @@ -171,7 +171,7 @@ Item { rightContent: Component { Item { id: rightPaneItem - + property var vpnPane: root.session && root.session.vpn ? root.session.vpn.active : null property var ethernetPane: root.session && root.session.ethernet ? root.session.ethernet.active : null property var wirelessPane: root.session && root.session.network ? root.session.network.active : null @@ -181,9 +181,12 @@ Item { property Component nextComponent: settingsComponent function getComponentForPane() { - if (vpnPane) return vpnDetailsComponent; - if (ethernetPane) return ethernetDetailsComponent; - if (wirelessPane) return wirelessDetailsComponent; + if (vpnPane) + return vpnDetailsComponent; + if (ethernetPane) + return ethernetDetailsComponent; + if (wirelessPane) + return wirelessDetailsComponent; return settingsComponent; } @@ -195,12 +198,14 @@ Item { Connections { target: root.session && root.session.vpn ? root.session.vpn : null enabled: target !== null - + function onActiveChanged() { // Clear others when VPN is selected if (root.session && root.session.vpn && root.session.vpn.active) { - if (root.session.ethernet && root.session.ethernet.active) root.session.ethernet.active = null; - if (root.session.network && root.session.network.active) root.session.network.active = null; + if (root.session.ethernet && root.session.ethernet.active) + root.session.ethernet.active = null; + if (root.session.network && root.session.network.active) + root.session.network.active = null; } rightPaneItem.nextComponent = rightPaneItem.getComponentForPane(); } @@ -209,12 +214,14 @@ Item { Connections { target: root.session && root.session.ethernet ? root.session.ethernet : null enabled: target !== null - + function onActiveChanged() { // Clear others when ethernet is selected if (root.session && root.session.ethernet && root.session.ethernet.active) { - if (root.session.vpn && root.session.vpn.active) root.session.vpn.active = null; - if (root.session.network && root.session.network.active) root.session.network.active = null; + if (root.session.vpn && root.session.vpn.active) + root.session.vpn.active = null; + if (root.session.network && root.session.network.active) + root.session.network.active = null; } rightPaneItem.nextComponent = rightPaneItem.getComponentForPane(); } @@ -223,12 +230,14 @@ Item { Connections { target: root.session && root.session.network ? root.session.network : null enabled: target !== null - + function onActiveChanged() { // Clear others when wireless is selected if (root.session && root.session.network && root.session.network.active) { - if (root.session.vpn && root.session.vpn.active) root.session.vpn.active = null; - if (root.session.ethernet && root.session.ethernet.active) root.session.ethernet.active = null; + if (root.session.vpn && root.session.vpn.active) + root.session.vpn.active = null; + if (root.session.ethernet && root.session.ethernet.active) + root.session.ethernet.active = null; } rightPaneItem.nextComponent = rightPaneItem.getComponentForPane(); } diff --git a/modules/controlcenter/network/VpnSettings.qml b/modules/controlcenter/network/VpnSettings.qml index 7387ddc..49d801d 100644 --- a/modules/controlcenter/network/VpnSettings.qml +++ b/modules/controlcenter/network/VpnSettings.qml @@ -54,17 +54,17 @@ ColumnLayout { ListView { Layout.fillWidth: true Layout.preferredHeight: contentHeight - + interactive: false spacing: Appearance.spacing.smaller - + model: ScriptModel { values: Config.utilities.vpn.provider.map((provider, index) => { const isObject = typeof provider === "object"; const name = isObject ? (provider.name || "custom") : String(provider); const displayName = isObject ? (provider.displayName || name) : name; const iface = isObject ? (provider.interface || "") : ""; - + return { index: index, name: name, diff --git a/modules/controlcenter/network/WirelessDetails.qml b/modules/controlcenter/network/WirelessDetails.qml index 47d42c2..e8777cd 100644 --- a/modules/controlcenter/network/WirelessDetails.qml +++ b/modules/controlcenter/network/WirelessDetails.qml @@ -18,7 +18,7 @@ DeviceDetails { required property Session session readonly property var network: root.session.network.active - + device: network Component.onCompleted: { @@ -66,8 +66,7 @@ DeviceDetails { const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); if (isActive) { if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) { - Nmcli.getWirelessDeviceDetails("", () => { - }); + Nmcli.getWirelessDeviceDetails("", () => {}); } else { connectionUpdateTimer.stop(); } diff --git a/modules/controlcenter/network/WirelessList.qml b/modules/controlcenter/network/WirelessList.qml index 8159291..57a155f 100644 --- a/modules/controlcenter/network/WirelessList.qml +++ b/modules/controlcenter/network/WirelessList.qml @@ -22,7 +22,7 @@ DeviceList { title: qsTr("Networks (%1)").arg(Nmcli.networks.length) description: qsTr("All available WiFi networks") activeItem: session.network.active - + titleSuffix: Component { StyledText { visible: Nmcli.scanning @@ -165,11 +165,13 @@ DeviceList { StyledText { Layout.fillWidth: true text: { - if (modelData.active) return qsTr("Connected"); + if (modelData.active) + return qsTr("Connected"); if (modelData.isSecure && modelData.security && modelData.security.length > 0) { return modelData.security; } - if (modelData.isSecure) return qsTr("Secured"); + if (modelData.isSecure) + return qsTr("Secured"); return qsTr("Open"); } color: modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline @@ -211,7 +213,7 @@ DeviceList { } } - onItemSelected: function(item) { + onItemSelected: function (item) { session.network.active = item; if (item && item.ssid) { checkSavedProfileForNetwork(item.ssid); diff --git a/modules/controlcenter/network/WirelessPane.qml b/modules/controlcenter/network/WirelessPane.qml index 109d416..8150af9 100644 --- a/modules/controlcenter/network/WirelessPane.qml +++ b/modules/controlcenter/network/WirelessPane.qml @@ -16,7 +16,7 @@ SplitPaneWithDetails { anchors.fill: parent activeItem: session.network.active - paneIdGenerator: function(item) { + paneIdGenerator: function (item) { return item ? (item.ssid || item.bssid || "") : ""; } diff --git a/modules/controlcenter/network/WirelessPasswordDialog.qml b/modules/controlcenter/network/WirelessPasswordDialog.qml index 7c046af..7ad5204 100644 --- a/modules/controlcenter/network/WirelessPasswordDialog.qml +++ b/modules/controlcenter/network/WirelessPasswordDialog.qml @@ -384,8 +384,7 @@ Item { text = qsTr("Connecting..."); NetworkConnection.connectWithPassword(root.network, password, result => { - if (result && result.success) { - } else if (result && result.needsPassword) { + if (result && result.success) {} else if (result && result.needsPassword) { connectionMonitor.stop(); connecting = false; hasError = true; diff --git a/modules/controlcenter/network/WirelessSettings.qml b/modules/controlcenter/network/WirelessSettings.qml index f87fe39..b4eb391 100644 --- a/modules/controlcenter/network/WirelessSettings.qml +++ b/modules/controlcenter/network/WirelessSettings.qml @@ -70,4 +70,4 @@ ColumnLayout { value: Nmcli.active ? qsTr("%1 MHz").arg(Nmcli.active.frequency) : qsTr("N/A") } } -} \ No newline at end of file +} diff --git a/modules/controlcenter/state/BluetoothState.qml b/modules/controlcenter/state/BluetoothState.qml index 00497ce..8678672 100644 --- a/modules/controlcenter/state/BluetoothState.qml +++ b/modules/controlcenter/state/BluetoothState.qml @@ -10,4 +10,3 @@ QtObject { property bool fabMenuOpen: false property bool editingDeviceName: false } - diff --git a/modules/controlcenter/state/EthernetState.qml b/modules/controlcenter/state/EthernetState.qml index c5da7aa..58f5fc8 100644 --- a/modules/controlcenter/state/EthernetState.qml +++ b/modules/controlcenter/state/EthernetState.qml @@ -5,4 +5,3 @@ QtObject { property var active: null } - diff --git a/modules/controlcenter/state/LauncherState.qml b/modules/controlcenter/state/LauncherState.qml index c5da7aa..58f5fc8 100644 --- a/modules/controlcenter/state/LauncherState.qml +++ b/modules/controlcenter/state/LauncherState.qml @@ -5,4 +5,3 @@ QtObject { property var active: null } - diff --git a/modules/controlcenter/state/NetworkState.qml b/modules/controlcenter/state/NetworkState.qml index da13e65..f9324c8 100644 --- a/modules/controlcenter/state/NetworkState.qml +++ b/modules/controlcenter/state/NetworkState.qml @@ -7,4 +7,3 @@ QtObject { property bool showPasswordDialog: false property var pendingNetwork: null } - diff --git a/modules/controlcenter/taskbar/ConnectedButtonGroup.qml b/modules/controlcenter/taskbar/ConnectedButtonGroup.qml index bf3a97f..01cd612 100644 --- a/modules/controlcenter/taskbar/ConnectedButtonGroup.qml +++ b/modules/controlcenter/taskbar/ConnectedButtonGroup.qml @@ -53,9 +53,9 @@ StyledRect { Layout.fillWidth: true text: modelData.label - + property bool _checked: false - + checked: _checked toggle: false type: TextButton.Tonal @@ -65,7 +65,7 @@ StyledRect { if (root.rootItem && modelData.propertyName) { const propName = modelData.propertyName; const rootItem = root.rootItem; - _checked = Qt.binding(function() { + _checked = Qt.binding(function () { return rootItem[propName] ?? false; }); } @@ -77,7 +77,7 @@ StyledRect { // Match utilities Toggles inactive color inactiveColour: Colours.layer(Colours.palette.m3surfaceContainerHighest, 2) - + // Adjust width similar to utilities toggles Layout.preferredWidth: implicitWidth + (stateLayer.pressed ? Appearance.padding.large : internalChecked ? Appearance.padding.smaller : 0) @@ -106,4 +106,3 @@ StyledRect { } } } - diff --git a/modules/controlcenter/taskbar/TaskbarPane.qml b/modules/controlcenter/taskbar/TaskbarPane.qml index 917b73a..d12d174 100644 --- a/modules/controlcenter/taskbar/TaskbarPane.qml +++ b/modules/controlcenter/taskbar/TaskbarPane.qml @@ -183,7 +183,7 @@ Item { { label: qsTr("Speakers"), propertyName: "showAudio", - onToggled: function(checked) { + onToggled: function (checked) { root.showAudio = checked; root.saveConfig(); } @@ -191,7 +191,7 @@ Item { { label: qsTr("Microphone"), propertyName: "showMicrophone", - onToggled: function(checked) { + onToggled: function (checked) { root.showMicrophone = checked; root.saveConfig(); } @@ -199,7 +199,7 @@ Item { { label: qsTr("Keyboard"), propertyName: "showKbLayout", - onToggled: function(checked) { + onToggled: function (checked) { root.showKbLayout = checked; root.saveConfig(); } @@ -207,7 +207,7 @@ Item { { label: qsTr("Network"), propertyName: "showNetwork", - onToggled: function(checked) { + onToggled: function (checked) { root.showNetwork = checked; root.saveConfig(); } @@ -215,7 +215,7 @@ Item { { label: qsTr("Wifi"), propertyName: "showWifi", - onToggled: function(checked) { + onToggled: function (checked) { root.showWifi = checked; root.saveConfig(); } @@ -223,7 +223,7 @@ Item { { label: qsTr("Bluetooth"), propertyName: "showBluetooth", - onToggled: function(checked) { + onToggled: function (checked) { root.showBluetooth = checked; root.saveConfig(); } @@ -231,7 +231,7 @@ Item { { label: qsTr("Battery"), propertyName: "showBattery", - onToggled: function(checked) { + onToggled: function (checked) { root.showBattery = checked; root.saveConfig(); } @@ -239,7 +239,7 @@ Item { { label: qsTr("Capslock"), propertyName: "showLockStatus", - onToggled: function(checked) { + onToggled: function (checked) { root.showLockStatus = checked; root.saveConfig(); } @@ -268,173 +268,173 @@ Item { font.pointSize: Appearance.font.size.normal } - StyledRect { - Layout.fillWidth: true - implicitHeight: workspacesShownRow.implicitHeight + Appearance.padding.large * 2 - radius: Appearance.rounding.normal - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - - Behavior on implicitHeight { - Anim {} - } - - RowLayout { - id: workspacesShownRow - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal + StyledRect { + Layout.fillWidth: true + implicitHeight: workspacesShownRow.implicitHeight + Appearance.padding.large * 2 + radius: Appearance.rounding.normal + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - StyledText { - Layout.fillWidth: true - text: qsTr("Shown") + Behavior on implicitHeight { + Anim {} } - CustomSpinBox { - min: 1 - max: 20 - value: root.workspacesShown - onValueModified: value => { - root.workspacesShown = value; - root.saveConfig(); + RowLayout { + id: workspacesShownRow + 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("Shown") } - } - } - } - - StyledRect { - Layout.fillWidth: true - implicitHeight: workspacesActiveIndicatorRow.implicitHeight + Appearance.padding.large * 2 - radius: Appearance.rounding.normal - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - Behavior on implicitHeight { - Anim {} + CustomSpinBox { + min: 1 + max: 20 + value: root.workspacesShown + onValueModified: value => { + root.workspacesShown = value; + root.saveConfig(); + } + } + } } - RowLayout { - id: workspacesActiveIndicatorRow - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal + StyledRect { + Layout.fillWidth: true + implicitHeight: workspacesActiveIndicatorRow.implicitHeight + Appearance.padding.large * 2 + radius: Appearance.rounding.normal + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - StyledText { - Layout.fillWidth: true - text: qsTr("Active indicator") + Behavior on implicitHeight { + Anim {} } - StyledSwitch { - checked: root.workspacesActiveIndicator - onToggled: { - root.workspacesActiveIndicator = checked; - root.saveConfig(); + RowLayout { + id: workspacesActiveIndicatorRow + 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("Active indicator") } - } - } - } - - StyledRect { - Layout.fillWidth: true - implicitHeight: workspacesOccupiedBgRow.implicitHeight + Appearance.padding.large * 2 - radius: Appearance.rounding.normal - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - Behavior on implicitHeight { - Anim {} + StyledSwitch { + checked: root.workspacesActiveIndicator + onToggled: { + root.workspacesActiveIndicator = checked; + root.saveConfig(); + } + } + } } - RowLayout { - id: workspacesOccupiedBgRow - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal + StyledRect { + Layout.fillWidth: true + implicitHeight: workspacesOccupiedBgRow.implicitHeight + Appearance.padding.large * 2 + radius: Appearance.rounding.normal + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - StyledText { - Layout.fillWidth: true - text: qsTr("Occupied background") + Behavior on implicitHeight { + Anim {} } - StyledSwitch { - checked: root.workspacesOccupiedBg - onToggled: { - root.workspacesOccupiedBg = checked; - root.saveConfig(); + RowLayout { + id: workspacesOccupiedBgRow + 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("Occupied background") } - } - } - } - - StyledRect { - Layout.fillWidth: true - implicitHeight: workspacesShowWindowsRow.implicitHeight + Appearance.padding.large * 2 - radius: Appearance.rounding.normal - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - Behavior on implicitHeight { - Anim {} + StyledSwitch { + checked: root.workspacesOccupiedBg + onToggled: { + root.workspacesOccupiedBg = checked; + root.saveConfig(); + } + } + } } - RowLayout { - id: workspacesShowWindowsRow - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal + StyledRect { + Layout.fillWidth: true + implicitHeight: workspacesShowWindowsRow.implicitHeight + Appearance.padding.large * 2 + radius: Appearance.rounding.normal + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - StyledText { - Layout.fillWidth: true - text: qsTr("Show windows") + Behavior on implicitHeight { + Anim {} } - StyledSwitch { - checked: root.workspacesShowWindows - onToggled: { - root.workspacesShowWindows = checked; - root.saveConfig(); + RowLayout { + id: workspacesShowWindowsRow + 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("Show windows") } - } - } - } - - StyledRect { - Layout.fillWidth: true - implicitHeight: workspacesPerMonitorRow.implicitHeight + Appearance.padding.large * 2 - radius: Appearance.rounding.normal - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - Behavior on implicitHeight { - Anim {} + StyledSwitch { + checked: root.workspacesShowWindows + onToggled: { + root.workspacesShowWindows = checked; + root.saveConfig(); + } + } + } } - RowLayout { - id: workspacesPerMonitorRow - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.large - spacing: Appearance.spacing.normal + StyledRect { + Layout.fillWidth: true + implicitHeight: workspacesPerMonitorRow.implicitHeight + Appearance.padding.large * 2 + radius: Appearance.rounding.normal + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - StyledText { - Layout.fillWidth: true - text: qsTr("Per monitor workspaces") + Behavior on implicitHeight { + Anim {} } - StyledSwitch { - checked: root.workspacesPerMonitor - onToggled: { - root.workspacesPerMonitor = checked; - root.saveConfig(); + RowLayout { + id: workspacesPerMonitorRow + 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("Per monitor workspaces") + } + + StyledSwitch { + checked: root.workspacesPerMonitor + onToggled: { + root.workspacesPerMonitor = checked; + root.saveConfig(); + } } } } } - } SectionContainer { Layout.fillWidth: true @@ -452,7 +452,7 @@ Item { { label: qsTr("Workspaces"), propertyName: "scrollWorkspaces", - onToggled: function(checked) { + onToggled: function (checked) { root.scrollWorkspaces = checked; root.saveConfig(); } @@ -460,7 +460,7 @@ Item { { label: qsTr("Volume"), propertyName: "scrollVolume", - onToggled: function(checked) { + onToggled: function (checked) { root.scrollVolume = checked; root.saveConfig(); } @@ -468,7 +468,7 @@ Item { { label: qsTr("Brightness"), propertyName: "scrollBrightness", - onToggled: function(checked) { + onToggled: function (checked) { root.scrollBrightness = checked; root.saveConfig(); } @@ -541,11 +541,14 @@ Item { from: 0 to: 100 suffix: "px" - validator: IntValidator { bottom: 0; top: 100 } - formatValueFunction: (val) => Math.round(val).toString() - parseValueFunction: (text) => parseInt(text) + validator: IntValidator { + bottom: 0 + top: 100 + } + formatValueFunction: val => Math.round(val).toString() + parseValueFunction: text => parseInt(text) - onValueModified: (newValue) => { + onValueModified: newValue => { root.dragThreshold = Math.round(newValue); root.saveConfig(); } @@ -613,7 +616,7 @@ Item { { label: qsTr("Background"), propertyName: "trayBackground", - onToggled: function(checked) { + onToggled: function (checked) { root.trayBackground = checked; root.saveConfig(); } @@ -621,7 +624,7 @@ Item { { label: qsTr("Compact"), propertyName: "trayCompact", - onToggled: function(checked) { + onToggled: function (checked) { root.trayCompact = checked; root.saveConfig(); } @@ -629,7 +632,7 @@ Item { { label: qsTr("Recolour"), propertyName: "trayRecolour", - onToggled: function(checked) { + onToggled: function (checked) { root.trayRecolour = checked; root.saveConfig(); } @@ -639,7 +642,6 @@ Item { } } } - } } } diff --git a/modules/dashboard/Content.qml b/modules/dashboard/Content.qml index 4eec97a..1cc960a 100644 --- a/modules/dashboard/Content.qml +++ b/modules/dashboard/Content.qml @@ -142,7 +142,8 @@ Item { Component.onCompleted: active = Qt.binding(() => { // Always keep current tab loaded - if (pane.index === view.currentIndex) return true; + if (pane.index === view.currentIndex) + return true; const vx = Math.floor(view.visibleArea.xPosition * view.contentWidth); const vex = Math.floor(vx + view.visibleArea.widthRatio * view.contentWidth); return (vx >= x && vx <= x + implicitWidth) || (vex >= x && vex <= x + implicitWidth); diff --git a/modules/utilities/cards/Toggles.qml b/modules/utilities/cards/Toggles.qml index 3cb61e6..5b57528 100644 --- a/modules/utilities/cards/Toggles.qml +++ b/modules/utilities/cards/Toggles.qml @@ -91,7 +91,6 @@ StyledRect { visible: Config.utilities.vpn.provider.some(p => typeof p === "object" ? (p.enabled === true) : false) onClicked: VPN.toggle() } - } } diff --git a/services/Audio.qml b/services/Audio.qml index 20d9cc8..908d156 100644 --- a/services/Audio.qml +++ b/services/Audio.qml @@ -106,7 +106,8 @@ Singleton { } function getStreamName(stream: PwNode): string { - if (!stream) return qsTr("Unknown"); + if (!stream) + return qsTr("Unknown"); // Try application name first, then description, then name return stream.applicationName || stream.description || stream.name || qsTr("Unknown Application"); } diff --git a/services/Network.qml b/services/Network.qml index fc16915..f3dfc3e 100644 --- a/services/Network.qml +++ b/services/Network.qml @@ -19,7 +19,7 @@ Singleton { root.savedConnectionSsids = Nmcli.savedConnectionSsids; }); // Get initial WiFi status - Nmcli.getWifiStatus((enabled) => { + Nmcli.getWifiStatus(enabled => { root.wifiEnabled = enabled; }); // Sync networks from Nmcli on startup @@ -41,7 +41,7 @@ Singleton { property var wirelessDeviceDetails: null function enableWifi(enabled: bool): void { - Nmcli.enableWifi(enabled, (result) => { + Nmcli.enableWifi(enabled, result => { if (result.success) { root.getWifiStatus(); Nmcli.getNetworks(() => { @@ -52,7 +52,7 @@ Singleton { } function toggleWifi(): void { - Nmcli.toggleWifi((result) => { + Nmcli.toggleWifi(result => { if (result.success) { root.getWifiStatus(); Nmcli.getNetworks(() => { @@ -73,23 +73,30 @@ Singleton { // Set up pending connection tracking if callback provided if (callback) { const hasBssid = bssid !== undefined && bssid !== null && bssid.length > 0; - root.pendingConnection = { ssid: ssid, bssid: hasBssid ? bssid : "", callback: callback }; + root.pendingConnection = { + ssid: ssid, + bssid: hasBssid ? bssid : "", + callback: callback + }; } - - Nmcli.connectToNetwork(ssid, password, bssid, (result) => { + + Nmcli.connectToNetwork(ssid, password, bssid, result => { if (result && result.success) { // Connection successful - if (callback) callback(result); + if (callback) + callback(result); root.pendingConnection = null; } else if (result && result.needsPassword) { // Password needed - callback will handle showing dialog - if (callback) callback(result); + if (callback) + callback(result); } else { // Connection failed if (result && result.error) { root.connectionFailed(ssid); } - if (callback) callback(result); + if (callback) + callback(result); root.pendingConnection = null; } }); @@ -98,22 +105,29 @@ Singleton { function connectToNetworkWithPasswordCheck(ssid: string, isSecure: bool, callback: var, bssid: string): void { // Set up pending connection tracking const hasBssid = bssid !== undefined && bssid !== null && bssid.length > 0; - root.pendingConnection = { ssid: ssid, bssid: hasBssid ? bssid : "", callback: callback }; - - Nmcli.connectToNetworkWithPasswordCheck(ssid, isSecure, (result) => { + root.pendingConnection = { + ssid: ssid, + bssid: hasBssid ? bssid : "", + callback: callback + }; + + Nmcli.connectToNetworkWithPasswordCheck(ssid, isSecure, result => { if (result && result.success) { // Connection successful - if (callback) callback(result); + if (callback) + callback(result); root.pendingConnection = null; } else if (result && result.needsPassword) { // Password needed - callback will handle showing dialog - if (callback) callback(result); + if (callback) + callback(result); } else { // Connection failed if (result && result.error) { root.connectionFailed(ssid); } - if (callback) callback(result); + if (callback) + callback(result); root.pendingConnection = null; } }, bssid); @@ -133,7 +147,7 @@ Singleton { function forgetNetwork(ssid: string): void { // Delete the connection profile for this network // This will remove the saved password and connection settings - Nmcli.forgetNetwork(ssid, (result) => { + Nmcli.forgetNetwork(ssid, result => { if (result.success) { // Refresh network list after deletion Qt.callLater(() => { @@ -145,7 +159,6 @@ Singleton { }); } - property list savedConnections: [] property list savedConnectionSsids: [] @@ -163,21 +176,21 @@ Singleton { function syncNetworksFromNmcli(): void { const rNetworks = root.networks; const nNetworks = Nmcli.networks; - + // Build a map of existing networks by key const existingMap = new Map(); for (const rn of rNetworks) { const key = `${rn.frequency}:${rn.ssid}:${rn.bssid}`; existingMap.set(key, rn); } - + // Build a map of new networks by key const newMap = new Map(); for (const nn of nNetworks) { const key = `${nn.frequency}:${nn.ssid}:${nn.bssid}`; newMap.set(key, nn); } - + // Remove networks that no longer exist for (const [key, network] of existingMap) { if (!newMap.has(key)) { @@ -188,7 +201,7 @@ Singleton { } } } - + // Add or update networks from Nmcli for (const [key, nNetwork] of newMap) { const existing = existingMap.get(key); @@ -226,28 +239,29 @@ Singleton { } function getWifiStatus(): void { - Nmcli.getWifiStatus((enabled) => { + Nmcli.getWifiStatus(enabled => { root.wifiEnabled = enabled; }); } function getEthernetDevices(): void { root.ethernetProcessRunning = true; - Nmcli.getEthernetInterfaces((interfaces) => { + Nmcli.getEthernetInterfaces(interfaces => { root.ethernetDevices = Nmcli.ethernetDevices; root.ethernetDeviceCount = Nmcli.ethernetDevices.length; root.ethernetProcessRunning = false; }); } - function connectEthernet(connectionName: string, interfaceName: string): void { - Nmcli.connectEthernet(connectionName, interfaceName, (result) => { + Nmcli.connectEthernet(connectionName, interfaceName, result => { if (result.success) { getEthernetDevices(); // Refresh device details after connection Qt.callLater(() => { - const activeDevice = root.ethernetDevices.find(function(d) { return d.connected; }); + const activeDevice = root.ethernetDevices.find(function (d) { + return d.connected; + }); if (activeDevice && activeDevice.interface) { updateEthernetDeviceDetails(activeDevice.interface); } @@ -257,7 +271,7 @@ Singleton { } function disconnectEthernet(connectionName: string): void { - Nmcli.disconnectEthernet(connectionName, (result) => { + Nmcli.disconnectEthernet(connectionName, result => { if (result.success) { getEthernetDevices(); // Clear device details after disconnection @@ -269,7 +283,7 @@ Singleton { } function updateEthernetDeviceDetails(interfaceName: string): void { - Nmcli.getEthernetDeviceDetails(interfaceName, (details) => { + Nmcli.getEthernetDeviceDetails(interfaceName, details => { root.ethernetDeviceDetails = details; }); } @@ -277,7 +291,7 @@ Singleton { function updateWirelessDeviceDetails(): void { // Find the wireless interface by looking for wifi devices // Pass empty string to let Nmcli find the active interface automatically - Nmcli.getWirelessDeviceDetails("", (details) => { + Nmcli.getWirelessDeviceDetails("", details => { root.wirelessDeviceDetails = details; }); } @@ -290,12 +304,7 @@ Singleton { } const mask = (0xffffffff << (32 - cidrNum)) >>> 0; - const octets = [ - (mask >>> 24) & 0xff, - (mask >>> 16) & 0xff, - (mask >>> 8) & 0xff, - mask & 0xff - ]; + const octets = [(mask >>> 24) & 0xff, (mask >>> 16) & 0xff, (mask >>> 8) & 0xff, mask & 0xff]; return octets.join("."); } @@ -312,5 +321,4 @@ Singleton { } } } - } diff --git a/services/VPN.qml b/services/VPN.qml index 431c8ec..2d08631 100644 --- a/services/VPN.qml +++ b/services/VPN.qml @@ -129,9 +129,9 @@ Singleton { command: ["ip", "link", "show"] environment: ({ - LANG: "C.UTF-8", - LC_ALL: "C.UTF-8" - }) + LANG: "C.UTF-8", + LC_ALL: "C.UTF-8" + }) stdout: StdioCollector { onStreamFinished: { const iface = root.currentConfig ? root.currentConfig.interface : ""; diff --git a/utils/NetworkConnection.qml b/utils/NetworkConnection.qml index c7595b1..e55b87b 100644 --- a/utils/NetworkConnection.qml +++ b/utils/NetworkConnection.qml @@ -5,18 +5,18 @@ import QtQuick /** * NetworkConnection - * + * * Centralized utility for network connection logic. Provides a single source of truth * for connecting to wireless networks, eliminating code duplication across * controlcenter components and bar popouts. - * + * * Usage: * ```qml * import qs.utils - * + * * // With Session object (controlcenter) * NetworkConnection.handleConnect(network, session); - * + * * // Without Session object (bar popouts) - provide password dialog callback * NetworkConnection.handleConnect(network, null, (network) => { * // Show password dialog @@ -32,7 +32,7 @@ QtObject { * Handle network connection with automatic disconnection if needed. * If there's an active network different from the target, disconnects first, * then connects to the target network. - * + * * @param network The network object to connect to (must have ssid property) * @param session Optional Session object (for controlcenter - must have network property with showPasswordDialog and pendingNetwork) * @param onPasswordNeeded Optional callback function(network) called when password is needed (for bar popouts) @@ -56,7 +56,7 @@ QtObject { * Connect to a wireless network. * Handles both secured and open networks, checks for saved profiles, * and shows password dialog if needed. - * + * * @param network The network object to connect to (must have ssid, isSecure, bssid properties) * @param session Optional Session object (for controlcenter - must have network property with showPasswordDialog and pendingNetwork) * @param onPasswordNeeded Optional callback function(network) called when password is needed (for bar popouts) @@ -73,30 +73,25 @@ QtObject { Nmcli.connectToNetwork(network.ssid, "", network.bssid, null); } else { // Use password check with callback - Nmcli.connectToNetworkWithPasswordCheck( - network.ssid, - network.isSecure, - (result) => { - if (result.needsPassword) { - // Clear pending connection if exists - if (Nmcli.pendingConnection) { - Nmcli.connectionCheckTimer.stop(); - Nmcli.immediateCheckTimer.stop(); - Nmcli.immediateCheckTimer.checkCount = 0; - Nmcli.pendingConnection = null; - } - - // Handle password dialog - use session if available, otherwise use callback - if (session && session.network) { - session.network.showPasswordDialog = true; - session.network.pendingNetwork = network; - } else if (onPasswordNeeded) { - onPasswordNeeded(network); - } + Nmcli.connectToNetworkWithPasswordCheck(network.ssid, network.isSecure, result => { + if (result.needsPassword) { + // Clear pending connection if exists + if (Nmcli.pendingConnection) { + Nmcli.connectionCheckTimer.stop(); + Nmcli.immediateCheckTimer.stop(); + Nmcli.immediateCheckTimer.checkCount = 0; + Nmcli.pendingConnection = null; } - }, - network.bssid - ); + + // Handle password dialog - use session if available, otherwise use callback + if (session && session.network) { + session.network.showPasswordDialog = true; + session.network.pendingNetwork = network; + } else if (onPasswordNeeded) { + onPasswordNeeded(network); + } + } + }, network.bssid); } } else { Nmcli.connectToNetwork(network.ssid, "", network.bssid, null); @@ -106,7 +101,7 @@ QtObject { /** * Connect to a wireless network with a provided password. * Used by password dialogs when the user has already entered a password. - * + * * @param network The network object to connect to (must have ssid, bssid properties) * @param password The password to use for connection * @param onResult Optional callback function(result) called with connection result @@ -119,4 +114,3 @@ QtObject { Nmcli.connectToNetwork(network.ssid, password || "", network.bssid || "", onResult || null); } } - -- cgit v1.2.3-freya