summaryrefslogtreecommitdiff
path: root/modules/controlcenter/network/NetworkingPane.qml
diff options
context:
space:
mode:
authorATMDA <atdma2600@gmail.com>2025-11-14 12:05:07 -0500
committerATMDA <atdma2600@gmail.com>2025-11-14 12:05:07 -0500
commit6043adf66615e3354a30f7efe24a1332bd10e3e5 (patch)
treea2f37d8ad13ffb2204a27daaa5820cd451c58e45 /modules/controlcenter/network/NetworkingPane.qml
parentcontrolcenter: merging wireless/ethernet panes (wip/stash) (diff)
downloadcaelestia-shell-6043adf66615e3354a30f7efe24a1332bd10e3e5.tar.gz
caelestia-shell-6043adf66615e3354a30f7efe24a1332bd10e3e5.tar.bz2
caelestia-shell-6043adf66615e3354a30f7efe24a1332bd10e3e5.zip
controlcenter: merged wireless/ethernet panes
Diffstat (limited to 'modules/controlcenter/network/NetworkingPane.qml')
-rw-r--r--modules/controlcenter/network/NetworkingPane.qml188
1 files changed, 80 insertions, 108 deletions
diff --git a/modules/controlcenter/network/NetworkingPane.qml b/modules/controlcenter/network/NetworkingPane.qml
index f220960..8616c85 100644
--- a/modules/controlcenter/network/NetworkingPane.qml
+++ b/modules/controlcenter/network/NetworkingPane.qml
@@ -90,9 +90,9 @@ RowLayout {
} else {
// Toggle to show settings - prefer ethernet if available, otherwise wireless
if (Nmcli.ethernetDevices.length > 0) {
- root.session.ethernet.active = ethernetListView.model.get(0)?.modelData ?? null;
+ root.session.ethernet.active = Nmcli.ethernetDevices[0];
} else if (Nmcli.networks.length > 0) {
- root.session.network.active = wirelessListView.model.get(0)?.modelData ?? null;
+ root.session.network.active = Nmcli.networks[0];
}
}
}
@@ -127,29 +127,16 @@ RowLayout {
color: Colours.palette.m3outline
}
- Item {
- Layout.fillWidth: true
- Layout.preferredHeight: Nmcli.ethernetDevices.length > 0 ? Math.min(400, Math.max(200, Nmcli.ethernetDevices.length * 80)) : 200
-
- StyledListView {
- id: ethernetListView
-
- anchors.fill: parent
+ Repeater {
+ id: ethernetRepeater
+ Layout.fillWidth: true
model: Nmcli.ethernetDevices
- spacing: Appearance.spacing.small / 2
- clip: true
-
- StyledScrollBar.vertical: StyledScrollBar {
- flickable: ethernetListView
- }
-
- delegate: StyledRect {
+ delegate: StyledRect {
required property var modelData
- anchors.left: parent.left
- anchors.right: parent.right
+ Layout.fillWidth: true
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.ethernet.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0)
radius: Appearance.rounding.normal
@@ -233,7 +220,6 @@ RowLayout {
}
implicitHeight: rowLayout.implicitHeight + Appearance.padding.normal * 2
- }
}
}
}
@@ -274,123 +260,109 @@ RowLayout {
color: Colours.palette.m3outline
}
- Item {
- Layout.fillWidth: true
- Layout.preferredHeight: Nmcli.networks.length > 0 ? Math.min(400, Math.max(200, Nmcli.networks.length * 80)) : 200
+ Repeater {
+ id: wirelessRepeater
- StyledListView {
- id: wirelessListView
+ Layout.fillWidth: true
+ model: Nmcli.networks
- anchors.fill: parent
+ delegate: StyledRect {
+ required property var modelData
- model: Nmcli.networks
+ Layout.fillWidth: true
- spacing: Appearance.spacing.small / 2
- clip: true
+ color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.network.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0)
+ radius: Appearance.rounding.normal
+ border.width: root.session.network.active === modelData ? 1 : 0
+ border.color: Colours.palette.m3primary
- StyledScrollBar.vertical: StyledScrollBar {
- flickable: wirelessListView
+ StateLayer {
+ function onClicked(): void {
+ root.session.network.active = modelData;
+ // Check if we need to refresh saved connections when selecting a network
+ if (modelData && modelData.ssid) {
+ checkSavedProfileForNetwork(modelData.ssid);
+ }
+ }
}
- delegate: StyledRect {
- required property var modelData
+ RowLayout {
+ id: wirelessRowLayout
anchors.left: parent.left
anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: Appearance.padding.normal
- color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.network.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0)
- radius: Appearance.rounding.normal
- border.width: root.session.network.active === modelData ? 1 : 0
- border.color: Colours.palette.m3primary
-
- StateLayer {
- function onClicked(): void {
- root.session.network.active = modelData;
- // Check if we need to refresh saved connections when selecting a network
- if (modelData && modelData.ssid) {
- checkSavedProfileForNetwork(modelData.ssid);
- }
- }
- }
-
- RowLayout {
- id: wirelessRowLayout
-
- 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
- StyledRect {
- implicitWidth: implicitHeight
- implicitHeight: wirelessIcon.implicitHeight + Appearance.padding.normal * 2
+ StyledRect {
+ implicitWidth: implicitHeight
+ implicitHeight: wirelessIcon.implicitHeight + Appearance.padding.normal * 2
- radius: Appearance.rounding.normal
- color: modelData.active ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh
+ radius: Appearance.rounding.normal
+ color: modelData.active ? Colours.palette.m3primaryContainer : Colours.tPalette.m3surfaceContainerHigh
- MaterialIcon {
- id: wirelessIcon
+ MaterialIcon {
+ id: wirelessIcon
- anchors.centerIn: parent
- text: modelData.isSecure ? "lock" : "wifi"
- font.pointSize: Appearance.font.size.large
- fill: modelData.active ? 1 : 0
- color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
- }
+ anchors.centerIn: parent
+ text: modelData.isSecure ? "lock" : "wifi"
+ font.pointSize: Appearance.font.size.large
+ fill: modelData.active ? 1 : 0
+ color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
}
+ }
- StyledText {
- Layout.fillWidth: true
- elide: Text.ElideRight
- maximumLineCount: 1
+ StyledText {
+ Layout.fillWidth: true
+ elide: Text.ElideRight
+ maximumLineCount: 1
- text: modelData.ssid || qsTr("Unknown")
- }
+ text: modelData.ssid || qsTr("Unknown")
+ }
- StyledText {
- text: modelData.active ? qsTr("Connected") : (modelData.isSecure ? qsTr("Secured") : qsTr("Open"))
- color: modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- font.weight: modelData.active ? 500 : 400
- }
+ StyledText {
+ text: modelData.active ? qsTr("Connected") : (modelData.isSecure ? qsTr("Secured") : qsTr("Open"))
+ color: modelData.active ? Colours.palette.m3primary : Colours.palette.m3outline
+ font.pointSize: Appearance.font.size.small
+ font.weight: modelData.active ? 500 : 400
+ }
- StyledText {
- text: qsTr("%1%").arg(modelData.strength)
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
+ StyledText {
+ text: qsTr("%1%").arg(modelData.strength)
+ color: Colours.palette.m3outline
+ font.pointSize: Appearance.font.size.small
+ }
- StyledRect {
- implicitWidth: implicitHeight
- implicitHeight: wirelessConnectIcon.implicitHeight + Appearance.padding.smaller * 2
+ StyledRect {
+ implicitWidth: implicitHeight
+ implicitHeight: wirelessConnectIcon.implicitHeight + Appearance.padding.smaller * 2
- radius: Appearance.rounding.full
- color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.active ? 1 : 0)
+ radius: Appearance.rounding.full
+ color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.active ? 1 : 0)
- StateLayer {
- function onClicked(): void {
- if (modelData.active) {
- Nmcli.disconnectFromNetwork();
- } else {
- handleWirelessConnect(modelData);
- }
+ StateLayer {
+ function onClicked(): void {
+ if (modelData.active) {
+ Nmcli.disconnectFromNetwork();
+ } else {
+ handleWirelessConnect(modelData);
}
}
+ }
- MaterialIcon {
- id: wirelessConnectIcon
+ MaterialIcon {
+ id: wirelessConnectIcon
- anchors.centerIn: parent
- text: modelData.active ? "link_off" : "link"
- color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
- }
+ anchors.centerIn: parent
+ text: modelData.active ? "link_off" : "link"
+ color: modelData.active ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3onSurface
}
}
-
- implicitHeight: wirelessRowLayout.implicitHeight + Appearance.padding.normal * 2
}
+
+ implicitHeight: wirelessRowLayout.implicitHeight + Appearance.padding.normal * 2
}
}
}