From 8dd0bd1e4431213d9a3bf1173deed7c3d729d610 Mon Sep 17 00:00:00 2001 From: Yuta Doi Date: Fri, 22 Jun 2018 09:30:26 +0900 Subject: Separate area.db from layout.db Change-Id: I556d3acb292fa79c45aee25f47170d66d76b1448 Signed-off-by: Yuta Doi --- src/CMakeLists.txt | 1 + src/layout_manager/db/area.db | 94 ++++++++++++++++++++++++ src/layout_manager/db/layout.db | 92 ----------------------- src/layout_manager/layout.cpp | 158 ++++++++++++---------------------------- src/layout_manager/layout.hpp | 3 +- 5 files changed, 143 insertions(+), 205 deletions(-) create mode 100644 src/layout_manager/db/area.db (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab0fd19..f2f1162 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -127,6 +127,7 @@ add_custom_command(TARGET ${TARGETS_WM} POST_BUILD COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_WM}.so ${PROJECT_BINARY_DIR}/package/root/lib COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers.json ${PROJECT_BINARY_DIR}/package/root/etc + COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/layout_manager/db/area.db ${PROJECT_BINARY_DIR}/package/root/etc COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/layout_manager/db/layout.db ${PROJECT_BINARY_DIR}/package/root/etc COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/${PLUGIN_PM}/db/role.db ${PROJECT_BINARY_DIR}/package/root/etc COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/db/app.db ${PROJECT_BINARY_DIR}/package/root/etc 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,108 +123,17 @@ 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\": { \ @@ -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 area2size; - int loadLayoutDb(); + int loadAreaDb(); }; - #endif // TMCAGLWM_LAYOUT_HPP -- cgit 1.2.3-korg