app/: Fixes and some monior tweaks to the qml file
authorMarius Vlad <marius.vlad@collabora.com>
Mon, 13 Apr 2020 11:48:20 +0000 (14:48 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Tue, 14 Apr 2020 19:26:39 +0000 (22:26 +0300)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
app/eventhandler.cpp
app/main.qml
app/onscreenmodel.cpp
app/onscreenmodel.h

index 9ffd6bb..dfa0a12 100644 (file)
@@ -164,7 +164,7 @@ void EventHandler::activateWindow(const char *role, const char *area)
     HMI_DEBUG(APP_ID, "EventHandler::activateWindow()");
     mp_wm->activateWindow(role, area);
 #endif
-       fprintf(stdout, "EventHandler::activateWindow() role %s, area %s\n",
+       fprintf(stderr, "EventHandler::activateWindow() role %s, area %s\n",
                        role, area);
 }
 
@@ -184,21 +184,21 @@ void EventHandler::deactivateWindow()
     }
 #endif
        int display_status = getDisplayStatus();
-       fprintf(stdout, "EventHandler::deactivateWindow(), "
+       fprintf(stderr, "EventHandler::deactivateWindow(), "
                        "display_status %d\n", display_status);
 }
 
 void EventHandler::onScreenReply(const QString &ons_title, const QString &btn_name)
 {
-#if 0
-    HMI_DEBUG(APP_ID, "ons_title=%s btn_name=%s", ons_title.toStdString().c_str(), btn_name.toStdString().c_str());
+    fprintf(stderr, "ons_title=%s btn_name=%s\n", ons_title.toStdString().c_str(), btn_name.toStdString().c_str());
     emit this->hideOnScreen();
 
+#if 0
     struct json_object* j_param = json_object_new_object();
     json_object_object_add(j_param, _onscreen_title, json_object_new_string(ons_title.toStdString().c_str()));
     json_object_object_add(j_param, _button_name, json_object_new_string(btn_name.toStdString().c_str()));
     mp_hs->replyShowWindow(m_dsp.first.toStdString().c_str(), j_param);
 #endif
-    fprintf(stdout, "EventHandler::onScreenReply with ons_title %s, btn_name %s\n",
+    fprintf(stderr, "EventHandler::onScreenReply with ons_title %s, btn_name %s\n",
                    ons_title.toStdString().c_str(), btn_name.toStdString().c_str());
 }
index 99d50f8..dd478c3 100644 (file)
@@ -25,8 +25,8 @@ Window {
     id: root
     flags: Qt.FramelessWindowHint
     visible: true
-    x: 0
-    y:         218
+    x: 0       // note, these are not set here
+    y:         218     // note, these are not set here
     width: 1080
     height: 1488
     color: '#00000000'
@@ -108,6 +108,13 @@ Window {
         ons.btn1Name = onscreenModel.buttonName(0)
         ons.btn2Name = onscreenModel.buttonName(1)
         ons.btn3Name = onscreenModel.buttonName(2)
+
+       console.log("dsp_title = " + ons.dsp_title + ", dsp_contents = " + ons.dsp_contents)
+       if (ons.btnNum > 0) {
+               console.log("Got ons.btNum > 0  " + ons.btnNum)
+       } else {
+               console.log("ons.btNum is " + ons.btnNum)
+       }
         ons_timer.running =  ons.btnNum > 0 ? false : true
         ons.dsp_sts = "show"
     }
@@ -122,4 +129,8 @@ Window {
         console.log(qsTr('onscreenapp >>> setModel status: ' + data));
         onscreenModel.setModel(data)
     }
+
+    function clearOnScreenModel() {
+           onscreenModel.clearModel()
+    }
 }
index 184d1a6..c36f0e9 100644 (file)
@@ -27,34 +27,38 @@ const char _buttons[] = "buttons";
 
 void OnScreenModel::setModel(QVariant data)
 {
-    HMI_DEBUG(_modelName, "setModel start!");
+    fprintf(stderr, "OnScreenModel::setModel: setModel start!\n");
+
     clearModel();
     struct json_object *j_title = nullptr, *j_type = nullptr, *j_contents = nullptr, *j_buttons = nullptr;
     struct json_object *j_param = json_tokener_parse(data.toString().toStdString().c_str());
+
+    fprintf(stderr, "OnScreenModel::setModel receiving end: %s\n", data.toString().toStdString().c_str());
+
     if(json_object_object_get_ex(j_param, _title, &j_title)) {
         m_title = json_object_get_string(j_title);
     }
     else {
-        HMI_DEBUG(_modelName, "title input is null");
+        fprintf(stderr, "OnScreenModel::setModel: title input is null\n");
     }
 
     if(json_object_object_get_ex(j_param, _type, &j_type)) {
         m_type = json_object_get_string(j_type);
     }
     else {
-        HMI_DEBUG(_modelName, "type input is null");
+        fprintf(stderr, "OnScreenModel::setModel: type input is null\n");
     }
 
     if(json_object_object_get_ex(j_param, _contents, &j_contents)) {
         m_contents = json_object_get_string(j_contents);
     }
     else {
-        HMI_DEBUG(_modelName, "contents input is null");
+        fprintf(stderr, "OnScreenModel::setModel: contents input is null\n");
     }
 
     if(json_object_object_get_ex(j_param, _buttons, &j_buttons)) {
         if(json_object_get_type(j_buttons) != json_type_array) {
-            HMI_DEBUG(_modelName, "buttons josn type isn't array!");
+            fprintf(stderr, "OnScreenModel::setModel buttons josn type isn't array!\n");
         }
         else {
             m_buttons.clear();
@@ -67,9 +71,10 @@ void OnScreenModel::setModel(QVariant data)
         }
     }
     else {
-        HMI_DEBUG("OnScreenModel", "buttons input is null");
+        fprintf(stderr, "OnScreenModel::setModel: buttons input is null\n");
     }
-    HMI_DEBUG(_modelName, "setModel end!titile=%s,type=%s,contents=%s,btnNum=%d",
+
+    fprintf(stderr, "OnScreenModel::setModel setModel end!titile=%s,type=%s,contents=%s,btnNum=%d\n",
               m_title.toStdString().c_str(), m_type.toStdString().c_str(), m_contents.toStdString().c_str(), m_buttons.size());
 }
 
index e12b269..4227cf8 100644 (file)
@@ -35,10 +35,9 @@ public:
     Q_INVOKABLE int buttonNum(void) const {return m_buttons.size();}
     Q_INVOKABLE QString buttonName(int index) const;
     Q_INVOKABLE void setModel(QVariant data);
+    Q_INVOKABLE void clearModel(void);
 
 private:
-    void clearModel(void);
-
     QString m_title;
     QString m_type;
     QString m_contents;