feat: add no networks placeholder
Also rescan on wifi enabled And dim & disable connecting networks
This commit is contained in:
parent
cde59b308d
commit
a6aa701e56
1 changed files with 67 additions and 5 deletions
|
|
@ -24,13 +24,29 @@ PageBase {
|
||||||
spacing: Tokens.spacing.extraSmall / 2
|
spacing: Tokens.spacing.extraSmall / 2
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
running: root.visible
|
running: root.visible && Nmcli.wifiEnabled
|
||||||
repeat: true
|
repeat: true
|
||||||
triggeredOnStart: true
|
triggeredOnStart: true
|
||||||
interval: GlobalConfig.nexus.networkRescanInterval
|
interval: GlobalConfig.nexus.networkRescanInterval
|
||||||
onTriggered: Nmcli.rescanWifi()
|
onTriggered: Nmcli.rescanWifi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: wifiScanDelay
|
||||||
|
|
||||||
|
interval: 100
|
||||||
|
onTriggered: Nmcli.rescanWifi()
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onWifiEnabledChanged(): void {
|
||||||
|
if (Nmcli.wifiEnabled)
|
||||||
|
wifiScanDelay.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: Nmcli
|
||||||
|
}
|
||||||
|
|
||||||
ToggleRow {
|
ToggleRow {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
first: true
|
first: true
|
||||||
|
|
@ -45,7 +61,7 @@ PageBase {
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
Layout.fillWidth: true
|
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
|
radius: Tokens.rounding.extraSmall
|
||||||
color: Colours.tPalette.m3surfaceContainer
|
color: Colours.tPalette.m3surfaceContainer
|
||||||
clip: true
|
clip: true
|
||||||
|
|
@ -54,6 +70,41 @@ PageBase {
|
||||||
Anim {}
|
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 {
|
ListView {
|
||||||
id: networkList
|
id: networkList
|
||||||
|
|
||||||
|
|
@ -120,8 +171,11 @@ PageBase {
|
||||||
required property Nmcli.AccessPoint modelData
|
required property Nmcli.AccessPoint modelData
|
||||||
readonly property Component rightComp: Nmcli.connectingSsid() === modelData.ssid ? loadingComp : iconComp
|
readonly property Component rightComp: Nmcli.connectingSsid() === modelData.ssid ? loadingComp : iconComp
|
||||||
property bool isComplete
|
property bool isComplete
|
||||||
|
property bool currentSelected
|
||||||
property real textOpacity: disabled ? 0.5 : 1
|
property real textOpacity: disabled ? 0.5 : 1
|
||||||
|
|
||||||
|
disabled: currentSelected || Nmcli.connectingSsid() === modelData.ssid
|
||||||
|
|
||||||
anchors.left: networkList.contentItem.left
|
anchors.left: networkList.contentItem.left
|
||||||
anchors.right: networkList.contentItem.right
|
anchors.right: networkList.contentItem.right
|
||||||
implicitHeight: networkLayout.implicitHeight + networkLayout.anchors.margins * 2
|
implicitHeight: networkLayout.implicitHeight + networkLayout.anchors.margins * 2
|
||||||
|
|
@ -131,7 +185,7 @@ PageBase {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!modelData.active) {
|
if (!modelData.active) {
|
||||||
NetworkConnection.handleConnect(modelData);
|
NetworkConnection.handleConnect(modelData);
|
||||||
disabled = true;
|
currentSelected = true;
|
||||||
root.networkSelected(modelData);
|
root.networkSelected(modelData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +205,7 @@ PageBase {
|
||||||
Connections {
|
Connections {
|
||||||
function onActiveChanged(): void {
|
function onActiveChanged(): void {
|
||||||
if (network.modelData.active)
|
if (network.modelData.active)
|
||||||
network.disabled = false;
|
network.currentSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target: network.modelData
|
target: network.modelData
|
||||||
|
|
@ -160,7 +214,7 @@ PageBase {
|
||||||
Connections {
|
Connections {
|
||||||
function onNetworkSelected(ap: Nmcli.AccessPoint): void {
|
function onNetworkSelected(ap: Nmcli.AccessPoint): void {
|
||||||
if (ap !== network.modelData)
|
if (ap !== network.modelData)
|
||||||
network.disabled = false;
|
network.currentSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target: root
|
target: root
|
||||||
|
|
@ -252,6 +306,14 @@ PageBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opacity: Nmcli.wifiEnabled ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {
|
||||||
|
type: Anim.DefaultEffects
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledProgressBar {
|
StyledProgressBar {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue