sample/app/main: Remove flickable and make it more resilient
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 15 Apr 2020 20:48:02 +0000 (23:48 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 15 Apr 2020 20:48:02 +0000 (23:48 +0300)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
sample/app/main.qml

index 609c637..b545c53 100644 (file)
@@ -25,6 +25,10 @@ ApplicationWindow {
     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
         width: parent.width
@@ -42,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 {
@@ -366,7 +370,7 @@ ApplicationWindow {
 
        if (!onscreen_role_set) {
                console.log("onscreen_role_set is not set")
-               eventHandler.set_window_popup(onsId, 0, 218)
+               eventHandler.set_window_popup(onsId, x, y)
                console.log("setting for popup for " + onsId)
                onscreen_role_set = true
        }
@@ -385,13 +389,21 @@ ApplicationWindow {
                armTimer(onsId, postmsg)
        } else {
                // onscreenapp is already start we just need to activate + pass the data
-               eventHandler.showWindow(mapp_id, mapp_data_msg)
+               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;
     }
 }