diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2019-04-13 10:42:23 +0800 |
---|---|---|
committer | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2019-04-13 10:42:23 +0800 |
commit | 546a95eb9b061d78deac570afb20ae8afae793a7 (patch) | |
tree | 80ee52b7c44b88e3803487dfae98dfdd49536999 | |
parent | d01f3c61041ff7b8d2d942f99680407ee10320bc (diff) |
add registerShortCut
Change-Id: I1a1f433e4d788765f5214a948ea44f3c779ff965
-rw-r--r-- | include/libhomescreen.hpp | 3 | ||||
-rw-r--r-- | src/libhomescreen.cpp | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/include/libhomescreen.hpp b/include/libhomescreen.hpp index 0fed49f..b7aae77 100644 --- a/include/libhomescreen.hpp +++ b/include/libhomescreen.hpp @@ -47,7 +47,8 @@ public: Event_HideWindow, Event_ReplyShowWindow, Event_ShowNotification, - Event_ShowInformation + Event_ShowInformation, + Event_RegisterShortCut }; /* Key for json obejct */ diff --git a/src/libhomescreen.cpp b/src/libhomescreen.cpp index 121def7..f302c3b 100644 --- a/src/libhomescreen.cpp +++ b/src/libhomescreen.cpp @@ -47,7 +47,8 @@ const std::vector<std::string> LibHomeScreen::api_list { std::string("hideWindow"), std::string("replyShowWindow"), std::string("showNotification"), - std::string("showInformation") + std::string("showInformation"), + std::string("registerShortcut") }; const std::vector<std::string> LibHomeScreen::event_list { @@ -59,6 +60,7 @@ const std::vector<std::string> LibHomeScreen::event_list { std::string("replyShowWindow"), std::string("showNotification"), std::string("showInformation"), + std::string("registerShortcut"), std::string("none") }; @@ -326,6 +328,9 @@ void LibHomeScreen::set_event_handler(enum EventType et, handler_func f) case Event_ShowInformation: this->subscribe(LibHomeScreen::event_list[6]); break; + case Event_RegisterShortCut: + this->subscribe(LibHomeScreen::event_list[7]); + break; } this->handlers[et] = std::move(f); @@ -692,6 +697,12 @@ void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_m i->second(json_data); } } + else if (strcasecmp(event_type, LibHomeScreen::event_list[7].c_str()) == 0) { + auto i = this->handlers.find(Event_RegisterShortCut); + if ( i != this->handlers.end() ) { + i->second(json_data); + } + } } /** |