Separate area.db from layout.db
authorYuta Doi <yuta-d@witz-inc.co.jp>
Fri, 22 Jun 2018 00:30:26 +0000 (09:30 +0900)
committerYuta Doi <yuta-d@witz-inc.co.jp>
Fri, 22 Jun 2018 00:30:26 +0000 (09:30 +0900)
Change-Id: I556d3acb292fa79c45aee25f47170d66d76b1448
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
src/CMakeLists.txt
src/layout_manager/db/area.db [new file with mode: 0644]
src/layout_manager/db/layout.db
src/layout_manager/layout.cpp
src/layout_manager/layout.hpp

index ab0fd19..f2f1162 100644 (file)
@@ -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 (file)
index 0000000..2ef9a4a
--- /dev/null
@@ -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
+            }
+        }
+    ]
+}
index 70523c5..29e40c8 100644 (file)
                 }
             ]
         }
-    ],
-    "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
-            }
-        }
     ]
 }
index a3952c4..2fcc07a 100644 (file)
@@ -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 \
             } \
         }, \
         { \
index 952765f..eade476 100644 (file)
@@ -57,9 +57,8 @@ private:
 
     std::unordered_map<std::string, compositor::rect> area2size;
 
-    int loadLayoutDb();
+    int loadAreaDb();
 };
 
 
-
 #endif  // TMCAGLWM_LAYOUT_HPP