forked from Shinonome/dots-hyprland
76 lines
2.0 KiB
QML
76 lines
2.0 KiB
QML
import qs
|
|
import qs.services
|
|
import qs.services.network
|
|
import qs.modules.common
|
|
import qs.modules.common.widgets
|
|
import qs.modules.common.functions
|
|
import "./quickToggles/"
|
|
import "./wifiNetworks/"
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Qt5Compat.GraphicalEffects
|
|
import Quickshell.Io
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import Quickshell.Hyprland
|
|
|
|
WindowDialog {
|
|
id: root
|
|
|
|
WindowDialogTitle {
|
|
text: Translation.tr("Connect to Wi-Fi")
|
|
}
|
|
// TODO: add indeterminate progress bar when scanning
|
|
WindowDialogSeparator {}
|
|
StyledListView {
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: -15
|
|
Layout.bottomMargin: -16
|
|
Layout.leftMargin: -Appearance.rounding.large
|
|
Layout.rightMargin: -Appearance.rounding.large
|
|
|
|
clip: true
|
|
spacing: 0
|
|
animateAppearance: false
|
|
|
|
model: ScriptModel {
|
|
values: [...Network.wifiNetworks].sort((a, b) => {
|
|
if (a.active && !b.active)
|
|
return -1;
|
|
if (!a.active && b.active)
|
|
return 1;
|
|
return b.strength - a.strength;
|
|
})
|
|
}
|
|
// model: Network.wifiNetworks
|
|
delegate: WifiNetworkItem {
|
|
required property WifiAccessPoint modelData
|
|
wifiNetwork: modelData
|
|
anchors {
|
|
left: parent?.left
|
|
right: parent?.right
|
|
}
|
|
}
|
|
}
|
|
WindowDialogSeparator {}
|
|
WindowDialogButtonRow {
|
|
DialogButton {
|
|
buttonText: Translation.tr("Details")
|
|
onClicked: {
|
|
Quickshell.execDetached(["bash", "-c", `${Network.ethernet ? Config.options.apps.networkEthernet : Config.options.apps.network}`]);
|
|
GlobalStates.sidebarRightOpen = false;
|
|
}
|
|
}
|
|
|
|
Item {
|
|
Layout.fillWidth: true
|
|
}
|
|
|
|
DialogButton {
|
|
buttonText: Translation.tr("Done")
|
|
onClicked: root.dismiss()
|
|
}
|
|
}
|
|
} |