diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2020-04-13 14:48:20 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2020-04-14 22:26:39 +0300 |
commit | 7ad4b093049453a54e4e0711d9e73ea693b85eea (patch) | |
tree | cb90acc0f07a3ca3c2b6c85a7c29c693327af732 | |
parent | 69ab2870ea1fbac6808dac791e141f3009e98724 (diff) |
app/: Fixes and some monior tweaks to the qml file
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r-- | app/eventhandler.cpp | 10 | ||||
-rw-r--r-- | app/main.qml | 15 | ||||
-rw-r--r-- | app/onscreenmodel.cpp | 19 | ||||
-rw-r--r-- | app/onscreenmodel.h | 3 |
4 files changed, 31 insertions, 16 deletions
diff --git a/app/eventhandler.cpp b/app/eventhandler.cpp index 9ffd6bb..dfa0a12 100644 --- a/app/eventhandler.cpp +++ b/app/eventhandler.cpp @@ -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()); } diff --git a/app/main.qml b/app/main.qml index 99d50f8..dd478c3 100644 --- a/app/main.qml +++ b/app/main.qml @@ -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() + } } diff --git a/app/onscreenmodel.cpp b/app/onscreenmodel.cpp index 184d1a6..c36f0e9 100644 --- a/app/onscreenmodel.cpp +++ b/app/onscreenmodel.cpp @@ -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()); } diff --git a/app/onscreenmodel.h b/app/onscreenmodel.h index e12b269..4227cf8 100644 --- a/app/onscreenmodel.h +++ b/app/onscreenmodel.h @@ -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; |