// Copyright (C) 2026 Danilo M. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. import Quickshell.Networking import QtQuick import "../.." Column { id: page required property var net signal back spacing: 14 function stateLabel(s) { return s === ConnectionState.Connected ? "connected" : s === ConnectionState.Connecting ? "connecting" : s === ConnectionState.Disconnecting ? "disconnecting" : "disconnected"; } // --- Wired --- Row { visible: page.net.wiredDevices.length > 0 spacing: 6 Text { anchors.verticalCenter: parent.verticalCenter text: "\uef44" font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 } color: Theme.subtext } Text { anchors.verticalCenter: parent.verticalCenter text: "Wired" font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true } color: Theme.subtext } } Repeater { model: page.net.wiredDevices Rectangle { required property var modelData width: page.width implicitHeight: wiredText.implicitHeight + 16 radius: 8 color: Qt.alpha(Theme.surface, 0.35) Text { id: wiredText anchors { left: parent.left; leftMargin: 10; verticalCenter: parent.verticalCenter } text: modelData.name + " " + page.stateLabel(modelData.state) font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } color: modelData.connected ? Theme.text : Theme.subtext } Button { anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } visible: modelData.connected text: "Disconnect" onClicked: page.net.disconnectNetwork(modelData) } } } Rectangle { width: page.width; height: 1; visible: page.net.wiredDevices.length > 0; color: Qt.alpha(Theme.text, 0.12) } // --- Wifi --- Item { width: page.width implicitHeight: Math.max(wifiLabel.implicitHeight, wifiSwitch.implicitHeight) Text { id: wifiLabel anchors { left: wifiGlyph.right; leftMargin: 6; verticalCenter: parent.verticalCenter } text: "Wi-Fi" font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 1; bold: true } color: Theme.text } Text { id: wifiGlyph anchors.verticalCenter: parent.verticalCenter text: "\uf1eb" font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 } color: Theme.subtext } 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 = !page.net.wifiDevice.scannerEnabled } } 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 } }