blob: 5a70102b330a6d5ae7e16fecfa8bef357441cde6 (
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.VirtualKeyboard 2.1
import AGL.Demo.Controls 1.0
ApplicationWindow {
id: root
visible: true
width: 1080
height: 1487
property string onsId: qsTr("onscreenapp")
property string pri_path: qsTr("/home/0/app-data/OnScreen/onstestapp/")
property string filepath: pri_path + qsTr("vics.qml")
property string msgdata: ""
property string postmsg: ""
Text {
id: title
width: parent.width
height: 40
text: "OnScreen Test App"
font.pixelSize: 40
}
ColumnLayout {
spacing: 20
anchors.top: title.bottom
anchors.topMargin: 40
anchors.horizontalCenter: title.horizontalCenter
// show received reply information area
Flickable {
id: flickable
width: 800
height: 160
Layout.alignment: Qt.AlignCenter
TextArea.flickable: TextArea {
id: output
text: "show received reply information area\n...\n...\n...\n...\n"
font.pixelSize: 20
wrapMode: TextArea.Wrap
}
ScrollBar.vertical: ScrollBar { }
}
// select onscreen type area
GroupBox {
title: "Please select send OnScreen Type"
font.pixelSize: 30
font.bold: true
width: 800
height: 100
Layout.alignment: Qt.AlignLeft
RowLayout {
anchors.fill: parent
RadioButton {
text: qsTr("VICS")
font.pixelSize: 20
checked: true
onClicked: {
selectVICS();
console.log("clicked:", "VICS")
}
}
RadioButton {
text: qsTr("SYS")
font.pixelSize: 20
onClicked: {
selectSYS();
console.log("clicked:", "SYS")
}
}
RadioButton {
text: qsTr("TEL")
font.pixelSize: 20
onClicked: {
selectTEL();
console.log("clicked:", "TEL")
}
}
RadioButton {
text: qsTr("MSG")
font.pixelSize: 20
onClicked: {
selectMSG();
console.log("clicked:", "MSG")
}
}
}
}
// edit post message area
GroupBox {
id : editarea
title: "Please input parameter to onscreen"
font.pixelSize: 30
font.bold: true
width: 800
height: 400
Layout.alignment: Qt.AlignLeft
ColumnLayout {
spacing: 20
RowLayout {
id: line3
spacing: 20
Label {
id: dataname1
anchors.left: parent.left
anchors.leftMargin: 30
text: qsTr("info")
font.pixelSize: 20
font.italic: true
color: '#00ADDC'
}
TextInput {
id: data1
text: qsTr("tokyo vics information!")
font.pixelSize: 20
font.italic: true
anchors.left: dataname1.right
anchors.leftMargin: 20
color: '#00ADDC'
cursorVisible: true
inputMethodHints: Qt.ImhNone
onFocusChanged: {
console.log("OnScreenData1")
if(data1.focus)
vkb.visible = true
}
}
}
RowLayout {
id: line4
visible: false
spacing: 20
Label {
id: dataname2
anchors.left: parent.left
anchors.leftMargin: 30
text: qsTr("")
font.pixelSize: 20
font.italic: true
color: '#00ADDC'
}
TextInput {
id: data2
text: qsTr("")
font.pixelSize: 20
font.italic: true
anchors.left: dataname2.right
anchors.leftMargin: 20
color: '#00ADDC'
cursorVisible: true
inputMethodHints: Qt.ImhNone
onFocusChanged: {
console.log("OnScreenData2")
if(data2.focus)
vkb.visible = true
}
}
}
RowLayout {
id: line5
visible: false
spacing: 20
Label {
id: dataname3
anchors.left: parent.left
anchors.leftMargin: 30
text: qsTr("")
font.pixelSize: 20
font.italic: true
color: '#00ADDC'
}
TextInput {
id: data3
text: qsTr("")
font.pixelSize: 20
font.italic: true
anchors.left: dataname3.right
anchors.leftMargin: 20
color: '#00ADDC'
cursorVisible: true
inputMethodHints: Qt.ImhNone
onFocusChanged: {
console.log("OnScreenData3")
if(data3.focus)
vkb.visible = true
}
}
}
}
}
// post button
Button {
id: poster
text: "Post"
Layout.alignment: Qt.AlignCenter
onClicked: {
console.log("poster pressed")
if (onsId != "")
postMessage();
}
}
}
InputPanel {
id: vkb
visible: false
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
onActiveChanged: {
if(!active) { visible = false; }
}
}
function selectVICS() {
filepath = pri_path + "vics.qml";
dataname1.text = "info"
data1.text = "tokyo vics information!"
dataname2.text = ""
data2.text = ""
dataname3.text = ""
data3.text = ""
line3.visible = true
line4.visible = false
line5.visible = false
}
function selectSYS() {
filepath = pri_path + "system.qml";
dataname1.text = "type"
data1.text = "system error"
dataname2.text = "text"
data2.text = "System Error Occured!"
dataname3.text = ""
data3.text = ""
line3.visible = true
line4.visible = true
line5.visible = false
}
function selectTEL() {
filepath = pri_path + "phone.qml";
dataname1.text = "status"
data1.text = "Call Answered"
dataname2.text = ""
data2.text = ""
dataname3.text = ""
data3.text = ""
line3.visible = true
line4.visible = false
line5.visible = false
}
function selectMSG() {
filepath = pri_path + "msg.qml";
dataname1.text = "data1"
data1.text = "from testApp data1"
dataname2.text = "data2"
data2.text = "from testApp data2"
dataname3.text = "data3"
data3.text = "from testApp data3"
line3.visible = true
line4.visible = true
line5.visible = true
}
function postMessage() {
postmsg = "{\"file\": \"" + filepath + "\"";
if (data1.text != "") {
msgdata = "\"" + dataname1.text + "\":\"" + data1.text + "\"";
}
if (data2.text !="") {
if (msgdata != "")
msgdata += ",";
msgdata += "\"" + dataname2.text + "\":\"" + data2.text + "\"";
}
if (data3.text !="") {
if (msgdata != "")
msgdata += ",";
msgdata += "\"" + dataname3.text + "\":\"" + data3.text + "\"";
}
if(msgdata != "")
postmsg += ",\"data\":{" + msgdata + "}}"
else
postmsg += "}"
eventHandler.showWindow(onsId, postmsg);
}
function qmlOnReplyShowWindow(text) {
console.log("onstestapp received:",text);
output.text = text;
eventHandler.hideWindow(onsId);
}
}
|