diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-12-03 14:48:50 +0800 |
---|---|---|
committer | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2018-12-03 16:27:51 +0800 |
commit | b218476402bceda7eb42d41064552a7261ff3205 (patch) | |
tree | 5adf90b7d10f60a208d0bc9886e5908cf50cd4f7 | |
parent | fdeea80c0f5b22fb50e176c98c85dace9b99edd5 (diff) |
fix issue and modify function parameter nameneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.1marlin/12.90.0lamprey_11.92.0lamprey_11.91.0lamprey/11.92.0lamprey/11.91.0koi_10.93.0koi_10.92.0koi_10.91.0koi/10.93.0koi/10.92.0koi/10.91.0jellyfish_9.99.4jellyfish_9.99.3jellyfish_9.99.2jellyfish_9.99.1jellyfish/9.99.4jellyfish/9.99.3jellyfish/9.99.2jellyfish/9.99.1icefish_8.99.5icefish_8.99.4icefish_8.99.3icefish_8.99.2icefish_8.99.1icefish/8.99.5icefish/8.99.4icefish/8.99.3icefish/8.99.2icefish/8.99.1halibut_8.0.6halibut_8.0.5halibut_8.0.4halibut_8.0.3halibut_8.0.2halibut_8.0.1halibut_8.0.0halibut_7.99.3halibut_7.99.2halibut_7.99.1halibut_7.90.0halibut/8.0.6halibut/8.0.5halibut/8.0.4halibut/8.0.3halibut/8.0.2halibut/8.0.1halibut/8.0.0halibut/7.99.3halibut/7.99.2halibut/7.99.1halibut/7.90.0guppy_6.99.4guppy_6.99.3guppy/6.99.4guppy/6.99.39.99.49.99.39.99.29.99.18.99.58.99.48.99.38.99.28.99.18.0.68.0.58.0.48.0.38.0.28.0.18.0.07.99.37.99.27.99.17.90.06.99.46.99.313.93.012.93.012.92.012.91.012.90.112.90.011.92.011.91.010.93.010.92.010.91.0halibut
1.it's wrong to use json_tokener_parse to convert char* to area json_object
in showWindow,remake area json_object.
2.modify function parameter name and comments to make it easy to understand
Change-Id: I24b1425d429cb63f47f82e679076171cd1d2c011
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
-rw-r--r-- | src/qlibhomescreen.cpp | 51 | ||||
-rw-r--r-- | src/qlibhomescreen.h | 8 |
2 files changed, 32 insertions, 27 deletions
diff --git a/src/qlibhomescreen.cpp b/src/qlibhomescreen.cpp index f769469..c67d408 100644 --- a/src/qlibhomescreen.cpp +++ b/src/qlibhomescreen.cpp @@ -182,38 +182,42 @@ void QLibHomeScreen::tapShortcut(QString application_id) } /** - * show application by application id + * show application by application id and display area * * #### Parameters * - application_id : application id - * - json : json parameters + * - area : display area liked {"area":"normal"} * * #### Return * - None. * */ -void QLibHomeScreen::showWindow(QString application_id, json_object* json) +void QLibHomeScreen::showWindow(QString application_id, json_object* area) { - mp_hs->showWindow(application_id.toStdString().c_str(), json); + mp_hs->showWindow(application_id.toStdString().c_str(), area); } /** - * show application by application id, json string + * show application by application id and display area * * #### Parameters * - application_id : application id - * - json : json parameters + * - area : display area liked "normal" * * #### Return * - None. * */ -void QLibHomeScreen::showWindow(QString application_id, QString json) +void QLibHomeScreen::showWindow(QString application_id, QString area) { - if(json.isNull()) + if(area.isNull()) { mp_hs->showWindow(application_id.toStdString().c_str(), nullptr); - else - mp_hs->showWindow(application_id.toStdString().c_str(), json_tokener_parse(json.toStdString().c_str())); + } else { + struct json_object *j_obj = json_object_new_object(); + struct json_object *value = json_object_new_string(area.toStdString().c_str()); + json_object_object_add(j_obj, "area", value); + mp_hs->showWindow(application_id.toStdString().c_str(), j_obj); + } } /** @@ -232,47 +236,47 @@ void QLibHomeScreen::hideWindow(QString application_id) } /** - * send onscreen or software keyboard message to application + * send onscreen reply to application * * #### Parameters * - application_id : application id - * - json : json parameters + * - reply : the reply contents * * #### Return * - None. * */ -void QLibHomeScreen::replyShowWindow(QString application_id, json_object* json) +void QLibHomeScreen::replyShowWindow(QString application_id, json_object* reply) { - mp_hs->replyShowWindow(application_id.toStdString().c_str(), json); + mp_hs->replyShowWindow(application_id.toStdString().c_str(), reply); } /** - * send onscreen or software keyboard message to application + * send onscreen reply to application * * #### Parameters * - application_id : application id - * - json : json parameters + * - reply : the reply contents which can convert to json * * #### Return * - None. * */ -void QLibHomeScreen::replyShowWindow(QString application_id, QString json) +void QLibHomeScreen::replyShowWindow(QString application_id, QString reply) { - if(json.isNull()) + if(reply.isNull()) mp_hs->replyShowWindow(application_id.toStdString().c_str(), nullptr); else - mp_hs->replyShowWindow(application_id.toStdString().c_str(), json_tokener_parse(json.toStdString().c_str())); + mp_hs->replyShowWindow(application_id.toStdString().c_str(), json_tokener_parse(reply.toStdString().c_str())); } /** * show information * - * use libhomescreen api to push information to menubarApp + * push information to HomeScreen * * #### Parameters - * - params : json parameters + * - info : information that want to show * * #### Return * - None. @@ -290,10 +294,11 @@ void QLibHomeScreen::showInformation(QString info) /** * show notification * - * use libhomescreen api to push notification to menubarApp + * push notification to HomeScreen * * #### Parameters - * - params : json parameters + * - icon : provided icon + * - text : text that want to show * * #### Resturn * - None. diff --git a/src/qlibhomescreen.h b/src/qlibhomescreen.h index e613de3..5dd1ae5 100644 --- a/src/qlibhomescreen.h +++ b/src/qlibhomescreen.h @@ -46,8 +46,8 @@ public: void init(int port, const QString &token); void set_event_handler(enum QEventType et, handler_fun f); - void showWindow(QString application_id, json_object* json); - void replyShowWindow(QString application_id, json_object* json); + void showWindow(QString application_id, json_object* area); + void replyShowWindow(QString application_id, json_object* reply); Q_INVOKABLE void showInformation(QString info); Q_INVOKABLE void showNotification(QString icon, QString text); @@ -55,9 +55,9 @@ public: Q_INVOKABLE int subscribe(const QString &eventName); Q_INVOKABLE int unsubscribe(const QString &eventName); Q_INVOKABLE void tapShortcut(QString application_id); - Q_INVOKABLE void showWindow(QString application_id, QString json); + Q_INVOKABLE void showWindow(QString application_id, QString area); Q_INVOKABLE void hideWindow(QString application_id); - Q_INVOKABLE void replyShowWindow(QString application_id, QString json); + Q_INVOKABLE void replyShowWindow(QString application_id, QString reply); signals: |