X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=sample%2Fapp%2Fmain.qml;h=609c637c6764fce7292541be0a3bdeb0d5f19a37;hb=ff66bdf313d0695aa8042c3f707282fa68b0ead3;hp=4d23921d63cc336c041aed1e6d5129173e88baac;hpb=85a1f5f0305fda98d7077bab78070456bcd680ac;p=apps%2Fonscreenapp.git diff --git a/sample/app/main.qml b/sample/app/main.qml index 4d23921..609c637 100644 --- a/sample/app/main.qml +++ b/sample/app/main.qml @@ -19,6 +19,11 @@ ApplicationWindow { property string onsButton3: qsTr("") 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: '' Label { id: title @@ -316,6 +321,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 = "" @@ -339,13 +364,30 @@ ApplicationWindow { else postmsg += "}" + if (!onscreen_role_set) { + console.log("onscreen_role_set is not set") + eventHandler.set_window_popup(onsId, 0, 218) + console.log("setting for popup for " + onsId) + onscreen_role_set = true + } + // if the application is not already started, start it - // if the application is not started, the first time we start - // it will by shown by default - eventHandler.start(onsId, postmsg) + 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 { + // onscreenapp is already start we just need to activate + pass the data + eventHandler.showWindow(mapp_id, mapp_data_msg) + } - // we just need to display - eventHandler.showWindow(onsId, postmsg) } function qmlOnReplyShowWindow(text) {