diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-22 09:30:26 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-22 09:30:26 +0900 |
commit | 8dd0bd1e4431213d9a3bf1173deed7c3d729d610 (patch) | |
tree | b2778428944df1c461a1422bd96a2d50e83e89f8 /src/layout_manager | |
parent | 208368fcc1c61319fa2728d950688523b0557b1f (diff) |
Separate area.db from layout.db
Change-Id: I556d3acb292fa79c45aee25f47170d66d76b1448
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/layout_manager')
-rw-r--r-- | src/layout_manager/db/area.db | 94 | ||||
-rw-r--r-- | src/layout_manager/db/layout.db | 92 | ||||
-rw-r--r-- | src/layout_manager/layout.cpp | 158 | ||||
-rw-r--r-- | src/layout_manager/layout.hpp | 3 |
4 files changed, 142 insertions, 205 deletions
diff --git a/src/layout_manager/db/area.db b/src/layout_manager/db/area.db new file mode 100644 index 0000000..2ef9a4a --- /dev/null +++ b/src/layout_manager/db/area.db @@ -0,0 +1,94 @@ +{ + "areas": [ + { + "name": "fullscreen", + "rect": { + "x": 0, + "y": 0, + "w": 1080, + "h": 1920 + } + }, + { + "name": "normal", + "rect": { + "x": 0, + "y": 218, + "w": 1080, + "h": 1488 + } + }, + { + "name": "split.main", + "rect": { + "x": 0, + "y": 218, + "w": 1080, + "h": 744 + } + }, + { + "name": "split.sub", + "rect": { + "x": 0, + "y": 962, + "w": 1080, + "h": 744 + } + }, + { + "name": "software_keyboard", + "rect": { + "x": 0, + "y": 962, + "w": 1080, + "h": 744 + } + }, + { + "name": "restriction.normal", + "rect": { + "x": 0, + "y": 218, + "w": 1080, + "h": 1488 + } + }, + { + "name": "restriction.split.main", + "rect": { + "x": 0, + "y": 218, + "w": 1080, + "h": 744 + } + }, + { + "name": "restriction.split.sub", + "rect": { + "x": 0, + "y": 962, + "w": 1080, + "h": 744 + } + }, + { + "name": "pop_up", + "rect": { + "x": 0, + "y": 640, + "w": 1080, + "h": 640 + } + }, + { + "name": "system_alert", + "rect": { + "x": 0, + "y": 640, + "w": 1080, + "h": 640 + } + } + ] +} diff --git a/src/layout_manager/db/layout.db b/src/layout_manager/db/layout.db index 70523c5..29e40c8 100644 --- a/src/layout_manager/db/layout.db +++ b/src/layout_manager/db/layout.db @@ -202,97 +202,5 @@ } ] } - ], - "areas": [ - { - "name": "fullscreen", - "rect": { - "x": 0, - "y": 0, - "w": 1080, - "h": 1920 - } - }, - { - "name": "normal", - "rect": { - "x": 0, - "y": 218, - "w": 1080, - "h": 1488 - } - }, - { - "name": "split.main", - "rect": { - "x": 0, - "y": 218, - "w": 1080, - "h": 744 - } - }, - { - "name": "split.sub", - "rect": { - "x": 0, - "y": 962, - "w": 1080, - "h": 744 - } - }, - { - "name": "software_keyboard", - "rect": { - "x": 0, - "y": 962, - "w": 1080, - "h": 744 - } - }, - { - "name": "restriction.normal", - "rect": { - "x": 0, - "y": 218, - "w": 1080, - "h": 1488 - } - }, - { - "name": "restriction.split.main", - "rect": { - "x": 0, - "y": 218, - "w": 1080, - "h": 744 - } - }, - { - "name": "restriction.split.sub", - "rect": { - "x": 0, - "y": 962, - "w": 1080, - "h": 744 - } - }, - { - "name": "pop_up", - "rect": { - "x": 0, - "y": 640, - "w": 1080, - "h": 640 - } - }, - { - "name": "system_alert", - "rect": { - "x": 0, - "y": 640, - "w": 1080, - "h": 640 - } - } ] } diff --git a/src/layout_manager/layout.cpp b/src/layout_manager/layout.cpp index a3952c4..2fcc07a 100644 --- a/src/layout_manager/layout.cpp +++ b/src/layout_manager/layout.cpp @@ -30,8 +30,8 @@ int LayoutManager::initialize() { int ret = 0; - // Load layout.db - ret = this->loadLayoutDb(); + // Load area.db + ret = this->loadAreaDb(); if (0 > ret) { HMI_ERROR("wm:lm", "Load layout.db Error!!"); return ret; @@ -44,8 +44,8 @@ compositor::rect LayoutManager::getAreaSize(const char* area) { return this->area2size[area]; } -extern const char* kDefaultLayoutDb; -int LayoutManager::loadLayoutDb() { +extern const char* kDefaultAreaDb; +int LayoutManager::loadAreaDb() { HMI_DEBUG("wm:lm", "Call"); // Get afm application installed dir @@ -57,15 +57,15 @@ int LayoutManager::loadLayoutDb() { HMI_ERROR("wm:lm", "AFM_APP_INSTALL_DIR is not defined"); } else { - file_name = std::string(afm_app_install_dir) + std::string("/etc/layout.db"); + file_name = std::string(afm_app_install_dir) + std::string("/etc/area.db"); } - // Load layout.db + // Load area.db json_object* json_obj; int ret = jh::inputJsonFilie(file_name.c_str(), &json_obj); if (0 > ret) { - HMI_DEBUG("wm:lm", "Could not open layout.db, so use default layout information"); - json_obj = json_tokener_parse(kDefaultLayoutDb); + HMI_DEBUG("wm:lm", "Could not open area.db, so use default area information"); + json_obj = json_tokener_parse(kDefaultAreaDb); } HMI_DEBUG("wm:lm", "json_obj dump:%s", json_object_get_string(json_obj)); @@ -123,109 +123,18 @@ int LayoutManager::loadLayoutDb() { return 0; } -const char* kDefaultLayoutDb = "{ \ - \"layouts\": [ \ - { \ - \"name\": \"pu\", \ - \"layer\": \"on_screen\", \ - \"areas\": [ \ - { \ - \"name\": \"pop_up\", \ - \"role\": \"incomming_call\" \ - } \ - ] \ - }, \ - { \ - \"name\": \"sa\", \ - \"layer\": \"on_screen\", \ - \"areas\": [ \ - { \ - \"name\": \"system_alert\", \ - \"role\": \"system_alert\" \ - } \ - ] \ - }, \ - { \ - \"name\": \"m1\", \ - \"layer\": \"apps\", \ - \"areas\": [ \ - { \ - \"name\": \"normal\", \ - \"role\": \"map\" \ - } \ - ] \ - }, \ - { \ - \"name\": \"m2\", \ - \"layer\": \"apps\", \ - \"areas\": [ \ - { \ - \"name\": \"split.main\", \ - \"role\": \"map\" \ - }, \ - { \ - \"name\": \"split.sub\", \ - \"category\": \"hvac\" \ - } \ - ] \ - }, \ - { \ - \"name\": \"mf\", \ - \"layer\": \"apps\", \ - \"areas\": [ \ - { \ - \"name\": \"full\", \ - \"role\": \"map\" \ - } \ - ] \ - }, \ - { \ - \"name\": \"s1\", \ - \"layer\": \"apps\", \ - \"areas\": [ \ - { \ - \"name\": \"normal\", \ - \"category\": \"splitable\" \ - } \ - ] \ - }, \ - { \ - \"name\": \"s2\", \ - \"layer\": \"apps\", \ - \"areas\": [ \ - { \ - \"name\": \"split.main\", \ - \"category\": \"splitable\" \ - }, \ - { \ - \"name\": \"split.sub\", \ - \"category\": \"splitable\" \ - } \ - ] \ - }, \ +const char* kDefaultAreaDb = "{ \ + \"areas\": [ \ { \ - \"name\": \"g\", \ - \"layer\": \"apps\", \ - \"areas\": [ \ - { \ - \"name\": \"normal\", \ - \"category\": \"general\" \ - } \ - ] \ + \"name\": \"fullscreen\", \ + \"rect\": { \ + \"x\": 0, \ + \"y\": 0, \ + \"w\": 1080, \ + \"h\": 1920 \ + } \ }, \ { \ - \"name\": \"hs\", \ - \"layer\": \"homescreen\", \ - \"areas\": [ \ - { \ - \"name\": \"full\", \ - \"role\": \"homescreen\" \ - } \ - ] \ - } \ - ], \ - \"areas\": [ \ - { \ \"name\": \"normal\", \ \"rect\": { \ \"x\": 0, \ @@ -253,12 +162,39 @@ const char* kDefaultLayoutDb = "{ \ } \ }, \ { \ - \"name\": \"full\", \ + \"name\": \"software_keyboard\", \ \"rect\": { \ \"x\": 0, \ - \"y\": 0, \ + \"y\": 962, \ \"w\": 1080, \ - \"h\": 1920 \ + \"h\": 744 \ + } \ + }, \ + { \ + \"name\": \"restriction.normal\", \ + \"rect\": { \ + \"x\": 0, \ + \"y\": 218, \ + \"w\": 1080, \ + \"h\": 1488 \ + } \ + }, \ + { \ + \"name\": \"restriction.split.main\", \ + \"rect\": { \ + \"x\": 0, \ + \"y\": 218, \ + \"w\": 1080, \ + \"h\": 744 \ + } \ + }, \ + { \ + \"name\": \"restriction.split.sub\", \ + \"rect\": { \ + \"x\": 0, \ + \"y\": 962, \ + \"w\": 1080, \ + \"h\": 744 \ } \ }, \ { \ diff --git a/src/layout_manager/layout.hpp b/src/layout_manager/layout.hpp index 952765f..eade476 100644 --- a/src/layout_manager/layout.hpp +++ b/src/layout_manager/layout.hpp @@ -57,9 +57,8 @@ private: std::unordered_map<std::string, compositor::rect> area2size; - int loadLayoutDb(); + int loadAreaDb(); }; - #endif // TMCAGLWM_LAYOUT_HPP |