aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/network/NetworkPage.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/network/NetworkPage.qml')
-rw-r--r--desktop/modules/network/NetworkPage.qml68
1 files changed, 67 insertions, 1 deletions
diff --git a/desktop/modules/network/NetworkPage.qml b/desktop/modules/network/NetworkPage.qml
index 0c79ef6..3a6362a 100644
--- a/desktop/modules/network/NetworkPage.qml
+++ b/desktop/modules/network/NetworkPage.qml
@@ -11,9 +11,9 @@
import Quickshell.Networking
import QtQuick
+import QtQuick.Controls
import "../.."
-// The wired half. Sibling of NetworkPage's wifi half, added in Task 2.
Column {
id: page
@@ -29,6 +29,8 @@ Column {
: "disconnected";
}
+ // --- Wired ---
+
Text {
visible: page.net.wiredDevices.length > 0
text: "Wired"
@@ -63,4 +65,68 @@ Column {
}
}
}
+
+ Rectangle { width: page.width; height: 1; color: Qt.alpha(Theme.text, 0.12) }
+
+ // --- Wifi ---
+
+ Item {
+ width: page.width
+ implicitHeight: Math.max(wifiLabel.implicitHeight, wifiSwitch.implicitHeight)
+
+ Text {
+ id: wifiLabel
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Wi-Fi"
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 1; bold: true }
+ color: Theme.text
+ }
+
+ Switch {
+ id: wifiSwitch
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ enabled: Networking.wifiHardwareEnabled
+ checked: page.net.wifiOn
+ onToggled: Networking.wifiEnabled = checked
+ }
+ }
+
+ Text {
+ width: page.width
+ visible: !page.net.wifiOn
+ text: "Wi-Fi off"
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ color: Theme.subtext
+ }
+
+ Row {
+ width: page.width
+ visible: page.net.wifiOn
+ spacing: 8
+
+ Button {
+ text: page.net.wifiDevice && page.net.wifiDevice.scannerEnabled ? "Scanning…" : "Scan"
+ onClicked: if (page.net.wifiDevice) page.net.wifiDevice.scannerEnabled = true
+ }
+ }
+
+ Repeater {
+ model: page.net.wifiOn ? page.net.wifiNetworksSorted : []
+
+ NetworkRow {
+ required property var modelData
+ net: page.net
+ entry: modelData
+ width: page.width
+ }
+ }
+
+ Text {
+ width: page.width
+ visible: page.net.error !== ""
+ wrapMode: Text.Wrap
+ text: page.net.error
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ color: Theme.red
+ }
}