diff options
| author | ATMDA <atdma2600@gmail.com> | 2025-11-09 23:36:44 -0500 |
|---|---|---|
| committer | ATMDA <atdma2600@gmail.com> | 2025-11-09 23:36:44 -0500 |
| commit | 615d1d9a495604d229764c225b363dbaaaacb2bc (patch) | |
| tree | 1c2b5491403b216570ea5ce76659d5fe9422d657 /modules/controlcenter/network/NetworkList.qml | |
| parent | fix: color schemes and variants in appearance pane (diff) | |
| download | caelestia-shell-615d1d9a495604d229764c225b363dbaaaacb2bc.tar.gz caelestia-shell-615d1d9a495604d229764c225b363dbaaaacb2bc.tar.bz2 caelestia-shell-615d1d9a495604d229764c225b363dbaaaacb2bc.zip | |
controlcenter: cleaning up ui to match
Diffstat (limited to 'modules/controlcenter/network/NetworkList.qml')
| -rw-r--r-- | modules/controlcenter/network/NetworkList.qml | 153 |
1 files changed, 96 insertions, 57 deletions
diff --git a/modules/controlcenter/network/NetworkList.qml b/modules/controlcenter/network/NetworkList.qml index df05de7..f528092 100644 --- a/modules/controlcenter/network/NetworkList.qml +++ b/modules/controlcenter/network/NetworkList.qml @@ -29,74 +29,38 @@ ColumnLayout { Layout.fillWidth: true } - StyledRect { - implicitWidth: implicitHeight - implicitHeight: wifiIcon.implicitHeight + Appearance.padding.normal * 2 + ToggleButton { + toggled: Network.wifiEnabled + icon: "wifi" + accent: "Tertiary" - radius: Appearance.rounding.normal - color: Network.wifiEnabled ? Colours.palette.m3tertiary : Colours.palette.m3tertiaryContainer - - StateLayer { - function onClicked(): void { - Network.toggleWifi(); - } - } - - MaterialIcon { - id: wifiIcon - - anchors.centerIn: parent - text: "wifi" - color: Network.wifiEnabled ? Colours.palette.m3onTertiary : Colours.palette.m3onTertiaryContainer + function onClicked(): void { + Network.toggleWifi(); } } - StyledRect { - implicitWidth: implicitHeight - implicitHeight: scanIcon.implicitHeight + Appearance.padding.normal * 2 - - radius: Appearance.rounding.normal - color: Network.scanning ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer + ToggleButton { + toggled: Network.scanning + icon: "wifi_find" + accent: "Secondary" - StateLayer { - function onClicked(): void { - Network.rescanWifi(); - } - } - - MaterialIcon { - id: scanIcon - - anchors.centerIn: parent - text: "wifi_find" - color: Network.scanning ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer + function onClicked(): void { + Network.rescanWifi(); } } - StyledRect { - implicitWidth: implicitHeight - implicitHeight: settingsIcon.implicitHeight + Appearance.padding.normal * 2 + ToggleButton { + toggled: !root.session.network.active + icon: "settings" + accent: "Primary" - radius: Appearance.rounding.normal - color: !root.session.network.active ? Colours.palette.m3primary : Colours.palette.m3primaryContainer - - StateLayer { - function onClicked(): void { - if (root.session.network.active) - root.session.network.active = null; - else { - root.session.network.active = view.model.get(0)?.modelData ?? null; - } + function onClicked(): void { + if (root.session.network.active) + root.session.network.active = null; + else { + root.session.network.active = view.model.get(0)?.modelData ?? null; } } - - MaterialIcon { - id: settingsIcon - - anchors.centerIn: parent - text: "settings" - color: !root.session.network.active ? Colours.palette.m3onPrimary : Colours.palette.m3onPrimaryContainer - } } } @@ -258,4 +222,79 @@ ColumnLayout { implicitHeight: rowLayout.implicitHeight + Appearance.padding.normal * 2 } } + + component ToggleButton: StyledRect { + id: toggleBtn + + required property bool toggled + property string icon + property string label + property string accent: "Secondary" + + function onClicked(): void { + } + + Layout.preferredWidth: implicitWidth + (toggleStateLayer.pressed ? Appearance.padding.normal * 2 : toggled ? Appearance.padding.small * 2 : 0) + implicitWidth: toggleBtnInner.implicitWidth + Appearance.padding.large * 2 + implicitHeight: toggleBtnIcon.implicitHeight + Appearance.padding.normal * 2 + + radius: toggled || toggleStateLayer.pressed ? Appearance.rounding.small : Math.min(width, height) / 2 * Math.min(1, Appearance.rounding.scale) + color: toggled ? Colours.palette[`m3${accent.toLowerCase()}`] : Colours.palette[`m3${accent.toLowerCase()}Container`] + + StateLayer { + id: toggleStateLayer + + color: toggleBtn.toggled ? Colours.palette[`m3on${toggleBtn.accent}`] : Colours.palette[`m3on${toggleBtn.accent}Container`] + + function onClicked(): void { + toggleBtn.onClicked(); + } + } + + RowLayout { + id: toggleBtnInner + + anchors.centerIn: parent + spacing: Appearance.spacing.normal + + MaterialIcon { + id: toggleBtnIcon + + visible: !!text + fill: toggleBtn.toggled ? 1 : 0 + text: toggleBtn.icon + color: toggleBtn.toggled ? Colours.palette[`m3on${toggleBtn.accent}`] : Colours.palette[`m3on${toggleBtn.accent}Container`] + font.pointSize: Appearance.font.size.large + + Behavior on fill { + Anim {} + } + } + + Loader { + asynchronous: true + active: !!toggleBtn.label + visible: active + + sourceComponent: StyledText { + text: toggleBtn.label + color: toggleBtn.toggled ? Colours.palette[`m3on${toggleBtn.accent}`] : Colours.palette[`m3on${toggleBtn.accent}Container`] + } + } + } + + Behavior on radius { + Anim { + duration: Appearance.anim.durations.expressiveFastSpatial + easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial + } + } + + Behavior on Layout.preferredWidth { + Anim { + duration: Appearance.anim.durations.expressiveFastSpatial + easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial + } + } + } } |