X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=sample%2Fapp%2Feventhandler.cpp;h=34e7e3ef150fe698c6a6519fc235f60928afeb00;hb=5ba4327b148f81852c6e2a53bc51ab07b238602e;hp=b88bda48b5d77c277ab9f908bbc41a4d34c9488f;hpb=e79d82c88e350e6b882158624363b82fe3e2d91a;p=apps%2Fonscreenapp.git diff --git a/sample/app/eventhandler.cpp b/sample/app/eventhandler.cpp index b88bda4..34e7e3e 100644 --- a/sample/app/eventhandler.cpp +++ b/sample/app/eventhandler.cpp @@ -19,11 +19,15 @@ #include #include #include -#include +//#include +#include +#include #include "eventhandler.h" void* EventHandler::myThis = 0; +const char _drawing_name[] = "drawing_name"; + EventHandler::EventHandler(QObject *parent) : QObject(parent), mp_hs(NULL), @@ -52,8 +56,8 @@ void EventHandler::init(int port, const char *token) mp_hs = new QLibHomeScreen(); mp_hs->init(port, token); - mp_hs->set_event_handler(QLibHomeScreen::Event_TapShortcut, [this](json_object *object){ - this->mp_wm->activateWindow(ROLE_NAME); + mp_hs->set_event_handler(QLibHomeScreen::Event_ShowWindow, [this](json_object *object){ + this->mp_wm->activateWindow(ROLE_NAME, "normal"); HMI_DEBUG(APP_ID, "received showWindow event, end!, line=%d", __LINE__); }); @@ -76,7 +80,7 @@ void EventHandler::init(int port, const char *token) mp_wm->set_event_handler(QLibWindowmanager::Event_Visible, [this](json_object *object) { struct json_object *value; - json_object_object_get_ex(object, "drawing_name", &value); + json_object_object_get_ex(object, _drawing_name, &value); const char *name = json_object_get_string(value); HMI_DEBUG(APP_ID, "Event_Active kKeyDrawingName = %s", name); @@ -84,7 +88,7 @@ void EventHandler::init(int port, const char *token) mp_wm->set_event_handler(QLibWindowmanager::Event_Invisible, [this](json_object *object) { struct json_object *value; - json_object_object_get_ex(object, "drawing_name", &value); + json_object_object_get_ex(object, _drawing_name, &value); const char *name = json_object_get_string(value); HMI_DEBUG(APP_ID, "Event_Inactive kKeyDrawingName = %s", name); @@ -106,3 +110,8 @@ void EventHandler::showWindow(QString id, QString json) else mp_hs->showWindow(id.toStdString().c_str(), json_tokener_parse(json.toStdString().c_str())); } + +void EventHandler::hideWindow(QString id) +{ + mp_hs->hideWindow(id.toStdString().c_str()); +}