add sorting by strength
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 15s
Python / lint-format (pull_request) Successful in 32s
Python / test (pull_request) Successful in 39s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m45s
C++ / build (pull_request) Successful in 2m47s

This commit is contained in:
2026-07-02 21:53:42 +02:00
parent 99a0155c17
commit e0873304d1
2 changed files with 29 additions and 22 deletions
+23 -20
View File
@@ -7,28 +7,25 @@ import QtQuick
Singleton {
id: root
readonly property list<NetworkDevice> devices: Networking.devices.values
readonly property list<Network> networks: {
const list = []
for (const d of wifiDevices)
list.push(...d.networks.values)
return list;
}
property bool scanning: false
readonly property list<WifiDevice> wifiDevices: devices.filter(d => wifiDevice(d))
readonly property bool wifiEnabled: Networking.wifiEnabled
property bool active: false
onActiveChanged: {
for (const d of wifiDevices)
d.scannerEnabled = active;
}
readonly property list<NetworkDevice> devices: Networking.devices.values
readonly property list<Network> knownNetworks: networks.filter(n => n.known)
// Original code
readonly property list<NetworkDevice> netDevice: Networking.devices.values
readonly property string networkName: getNetworkName()
readonly property list<Network> networks: {
const list = [];
for (const d of wifiDevices)
list.push(...d.networks.values);
return list;
}
readonly property list<string> nicNames: networkInterfaceCardNames()
property bool scanning: false
readonly property list<Network> unknownNetworks: networks.filter(n => !n.known)
readonly property list<WifiDevice> wifiDevices: devices.filter(d => wifiDevice(d))
readonly property bool wifiEnabled: Networking.wifiEnabled
// Useless will prob remove
function getConnectedDevices() {
@@ -52,6 +49,12 @@ Singleton {
return "Failed network name";
}
//
function isSecure(security): bool {
return (security === WifiSecurityType.WpaPsk || security === WifiSecurityType.Wpa2Psk || security === WifiSecurityType.Sae);
}
// Searches wired/wireless devices and sets them in a list
function networkInterfaceCardNames() {
let nicList = [];
@@ -62,11 +65,6 @@ Singleton {
return nicList;
}
//
function isSecure(security): bool {
return (security === WifiSecurityType.WpaPsk || security === WifiSecurityType.Wpa2Psk || security === WifiSecurityType.Sae);
}
function setScan(value: bool): void {
for (const d of wifiDevices) {
@@ -81,4 +79,9 @@ Singleton {
function wifiDevice(dev): bool {
return dev.type === DeviceType.Wifi;
}
onActiveChanged: {
for (const d of wifiDevices)
d.scannerEnabled = active;
}
}
+6 -2
View File
@@ -68,7 +68,9 @@ CustomClippingRect {
Repeater {
model: ScriptModel {
values: [...Network.networks].filter(n => n.known)
values: [...Network.knownNetworks].sort((a, b) => {
return a.signalStrength - b.signalStrength;
})
}
RowLayout {
@@ -159,7 +161,9 @@ CustomClippingRect {
id: networkRepeater
model: ScriptModel {
values: [...Network.networks].filter(n => !n.known)
values: [...Network.unknownNetworks].sort((a, b) => {
return a.signalStrength - b.signalStrength;
})
}
RowLayout {