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 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 MaterialIcon { Layout.alignment: Qt.AlignHCenter animate: true text: "cable" font.pointSize: Appearance.font.size.extraLarge * 3 font.bold: true } StyledText { Layout.alignment: Qt.AlignHCenter animate: true text: root.device?.interface ?? qsTr("Unknown") font.pointSize: Appearance.font.size.large font.bold: true } StyledText { Layout.topMargin: Appearance.spacing.large text: qsTr("Connection status") font.pointSize: Appearance.font.size.larger font.weight: 500 } StyledText { text: qsTr("Connection settings for this device") color: Colours.palette.m3outline } StyledRect { Layout.fillWidth: true implicitHeight: deviceStatus.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal color: Colours.tPalette.m3surfaceContainer ColumnLayout { id: deviceStatus anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.margins: Appearance.padding.large spacing: Appearance.spacing.larger Toggle { label: qsTr("Connected") checked: root.device?.connected ?? false toggle.onToggled: { if (checked) { if (root.device?.connection) { Network.connectEthernet(root.device.connection); } } else { if (root.device?.connection) { Network.disconnectEthernet(root.device.connection); } } } } } } StyledText { Layout.topMargin: Appearance.spacing.large text: qsTr("Device properties") font.pointSize: Appearance.font.size.larger font.weight: 500 } StyledText { text: qsTr("Additional information") color: Colours.palette.m3outline } StyledRect { Layout.fillWidth: true implicitHeight: deviceProps.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal color: Colours.tPalette.m3surfaceContainer ColumnLayout { id: deviceProps anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.margins: Appearance.padding.large spacing: Appearance.spacing.small / 2 StyledText { text: qsTr("Interface") } StyledText { text: root.device?.interface ?? qsTr("Unknown") color: Colours.palette.m3outline font.pointSize: Appearance.font.size.small } StyledText { Layout.topMargin: Appearance.spacing.normal text: qsTr("Connection") } StyledText { text: root.device?.connection || qsTr("Not connected") color: Colours.palette.m3outline font.pointSize: Appearance.font.size.small } StyledText { Layout.topMargin: Appearance.spacing.normal text: qsTr("State") } StyledText { text: root.device?.state ?? qsTr("Unknown") color: Colours.palette.m3outline font.pointSize: Appearance.font.size.small } } } } } component Toggle: RowLayout { required property string label property alias checked: toggle.checked property alias toggle: toggle Layout.fillWidth: true spacing: Appearance.spacing.normal StyledText { Layout.fillWidth: true text: parent.label } StyledSwitch { id: toggle cLayer: 2 } } }