From a6aa701e5619d272f6ce1f4127812900064f9c8c Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 6 Jun 2026 15:51:37 +1000 Subject: [PATCH] feat: add no networks placeholder Also rescan on wifi enabled And dim & disable connecting networks --- modules/nexus/pages/NetworkPage.qml | 72 +++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 5 deletions(-) diff --git a/modules/nexus/pages/NetworkPage.qml b/modules/nexus/pages/NetworkPage.qml index f83427a7..219266b3 100644 --- a/modules/nexus/pages/NetworkPage.qml +++ b/modules/nexus/pages/NetworkPage.qml @@ -24,13 +24,29 @@ PageBase { spacing: Tokens.spacing.extraSmall / 2 Timer { - running: root.visible + running: root.visible && Nmcli.wifiEnabled repeat: true triggeredOnStart: true interval: GlobalConfig.nexus.networkRescanInterval onTriggered: Nmcli.rescanWifi() } + Timer { + id: wifiScanDelay + + interval: 100 + onTriggered: Nmcli.rescanWifi() + } + + Connections { + function onWifiEnabledChanged(): void { + if (Nmcli.wifiEnabled) + wifiScanDelay.start(); + } + + target: Nmcli + } + ToggleRow { Layout.fillWidth: true first: true @@ -45,7 +61,7 @@ PageBase { StyledRect { Layout.fillWidth: true - implicitHeight: networkList.contentHeight + (Nmcli.scanning ? Tokens.rounding.extraSmall : 0) // Inline so it isn't affected by anim + implicitHeight: (Nmcli.wifiEnabled && networkList.count > 0 ? networkList.contentHeight : noNetworksPlaceholder.implicitHeight + Tokens.padding.extraLarge * 2) + (Nmcli.scanning ? Tokens.rounding.extraSmall : 0) // Inline so it isn't affected by anim radius: Tokens.rounding.extraSmall color: Colours.tPalette.m3surfaceContainer clip: true @@ -54,6 +70,41 @@ PageBase { Anim {} } + Loader { + id: noNetworksPlaceholder + + anchors.centerIn: parent + active: opacity > 0 + asynchronous: true + opacity: Nmcli.wifiEnabled && networkList.count > 0 ? 0 : 1 + + sourceComponent: ColumnLayout { + spacing: Tokens.spacing.extraSmall + + MaterialIcon { + Layout.alignment: Qt.AlignHCenter + text: Nmcli.wifiEnabled ? "wifi_find" : "signal_wifi_off" + color: Colours.palette.m3outline + font: Tokens.font.icon.large + animate: true + } + + StyledText { + Layout.alignment: Qt.AlignHCenter + text: Nmcli.wifiEnabled ? qsTr("No networks found") : qsTr("Wi-Fi disabled") + color: Colours.palette.m3outline + font: Tokens.font.body.large + animate: true + } + } + + Behavior on opacity { + Anim { + type: Anim.DefaultEffects + } + } + } + ListView { id: networkList @@ -120,8 +171,11 @@ PageBase { required property Nmcli.AccessPoint modelData readonly property Component rightComp: Nmcli.connectingSsid() === modelData.ssid ? loadingComp : iconComp property bool isComplete + property bool currentSelected property real textOpacity: disabled ? 0.5 : 1 + disabled: currentSelected || Nmcli.connectingSsid() === modelData.ssid + anchors.left: networkList.contentItem.left anchors.right: networkList.contentItem.right implicitHeight: networkLayout.implicitHeight + networkLayout.anchors.margins * 2 @@ -131,7 +185,7 @@ PageBase { onClicked: { if (!modelData.active) { NetworkConnection.handleConnect(modelData); - disabled = true; + currentSelected = true; root.networkSelected(modelData); } } @@ -151,7 +205,7 @@ PageBase { Connections { function onActiveChanged(): void { if (network.modelData.active) - network.disabled = false; + network.currentSelected = false; } target: network.modelData @@ -160,7 +214,7 @@ PageBase { Connections { function onNetworkSelected(ap: Nmcli.AccessPoint): void { if (ap !== network.modelData) - network.disabled = false; + network.currentSelected = false; } target: root @@ -252,6 +306,14 @@ PageBase { } } } + + opacity: Nmcli.wifiEnabled ? 1 : 0 + + Behavior on opacity { + Anim { + type: Anim.DefaultEffects + } + } } StyledProgressBar {