Remove config source
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Thu, 21 Jun 2018 07:44:50 +0000 (16:44 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Thu, 21 Jun 2018 07:49:11 +0000 (16:49 +0900)
This is because the source doesn't have a big deal work,
so integrate the source to the app.cpp

Change-Id: I7def8effd287043a9e6955548f1c26092ad808a7
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/CMakeLists.txt
src/app.cpp
src/app.hpp
src/config.cpp [deleted file]
src/config.hpp [deleted file]
src/policy.hpp [deleted file]

index 597a610..c92190e 100644 (file)
@@ -41,9 +41,6 @@ add_library(${TARGETS_WM} MODULE
    layers.cpp
    layers.hpp
    controller_hooks.hpp
-   config.cpp
-   config.hpp
-   policy.hpp
    wm_client.cpp
    wm_error.cpp
    applist.cpp
index c7b0391..8ff0c17 100644 (file)
@@ -160,17 +160,26 @@ App::App(wl::display *d)
       display{d},
       controller{},
       outputs(),
-      config(),
       layers(),
       id_alloc{},
-      pending_events(false),
-      policy{}
+      pending_events(false)
 {
+    char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR");
+    std::string path;
+    if (!path_layers_json)
+    {
+        HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined");
+        path = std::string(path_layers_json);
+    }
+    else
+    {
+        path = std::string(path_layers_json) + std::string("/etc/layers.json");
+    }
+
     try
     {
         {
-            auto l = load_layer_map(
-                this->config.get_string("layers.json").value().c_str());
+            auto l = load_layer_map(path.c_str());
             if (l.is_ok())
             {
                 this->layers = l.unwrap();
index 80a9142..4df650a 100644 (file)
 #include <unordered_map>
 #include <unordered_set>
 #include <experimental/optional>
-#include "config.hpp"
 #include "controller_hooks.hpp"
 #include "layers.hpp"
 #include "layout.hpp"
-#include "policy.hpp"
 #include "result.hpp"
 #include "wayland_ivi_wm.hpp"
 #include "hmi-debug.h"
@@ -179,8 +177,6 @@ struct App
     std::unique_ptr<struct compositor::controller> controller;
     std::vector<std::unique_ptr<struct wl::output>> outputs;
 
-    struct config config;
-
     // track current layouts separately
     layer_map layers;
 
@@ -190,8 +186,6 @@ struct App
     // Set by AFB API when wayland events need to be dispatched
     std::atomic<bool> pending_events;
 
-    Policy policy;
-
     std::map<const char *, struct afb_event> map_afb_event;
 
     // Surface are info (x, y, w, h)
diff --git a/src/config.cpp b/src/config.cpp
deleted file mode 100644 (file)
index 7b18224..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "config.hpp"
-#include "hmi-debug.h"
-
-namespace wm
-{
-
-config::config() : cfg()
-{
-    // Supply default values for these...
-    char const *path_layers_json = getenv("AFM_APP_INSTALL_DIR");
-
-    if (!path_layers_json)
-    {
-        HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined");
-    }
-    else
-    {
-        this->cfg["layers.json"] = std::string(path_layers_json) + std::string("/etc/layers.json");
-    }
-}
-
-} // namespace wm
diff --git a/src/config.hpp b/src/config.hpp
deleted file mode 100644 (file)
index 43fb67e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef TMCAGLWM_CONFIG_HPP
-#define TMCAGLWM_CONFIG_HPP
-
-#include <experimental/optional>
-#include <map>
-
-namespace wm
-{
-
-using std::experimental::nullopt;
-using std::experimental::optional;
-
-struct config
-{
-    typedef std::map<std::string, std::string> map;
-
-    map cfg;
-
-    config();
-
-    optional<std::string> get_string(char const *s)
-    {
-        auto i = this->cfg.find(s);
-        return i != this->cfg.end() ? optional<std::string>(i->second) : nullopt;
-    }
-
-    optional<int> get_int(char const *s)
-    {
-        auto i = this->cfg.find(s);
-        return i != this->cfg.end() ? optional<int>(std::stoi(i->second))
-                                    : nullopt;
-    }
-};
-
-} // namespace wm
-
-#endif // TMCAGLWM_CONFIG_HPP
diff --git a/src/policy.hpp b/src/policy.hpp
deleted file mode 100644 (file)
index b87f94d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef TMCAGLWM_POLICY_HPP
-#define TMCAGLWM_POLICY_HPP
-
-#include "layout.hpp"
-#include "hmi-debug.h"
-
-namespace wm
-{
-
-class Policy
-{
-  public:
-    bool layout_is_valid(LayoutState const & /* layout */)
-    {
-        // We do not check for policy currently
-        HMI_DEBUG("wm", "Policy check returns positive");
-        return true;
-    }
-};
-
-} // namespace wm
-
-#endif //TMCAGLWM_POLICY_HPP