2 import QtQuick.Window 2.2
3 import QtQuick.Controls 2.0
4 import QtQuick.Layouts 1.0
5 import AGL.Demo.Controls 1.0
13 property string onsId: qsTr("onscreenapp")
14 property string onsTitle: qsTr("One Button title")
15 property string onsType: "critical"
16 property string onsContents: qsTr("An operating system is a program that manages a computer’s hardware.")
17 property string onsButton1: qsTr("Yes")
18 property string onsButton2: qsTr("")
19 property string onsButton3: qsTr("")
20 property string postmsg: qsTr("")
21 property string btndata: qsTr("")
23 property bool onscreen_role_set: false
29 text: "OnScreen Test App"
37 anchors.top: title.bottom
39 anchors.horizontalCenter: title.horizontalCenter
41 // show received reply information area
46 Layout.alignment: Qt.AlignCenter
47 flickableDirection: Flickable.VerticalFlick
48 boundsBehavior: Flickable.StopAtBounds
50 TextArea.flickable: TextArea {
52 text: "show received reply information area\n...\n...\n...\n...\n"
54 wrapMode: TextArea.Wrap
58 ScrollBar.vertical: ScrollBar { }
61 // select onscreen type area
64 text: qsTr("Please select send OnScreen Message")
72 Layout.alignment: Qt.AlignLeft
77 text: qsTr("One Button")
85 text: qsTr("Two Buttons")
92 text: qsTr("Three Buttons")
99 text: qsTr("No Button")
108 // edit post message area
111 text: qsTr("Post Infomations")
118 Layout.alignment: Qt.AlignLeft
119 Layout.maximumWidth: 800
120 Layout.maximumHeight: 400
128 anchors.left: parent.left
129 anchors.leftMargin: 30
130 text: qsTr("ons_title:")
141 anchors.left: ons_title.right
142 anchors.leftMargin: 20
144 Layout.maximumWidth: 600
145 Layout.maximumHeight: 40
148 elide: Text.ElideRight
149 horizontalAlignment: Label.AlignHCenter
150 verticalAlignment: Label.AlignVCenter
157 anchors.left: parent.left
158 anchors.leftMargin: 30
170 anchors.left: ons_type.right
171 anchors.leftMargin: 20
179 anchors.left: parent.left
180 anchors.leftMargin: 30
181 text: qsTr("contents:")
187 id: ons_contents_data
191 anchors.left: ons_contents.right
192 anchors.leftMargin: 20
194 Layout.maximumWidth: 600
195 Layout.maximumHeight: 200
198 elide: Text.ElideRight
199 horizontalAlignment: Label.AlignLeft
200 verticalAlignment: Label.AlignVCenter
207 anchors.left: parent.left
208 anchors.leftMargin: 30
209 text: qsTr("Button1")
220 anchors.left: btn1.right
221 anchors.leftMargin: 20
229 anchors.left: parent.left
230 anchors.leftMargin: 30
231 text: qsTr("Button2")
241 anchors.left: btn2.right
242 anchors.leftMargin: 20
250 anchors.left: parent.left
251 anchors.leftMargin: 30
252 text: qsTr("Button3")
262 anchors.left: btn3.right
263 anchors.leftMargin: 20
274 Layout.alignment: Qt.AlignCenter
281 function selectOneButton() {
282 console.log("select one button!")
283 onsTitle = qsTr("One Button title")
284 onsType = qsTr("critical")
285 onsContents = qsTr("An operating system is a program that manages a computer’s hardware.")
286 onsButton1 = qsTr("Yes")
287 onsButton2 = qsTr("")
288 onsButton3 = qsTr("")
291 function selectTwoButtons() {
292 console.log("select two buttons!")
293 onsTitle = qsTr("Two Buttons title")
294 onsType = qsTr("exclamation")
295 onsContents = qsTr("Beforewe can explore the details of computer system operation, we need to know something about system structure. We thus discuss the basic functions of system startup, I/O, and storage early in this chapter. We also describe the basic computer architecture that makes it possible to write a functional operating system.")
296 onsButton1 = qsTr("Yes")
297 onsButton2 = qsTr("No")
298 onsButton3 = qsTr("")
301 function selectThreeButtons() {
302 console.log("select three buttons!")
303 onsTitle = qsTr("Three Buttons title")
304 onsType = qsTr("information")
305 onsContents = qsTr("We can also view a computer system as consisting of hardware, software,and data. The operating system provides the means for proper use of these resources in the operation of the computer system.")
306 onsButton1 = qsTr("Yes")
307 onsButton2 = qsTr("Abort")
308 onsButton3 = qsTr("No")
311 function selectNoButton() {
312 console.log("select no button!")
313 onsTitle = qsTr("No Button title,very long title beyond screen wide which will show ellipsis at the end")
314 onsType = qsTr("question")
315 onsContents = qsTr("Recently, many varieties of mobile computers, such as smartphones and tablets, have come into fashion. Most mobile computers are standalone units for individual users. Quite often, they are connected to networks through cellular or other wireless technologies. Increasingly, these mobile devices are replacing desktop and laptop computers for people who are primarily interested in using computers for e-mail and web browsing. The user interface for mobile computers generally features a touch screen, where the user interacts with the system by pressing and swiping fingers across the screen rather than using a physical keyboard and mouse.")
316 onsButton1 = qsTr("")
317 onsButton2 = qsTr("")
318 onsButton3 = qsTr("")
321 function postMessage() {
322 console.log("poster pressed")
324 postmsg = "{\"title\": \"" + onsTitle + "\"," + "\"type\": \"" + onsType + "\"," + "\"contents\": \"" + onsContents + "\"";
325 if (onsButton1 != "") {
326 btndata = "\"" + onsButton1 + "\"";
328 if (onsButton2 != "") {
331 btndata += "\"" + onsButton2 + "\"";
333 if (onsButton3 != "") {
336 btndata += "\"" + onsButton3 + "\"";
340 postmsg += ",\"buttons\":[" + btndata + "]}"
344 if (!onscreen_role_set) {
345 eventHandler.set_window_poup(onsId, 0, 218)
346 onscreen_role_set = true
349 // if the application is not already started, start it
351 // if the application is not started, then the first time
352 // we start we also display it using the default policy engine
353 pid = eventHandler.start(onsId, postmsg)
355 // we just need to display it
356 eventHandler.showWindow(onsId, postmsg)
360 function qmlOnReplyShowWindow(text) {
361 console.log("onstestapp received:",text);