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("")
27 text: "OnScreen Test App"
35 anchors.top: title.bottom
37 anchors.horizontalCenter: title.horizontalCenter
39 // show received reply information area
44 Layout.alignment: Qt.AlignCenter
45 flickableDirection: Flickable.VerticalFlick
46 boundsBehavior: Flickable.StopAtBounds
48 TextArea.flickable: TextArea {
50 text: "show received reply information area\n...\n...\n...\n...\n"
52 wrapMode: TextArea.Wrap
56 ScrollBar.vertical: ScrollBar { }
59 // select onscreen type area
62 text: qsTr("Please select send OnScreen Message")
70 Layout.alignment: Qt.AlignLeft
75 text: qsTr("One Button")
83 text: qsTr("Two Buttons")
90 text: qsTr("Three Buttons")
97 text: qsTr("No Button")
106 // edit post message area
109 text: qsTr("Post Infomations")
116 Layout.alignment: Qt.AlignLeft
117 Layout.maximumWidth: 800
118 Layout.maximumHeight: 400
126 anchors.left: parent.left
127 anchors.leftMargin: 30
128 text: qsTr("ons_title:")
139 anchors.left: ons_title.right
140 anchors.leftMargin: 20
142 Layout.maximumWidth: 600
143 Layout.maximumHeight: 40
146 elide: Text.ElideRight
147 horizontalAlignment: Label.AlignHCenter
148 verticalAlignment: Label.AlignVCenter
155 anchors.left: parent.left
156 anchors.leftMargin: 30
168 anchors.left: ons_type.right
169 anchors.leftMargin: 20
177 anchors.left: parent.left
178 anchors.leftMargin: 30
179 text: qsTr("contents:")
185 id: ons_contents_data
189 anchors.left: ons_contents.right
190 anchors.leftMargin: 20
192 Layout.maximumWidth: 600
193 Layout.maximumHeight: 200
196 elide: Text.ElideRight
197 horizontalAlignment: Label.AlignLeft
198 verticalAlignment: Label.AlignVCenter
205 anchors.left: parent.left
206 anchors.leftMargin: 30
207 text: qsTr("Button1")
218 anchors.left: btn1.right
219 anchors.leftMargin: 20
227 anchors.left: parent.left
228 anchors.leftMargin: 30
229 text: qsTr("Button2")
239 anchors.left: btn2.right
240 anchors.leftMargin: 20
248 anchors.left: parent.left
249 anchors.leftMargin: 30
250 text: qsTr("Button3")
260 anchors.left: btn3.right
261 anchors.leftMargin: 20
272 Layout.alignment: Qt.AlignCenter
279 function selectOneButton() {
280 console.log("select one button!")
281 onsTitle = qsTr("One Button title")
282 onsType = qsTr("critical")
283 onsContents = qsTr("An operating system is a program that manages a computer’s hardware.")
284 onsButton1 = qsTr("Yes")
285 onsButton2 = qsTr("")
286 onsButton3 = qsTr("")
289 function selectTwoButtons() {
290 console.log("select two buttons!")
291 onsTitle = qsTr("Two Buttons title")
292 onsType = qsTr("exclamation")
293 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.")
294 onsButton1 = qsTr("Yes")
295 onsButton2 = qsTr("No")
296 onsButton3 = qsTr("")
299 function selectThreeButtons() {
300 console.log("select three buttons!")
301 onsTitle = qsTr("Three Buttons title")
302 onsType = qsTr("information")
303 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.")
304 onsButton1 = qsTr("Yes")
305 onsButton2 = qsTr("Abort")
306 onsButton3 = qsTr("No")
309 function selectNoButton() {
310 console.log("select no button!")
311 onsTitle = qsTr("No Button title,very long title beyond screen wide which will show ellipsis at the end")
312 onsType = qsTr("question")
313 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.")
314 onsButton1 = qsTr("")
315 onsButton2 = qsTr("")
316 onsButton3 = qsTr("")
319 function postMessage() {
320 console.log("poster pressed")
322 postmsg = "{\"title\": \"" + onsTitle + "\"," + "\"type\": \"" + onsType + "\"," + "\"contents\": \"" + onsContents + "\"";
323 if (onsButton1 != "") {
324 btndata = "\"" + onsButton1 + "\"";
326 if (onsButton2 != "") {
329 btndata += "\"" + onsButton2 + "\"";
331 if (onsButton3 != "") {
334 btndata += "\"" + onsButton3 + "\"";
338 postmsg += ",\"buttons\":[" + btndata + "]}"
342 eventHandler.showWindow(onsId, postmsg);
345 function qmlOnReplyShowWindow(text) {
346 console.log("onstestapp received:",text);