aboutsummaryrefslogtreecommitdiff
path: root/xT/xTq.qml
blob: 50063c9f1fcfe9dfb72350cedd98b2571b8fd8dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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()
			}
		}
	}
}