X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=sample%2Fapp%2Fmain.qml;h=b545c5375bdce764694504808e7f7e4338784edb;hb=e91a218a47f505364221c33af622ac65f6c6afd8;hp=f0a65e99d94df38ad277ef515d6724b3d8534bfd;hpb=cd39ff2c9987904617c53685a75f5fe89513ce81;p=apps%2Fonscreenapp.git diff --git a/sample/app/main.qml b/sample/app/main.qml index f0a65e9..b545c53 100644 --- a/sample/app/main.qml +++ b/sample/app/main.qml @@ -20,6 +20,14 @@ ApplicationWindow { property string postmsg: qsTr("") property string btndata: qsTr("") property int pid: -1 + property bool onscreen_role_set: false + + property string mapp_id: '' + property string mapp_data_msg: '' + + // position of the pop-up + property int x: 200 + property int y: 200 Label { id: title @@ -38,24 +46,24 @@ ApplicationWindow { anchors.horizontalCenter: title.horizontalCenter // show received reply information area - Flickable { - id: flickable - width: 800 - height: 320 - Layout.alignment: Qt.AlignCenter - flickableDirection: Flickable.VerticalFlick - boundsBehavior: Flickable.StopAtBounds - - TextArea.flickable: TextArea { - id: output - text: "show received reply information area\n...\n...\n...\n...\n" - font.pixelSize: 24 - wrapMode: TextArea.Wrap - color: '#00ADDC' - } - - ScrollBar.vertical: ScrollBar { } - } + //Flickable { + // id: flickable + // width: 400 + // height: 220 + // Layout.alignment: Qt.AlignCenter + // flickableDirection: Flickable.VerticalFlick + // boundsBehavior: Flickable.StopAtBounds + + // TextArea.flickable: TextArea { + // id: output + // text: "show received reply information area\n...\n...\n...\n...\n" + // font.pixelSize: 12 + // wrapMode: TextArea.Wrap + // color: '#00ADDC' + // } + + // ScrollBar.vertical: ScrollBar { } + // } // select onscreen type area GroupBox { @@ -317,6 +325,26 @@ ApplicationWindow { onsButton3 = qsTr("") } + Timer { + id: activate_timer + interval: 500 + running: false + repeat: false + onTriggered: { + console.log("calling eventHandler.showWindow for " + mapp_id + " and data msg " + mapp_data_msg) + eventHandler.showWindow(mapp_id, mapp_data_msg) + mapp_id = '' + mapp_data_msg = '' + } + } + + + function armTimer(app_id, msg) { + mapp_id = app_id + mapp_data_msg = msg + activate_timer.running = true + } + function postMessage() { console.log("poster pressed") btndata = "" @@ -340,19 +368,42 @@ ApplicationWindow { else postmsg += "}" + if (!onscreen_role_set) { + console.log("onscreen_role_set is not set") + eventHandler.set_window_popup(onsId, x, y) + console.log("setting for popup for " + onsId) + onscreen_role_set = true + } + // if the application is not already started, start it - if (pid == -1) { + if (pid === -1) { // if the application is not started, then the first time // we start we also display it using the default policy engine pid = eventHandler.start(onsId, postmsg) + console.log("calling eventHandler.start for " + onsId + " with pid " + pid) + + // this is necessary jus the first time as we don't queue the + // 'activate_app' event and pass it over once onscreenapp is + // started. It is implementation detail in case it is required + console.log("calling armTimer for " + onsId) + armTimer(onsId, postmsg) } else { - // we just need to display it - eventHandler.showWindow(onsId, postmsg) + // onscreenapp is already start we just need to activate + pass the data + if (!eventHandler.is_running(onsId) && pid > 0) { + // this is mostly for testing, in case onscreenapp died + // unexpectedly + eventHandler.set_window_popup(onsId, x, y) + pid = eventHandler.start(onsId, postmsg) + armTimer(onsId, postmsg) + } else { + eventHandler.showWindow(onsId, postmsg) + } } + } function qmlOnReplyShowWindow(text) { console.log("onstestapp received:",text); - output.text = text; + //output.text = text; } }