summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qlibhomescreen.cpp51
-rw-r--r--src/qlibhomescreen.h8
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: