controlcenter: merged wireless/ethernet panes

This commit is contained in:
ATMDA 2025-11-14 12:05:07 -05:00
parent 540cebdbbd
commit 6043adf666
2 changed files with 84 additions and 122 deletions

View file

@ -158,13 +158,8 @@ Item {
NavItem { NavItem {
Layout.topMargin: Appearance.spacing.large * 2 Layout.topMargin: Appearance.spacing.large * 2
icon: "cable" icon: "router"
label: "ethernet" label: "networking"
}
NavItem {
icon: "wifi"
label: "wireless"
} }
NavItem { NavItem {
@ -191,11 +186,6 @@ Item {
icon: "apps" icon: "apps"
label: "launcher" label: "launcher"
} }
NavItem {
icon: "router"
label: "networking"
}
} }
component NavItem: Item { component NavItem: Item {

View file

@ -90,9 +90,9 @@ RowLayout {
} else { } else {
// Toggle to show settings - prefer ethernet if available, otherwise wireless // Toggle to show settings - prefer ethernet if available, otherwise wireless
if (Nmcli.ethernetDevices.length > 0) { 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) { } 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 color: Colours.palette.m3outline
} }
Item { Repeater {
id: ethernetRepeater
Layout.fillWidth: true 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
model: Nmcli.ethernetDevices model: Nmcli.ethernetDevices
spacing: Appearance.spacing.small / 2
clip: true
StyledScrollBar.vertical: StyledScrollBar {
flickable: ethernetListView
}
delegate: StyledRect { delegate: StyledRect {
required property var modelData required property var modelData
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.ethernet.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0) color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.ethernet.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0)
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
@ -237,7 +224,6 @@ RowLayout {
} }
} }
} }
}
CollapsibleSection { CollapsibleSection {
id: wirelessListSection id: wirelessListSection
@ -274,29 +260,16 @@ RowLayout {
color: Colours.palette.m3outline color: Colours.palette.m3outline
} }
Item { Repeater {
id: wirelessRepeater
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Nmcli.networks.length > 0 ? Math.min(400, Math.max(200, Nmcli.networks.length * 80)) : 200
StyledListView {
id: wirelessListView
anchors.fill: parent
model: Nmcli.networks model: Nmcli.networks
spacing: Appearance.spacing.small / 2
clip: true
StyledScrollBar.vertical: StyledScrollBar {
flickable: wirelessListView
}
delegate: StyledRect { delegate: StyledRect {
required property var modelData required property var modelData
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.network.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0) color: Qt.alpha(Colours.tPalette.m3surfaceContainer, root.session.network.active === modelData ? Colours.tPalette.m3surfaceContainer.a : 0)
radius: Appearance.rounding.normal radius: Appearance.rounding.normal
@ -396,7 +369,6 @@ RowLayout {
} }
} }
} }
}
InnerBorder { InnerBorder {
leftThickness: 0 leftThickness: 0