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
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:
+23
-20
@@ -7,28 +7,25 @@ import QtQuick
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
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
|
property bool active: false
|
||||||
|
readonly property list<NetworkDevice> devices: Networking.devices.values
|
||||||
onActiveChanged: {
|
readonly property list<Network> knownNetworks: networks.filter(n => n.known)
|
||||||
for (const d of wifiDevices)
|
|
||||||
d.scannerEnabled = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Original code
|
// Original code
|
||||||
|
|
||||||
readonly property list<NetworkDevice> netDevice: Networking.devices.values
|
readonly property list<NetworkDevice> netDevice: Networking.devices.values
|
||||||
readonly property string networkName: getNetworkName()
|
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()
|
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
|
// Useless will prob remove
|
||||||
function getConnectedDevices() {
|
function getConnectedDevices() {
|
||||||
@@ -52,6 +49,12 @@ Singleton {
|
|||||||
return "Failed network name";
|
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
|
// Searches wired/wireless devices and sets them in a list
|
||||||
function networkInterfaceCardNames() {
|
function networkInterfaceCardNames() {
|
||||||
let nicList = [];
|
let nicList = [];
|
||||||
@@ -62,11 +65,6 @@ Singleton {
|
|||||||
|
|
||||||
return nicList;
|
return nicList;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
|
|
||||||
function isSecure(security): bool {
|
|
||||||
return (security === WifiSecurityType.WpaPsk || security === WifiSecurityType.Wpa2Psk || security === WifiSecurityType.Sae);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setScan(value: bool): void {
|
function setScan(value: bool): void {
|
||||||
for (const d of wifiDevices) {
|
for (const d of wifiDevices) {
|
||||||
@@ -81,4 +79,9 @@ Singleton {
|
|||||||
function wifiDevice(dev): bool {
|
function wifiDevice(dev): bool {
|
||||||
return dev.type === DeviceType.Wifi;
|
return dev.type === DeviceType.Wifi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onActiveChanged: {
|
||||||
|
for (const d of wifiDevices)
|
||||||
|
d.scannerEnabled = active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ CustomClippingRect {
|
|||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: [...Network.networks].filter(n => n.known)
|
values: [...Network.knownNetworks].sort((a, b) => {
|
||||||
|
return a.signalStrength - b.signalStrength;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@@ -159,7 +161,9 @@ CustomClippingRect {
|
|||||||
id: networkRepeater
|
id: networkRepeater
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: [...Network.networks].filter(n => !n.known)
|
values: [...Network.unknownNetworks].sort((a, b) => {
|
||||||
|
return a.signalStrength - b.signalStrength;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|||||||
Reference in New Issue
Block a user