fix issue and modify function parameter name 09/18509/2 halibut 10.91.0 10.92.0 10.93.0 11.91.0 11.92.0 12.90.0 12.90.1 12.91.0 12.92.0 12.93.0 13.93.0 6.99.3 6.99.4 7.90.0 7.99.1 7.99.2 7.99.3 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.99.1 8.99.2 8.99.3 8.99.4 8.99.5 9.99.1 9.99.2 9.99.3 9.99.4 guppy/6.99.3 guppy/6.99.4 guppy_6.99.3 guppy_6.99.4 halibut/7.90.0 halibut/7.99.1 halibut/7.99.2 halibut/7.99.3 halibut/8.0.0 halibut/8.0.1 halibut/8.0.2 halibut/8.0.3 halibut/8.0.4 halibut/8.0.5 halibut/8.0.6 halibut_7.90.0 halibut_7.99.1 halibut_7.99.2 halibut_7.99.3 halibut_8.0.0 halibut_8.0.1 halibut_8.0.2 halibut_8.0.3 halibut_8.0.4 halibut_8.0.5 halibut_8.0.6 icefish/8.99.1 icefish/8.99.2 icefish/8.99.3 icefish/8.99.4 icefish/8.99.5 icefish_8.99.1 icefish_8.99.2 icefish_8.99.3 icefish_8.99.4 icefish_8.99.5 jellyfish/9.99.1 jellyfish/9.99.2 jellyfish/9.99.3 jellyfish/9.99.4 jellyfish_9.99.1 jellyfish_9.99.2 jellyfish_9.99.3 jellyfish_9.99.4 koi/10.91.0 koi/10.92.0 koi/10.93.0 koi_10.91.0 koi_10.92.0 koi_10.93.0 lamprey/11.91.0 lamprey/11.92.0 lamprey_11.91.0 lamprey_11.92.0 marlin/12.90.0 marlin/12.90.1 marlin/12.91.0 marlin/12.92.0 marlin/12.93.0 marlin_12.90.0 marlin_12.90.1 marlin_12.91.0 marlin_12.92.0 marlin_12.93.0 needlefish/13.93.0 needlefish_13.93.0
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Mon, 3 Dec 2018 06:48:50 +0000 (14:48 +0800)
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Mon, 3 Dec 2018 08:27:51 +0000 (16:27 +0800)
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>
src/qlibhomescreen.cpp
src/qlibhomescreen.h

index f769469..c67d408 100644 (file)
@@ -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.
index e613de3..5dd1ae5 100644 (file)
@@ -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: