From c8c3d8641f72e979cd7da11901b6a2ae0745de0b Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Fri, 13 Dec 2024 06:37:21 +0100 Subject: WIP: Add a Qt Quick frontend for xC We have to decouple the UI from the relay code. --- xT/xTq.qml | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 xT/xTq.qml (limited to 'xT/xTq.qml') diff --git a/xT/xTq.qml b/xT/xTq.qml new file mode 100644 index 0000000..50063c9 --- /dev/null +++ b/xT/xTq.qml @@ -0,0 +1,105 @@ +import QtQuick +import QtQuick.Controls.Fusion +//import QtQuick.Controls +import QtQuick.Layouts + +ApplicationWindow { + id: window + width: 640 + height: 480 + visible: true + title: qsTr("xT") + + property RelayConnection connection + + ColumnLayout { + id: column + anchors.fill: parent + anchors.margins: 6 + + ScrollView { + id: bufferScroll + Layout.fillWidth: true + Layout.fillHeight: true + TextArea { + id: buffer + text: qsTr("Buffer text") + } + } + + RowLayout { + id: row + Layout.fillWidth: true + + Label { + Layout.fillWidth: true + id: prompt + text: qsTr("Prompt") + } + + Label { + Layout.fillWidth: true + id: status + horizontalAlignment: Text.AlignRight + text: qsTr("Status") + } + } + + TextArea { + id: input + Layout.fillWidth: true + text: qsTr("Input") + } + } + + Component.onCompleted: {} + + Dialog { + id: connect + title: "Connect to relay" + anchors.centerIn: parent + modal: true + visible: true + + onRejected: Qt.quit() + onAccepted: { + // TODO(p): Store the host, store the port, initiate connection. + } + + GridLayout { + anchors.fill: parent + anchors.margins: 6 + columns: 2 + + // It is a bit silly that one has to do everything manually. + Keys.onReturnPressed: connect.accept() + + Label { text: "Host:" } + TextField { + id: connectHost + Layout.fillWidth: true + // And if this doesn't work reliably, do it after open(). + focus: true + } + Label { text: "Port:" } + TextField { + id: connectPort + Layout.fillWidth: true + } + } + + footer: DialogButtonBox { + Button { + text: qsTr("Connect") + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + Keys.onReturnPressed: connect.accept() + highlighted: true + } + Button { + text: qsTr("Close") + DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole + Keys.onReturnPressed: connect.reject() + } + } + } +} -- cgit v1.2.3-70-g09d2