diff options
Diffstat (limited to 'desktop/modules/network/NetworkPage.qml')
| -rw-r--r-- | desktop/modules/network/NetworkPage.qml | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/desktop/modules/network/NetworkPage.qml b/desktop/modules/network/NetworkPage.qml new file mode 100644 index 0000000..0c79ef6 --- /dev/null +++ b/desktop/modules/network/NetworkPage.qml @@ -0,0 +1,66 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// 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 "../.." + +// The wired half. Sibling of NetworkPage's wifi half, added in Task 2. +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"; + } + + Text { + visible: page.net.wiredDevices.length > 0 + 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) + } + } + } +} |
