137 lines
3.2 KiB
QML
137 lines
3.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import ".."
|
|
import qs.components
|
|
import qs.components.controls
|
|
import qs.components.effects
|
|
import qs.components.containers
|
|
import qs.services
|
|
import qs.config
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property Session session
|
|
readonly property var device: session.ethernet.active
|
|
|
|
Component.onCompleted: {
|
|
if (device && device.interface) {
|
|
Network.updateEthernetDeviceDetails(device.interface);
|
|
}
|
|
}
|
|
|
|
onDeviceChanged: {
|
|
if (device && device.interface) {
|
|
Network.updateEthernetDeviceDetails(device.interface);
|
|
} else {
|
|
Network.ethernetDeviceDetails = null;
|
|
}
|
|
}
|
|
|
|
StyledFlickable {
|
|
anchors.fill: parent
|
|
|
|
flickableDirection: Flickable.VerticalFlick
|
|
contentHeight: layout.height
|
|
|
|
ColumnLayout {
|
|
id: layout
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
spacing: Appearance.spacing.normal
|
|
|
|
ConnectionHeader {
|
|
icon: "cable"
|
|
title: root.device?.interface ?? qsTr("Unknown")
|
|
}
|
|
|
|
SectionHeader {
|
|
title: qsTr("Connection status")
|
|
description: qsTr("Connection settings for this device")
|
|
}
|
|
|
|
SectionContainer {
|
|
ToggleRow {
|
|
label: qsTr("Connected")
|
|
checked: root.device?.connected ?? false
|
|
toggle.onToggled: {
|
|
if (checked) {
|
|
// Use connection name if available, otherwise use interface
|
|
Network.connectEthernet(root.device?.connection || "", root.device?.interface || "");
|
|
} else {
|
|
if (root.device?.connection) {
|
|
Network.disconnectEthernet(root.device.connection);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
SectionHeader {
|
|
title: qsTr("Device properties")
|
|
description: qsTr("Additional information")
|
|
}
|
|
|
|
SectionContainer {
|
|
contentSpacing: Appearance.spacing.small / 2
|
|
|
|
PropertyRow {
|
|
label: qsTr("Interface")
|
|
value: root.device?.interface ?? qsTr("Unknown")
|
|
}
|
|
|
|
PropertyRow {
|
|
showTopMargin: true
|
|
label: qsTr("Connection")
|
|
value: root.device?.connection || qsTr("Not connected")
|
|
}
|
|
|
|
PropertyRow {
|
|
showTopMargin: true
|
|
label: qsTr("State")
|
|
value: root.device?.state ?? qsTr("Unknown")
|
|
}
|
|
}
|
|
|
|
SectionHeader {
|
|
title: qsTr("Connection information")
|
|
description: qsTr("Network connection details")
|
|
}
|
|
|
|
SectionContainer {
|
|
ConnectionInfoSection {
|
|
deviceDetails: Network.ethernetDeviceDetails
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|