Add small image feature 62/226562/3
authorJusung Son <jusung07.son@samsung.com>
Wed, 4 Mar 2020 01:26:58 +0000 (10:26 +0900)
committerhyunho <hhstark.kang@samsung.com>
Wed, 4 Mar 2020 03:21:24 +0000 (12:21 +0900)
Change-Id: I3d53a45a15ea22bf976c7feeec18d5c4a36bbc01
Signed-off-by: Jusung Son <jusung07.son@samsung.com>
97 files changed:
packaging/libwatchface-complication.spec
parser/complication_parser_plugin.cc
parser/complication_parser_plugin_internal.cc
unittest/data/test.sql
unittest/src/test-complication-provider.cc
unittest/src/test-complication.cc
unittest/src/test-db-manager.cc
unittest/src/test-design-element.cc
unittest/src/test-editables-container.cc
unittest/src/test-editables-manager.cc
unittest/src/test-editor.cc
unittest/src/test-received-editable.cc
unittest/src/test-watchface-complication-provider.cc
unittest/src/test-watchface-complication.cc
unittest/src/test-watchface-editable.cc
unittest/src/test-watchface-editor.cc
watchface-common/CMakeLists.txt
watchface-common/include/watchface-common-internal.h [new file with mode: 0644]
watchface-common/shared-handle.h [deleted file]
watchface-common/shared-handle.hh [new file with mode: 0644]
watchface-common/watchface-common-internal.h [deleted file]
watchface-common/watchface-common-internal.hh [new file with mode: 0644]
watchface-common/watchface-exception.h [deleted file]
watchface-common/watchface-exception.hh [new file with mode: 0644]
watchface-common/watchface-util.cc
watchface-common/watchface-util.h [deleted file]
watchface-common/watchface-util.hh [new file with mode: 0644]
watchface-complication-provider/complication-provider-event-interface.h [deleted file]
watchface-complication-provider/complication-provider-event-interface.hh [new file with mode: 0644]
watchface-complication-provider/complication-provider-implementation.h [deleted file]
watchface-complication-provider/complication-provider-implementation.hh [new file with mode: 0644]
watchface-complication-provider/complication-provider.cc
watchface-complication-provider/complication-provider.h [deleted file]
watchface-complication-provider/complication-provider.hh [new file with mode: 0644]
watchface-complication-provider/include/watchface-complication-provider-internal.h
watchface-complication-provider/watchface-complication-provider.cc
watchface-complication/CMakeLists.txt
watchface-complication/complication-connector-implementation.h
watchface-complication/complication-connector.cc
watchface-complication/complication-connector.h [deleted file]
watchface-complication/complication-connector.hh [new file with mode: 0644]
watchface-complication/complication-event-interface.h [deleted file]
watchface-complication/complication-event-interface.hh [new file with mode: 0644]
watchface-complication/complication-implementation.h [deleted file]
watchface-complication/complication-implementation.hh [new file with mode: 0644]
watchface-complication/complication-internal.h [deleted file]
watchface-complication/complication-internal.hh [new file with mode: 0644]
watchface-complication/complication.cc
watchface-complication/complication.h [deleted file]
watchface-complication/complication.hh [new file with mode: 0644]
watchface-complication/db-manager.cc
watchface-complication/db-manager.h [deleted file]
watchface-complication/db-manager.hh [new file with mode: 0644]
watchface-complication/design-element-implementation.h [deleted file]
watchface-complication/design-element-implementation.hh [new file with mode: 0644]
watchface-complication/design-element.cc
watchface-complication/design-element.h [deleted file]
watchface-complication/design-element.hh [new file with mode: 0644]
watchface-complication/editable-interface.h [deleted file]
watchface-complication/editable-interface.hh [new file with mode: 0644]
watchface-complication/editables-container-event-interface.h [deleted file]
watchface-complication/editables-container-event-interface.hh [new file with mode: 0644]
watchface-complication/editables-container-implementation.h [deleted file]
watchface-complication/editables-container-implementation.hh [new file with mode: 0644]
watchface-complication/editables-container.cc
watchface-complication/editables-container.h [deleted file]
watchface-complication/editables-container.hh [new file with mode: 0644]
watchface-complication/editables-manager-implementation.h [deleted file]
watchface-complication/editables-manager-implementation.hh [new file with mode: 0644]
watchface-complication/editables-manager.cc
watchface-complication/editables-manager.h [deleted file]
watchface-complication/editables-manager.hh [new file with mode: 0644]
watchface-complication/gdbus-interface.h [deleted file]
watchface-complication/gdbus-interface.hh [new file with mode: 0644]
watchface-complication/gdbus.h [deleted file]
watchface-complication/gdbus.hh [new file with mode: 0644]
watchface-complication/include/watchface-complication-internal.h
watchface-complication/package-manager-interface.h [deleted file]
watchface-complication/package-manager-interface.hh [new file with mode: 0644]
watchface-complication/package-manager.h [deleted file]
watchface-complication/package-manager.hh [new file with mode: 0644]
watchface-complication/received-editable-implementation.h [deleted file]
watchface-complication/received-editable-implementation.hh [new file with mode: 0644]
watchface-complication/received-editable.cc
watchface-complication/received-editable.h [deleted file]
watchface-complication/received-editable.hh [new file with mode: 0644]
watchface-complication/watchface-complication.cc
watchface-complication/watchface-editable.cc
watchface-editor/editables-editor-event-interface.h [deleted file]
watchface-editor/editables-editor-event-interface.hh [new file with mode: 0644]
watchface-editor/editables-editor-implementation.h [deleted file]
watchface-editor/editables-editor-implementation.hh [new file with mode: 0644]
watchface-editor/editables-editor.cc
watchface-editor/editables-editor.h [deleted file]
watchface-editor/editables-editor.hh [new file with mode: 0644]
watchface-editor/include/watchface-editor.h
watchface-editor/watchface-editor.cc

index e2abe4c27768328bc85ffff3987357c05629e4c2..1b5ed53a43ccf7aeb624ef696be39384ccd7d59e 100644 (file)
@@ -125,7 +125,9 @@ install -m 0644 watchface-complication.zip %{buildroot}%{_datadir}/gcov/
 
 %files -n %{name}-devel
 %{_includedir}/watchface-complication/*.h
+%{_includedir}/watchface-complication/*.hh
 %{_includedir}/watchface-common/*.h
+%{_includedir}/watchface-common/*.hh
 %{_libdir}/pkgconfig/watchface-complication.pc
 %attr(0644,root,root) %{_libdir}/%{name}.so
 
@@ -233,6 +235,7 @@ Header & package configuration files to support development of the watchface lib
 
 %files -n libwatchface-common-devel
 %{_includedir}/watchface-common/*.h
+%{_includedir}/watchface-common/*.hh
 %{_libdir}/pkgconfig/watchface-common.pc
 %attr(0644,root,root) %{_libdir}/libwatchface-common.so
 
index e109977593167cd9a30f103d1cb2d26fa1717700..f36b6671df957a2abfa538f0eab2ce5f809e4f30 100644 (file)
 #include <memory>
 #include <list>
 
-#include "watchface-complication/complication-internal.h"
+#include "watchface-complication/complication-internal.hh"
 #include "watchface-complication/include/watchface-complication.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-common/include/watchface-common-internal.h"
 
 #include "parser/complication_parser_plugin_internal.h"
 
@@ -52,6 +53,7 @@
 #define DEFAULT_MAX "default-max"
 #define DEFAULT_MIN "default-min"
 #define DEFAULT_IMAGE "default-image"
+#define DEFAULT_SMALL_IMAGE "default-small-image"
 #define DEFAULT_EXTRA_DATA "default-extra-data"
 
 using namespace std;
@@ -79,7 +81,8 @@ static struct support_type_tag_map __type_map[] = {
   {"ranged-value-type", WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE},
   {"time-type", WATCHFACE_COMPLICATION_TYPE_TIME},
   {"icon-type", WATCHFACE_COMPLICATION_TYPE_ICON},
-  {"image-type", WATCHFACE_COMPLICATION_TYPE_IMAGE}
+  {"image-type", WATCHFACE_COMPLICATION_TYPE_IMAGE},
+  {"small-image-type", (watchface_complication_type_e)WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE},
 };
 
 struct xml_to_bundle_key_map {
@@ -100,7 +103,9 @@ static struct xml_to_bundle_key_map __budle_key_map[] = {
   {DEFAULT_MAX, RANGE_MAX_KEY},
   {DEFAULT_MIN, RANGE_MIN_KEY},
   {DEFAULT_IMAGE, IMAGE_KEY},
-  {DEFAULT_EXTRA_DATA, EXTRA_DATA_KEY}
+  {DEFAULT_EXTRA_DATA, EXTRA_DATA_KEY},
+  {DEFAULT_EXTRA_DATA, EXTRA_DATA_KEY},
+  {DEFAULT_SMALL_IMAGE, SMALL_IMAGE_KEY}
 };
 
 static uid_t __target_uid;
@@ -208,6 +213,7 @@ static bool _is_valid_element(int type, char* element_name) {
     if (strcmp(element_name, DEFAULT_TITLE) != 0 &&
       strcmp(element_name, DEFAULT_LONG_TEXT) != 0 &&
       strcmp(element_name, DEFAULT_ICON) != 0 &&
+      strcmp(element_name, DEFAULT_SMALL_IMAGE) != 0 &&
       strcmp(element_name, DEFAULT_EXTRA_DATA) != 0) {
       LOGE("type (%d) do not support (%s)", type, element_name);
       is_valid = false;
@@ -239,6 +245,13 @@ static bool _is_valid_element(int type, char* element_name) {
       is_valid = false;
     }
     break;
+  case WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE :
+    if (strcmp(element_name, DEFAULT_SMALL_IMAGE) != 0 &&
+      strcmp(element_name, DEFAULT_EXTRA_DATA) != 0) {
+      LOGE("type (%d) do not support (%s) %s", type, element_name, DEFAULT_SMALL_IMAGE);
+      is_valid = false;
+    }
+    break;
   case WATCHFACE_COMPLICATION_TYPE_TIME :
     if (strcmp(element_name, DEFAULT_SHORT_TEXT) != 0 &&
       strcmp(element_name, DEFAULT_TIMEZONE_ID) != 0 &&
index ce67ee94ee706adaf995c612d4dbfa7460d3b52d..09b378e289ab15e9becb01bbb4924934825ba089 100644 (file)
@@ -23,7 +23,7 @@
 #include <dlog.h>
 #include <tzplatform_config.h>
 
-#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-util.hh"
 #include "parser/complication_parser_plugin_internal.h"
 
 #define BUSY_WAITING_USEC 50000 /* 0.05 sec */
index 2ec263f746c7c1f700539c6981788b229a52de28..39ca2db59e701cdc91d374bb4e40d6719f429090 100644 (file)
@@ -87,6 +87,13 @@ INSERT INTO provider_support_types (
   'test'
 );
 
+INSERT INTO provider_support_types (
+  provider_id, support_type, default_data) VALUES (
+  'org.tizen.gmock_comp_provider/test',
+  128,
+  'test'
+);
+
 INSERT INTO complication_provider (
   pkgid, appid, provider_id, trusted, period) VALUES (
   'org.tizen.gmock_comp_provider2',
index df14a0bc33eac456090b0d2141de2947df377110..27299cddc6219029f98c0d8a1a9d98e1222101e1 100644 (file)
@@ -22,7 +22,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication-provider/complication-provider.h"
+#include "watchface-complication-provider/complication-provider.hh"
 #include "watchface-complication-provider/include/watchface-complication-provider.h"
 #include "mock/tzplatform_config_mock.h"
 #include "mock/app_common.h"
index 7544ca6ee219b629cfc10b51836482efce3780f0..ce1b8614accf04f18c02018eef464efb42e20947 100644 (file)
@@ -28,7 +28,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication/complication.h"
+#include "watchface-complication/complication.hh"
 #include "mock/tzplatform_config_mock.h"
 #include "mock/app_common.h"
 #include "mock/mock_util.h"
index 404f6f04f1484eb9ca03e9b06da02997ebc0ee29..35bdb14516281cf7b18de5777583efd26b65e560 100644 (file)
@@ -27,7 +27,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication/db-manager.h"
+#include "watchface-complication/db-manager.hh"
 
 using namespace std;
 using namespace watchface_complication;
index efd412765c1bfc6a0d00c58951a8adac42e324ac..064a5be0668e0e9af7a110221811234100d5dcd2 100644 (file)
@@ -27,7 +27,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication/design-element.h"
+#include "watchface-complication/design-element.hh"
 
 using namespace std;
 using namespace tizen_base;
index c80189a12a247142e395ff9847b65360f16e0ddb..620b7da6578d7ed757ea98bae156cf287930c774 100644 (file)
@@ -29,9 +29,9 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
 #include "watchface-complication/include/watchface-complication.h"
 #include "watchface-complication/include/watchface-editable.h"
 
index 660a58e9e4b81056053ac158801bcb0c194a9fed..3c34d0fe5a3771622214e8418164d639c1db67db 100644 (file)
@@ -27,7 +27,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication/editables-manager.h"
+#include "watchface-complication/editables-manager.hh"
 
 using namespace std;
 using namespace tizen_base;
index d467afc709620e7c241fa137179366f44e0758a5..afa7ffcab957685b639f7e894ef953b64efa59d7 100644 (file)
@@ -23,8 +23,8 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-editor/editables-editor.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-editor/editables-editor.hh"
+#include "watchface-complication/received-editable.hh"
 #include "watchface-complication/include/watchface-editable.h"
 #include "watchface-editor/include/watchface-editor.h"
 #include "mock/cynara_mock.h"
index 447852ffee7056611610b5c2c41f3e2460589b0b..a1082dcb7060a2e9ca2c084f268fb1478d48c2a1 100644 (file)
@@ -29,7 +29,7 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/received-editable.hh"
 
 using namespace std;
 using namespace tizen_base;
index 2e79da0b9ea953f657b2d79cb268c1431569bc13..fd77c56cfd4c23afba2105f1a709f54aa43f9f0b 100644 (file)
 #include <watchface-complication-provider-internal.h>
 #include <app_control_internal.h>
 
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-common/include/watchface-common-internal.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
 
 #include "mock/system_info_mock.h"
 #include "mock/tzplatform_config_mock.h"
@@ -275,6 +276,13 @@ TEST_F(CWCP, watchface_complication_provider_data_is_valid)
   ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
   EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
   EXPECT_EQ(is_valid, true);
+
+  watchface_complication_provider_data_set_type(shared,
+    static_cast<watchface_complication_type_e>(WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE));
+  watchface_complication_provider_data_set_small_image_path(shared, "res/data.png");
+  ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
+  EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+  EXPECT_EQ(is_valid, true);
 }
 
 TEST_F(CWCP, watchface_complication_provider_event_get_type)
index c92366b5b5287c4a4618890ecec8f0647b0831d5..de4843ff395bfdda23ef08f79e70fd0954d993b6 100644 (file)
@@ -21,7 +21,7 @@
 #include <watchface-complication-provider.h>
 #include <watchface-complication-provider-internal.h>
 
-#include "watchface-complication/complication.h"
+#include "watchface-complication/complication.hh"
 #include "mock/system_info_mock.h"
 #include "mock/tzplatform_config_mock.h"
 #include "mock/app_common.h"
@@ -335,6 +335,8 @@ guint __fake_signal_subscribe_on_data_updated(GDBusConnection* connection,
     snprintf(num_str, sizeof(num_str), "%d", LongText);
     b.Add("__DATA_TYPE_KEY__", num_str);
     watchface_complication_provider_data_set_long_text(b.GetHandle(), "longtext");
+    watchface_complication_provider_data_set_small_image_path_with_aod(b.GetHandle(),
+        "data/small.png", "data/aod_small.png");
     parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
                           LongText,
                           777,
@@ -403,6 +405,21 @@ guint __fake_signal_subscribe_on_data_updated(GDBusConnection* connection,
                         "__COMP_UPDATED__",
                         parameters);
 
+    b.Delete("__DATA_TYPE_KEY__");
+    snprintf(num_str, sizeof(num_str), "%d", SmallImage);
+    b.Add("__DATA_TYPE_KEY__", num_str);
+    watchface_complication_provider_data_set_small_image_path_with_aod(
+        b.GetHandle(), "data/small_img.png", "data/aod_small_img.png");
+    parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+                          SmallImage,
+                          777,
+                          reinterpret_cast<char*>(b.ToRaw().first.get()));
+    rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+                        "test path",
+                        "test interface",
+                        "__COMP_UPDATED__",
+                        parameters);
+
     if (g_main_loop_is_running(loop_))
       g_main_loop_quit(loop_);
     return G_SOURCE_CONTINUE;
@@ -446,10 +463,19 @@ void _complication_updated_cb_get_test(
     free(sc_text);
 
   } else if (type == WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
-    char *longtext;
+    char *longtext, *image, *aod_image;
     watchface_complication_data_get_long_text(data, &longtext);
     EXPECT_STREQ(longtext, "longtext");
     free(longtext);
+
+    watchface_complication_data_get_small_image_path(data, &image);
+    EXPECT_STREQ(image, "data/small.png");
+    free(image);
+
+    watchface_complication_data_get_aod_small_image_path(data, &aod_image);
+    EXPECT_STREQ(aod_image, "data/aod_small.png");
+    free(aod_image);
+
   } else if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
     long time;
     watchface_complication_data_get_timestamp(data, &time);
@@ -500,6 +526,15 @@ void _complication_updated_cb_get_test(
     EXPECT_EQ(cur, 10);
     EXPECT_EQ(min, 0);
     EXPECT_EQ(max, 100);
+  } else if (type ==
+      static_cast<watchface_complication_type_e>(WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE)) {
+    char* image, *aod_image;
+    watchface_complication_data_get_small_image_path(data, &image);
+    EXPECT_STREQ(image, "data/small_img.png");
+    free(image);
+    watchface_complication_data_get_aod_small_image_path(data, &aod_image);
+    EXPECT_STREQ(aod_image, "data/aod_small_img.png");
+    free(aod_image);
   }
 }
 
@@ -579,6 +614,25 @@ TEST_F(CWC, watchface_complication_data_get_image_path)
   RunLoop();
 }
 
+TEST_F(CWC, watchface_complication_data_get_small_image_path)
+{
+  g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_signal_subscribe_on_data_updated;
+  int comp_id = 777;
+  int ret = watchface_complication_create(comp_id,
+    "org.tizen.gmock_comp_provider/test",
+    (watchface_complication_type_e)WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE,
+    (watchface_complication_type_e)WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE,
+    WATCHFACE_COMPLICATION_EVENT_TAP,
+    &complication_);
+  EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+  ret = watchface_complication_add_updated_cb(complication_,
+      _complication_updated_cb_get_test,
+      _complication_error_cb, nullptr);
+  EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+  RunLoop();
+}
+
 TEST_F(CWC, watchface_complication_data_get_ranged_value)
 {
   g_dbus_connection_signal_subscribe_fake.custom_fake =
index 6e87dd0061ea1395db690591e2634648ca3bf8f4..7ccc095c2efcc1305beead148bf4115c617a0448 100644 (file)
@@ -19,9 +19,9 @@
 #include <watchface-editable.h>
 #include <watchface-editable-internal.h>
 
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
 
 #include "mock/system_info_mock.h"
 #include "mock/tzplatform_config_mock.h"
index d28adf1711359d9f515dec0c70b14ade850c47ca..3c062c34657fc2d2c5be4591b5f31417a56483f2 100644 (file)
@@ -19,9 +19,9 @@
 #include <watchface-editor.h>
 #include <vector>
 
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/received-editable.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/received-editable.hh"
 
 #include "mock/system_info_mock.h"
 #include "mock/tzplatform_config_mock.h"
index b8f45b60201671f913869034b333eff8e74bd1f5..3b8e4c0999bcd055582e8c79a2e714508a84fb3c 100644 (file)
@@ -52,4 +52,5 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-common.h DESTINATION include/watchface-common)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/watchface-common-internal.h DESTINATION include/watchface-common)
\ No newline at end of file
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/watchface-common-internal.hh DESTINATION include/watchface-common)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-common-internal.h DESTINATION include/watchface-common)
\ No newline at end of file
diff --git a/watchface-common/include/watchface-common-internal.h b/watchface-common/include/watchface-common-internal.h
new file mode 100644 (file)
index 0000000..caf563d
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__
+#define __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define        WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE  0x80 /**< Small Image */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__ */
diff --git a/watchface-common/shared-handle.h b/watchface-common/shared-handle.h
deleted file mode 100644 (file)
index c8402ee..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMMON_SHARED_HANDLE_H_
-#define WATCHFACE_COMMON_SHARED_HANDLE_H_
-
-namespace watchface_complication {
-
-template<class T>
-class SharedHandle {
- public:
-  static SharedHandle* Make(T* ptr) {
-    return new SharedHandle(ptr);
-  }
-
-  static SharedHandle* Make(std::shared_ptr<T> ptr) {
-    return new SharedHandle(ptr);
-  }
-
-  static std::shared_ptr<T> Share(SharedHandle* h) {
-    return h->ptr_;
-  }
-
-  std::shared_ptr<T> GetPtr() const {
-    if (ptr_ == nullptr)
-      return std::shared_ptr<T>({});
-    return ptr_;
-  }
-
-  T* GetRawPtr() const {
-    if (ptr_ == nullptr)
-      return nullptr;
-    return ptr_.get();
-  }
-
- private:
-  SharedHandle(T* ptr) : ptr_(ptr) {}
-  SharedHandle(std::shared_ptr<T> ptr) : ptr_(ptr) {}
-
- private:
-  std::shared_ptr<T> ptr_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMMON_SHARED_HANDLE_H_
\ No newline at end of file
diff --git a/watchface-common/shared-handle.hh b/watchface-common/shared-handle.hh
new file mode 100644 (file)
index 0000000..c8402ee
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMMON_SHARED_HANDLE_H_
+#define WATCHFACE_COMMON_SHARED_HANDLE_H_
+
+namespace watchface_complication {
+
+template<class T>
+class SharedHandle {
+ public:
+  static SharedHandle* Make(T* ptr) {
+    return new SharedHandle(ptr);
+  }
+
+  static SharedHandle* Make(std::shared_ptr<T> ptr) {
+    return new SharedHandle(ptr);
+  }
+
+  static std::shared_ptr<T> Share(SharedHandle* h) {
+    return h->ptr_;
+  }
+
+  std::shared_ptr<T> GetPtr() const {
+    if (ptr_ == nullptr)
+      return std::shared_ptr<T>({});
+    return ptr_;
+  }
+
+  T* GetRawPtr() const {
+    if (ptr_ == nullptr)
+      return nullptr;
+    return ptr_.get();
+  }
+
+ private:
+  SharedHandle(T* ptr) : ptr_(ptr) {}
+  SharedHandle(std::shared_ptr<T> ptr) : ptr_(ptr) {}
+
+ private:
+  std::shared_ptr<T> ptr_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMMON_SHARED_HANDLE_H_
\ No newline at end of file
diff --git a/watchface-common/watchface-common-internal.h b/watchface-common/watchface-common-internal.h
deleted file mode 100644 (file)
index 0b56832..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
-#define WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
-
-#include <tizen.h>
-
-#ifdef EXPORT_API
-#undef EXPORT_API
-#endif
-
-#define EXPORT_API __attribute__((visibility("default")))
-
-#define SETUP_EDITOR_APPID_KEY "__SETUP_EDITOR_APPID_KEY__"
-#define SETUP_EDITABLE_ID_KEY "__SETUP_EDITABLE_ID_KEY__"
-#define SETUP_CONTEXT_DATA_KEY "__SETUP_CONTEXT_DATA_KEY__"
-#define SHORT_TEXT_KEY "__SHORT_TEXT_KEY__"
-#define LONG_TEXT_KEY "__LONG_TEXT_KEY__"
-#define ICON_KEY "__ICON_KEY__"
-#define AOD_ICON_KEY "__AOD_ICON_KEY__"
-#define TITLE_KEY "__TITLE_KEY__"
-#define TIME_KEY "__TIME_KEY__"
-#define TIME_ZONE_KEY "__TIME_ZONE_KEY__"
-#define TIME_ZONE_ID_KEY "__TIME_ZONE_ID_KEY__"
-#define TIME_COUNTRY_KEY "__TIME_COUNTRY_KEY__"
-#define TIME_CITY_KEY "__TIME_CITY_KEY__"
-#define RANGE_CUR_KEY "__CUR_KEY__"
-#define RANGE_MAX_KEY "__MAX_KEY__"
-#define RANGE_MIN_KEY "__MIN_KEY__"
-#define IMAGE_KEY "__IMAGE_KEY__"
-#define AOD_IMAGE_KEY "__AOD_IMAGE_KEY__"
-#define DATA_TYPE_KEY "__DATA_TYPE_KEY__"
-#define EXTRA_DATA_KEY "__EXTRA_DATA_KEY__"
-#define SCREEN_READER_TEXT_KEY "__SCREEN_READER_TEXT_KEY__"
-#define TOUCH_LAUNCH_CONTEXT_KEY "__TOUCH_LAUNCH_CONTEXT_KEY__"
-#define TOUCH_LAUNCH_PROVIDER_ID_KEY "__TOUCH_LAUNCH_PROVIDER_ID_KEY__"
-#define TOUCH_LAUNCH_TYPE_KEY "__TOUCH_LAUNCH_TYPE_KEY__"
-#define TOUCH_LAUNCH_EVENT_KEY "__TOUCH_LAUNCH_EVENT_KEY__"
-#define TOUCH_LAUNCH_DATA_KEY "__TOUCH_LAUNCH_DATA_KEY__"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum _editor_error_e {
-       WATCHFACE_EDITOR_ERROR_NONE = 0x01, /**< Error none */
-       WATCHFACE_EDITOR_ERROR_PERMISSION_DENY = 0x02, /**< Watchface do not have privileges for provider application. */
-       WATCHFACE_EDITOR_ERROR_EVENT_NOT_SUPPORT = 0x04 /**< Watchface complication do not support provider's events. */
-} watchface_editor_error_e;
-
-struct complication_time_info_s {
-  char *timezone;
-  char *timezone_id;
-  char *country;
-  char *city;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
diff --git a/watchface-common/watchface-common-internal.hh b/watchface-common/watchface-common-internal.hh
new file mode 100644 (file)
index 0000000..ba47a5f
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
+#define WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
+
+#include <tizen.h>
+
+#ifdef EXPORT_API
+#undef EXPORT_API
+#endif
+
+#define EXPORT_API __attribute__((visibility("default")))
+
+#define SETUP_EDITOR_APPID_KEY "__SETUP_EDITOR_APPID_KEY__"
+#define SETUP_EDITABLE_ID_KEY "__SETUP_EDITABLE_ID_KEY__"
+#define SETUP_CONTEXT_DATA_KEY "__SETUP_CONTEXT_DATA_KEY__"
+#define SHORT_TEXT_KEY "__SHORT_TEXT_KEY__"
+#define LONG_TEXT_KEY "__LONG_TEXT_KEY__"
+#define ICON_KEY "__ICON_KEY__"
+#define AOD_ICON_KEY "__AOD_ICON_KEY__"
+#define TITLE_KEY "__TITLE_KEY__"
+#define TIME_KEY "__TIME_KEY__"
+#define TIME_ZONE_KEY "__TIME_ZONE_KEY__"
+#define TIME_ZONE_ID_KEY "__TIME_ZONE_ID_KEY__"
+#define TIME_COUNTRY_KEY "__TIME_COUNTRY_KEY__"
+#define TIME_CITY_KEY "__TIME_CITY_KEY__"
+#define RANGE_CUR_KEY "__CUR_KEY__"
+#define RANGE_MAX_KEY "__MAX_KEY__"
+#define RANGE_MIN_KEY "__MIN_KEY__"
+#define IMAGE_KEY "__IMAGE_KEY__"
+#define SMALL_IMAGE_KEY "__SMALL_IMAGE_KEY__"
+#define AOD_IMAGE_KEY "__AOD_IMAGE_KEY__"
+#define AOD_SMALL_IMAGE_KEY "__AOD_SMALL_IMAGE_KEY__"
+#define DATA_TYPE_KEY "__DATA_TYPE_KEY__"
+#define EXTRA_DATA_KEY "__EXTRA_DATA_KEY__"
+#define SCREEN_READER_TEXT_KEY "__SCREEN_READER_TEXT_KEY__"
+#define TOUCH_LAUNCH_CONTEXT_KEY "__TOUCH_LAUNCH_CONTEXT_KEY__"
+#define TOUCH_LAUNCH_PROVIDER_ID_KEY "__TOUCH_LAUNCH_PROVIDER_ID_KEY__"
+#define TOUCH_LAUNCH_TYPE_KEY "__TOUCH_LAUNCH_TYPE_KEY__"
+#define TOUCH_LAUNCH_EVENT_KEY "__TOUCH_LAUNCH_EVENT_KEY__"
+#define TOUCH_LAUNCH_DATA_KEY "__TOUCH_LAUNCH_DATA_KEY__"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _editor_error_e {
+       WATCHFACE_EDITOR_ERROR_NONE = 0x01, /**< Error none */
+       WATCHFACE_EDITOR_ERROR_PERMISSION_DENY = 0x02, /**< Watchface do not have privileges for provider application. */
+       WATCHFACE_EDITOR_ERROR_EVENT_NOT_SUPPORT = 0x04 /**< Watchface complication do not support provider's events. */
+} watchface_editor_error_e;
+
+struct complication_time_info_s {
+  char *timezone;
+  char *timezone_id;
+  char *country;
+  char *city;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
diff --git a/watchface-common/watchface-exception.h b/watchface-common/watchface-exception.h
deleted file mode 100644 (file)
index 4504fbd..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
-#define WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
-
-#include <string>
-#include <exception>
-
-#include "watchface-common/include/watchface-common.h"
-
-#define THROW(error_code) throw Exception(error_code, __FILE__, __LINE__)
-
-namespace watchface_complication {
-/* LCOV_EXCL_START */
-class Exception : public std::exception {
- public:
-  explicit Exception(int error_code, std::string file = __FILE__,
-      int line = __LINE__ ) {
-    _error_code = error_code;
-    _whatMessage = file.substr(file.find_last_of("/") + 1) + ":"
-        + std::to_string(line) + GetErrorString(error_code);
-    }
-    virtual ~Exception() {}
-    virtual const char *what(void) const noexcept {
-      return _whatMessage.c_str();
-    }
-    int GetErrorCode() {
-      return _error_code;
-    }
-
- private:
-    int _error_code;
-    std::string _whatMessage;
-    std::string GetErrorString(int error_code) {
-      switch (error_code) {
-      case WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY:
-        return ": OUT_OF_MEMORY";
-      case WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER:
-        return ": INVALID_PARAMETER";
-      case WATCHFACE_COMPLICATION_ERROR_IO_ERROR:
-        return ": IO_ERROR";
-      case WATCHFACE_COMPLICATION_ERROR_NO_DATA:
-        return ": NO_DATA";
-      case WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED:
-        return ": PERMISSION_DENIED";
-      case WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED:
-        return ": NOT_SUPPORTED";
-      case WATCHFACE_COMPLICATION_ERROR_DB:
-        return ": DB_ERROR";
-      case WATCHFACE_COMPLICATION_ERROR_DBUS:
-        return ": DBUS_ERROR";
-      case WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY:
-        return ": EDIT_NOT_READY";
-      case WATCHFACE_COMPLICATION_ERROR_EXIST_ID:
-        return ": EXIST_ID";
-      case WATCHFACE_COMPLICATION_ERROR_NOT_EXIST:
-        return ": NOT_EXIST";
-      default :
-        return "";
-    }
-  }
-};
-/* LCOV_EXCL_STOP */
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
diff --git a/watchface-common/watchface-exception.hh b/watchface-common/watchface-exception.hh
new file mode 100644 (file)
index 0000000..4504fbd
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
+#define WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
+
+#include <string>
+#include <exception>
+
+#include "watchface-common/include/watchface-common.h"
+
+#define THROW(error_code) throw Exception(error_code, __FILE__, __LINE__)
+
+namespace watchface_complication {
+/* LCOV_EXCL_START */
+class Exception : public std::exception {
+ public:
+  explicit Exception(int error_code, std::string file = __FILE__,
+      int line = __LINE__ ) {
+    _error_code = error_code;
+    _whatMessage = file.substr(file.find_last_of("/") + 1) + ":"
+        + std::to_string(line) + GetErrorString(error_code);
+    }
+    virtual ~Exception() {}
+    virtual const char *what(void) const noexcept {
+      return _whatMessage.c_str();
+    }
+    int GetErrorCode() {
+      return _error_code;
+    }
+
+ private:
+    int _error_code;
+    std::string _whatMessage;
+    std::string GetErrorString(int error_code) {
+      switch (error_code) {
+      case WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY:
+        return ": OUT_OF_MEMORY";
+      case WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER:
+        return ": INVALID_PARAMETER";
+      case WATCHFACE_COMPLICATION_ERROR_IO_ERROR:
+        return ": IO_ERROR";
+      case WATCHFACE_COMPLICATION_ERROR_NO_DATA:
+        return ": NO_DATA";
+      case WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED:
+        return ": PERMISSION_DENIED";
+      case WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED:
+        return ": NOT_SUPPORTED";
+      case WATCHFACE_COMPLICATION_ERROR_DB:
+        return ": DB_ERROR";
+      case WATCHFACE_COMPLICATION_ERROR_DBUS:
+        return ": DBUS_ERROR";
+      case WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY:
+        return ": EDIT_NOT_READY";
+      case WATCHFACE_COMPLICATION_ERROR_EXIST_ID:
+        return ": EXIST_ID";
+      case WATCHFACE_COMPLICATION_ERROR_NOT_EXIST:
+        return ": NOT_EXIST";
+      default :
+        return "";
+    }
+  }
+};
+/* LCOV_EXCL_STOP */
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMMON_WATCHFACE_EXCEPTION_H_
index d1e3861a28ff2ba54522782106c509deab0bd9dc..e4056d20b9c2507e0f71dcc80af43a4517324015 100644 (file)
 #include <map>
 #include <list>
 
-#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-util.hh"
 #include "watchface-common/include/watchface-common.h"
-#include "watchface-common/watchface-common-internal.h"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-common/include/watchface-common-internal.h"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -269,6 +270,8 @@ out:
       return true;
     case WATCHFACE_COMPLICATION_TYPE_IMAGE:
       return true;
+    case WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE:
+      return true;
     default:
       return false;
     }
@@ -457,6 +460,11 @@ out:
           is_valid = false;
         break;
       }
+      case WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE : {
+        if (shared_data.GetString(SMALL_IMAGE_KEY).empty())
+          is_valid = false;
+        break;
+      }
       case WATCHFACE_COMPLICATION_TYPE_NO_DATA :
         is_valid = true;
         break;
@@ -481,7 +489,8 @@ out:
   }
 
   int ConvertPathToAppPath(const char* appid, bundle* data) {
-    list<string> key_list {ICON_KEY, IMAGE_KEY, AOD_ICON_KEY, AOD_IMAGE_KEY};
+    list<string> key_list {ICON_KEY, IMAGE_KEY, AOD_ICON_KEY,
+           AOD_IMAGE_KEY, SMALL_IMAGE_KEY, AOD_SMALL_IMAGE_KEY};
     for (auto& i : key_list) {
       char* path;
       int ret = bundle_get_str(data, i.c_str(), &path);
diff --git a/watchface-common/watchface-util.h b/watchface-common/watchface-util.h
deleted file mode 100644 (file)
index a45c729..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMMON_WATCHFACE_UTIL_H_
-#define WATCHFACE_COMMON_WATCHFACE_UTIL_H_
-
-#include <gio/gio.h>
-#include <bundle.h>
-#include <bundle_cpp.h>
-#include <sqlite3.h>
-#include <tzplatform_config.h>
-
-#include <string>
-#include "watchface-common/include/watchface-common.h"
-#include "watchface-common/watchface-common-internal.h"
-
-#define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
-
-enum cynara_result {
-  COMPLICATION_CYNARA_UNKNOWN,
-  COMPLICATION_CYNARA_ALLOWED,
-  COMPLICATION_CYNARA_DENIED,
-};
-
-namespace watchface_complication {
-namespace util {
-  enum CmdType {
-    CompUpdateRequest,
-    CompUpdated,
-    CompNotifyDataUpdate,
-    CompNotifyListeningStatus,
-    EditableEditRequest,
-    EditableEditComplete,
-    EditableEditPreview,
-    EditableEditCancel,
-    EditableEditReady,
-    SetupReply,
-    EditResult,
-    ProviderReady
-  };
-
-  enum EncodeType {
-    Name,
-    CompPath,
-    EditablePath
-  };
-
-  EXPORT_API bool CheckWatchFeatureEnabled();
-  EXPORT_API int CheckPrivilege(const char* privilege);
-  EXPORT_API int CheckPrivilege(std::string privilege, cynara_result *pcr);
-  EXPORT_API int CheckPrivilege(std::string& privilege,
-                                     GDBusConnection *connection,
-                                     std::string& sender_name,
-                                     std::string& sender_appid);
-  EXPORT_API int GetSenderPid(GDBusConnection *conn, const std::string& sender_name);
-  EXPORT_API std::string GetSenderAppid(GDBusConnection *conn,
-                          const std::string& sender_name);
-  EXPORT_API bool CheckSender(const char* sender_app_id,
-                                const std::string& sender_name,
-                                GDBusConnection* conn);
-  EXPORT_API bool CheckComplicationType(int type);
-  EXPORT_API std::string EncodeStr(EncodeType type, std::string appid);
-  EXPORT_API std::string EncodeStr(EncodeType type, std::string appid, int compid);
-  EXPORT_API std::string GetAppId();
-  EXPORT_API std::string GetCmdStr(CmdType type);
-  EXPORT_API bool CheckCertificate(const std::string& provider_app_id);
-  EXPORT_API std::string GetAppPath(const char* appid, char* path);
-  EXPORT_API int ConvertPathToAppPath(const char* appid, bundle* data);
-  EXPORT_API bool IsValidData(tizen_base::Bundle shared_data);
-  EXPORT_API int GetDataType(tizen_base::Bundle shared_data);
-  EXPORT_API int ConvertAulError(int ret);
-  EXPORT_API void DestroyTimeInfo(struct complication_time_info_s* info);
-
-  class EXPORT_API DBHelper {
-    public:
-      using Cursor = std::unique_ptr<sqlite3_stmt, decltype(sqlite3_finalize)*>;
-      DBHelper()
-          : db_(nullptr, sqlite3_close_v2), stmt_(nullptr, sqlite3_finalize) {}
-
-      bool Open();
-      bool Open(int mode);
-      void Close();
-      bool Prepare(const std::string& query);
-      bool Exec(const std::string& query);
-      const Cursor& GetCursor() const;
-      int Step() const;
-      int Reset() const;
-
-      bool Bind(int pos, std::string text);
-      bool Bind(int pos, int val);
-
-      const char* GetText(int pos) const;
-      int GetInt(int pos) const;
-
-    private:
-      const char* GetParserDataPath() const;
-
-    private:
-      std::unique_ptr<sqlite3, decltype(sqlite3_close_v2)*> db_;
-      Cursor stmt_;
-  };
-}  // namespace util
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMMON_WATCHFACE_UTIL_H_
diff --git a/watchface-common/watchface-util.hh b/watchface-common/watchface-util.hh
new file mode 100644 (file)
index 0000000..b670733
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMMON_WATCHFACE_UTIL_H_
+#define WATCHFACE_COMMON_WATCHFACE_UTIL_H_
+
+#include <gio/gio.h>
+#include <bundle.h>
+#include <bundle_cpp.h>
+#include <sqlite3.h>
+#include <tzplatform_config.h>
+
+#include <string>
+#include "watchface-common/include/watchface-common.h"
+#include "watchface-common/watchface-common-internal.hh"
+
+#define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
+
+enum cynara_result {
+  COMPLICATION_CYNARA_UNKNOWN,
+  COMPLICATION_CYNARA_ALLOWED,
+  COMPLICATION_CYNARA_DENIED,
+};
+
+namespace watchface_complication {
+namespace util {
+  enum CmdType {
+    CompUpdateRequest,
+    CompUpdated,
+    CompNotifyDataUpdate,
+    CompNotifyListeningStatus,
+    EditableEditRequest,
+    EditableEditComplete,
+    EditableEditPreview,
+    EditableEditCancel,
+    EditableEditReady,
+    SetupReply,
+    EditResult,
+    ProviderReady
+  };
+
+  enum EncodeType {
+    Name,
+    CompPath,
+    EditablePath
+  };
+
+  EXPORT_API bool CheckWatchFeatureEnabled();
+  EXPORT_API int CheckPrivilege(const char* privilege);
+  EXPORT_API int CheckPrivilege(std::string privilege, cynara_result *pcr);
+  EXPORT_API int CheckPrivilege(std::string& privilege,
+                                     GDBusConnection *connection,
+                                     std::string& sender_name,
+                                     std::string& sender_appid);
+  EXPORT_API int GetSenderPid(GDBusConnection *conn, const std::string& sender_name);
+  EXPORT_API std::string GetSenderAppid(GDBusConnection *conn,
+                          const std::string& sender_name);
+  EXPORT_API bool CheckSender(const char* sender_app_id,
+                                const std::string& sender_name,
+                                GDBusConnection* conn);
+  EXPORT_API bool CheckComplicationType(int type);
+  EXPORT_API std::string EncodeStr(EncodeType type, std::string appid);
+  EXPORT_API std::string EncodeStr(EncodeType type, std::string appid, int compid);
+  EXPORT_API std::string GetAppId();
+  EXPORT_API std::string GetCmdStr(CmdType type);
+  EXPORT_API bool CheckCertificate(const std::string& provider_app_id);
+  EXPORT_API std::string GetAppPath(const char* appid, char* path);
+  EXPORT_API int ConvertPathToAppPath(const char* appid, bundle* data);
+  EXPORT_API bool IsValidData(tizen_base::Bundle shared_data);
+  EXPORT_API int GetDataType(tizen_base::Bundle shared_data);
+  EXPORT_API int ConvertAulError(int ret);
+  EXPORT_API void DestroyTimeInfo(struct complication_time_info_s* info);
+
+  class EXPORT_API DBHelper {
+    public:
+      using Cursor = std::unique_ptr<sqlite3_stmt, decltype(sqlite3_finalize)*>;
+      DBHelper()
+          : db_(nullptr, sqlite3_close_v2), stmt_(nullptr, sqlite3_finalize) {}
+
+      bool Open();
+      bool Open(int mode);
+      void Close();
+      bool Prepare(const std::string& query);
+      bool Exec(const std::string& query);
+      const Cursor& GetCursor() const;
+      int Step() const;
+      int Reset() const;
+
+      bool Bind(int pos, std::string text);
+      bool Bind(int pos, int val);
+
+      const char* GetText(int pos) const;
+      int GetInt(int pos) const;
+
+    private:
+      const char* GetParserDataPath() const;
+
+    private:
+      std::unique_ptr<sqlite3, decltype(sqlite3_close_v2)*> db_;
+      Cursor stmt_;
+  };
+}  // namespace util
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMMON_WATCHFACE_UTIL_H_
diff --git a/watchface-complication-provider/complication-provider-event-interface.h b/watchface-complication-provider/complication-provider-event-interface.h
deleted file mode 100644 (file)
index 62479af..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
-
-#include <bundle_cpp.h>
-
-#include <string>
-
-#include "watchface-complication/complication-internal.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IComplicationProviderEvent {
- public:
-  virtual void OnDataUpdated(const std::string& provider_id,
-                ComplicationType type,
-                const std::unique_ptr<tizen_base::Bundle>& data) = 0;
-  virtual void OnProviderError(const std::string& provider_id,
-                ComplicationType type, int error) = 0;
-  virtual void OnNotifyDataUpdate() = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
diff --git a/watchface-complication-provider/complication-provider-event-interface.hh b/watchface-complication-provider/complication-provider-event-interface.hh
new file mode 100644 (file)
index 0000000..38bac5e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
+
+#include <bundle_cpp.h>
+
+#include <string>
+
+#include "watchface-complication/complication-internal.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API IComplicationProviderEvent {
+ public:
+  virtual void OnDataUpdated(const std::string& provider_id,
+                ComplicationType type,
+                const std::unique_ptr<tizen_base::Bundle>& data) = 0;
+  virtual void OnProviderError(const std::string& provider_id,
+                ComplicationType type, int error) = 0;
+  virtual void OnNotifyDataUpdate() = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
diff --git a/watchface-complication-provider/complication-provider-implementation.h b/watchface-complication-provider/complication-provider-implementation.h
deleted file mode 100644 (file)
index 86c6137..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-#include <map>
-
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-common/watchface-util.h"
-
-namespace watchface_complication {
-
-class ComplicationProvider::Impl : IGDBus::IGDBusEvent {
- public:
-  virtual ~Impl();
-
- private:
-  friend class ComplicationProvider;
-
-  void OnSignal(GDBusConnection* connection,
-                const std::string& sender_name,
-                const std::string& object_path,
-                const std::string& interface_name,
-                const std::string& signal_name,
-                GVariant* parameters) override;
-  void OnVanish(const std::string& name) override;
-  void OnAppear(const std::string& name, const std::string& name_owner) override;
-  std::list<std::string>& GetRequiredPrivileges();
-  int NotifyProviderReady();
-  Impl(ComplicationProvider* parent, const std::string& provider_id);
-  class SenderInfo {
-   public:
-    SenderInfo(const std::string& sender_name, const char* sender_app_id,
-                      int watcher_id, std::string watch_name);
-    int CheckPrivilege(std::list<std::string>& required_privileges,
-                        GDBusConnection* connection);
-    bool CheckAppid(const std::string& Appid);
-    const std::string& GetAppid() const;
-    int GetWatcherID();
-    std::string& GetWatchName();
-    cynara_result GetPrivilegeResult();
-    void SetPrivilegeResult(cynara_result result);
-    int GetListeningCount() const;
-    void SetListeningCount(int count);
-
-   private:
-    std::string sender_name_;
-    std::string sender_app_id_;
-    int watcher_id_;
-    std::string watch_name_;
-    std::list<std::string> sender_privileges_;
-    cynara_result privilege_result_;
-    int listening_count_ = 0;
-  };
-  SenderInfo* GetSenderInfo(std::string sender_name,
-      GDBusConnection* connection, GVariant* parameters);
-
- private:
-  ComplicationProvider* parent_;
-  int subscribe_id_;
-  std::string provider_id_;
-  std::string setup_appid_;
-  int supported_types_;
-  std::map<std::string, SenderInfo*> sender_info_;
-  std::list<std::string> required_privileges_;
-  std::unique_ptr<IGDBus> gdbus_;
-  bool trusted_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
-
diff --git a/watchface-complication-provider/complication-provider-implementation.hh b/watchface-complication-provider/complication-provider-implementation.hh
new file mode 100644 (file)
index 0000000..1d1e8a0
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+#include <map>
+
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-common/watchface-util.hh"
+
+namespace watchface_complication {
+
+class ComplicationProvider::Impl : IGDBus::IGDBusEvent {
+ public:
+  virtual ~Impl();
+
+ private:
+  friend class ComplicationProvider;
+
+  void OnSignal(GDBusConnection* connection,
+                const std::string& sender_name,
+                const std::string& object_path,
+                const std::string& interface_name,
+                const std::string& signal_name,
+                GVariant* parameters) override;
+  void OnVanish(const std::string& name) override;
+  void OnAppear(const std::string& name, const std::string& name_owner) override;
+  std::list<std::string>& GetRequiredPrivileges();
+  int NotifyProviderReady();
+  Impl(ComplicationProvider* parent, const std::string& provider_id);
+  class SenderInfo {
+   public:
+    SenderInfo(const std::string& sender_name, const char* sender_app_id,
+                      int watcher_id, std::string watch_name);
+    int CheckPrivilege(std::list<std::string>& required_privileges,
+                        GDBusConnection* connection);
+    bool CheckAppid(const std::string& Appid);
+    const std::string& GetAppid() const;
+    int GetWatcherID();
+    std::string& GetWatchName();
+    cynara_result GetPrivilegeResult();
+    void SetPrivilegeResult(cynara_result result);
+    int GetListeningCount() const;
+    void SetListeningCount(int count);
+
+   private:
+    std::string sender_name_;
+    std::string sender_app_id_;
+    int watcher_id_;
+    std::string watch_name_;
+    std::list<std::string> sender_privileges_;
+    cynara_result privilege_result_;
+    int listening_count_ = 0;
+  };
+  SenderInfo* GetSenderInfo(std::string sender_name,
+      GDBusConnection* connection, GVariant* parameters);
+
+ private:
+  ComplicationProvider* parent_;
+  int subscribe_id_;
+  std::string provider_id_;
+  std::string setup_appid_;
+  int supported_types_;
+  std::map<std::string, SenderInfo*> sender_info_;
+  std::list<std::string> required_privileges_;
+  std::unique_ptr<IGDBus> gdbus_;
+  bool trusted_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_IMPLEMENTATION_H_
+
index e1771851d4b00ea524c5ed4fe852bffe81775472..037f82542f8a850aed19f07a2bada85b24f98c96 100644 (file)
 
 #include <list>
 
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
-#include "watchface-complication-provider/complication-provider.h"
-#include "watchface-complication-provider/complication-provider-implementation.h"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-complication-provider/complication-provider.hh"
+#include "watchface-complication-provider/complication-provider-implementation.hh"
 #include "watchface-complication-provider/include/watchface-complication-provider.h"
 
 #ifdef LOG_TAG
diff --git a/watchface-complication-provider/complication-provider.h b/watchface-complication-provider/complication-provider.h
deleted file mode 100644 (file)
index 24f67d0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
-#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
-
-#include <gio/gio.h>
-#include <string>
-#include <memory>
-
-#include "watchface-complication/complication-event-interface.h"
-#include "watchface-complication/complication-connector.h"
-
-namespace watchface_complication {
-
-class EXPORT_API ComplicationProvider : public IComplicationEvent {
- public:
-  explicit ComplicationProvider(const std::string& provider_id);
-  virtual ~ComplicationProvider(); /* LCOV_EXCL_LINE */
-
- public:
-  void OnDataUpdateRequest(const std::string& sender_appid,
-                           ComplicationType type,
-                           const tizen_base::Bundle& context,
-                           tizen_base::Bundle* shared_data) override;
-  void OnConsumerStatusChange(const std::string& sender_appid,
-       watchface_complication_consumer_status_e status) override;
-
-  int NotifyDataUpdate();
-  const std::string& GetProviderId() const;
-  static bool SetupReplyToEditor(std::string editor_appid,
-      int editable_id, const char* raw);
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
diff --git a/watchface-complication-provider/complication-provider.hh b/watchface-complication-provider/complication-provider.hh
new file mode 100644 (file)
index 0000000..479994e
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
+#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
+
+#include <gio/gio.h>
+#include <string>
+#include <memory>
+
+#include "watchface-complication/complication-event-interface.hh"
+#include "watchface-complication/complication-connector.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API ComplicationProvider : public IComplicationEvent {
+ public:
+  explicit ComplicationProvider(const std::string& provider_id);
+  virtual ~ComplicationProvider(); /* LCOV_EXCL_LINE */
+
+ public:
+  void OnDataUpdateRequest(const std::string& sender_appid,
+                           ComplicationType type,
+                           const tizen_base::Bundle& context,
+                           tizen_base::Bundle* shared_data) override;
+  void OnConsumerStatusChange(const std::string& sender_appid,
+       watchface_complication_consumer_status_e status) override;
+
+  int NotifyDataUpdate();
+  const std::string& GetProviderId() const;
+  static bool SetupReplyToEditor(std::string editor_appid,
+      int editable_id, const char* raw);
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_H_
index 8f66aa278a3a8c0903467410699392d14d3356a4..4add505d0f33cfb0d41b082b28bd6bd85a1b2ebc 100644 (file)
@@ -53,7 +53,10 @@ int watchface_complication_provider_data_set_icon_path_with_aod(
        bundle *shared_data, const char *icon_path, const char *aod_icon_path);
 int watchface_complication_provider_data_set_image_path_with_aod(
        bundle *shared_data, const char *image_path, const char *aod_image_path);
-
+int watchface_complication_provider_data_set_small_image_path(
+    bundle* shared_data, const char* small_image_path);
+int watchface_complication_provider_data_set_small_image_path_with_aod(
+    bundle* shared_data, const char* image_path, const char* small_image_path);
 
 typedef enum _watchface_complication_consumer_status {
        WATCHFACE_COMPLICATION_CONSUMER_LISTENING_START = 0x1,
index 636c4f459ed1a6a7ed90a47dfc14e3b7c26b065a..f554bdd7adc3696c93071075ba0502ad2bdbf51e 100644 (file)
 #include <map>
 #include <list>
 
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
-#include "watchface-complication-provider/complication-provider.h"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-common/include/watchface-common-internal.h"
+#include "watchface-complication-provider/complication-provider.hh"
 #include "watchface-complication-provider/include/watchface-complication-provider.h"
 #include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
-#include "watchface-complication/db-manager.h"
-#include "watchface-complication/complication-internal.h"
+#include "watchface-complication/db-manager.hh"
+#include "watchface-complication/complication-internal.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -488,6 +489,37 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_image_path_wi
   return _add_bundle_data(shared_data, IMAGE_KEY, image_path);
 }
 
+extern "C" EXPORT_API int watchface_complication_provider_data_set_small_image_path_with_aod(
+    bundle* shared_data, const char* image_path, const char* aod_image_path) {
+  int ret;
+  watchface_complication_type_e type;
+
+  if (!watchface_complication::util::CheckWatchFeatureEnabled())
+    return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+  if (shared_data == nullptr || image_path == nullptr) {
+    LOGE("Invalid param");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  ret = _get_data_type(shared_data, &type);
+  if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+      return ret;
+  if (type != WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE &&
+      type != WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
+    LOGE("Invalid type, not allowed for this type !!");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  if (aod_image_path != nullptr) {
+    ret = _add_bundle_data(shared_data, AOD_SMALL_IMAGE_KEY, aod_image_path);
+    if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+      return ret;
+  }
+
+  return _add_bundle_data(shared_data, SMALL_IMAGE_KEY, image_path);
+}
+
 extern "C" EXPORT_API int watchface_complication_provider_data_set_title(
     bundle* shared_data, const char* title) {
   int ret;
@@ -790,6 +822,31 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_image_path(
   return _add_bundle_data(shared_data, IMAGE_KEY, image_path);
 }
 
+extern "C" EXPORT_API int watchface_complication_provider_data_set_small_image_path(
+    bundle* shared_data, const char* image_path) {
+  int ret;
+  watchface_complication_type_e type;
+
+  if (!watchface_complication::util::CheckWatchFeatureEnabled())
+    return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+  if (shared_data == nullptr || image_path == nullptr) {
+    LOGE("Invalid param");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  ret = _get_data_type(shared_data, &type);
+  if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+      return ret;
+  if (type != WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE &&
+      type != WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
+    LOGE("Invalid type, not allowed for this type !!");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  return _add_bundle_data(shared_data, SMALL_IMAGE_KEY, image_path);
+}
+
 extern "C" EXPORT_API int watchface_complication_provider_data_set_ranged_value(
     bundle* shared_data, double current_value, double min_value,
     double max_value) {
index ca0a2f2dbc8271f67622f8932b6cc4925005d56d..54cf930ce46ddef39dcebe756e0d2cccd95618d1 100644 (file)
@@ -57,4 +57,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-editable-internal.h
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-editable.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-complication.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-complication-internal.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/complication-internal.h DESTINATION include/${PROJECT_NAME})
\ No newline at end of file
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/complication-internal.hh DESTINATION include/${PROJECT_NAME})
\ No newline at end of file
index 29e1bd040d42da3899d62930b68c58418acf33b7..7e7acaf0369a5b9e453bf223cfb7e7474533cd07 100644 (file)
@@ -24,8 +24,8 @@
 #include <string>
 #include <list>
 
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
index 24822d42c721171ddd745648deda89d4514e850d..cfcdfd9d7f55b6615032b0ee4191ffc5b188eaf8 100644 (file)
 
 #include <list>
 
-#include "watchface-complication/complication-connector.h"
+#include "watchface-complication/complication-connector.hh"
 #include "watchface-complication/complication-connector-implementation.h"
-#include "watchface-common/watchface-exception.h"
-#include "watchface-complication/package-manager.h"
-#include "watchface-complication/gdbus.h"
+#include "watchface-common/watchface-exception.hh"
+#include "watchface-complication/package-manager.hh"
+#include "watchface-complication/gdbus.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-complication/complication-connector.h b/watchface-complication/complication-connector.h
deleted file mode 100644 (file)
index f3f2f63..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
-
-#include <gio/gio.h>
-#include <string>
-#include <memory>
-
-#include "watchface-complication/complication-internal.h"
-#include "watchface-common/watchface-exception.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-complication/package-manager-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API ComplicationConnector {
- public:
-  static ComplicationConnector& GetInst();
-  IGDBus* CreateGDBus();
-  IPackageManager* CreatePackageManager();
-  bool EmitSignal(IGDBus::SigType type, std::string target_id, std::string id,
-    int sub_id, std::string cmd, GVariant* data);
-  void WatchPackageEvent(IPackageManager::IPackageEvent* pe);
-  void UnWatchPackageEvent(IPackageManager::IPackageEvent* pe);
-
- private:
-  ComplicationConnector();
-  int Init();
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
diff --git a/watchface-complication/complication-connector.hh b/watchface-complication/complication-connector.hh
new file mode 100644 (file)
index 0000000..f87319f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
+
+#include <gio/gio.h>
+#include <string>
+#include <memory>
+
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-common/watchface-exception.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-complication/package-manager-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API ComplicationConnector {
+ public:
+  static ComplicationConnector& GetInst();
+  IGDBus* CreateGDBus();
+  IPackageManager* CreatePackageManager();
+  bool EmitSignal(IGDBus::SigType type, std::string target_id, std::string id,
+    int sub_id, std::string cmd, GVariant* data);
+  void WatchPackageEvent(IPackageManager::IPackageEvent* pe);
+  void UnWatchPackageEvent(IPackageManager::IPackageEvent* pe);
+
+ private:
+  ComplicationConnector();
+  int Init();
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_COMPLICATION_CONNECTOR_H_
diff --git a/watchface-complication/complication-event-interface.h b/watchface-complication/complication-event-interface.h
deleted file mode 100644 (file)
index 6ce27b3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
-
-#include <bundle_cpp.h>
-
-#include <string>
-
-#include "watchface-complication/complication-internal.h"
-#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IComplicationEvent {
- public:
-  virtual void OnDataUpdateRequest(const std::string& sender_appid,
-                                   ComplicationType type,
-                                   const tizen_base::Bundle& context,
-                                   tizen_base::Bundle* shared_data) = 0;
- virtual void OnConsumerStatusChange(const std::string& sender_appid,
-                                   watchface_complication_consumer_status_e status) = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
diff --git a/watchface-complication/complication-event-interface.hh b/watchface-complication/complication-event-interface.hh
new file mode 100644 (file)
index 0000000..0e7bd13
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
+
+#include <bundle_cpp.h>
+
+#include <string>
+
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
+
+namespace watchface_complication {
+
+class EXPORT_API IComplicationEvent {
+ public:
+  virtual void OnDataUpdateRequest(const std::string& sender_appid,
+                                   ComplicationType type,
+                                   const tizen_base::Bundle& context,
+                                   tizen_base::Bundle* shared_data) = 0;
+ virtual void OnConsumerStatusChange(const std::string& sender_appid,
+                                   watchface_complication_consumer_status_e status) = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
diff --git a/watchface-complication/complication-implementation.h b/watchface-complication/complication-implementation.h
deleted file mode 100644 (file)
index f9f05e9..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <dlog.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <map>
-#include <list>
-
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "WATCHFACE_COMPLICATION"
-
-namespace watchface_complication {
-
-class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
- public:
-  void OnSignal(GDBusConnection* connection,
-                const std::string& sender_name,
-                const std::string& object_path,
-                const std::string& interface_name,
-                const std::string& signal_name,
-                GVariant* parameters) override;
-  void OnVanish(const std::string& name) override;
-  void OnAppear(const std::string& name, const std::string& name_owner) override;
-  void OnAppDisabled(const std::string& appid) override;
-  void OnAppUninstalled(const std::string& appid) override;
-  virtual ~Impl();
-
- private:
-  friend class Complication;
-
-  Impl(Complication* parent, int id, int supported_types, int supported_event_types,
-       const std::string& default_provider_id,
-       ComplicationType default_type);
-  void RestoreStateOrSetDefault();
-  int StoreSetting(int comp_id, std::string& provider_id,
-                ComplicationType type);
-  std::unique_ptr<tizen_base::Bundle> LoadSetting();
-  int AddCandidate(std::string provider_id, int type);
-  int AddCandidates(std::string provider_id, int types);
-  int AddCandidates(int types);
-  int UpdateCandidatesInfo();
-  int MakeCandidatesList();
-  int LoadPeriod();
-  void LoadLabel();
-  int LoadContext();
-  int LoadCurProviderFromPrev();
-  int LoadCurProviderFromDefault();
-  void UpdateLastDataFields();
-  int UpdateProviderInfo();
-  int DeleteAppContext(const char* appid);
-  int ReplaceUnavailableProvider(const char* deleted_appid);
-  bool CheckCachedPrivilege(std::string privilege);
-  int CheckNotSupported(std::string provider_id);
-  int GetNotSupportedEvents(std::string provider_id);
-  std::string GetNotSupportedPrivileges(std::string provider_id);
-  bool IsValidSender(GDBusConnection* connection,
-                    const std::string& sender_name);
-  void UpdatedProcess(GVariant* parameters);
-  void NotifyDataUpdateProcess(GVariant* parameters);
-  void ProviderReadyProcess(GVariant* parameters);
-  int UpdateCurProvider(std::string new_provider_id, ComplicationType type);
-
- private:
-  Complication* parent_;
-  int complication_id_ = -1;
-  int editable_id_ = -1;
-  int supported_types_ = -1;
-  int supported_event_types_ = -1;
-  std::string default_provider_appid_;
-  std::string default_provider_id_;
-  ComplicationType default_type_;
-  std::shared_ptr<IEditable::Highlight> highlight_;
-  std::string cur_provider_appid_;
-  std::string cur_provider_id_;
-  ComplicationType cur_type_;
-  std::string last_provider_id_;
-  ComplicationType last_type_ = NoData;
-  std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
-  std::list<std::unique_ptr<ProviderInfo>> allowed_list_;
-  std::list<std::unique_ptr<ProviderInfo>> denied_list_;
-  std::list<std::unique_ptr<ProviderInfo>> priority_list_;
-  std::list<std::string> privilege_list_;
-  int cur_data_idx_ = -1;
-  std::unique_ptr<tizen_base::Bundle> context_data_;
-  std::unique_ptr<tizen_base::Bundle> last_context_data_;
-  std::unique_ptr<tizen_base::Bundle> last_data_;
-  int last_data_idx_ = -1;
-  std::string name_;
-  int subscribe_id_ = -1;
-  int watcher_id_ = -1;
-  static const std::string provider_id_key_;
-  static const std::string provider_type_key_;
-  static const std::string supported_events_error_key_;
-  static const std::string privilege_error_key_;
-  static std::list<int> complication_id_list_;
-  IEditable::EditableState ed_state_ = Complete;
-  guint periodic_timer_ = 0;
-  std::unique_ptr<IGDBus> gdbus_;
-  std::unique_ptr<IPackageManager> package_;
-  EditablesManager& editables_manager_;
-  bool mock_ = false;
-  bool is_provider_ready_ = false;
-  int listening_status_ = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
diff --git a/watchface-complication/complication-implementation.hh b/watchface-complication/complication-implementation.hh
new file mode 100644 (file)
index 0000000..a41e880
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <dlog.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <map>
+#include <list>
+
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "WATCHFACE_COMPLICATION"
+
+namespace watchface_complication {
+
+class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
+ public:
+  void OnSignal(GDBusConnection* connection,
+                const std::string& sender_name,
+                const std::string& object_path,
+                const std::string& interface_name,
+                const std::string& signal_name,
+                GVariant* parameters) override;
+  void OnVanish(const std::string& name) override;
+  void OnAppear(const std::string& name, const std::string& name_owner) override;
+  void OnAppDisabled(const std::string& appid) override;
+  void OnAppUninstalled(const std::string& appid) override;
+  virtual ~Impl();
+
+ private:
+  friend class Complication;
+
+  Impl(Complication* parent, int id, int supported_types, int supported_event_types,
+       const std::string& default_provider_id,
+       ComplicationType default_type);
+  void RestoreStateOrSetDefault();
+  int StoreSetting(int comp_id, std::string& provider_id,
+                ComplicationType type);
+  std::unique_ptr<tizen_base::Bundle> LoadSetting();
+  int AddCandidate(std::string provider_id, int type);
+  int AddCandidates(std::string provider_id, int types);
+  int AddCandidates(int types);
+  int UpdateCandidatesInfo();
+  int MakeCandidatesList();
+  int LoadPeriod();
+  void LoadLabel();
+  int LoadContext();
+  int LoadCurProviderFromPrev();
+  int LoadCurProviderFromDefault();
+  void UpdateLastDataFields();
+  int UpdateProviderInfo();
+  int DeleteAppContext(const char* appid);
+  int ReplaceUnavailableProvider(const char* deleted_appid);
+  bool CheckCachedPrivilege(std::string privilege);
+  int CheckNotSupported(std::string provider_id);
+  int GetNotSupportedEvents(std::string provider_id);
+  std::string GetNotSupportedPrivileges(std::string provider_id);
+  bool IsValidSender(GDBusConnection* connection,
+                    const std::string& sender_name);
+  void UpdatedProcess(GVariant* parameters);
+  void NotifyDataUpdateProcess(GVariant* parameters);
+  void ProviderReadyProcess(GVariant* parameters);
+  int UpdateCurProvider(std::string new_provider_id, ComplicationType type);
+
+ private:
+  Complication* parent_;
+  int complication_id_ = -1;
+  int editable_id_ = -1;
+  int supported_types_ = -1;
+  int supported_event_types_ = -1;
+  std::string default_provider_appid_;
+  std::string default_provider_id_;
+  ComplicationType default_type_;
+  std::shared_ptr<IEditable::Highlight> highlight_;
+  std::string cur_provider_appid_;
+  std::string cur_provider_id_;
+  ComplicationType cur_type_;
+  std::string last_provider_id_;
+  ComplicationType last_type_ = NoData;
+  std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
+  std::list<std::unique_ptr<ProviderInfo>> allowed_list_;
+  std::list<std::unique_ptr<ProviderInfo>> denied_list_;
+  std::list<std::unique_ptr<ProviderInfo>> priority_list_;
+  std::list<std::string> privilege_list_;
+  int cur_data_idx_ = -1;
+  std::unique_ptr<tizen_base::Bundle> context_data_;
+  std::unique_ptr<tizen_base::Bundle> last_context_data_;
+  std::unique_ptr<tizen_base::Bundle> last_data_;
+  int last_data_idx_ = -1;
+  std::string name_;
+  int subscribe_id_ = -1;
+  int watcher_id_ = -1;
+  static const std::string provider_id_key_;
+  static const std::string provider_type_key_;
+  static const std::string supported_events_error_key_;
+  static const std::string privilege_error_key_;
+  static std::list<int> complication_id_list_;
+  IEditable::EditableState ed_state_ = Complete;
+  guint periodic_timer_ = 0;
+  std::unique_ptr<IGDBus> gdbus_;
+  std::unique_ptr<IPackageManager> package_;
+  EditablesManager& editables_manager_;
+  bool mock_ = false;
+  bool is_provider_ready_ = false;
+  int listening_status_ = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_COMPLICATION_IMPLEMENTATION_H_
diff --git a/watchface-complication/complication-internal.h b/watchface-complication/complication-internal.h
deleted file mode 100644 (file)
index 1f07b02..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TIZEN_APPFW_COMPLICATION_INTERNAL_H__
-#define __TIZEN_APPFW_COMPLICATION_INTERNAL_H__
-
-#include <watchface-common.h>
-
-namespace watchface_complication {
-
-typedef enum {
-  NoData = WATCHFACE_COMPLICATION_TYPE_NO_DATA,
-  ShortText = WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
-  LongText = WATCHFACE_COMPLICATION_TYPE_LONG_TEXT,
-  RangedValue = WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
-  Time = WATCHFACE_COMPLICATION_TYPE_TIME,
-  Icon = WATCHFACE_COMPLICATION_TYPE_ICON,
-  Image = WATCHFACE_COMPLICATION_TYPE_IMAGE
-} ComplicationType;
-
-typedef enum {
-  EventNone = WATCHFACE_COMPLICATION_EVENT_NONE,
-  EventTap = WATCHFACE_COMPLICATION_EVENT_TAP,
-  EventDoubleTap = WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP
-} ComplicationEventType;
-
-}  // namespace watchface_complication
-
-#endif  /* __TIZEN_APPFW_COMPLICATION_INTERNAL_H__ */
diff --git a/watchface-complication/complication-internal.hh b/watchface-complication/complication-internal.hh
new file mode 100644 (file)
index 0000000..2688847
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_APPFW_COMPLICATION_INTERNAL_H__
+#define __TIZEN_APPFW_COMPLICATION_INTERNAL_H__
+
+#include <watchface-common.h>
+#include "watchface-common/include/watchface-common-internal.h"
+
+namespace watchface_complication {
+
+typedef enum {
+  NoData = WATCHFACE_COMPLICATION_TYPE_NO_DATA,
+  ShortText = WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+  LongText = WATCHFACE_COMPLICATION_TYPE_LONG_TEXT,
+  RangedValue = WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
+  Time = WATCHFACE_COMPLICATION_TYPE_TIME,
+  Icon = WATCHFACE_COMPLICATION_TYPE_ICON,
+  Image = WATCHFACE_COMPLICATION_TYPE_IMAGE,
+  SmallImage = WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE
+} ComplicationType;
+
+typedef enum {
+  EventNone = WATCHFACE_COMPLICATION_EVENT_NONE,
+  EventTap = WATCHFACE_COMPLICATION_EVENT_TAP,
+  EventDoubleTap = WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP
+} ComplicationEventType;
+
+}  // namespace watchface_complication
+
+#endif  /* __TIZEN_APPFW_COMPLICATION_INTERNAL_H__ */
index d7975f7826e9b1c02ec8526e26ab84af09672af0..e385fc339e0277d7fe16be83233a368243322415 100644 (file)
 #include <pkgmgr-info.h>
 #include <stdexcept>
 
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-implementation.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
-#include "watchface-complication/complication-internal.h"
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-implementation.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
+#include "watchface-complication/complication-internal.hh"
 #include "watchface-complication/include/watchface-complication-internal.h"
 
 #include <iostream>
diff --git a/watchface-complication/complication.h b/watchface-complication/complication.h
deleted file mode 100644 (file)
index d154c81..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_COMPLICATION_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication-provider/complication-provider-event-interface.h"
-#include "watchface-complication/editable-interface.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/editables-manager.h"
-#include "watchface-complication/db-manager.h"
-#include "watchface-common/watchface-exception.h"
-#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
-
-namespace watchface_complication {
-
-class EXPORT_API Complication : public IEditable
-  , public IComplicationProviderEvent {
- public:
-  Complication(int id, int supported_types, int supported_event_types,
-               const std::string& default_provider_id,
-               ComplicationType default_type);
-  virtual ~Complication();
-
- public:
-  class ProviderInfo {
-   public:
-    ProviderInfo(std::string provider_id, int types)
-      : provider_id_(provider_id), types_(types) {
-    }
-
-    const std::string& GetProviderId() const {
-      return provider_id_;
-    }
-
-    int GetTypes() const {
-      return types_;
-    }
-
-   private:
-    std::string provider_id_;
-    int types_;
-  };
-
-  int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
-  std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
-  std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
-  int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
-  std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
-  std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
-  int GetCurDataIdx() const override;
-  int SetCurDataIdx(int cur_data_idx) override;
-  int GetLastDataIdx() const override;
-  int UpdateLastData() override;
-  const std::string& GetLabel() const override;
-  void OnEditableUpdated(int selected_idx,
-                    IEditable::EditableState state) override;
-  void OnDataUpdated(const std::string& provider_id,
-                    ComplicationType type,
-                    const std::unique_ptr<tizen_base::Bundle>& data) override;
-  void OnProviderError(const std::string& provider_id, ComplicationType type,
-                    int error) override;
-  void OnNotifyDataUpdate() override;
-  int GetEditableId() const override;
-  int SetEditableId(int id) override;
-  void SetLabel(const std::string& name) override;
-  void SetState(IEditable::EditableState state) override;
-  IEditable::EditableState GetState() const override;
-  int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
-  std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
-  int UpdateLastContext() override;
-  std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
-  std::string GetSetupAppId() const override;
-
-  int GetComplicationId() const;
-  int SendDataUpdateRequest(bool launch_option = true);
-  std::string GetCurProviderId() const;
-  std::string GetProviderId(const tizen_base::Bundle& candidate_data) const;
-  int GetProviderType(const tizen_base::Bundle& candidate_data) const;
-  int GetCurType() const;
-  int TouchLaunch(watchface_complication_event_type_e event_type);
-  int ApplyAllowedList(
-      std::list<std::unique_ptr<ProviderInfo>> allowed_list);
-  int ApplyDeniedList(
-      std::list<std::unique_ptr<ProviderInfo>> denied_list);
-  int ApplyPriorityList(
-      std::list<std::unique_ptr<ProviderInfo>> allowed_list);
-  int ClearAllowedList();
-  int ClearPriorityList();
-  int ClearDeniedList();
-  int Init();
-  void SetListeningStatus(watchface_complication_consumer_status_e state);
-  void NotifyListeningStatus(watchface_complication_consumer_status_e state);
-
- public:
-  static const char* GetProviderIdKey();
-  static const char* GetProviderTypeKey();
-  static const char* GetSupportedEventsErrorKey();
-  static const char* GetPrivilegeErrorKey();
-  static gboolean PeriodCallback(gpointer user_data);
-  static int GetDefaultData(
-      std::string provider_id, int type, tizen_base::Bundle* data);
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_COMPLICATION_H_
diff --git a/watchface-complication/complication.hh b/watchface-complication/complication.hh
new file mode 100644 (file)
index 0000000..8bdfa47
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_COMPLICATION_H_
+#define WATCHFACE_COMPLICATION_COMPLICATION_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication-provider/complication-provider-event-interface.hh"
+#include "watchface-complication/editable-interface.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/editables-manager.hh"
+#include "watchface-complication/db-manager.hh"
+#include "watchface-common/watchface-exception.hh"
+#include "watchface-complication-provider/include/watchface-complication-provider-internal.h"
+
+namespace watchface_complication {
+
+class EXPORT_API Complication : public IEditable
+  , public IComplicationProviderEvent {
+ public:
+  Complication(int id, int supported_types, int supported_event_types,
+               const std::string& default_provider_id,
+               ComplicationType default_type);
+  virtual ~Complication();
+
+ public:
+  class ProviderInfo {
+   public:
+    ProviderInfo(std::string provider_id, int types)
+      : provider_id_(provider_id), types_(types) {
+    }
+
+    const std::string& GetProviderId() const {
+      return provider_id_;
+    }
+
+    int GetTypes() const {
+      return types_;
+    }
+
+   private:
+    std::string provider_id_;
+    int types_;
+  };
+
+  int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
+  std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
+  std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+  int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+  std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+  std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+  int GetCurDataIdx() const override;
+  int SetCurDataIdx(int cur_data_idx) override;
+  int GetLastDataIdx() const override;
+  int UpdateLastData() override;
+  const std::string& GetLabel() const override;
+  void OnEditableUpdated(int selected_idx,
+                    IEditable::EditableState state) override;
+  void OnDataUpdated(const std::string& provider_id,
+                    ComplicationType type,
+                    const std::unique_ptr<tizen_base::Bundle>& data) override;
+  void OnProviderError(const std::string& provider_id, ComplicationType type,
+                    int error) override;
+  void OnNotifyDataUpdate() override;
+  int GetEditableId() const override;
+  int SetEditableId(int id) override;
+  void SetLabel(const std::string& name) override;
+  void SetState(IEditable::EditableState state) override;
+  IEditable::EditableState GetState() const override;
+  int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+  std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
+  int UpdateLastContext() override;
+  std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+  std::string GetSetupAppId() const override;
+
+  int GetComplicationId() const;
+  int SendDataUpdateRequest(bool launch_option = true);
+  std::string GetCurProviderId() const;
+  std::string GetProviderId(const tizen_base::Bundle& candidate_data) const;
+  int GetProviderType(const tizen_base::Bundle& candidate_data) const;
+  int GetCurType() const;
+  int TouchLaunch(watchface_complication_event_type_e event_type);
+  int ApplyAllowedList(
+      std::list<std::unique_ptr<ProviderInfo>> allowed_list);
+  int ApplyDeniedList(
+      std::list<std::unique_ptr<ProviderInfo>> denied_list);
+  int ApplyPriorityList(
+      std::list<std::unique_ptr<ProviderInfo>> allowed_list);
+  int ClearAllowedList();
+  int ClearPriorityList();
+  int ClearDeniedList();
+  int Init();
+  void SetListeningStatus(watchface_complication_consumer_status_e state);
+  void NotifyListeningStatus(watchface_complication_consumer_status_e state);
+
+ public:
+  static const char* GetProviderIdKey();
+  static const char* GetProviderTypeKey();
+  static const char* GetSupportedEventsErrorKey();
+  static const char* GetPrivilegeErrorKey();
+  static gboolean PeriodCallback(gpointer user_data);
+  static int GetDefaultData(
+      std::string provider_id, int type, tizen_base::Bundle* data);
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_COMPLICATION_H_
index d4def18c3686e291912e9016018fb0c6dfeebbf1..b84a1375e51af55dea30438a4ea7088ece975933 100644 (file)
@@ -22,9 +22,9 @@
 #include <pkgmgr_installer_info.h>
 #include <vconf.h>
 
-#include "watchface-complication/complication-internal.h"
-#include "watchface-complication/db-manager.h"
-#include "watchface-common/watchface-util.h"
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-complication/db-manager.hh"
+#include "watchface-common/watchface-util.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-complication/db-manager.h b/watchface-complication/db-manager.h
deleted file mode 100644 (file)
index 0b6d2e6..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_DB_MANAGER_H_
-#define WATCHFACE_COMPLICATION_DB_MANAGER_H_
-
-#include <gio/gio.h>
-#include <sqlite3.h>
-#include <watchface-common.h>
-#include <bundle_cpp.h>
-
-#include <string>
-#include <memory>
-#include <list>
-
-namespace watchface_complication {
-
-class EXPORT_API DBManager {
- public:
-  class ProviderInfo {
-    std::string provider_id_;
-    int type_;
-   public:
-    ProviderInfo(std::string provider_id, int type)
-      : provider_id_(provider_id), type_(type) {
-    }
-    std::string& GetProviderId() {
-      return provider_id_;
-    }
-    int GetType() {
-      return type_;
-    }
-  };
-  static std::unique_ptr<tizen_base::Bundle> GetDefaultData(
-      const char* provider_id, int support_type);
-  static std::string GetProviderAppId(const char* provider_id);
-  static std::list<std::string> GetRequiredPrivilegeList(
-                  std::string& provider_id);
-  static int GetRequiredSupportEvents(std::string& provider_id);
-  static std::list<std::unique_ptr<ProviderInfo>> GetProviderListWithTypes(
-                  int supported_types);
-  static int GetSupportTypes(std::string& provider_id, int* types);
-  static int GetProviderPeriod(std::string& provider_id, int* period);
-  static std::string GetLabel(const char* provider_id);
-  static std::string GetIcon(std::string provider_id, std::string locale);
-  static std::string GetSetupAppId(const char* provider_id);
-  static bool IsProviderExist(std::string& provider_id, int support_type);
-  static std::list<std::string> GetProviderListWithAppId(const char* provider_id);
-  static int GetTrustedInfo(std::string& provider_id, bool* trusted);
-  static std::string GetSystemLocale();
-
- private:
-  DBManager(); /* LCOV_EXCL_LINE */
-  virtual ~DBManager(); /* LCOV_EXCL_LINE */
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_DB_MANAGER_H_
diff --git a/watchface-complication/db-manager.hh b/watchface-complication/db-manager.hh
new file mode 100644 (file)
index 0000000..0b6d2e6
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_DB_MANAGER_H_
+#define WATCHFACE_COMPLICATION_DB_MANAGER_H_
+
+#include <gio/gio.h>
+#include <sqlite3.h>
+#include <watchface-common.h>
+#include <bundle_cpp.h>
+
+#include <string>
+#include <memory>
+#include <list>
+
+namespace watchface_complication {
+
+class EXPORT_API DBManager {
+ public:
+  class ProviderInfo {
+    std::string provider_id_;
+    int type_;
+   public:
+    ProviderInfo(std::string provider_id, int type)
+      : provider_id_(provider_id), type_(type) {
+    }
+    std::string& GetProviderId() {
+      return provider_id_;
+    }
+    int GetType() {
+      return type_;
+    }
+  };
+  static std::unique_ptr<tizen_base::Bundle> GetDefaultData(
+      const char* provider_id, int support_type);
+  static std::string GetProviderAppId(const char* provider_id);
+  static std::list<std::string> GetRequiredPrivilegeList(
+                  std::string& provider_id);
+  static int GetRequiredSupportEvents(std::string& provider_id);
+  static std::list<std::unique_ptr<ProviderInfo>> GetProviderListWithTypes(
+                  int supported_types);
+  static int GetSupportTypes(std::string& provider_id, int* types);
+  static int GetProviderPeriod(std::string& provider_id, int* period);
+  static std::string GetLabel(const char* provider_id);
+  static std::string GetIcon(std::string provider_id, std::string locale);
+  static std::string GetSetupAppId(const char* provider_id);
+  static bool IsProviderExist(std::string& provider_id, int support_type);
+  static std::list<std::string> GetProviderListWithAppId(const char* provider_id);
+  static int GetTrustedInfo(std::string& provider_id, bool* trusted);
+  static std::string GetSystemLocale();
+
+ private:
+  DBManager(); /* LCOV_EXCL_LINE */
+  virtual ~DBManager(); /* LCOV_EXCL_LINE */
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_DB_MANAGER_H_
diff --git a/watchface-complication/design-element-implementation.h b/watchface-complication/design-element-implementation.h
deleted file mode 100644 (file)
index 40b0fd3..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/editables-manager.h"
-
-namespace watchface_complication {
-
-class DesignElement::Impl {
- public:
-  virtual ~Impl() = default;
-
- private:
-  friend class DesignElement;
-  Impl(DesignElement* parent, int id, int cur_data_idx);
-  Impl(Impl const& other) = default;
-  Impl(Impl && other) = default;
-  Impl& operator=(Impl const& other) = default;
-  Impl& operator=(Impl && other) = default;
-
- private:
-  DesignElement* parent_;
-  int id_ = -1;
-  int cur_data_idx_;
-  int last_data_idx_;
-  std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
-  std::shared_ptr<IEditable::Highlight> highlight_;
-  EditableShapeType shape_type_ = Circle;
-  std::string name_;
-  IEditable::EditableState ed_state_ = Complete;
-  std::unique_ptr<tizen_base::Bundle> context_data_;
-  std::unique_ptr<tizen_base::Bundle> last_context_data_;
-  EditablesManager& editables_manager_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
-
-
-
diff --git a/watchface-complication/design-element-implementation.hh b/watchface-complication/design-element-implementation.hh
new file mode 100644 (file)
index 0000000..df490cf
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/editables-manager.hh"
+
+namespace watchface_complication {
+
+class DesignElement::Impl {
+ public:
+  virtual ~Impl() = default;
+
+ private:
+  friend class DesignElement;
+  Impl(DesignElement* parent, int id, int cur_data_idx);
+  Impl(Impl const& other) = default;
+  Impl(Impl && other) = default;
+  Impl& operator=(Impl const& other) = default;
+  Impl& operator=(Impl && other) = default;
+
+ private:
+  DesignElement* parent_;
+  int id_ = -1;
+  int cur_data_idx_;
+  int last_data_idx_;
+  std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
+  std::shared_ptr<IEditable::Highlight> highlight_;
+  EditableShapeType shape_type_ = Circle;
+  std::string name_;
+  IEditable::EditableState ed_state_ = Complete;
+  std::unique_ptr<tizen_base::Bundle> context_data_;
+  std::unique_ptr<tizen_base::Bundle> last_context_data_;
+  EditablesManager& editables_manager_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
+
+
+
index c66d1704ccc7519752b30141978c39d57f31167b..73ccb4bc375ff01b1a9852ebeb6e74e64d9f5e6b 100644 (file)
@@ -18,9 +18,9 @@
 #include <unistd.h>
 #include <utility>
 
-#include "watchface-complication/design-element.h"
-#include "watchface-complication/design-element-implementation.h"
-#include "watchface-complication/editables-manager.h"
+#include "watchface-complication/design-element.hh"
+#include "watchface-complication/design-element-implementation.hh"
+#include "watchface-complication/editables-manager.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-complication/design-element.h b/watchface-complication/design-element.h
deleted file mode 100644 (file)
index ac9f619..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
-#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editable-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API DesignElement : public IEditable {
- public:
-  DesignElement(int id, int cur_data_idx);
-  virtual ~DesignElement();
-  DesignElement(DesignElement const& other) = default;
-  DesignElement(DesignElement && other) = default;
-  DesignElement& operator=(DesignElement const& other) = default;
-  DesignElement& operator=(DesignElement && other) = default;
-
- public:
-  int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
-  std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
-  std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
-  int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
-  std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
-  std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
-  int GetCurDataIdx() const override;
-  int SetCurDataIdx(int cur_data_idx) override;
-  int GetLastDataIdx() const override;
-  int UpdateLastData() override;
-  const std::string& GetLabel() const override;
-  void OnEditableUpdated(int selected_idx,
-                    IEditable::EditableState state) override;
-  int GetEditableId() const override;
-  int SetEditableId(int id) override;
-  void SetLabel(const std::string& name) override;
-  void SetState(IEditable::EditableState state) override;
-  IEditable::EditableState GetState() const override;
-  int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
-  std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
-  int UpdateLastContext() override;
-  std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
-  std::string GetSetupAppId() const override;
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
diff --git a/watchface-complication/design-element.hh b/watchface-complication/design-element.hh
new file mode 100644 (file)
index 0000000..2c2c7bb
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
+#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editable-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API DesignElement : public IEditable {
+ public:
+  DesignElement(int id, int cur_data_idx);
+  virtual ~DesignElement();
+  DesignElement(DesignElement const& other) = default;
+  DesignElement(DesignElement && other) = default;
+  DesignElement& operator=(DesignElement const& other) = default;
+  DesignElement& operator=(DesignElement && other) = default;
+
+ public:
+  int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
+  std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
+  std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+  int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+  std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+  std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+  int GetCurDataIdx() const override;
+  int SetCurDataIdx(int cur_data_idx) override;
+  int GetLastDataIdx() const override;
+  int UpdateLastData() override;
+  const std::string& GetLabel() const override;
+  void OnEditableUpdated(int selected_idx,
+                    IEditable::EditableState state) override;
+  int GetEditableId() const override;
+  int SetEditableId(int id) override;
+  void SetLabel(const std::string& name) override;
+  void SetState(IEditable::EditableState state) override;
+  IEditable::EditableState GetState() const override;
+  int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+  std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
+  int UpdateLastContext() override;
+  std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+  std::string GetSetupAppId() const override;
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
diff --git a/watchface-complication/editable-interface.h b/watchface-complication/editable-interface.h
deleted file mode 100644 (file)
index 1162567..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
-#include <bundle_cpp.h>
-
-#include <string>
-#include <list>
-#include <memory>
-
-#include "watchface-complication/include/watchface-editable.h"
-
-namespace watchface_complication {
-
-class IEditable {
- public:
-  enum EditableShapeType {
-    Circle = WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE,
-    Rectangle = WATCHFACE_EDITABLE_SHAPE_TYPE_RECT
-  };
-
-  enum EditableState {
-    Complete = WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE,
-    OnGoing = WATCHFACE_EDITABLE_EDIT_STATE_ONGOING,
-    Cancel = WATCHFACE_EDITABLE_EDIT_STATE_CANCEL
-  };
-
-  class Geometry {
-   public:
-    Geometry()
-        : x_(0), y_(0), w_(0), h_(0) {
-    }
-
-    Geometry(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {
-    }
-
-    Geometry(Geometry&& info)
-        : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
-    }
-
-    Geometry(const Geometry& info)
-        : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
-    }
-
-    Geometry& operator = (const Geometry& info) {
-      if (this != &info) {
-        x_ = info.GetX();
-        y_ = info.GetY();
-        w_ = info.GetW();
-        h_ = info.GetH();
-      }
-      return *this;
-    }
-
-    Geometry& operator = (Geometry&& info) noexcept {
-      if (this != &info) {
-        x_ = info.GetX();
-        y_ = info.GetY();
-        w_ = info.GetW();
-        h_ = info.GetH();
-      }
-      return *this;
-    }
-
-    const int GetX() const {
-      return x_;
-    }
-
-    const int GetY() const {
-      return y_;
-    }
-
-    const int GetW() const {
-      return w_;
-    }
-
-    const int GetH() const {
-      return h_;
-    }
-
-    void SetX(int x) {
-      x_ = x;
-    }
-
-    void SetY(int y) {
-      y_ = y;
-    }
-
-    void SetW(int w) {
-      w_ = w;
-    }
-
-    void SetH(int h) {
-      h_ = h;
-    }
-
-   private:
-    int x_;
-    int y_;
-    int w_;
-    int h_;
-  };
-
-  class NormalizedGeometry {
-   public:
-    NormalizedGeometry()
-        : norm_x_(0), norm_y_(0), norm_w_(0), norm_h_(0) {
-    }
-
-    NormalizedGeometry(double norm_x, double norm_y, double norm_w, double norm_h)
-        : norm_x_(norm_x), norm_y_(norm_y), norm_w_(norm_w), norm_h_(norm_h) {
-    }
-
-    NormalizedGeometry(NormalizedGeometry&& info)
-        : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
-          norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
-    }
-
-    NormalizedGeometry(const NormalizedGeometry& info)
-        : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
-          norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
-    }
-
-    NormalizedGeometry& operator = (const NormalizedGeometry& info) {
-      if (this != &info) {
-        norm_x_ = info.GetNormalizedX();
-        norm_y_ = info.GetNormalizedY();
-        norm_w_ = info.GetNormalizedW();
-        norm_h_ = info.GetNormalizedH();
-      }
-      return *this;
-    }
-
-    NormalizedGeometry& operator = (NormalizedGeometry&& info) noexcept {
-      if (this != &info) {
-        norm_x_ = info.GetNormalizedX();
-        norm_y_ = info.GetNormalizedY();
-        norm_w_ = info.GetNormalizedW();
-        norm_h_ = info.GetNormalizedH();
-      }
-      return *this;
-    }
-
-    const double GetNormalizedX() const {
-      return norm_x_;
-    }
-
-    const double GetNormalizedY() const {
-      return norm_y_;
-    }
-
-    const double GetNormalizedW() const {
-      return norm_w_;
-    }
-
-    const double GetNormalizedH() const {
-      return norm_h_;
-    }
-
-    void SetNormalizedX(double x) {
-      norm_x_ = x;
-    }
-
-    void SetNormalizedY(double y) {
-      norm_y_ = y;
-    }
-
-    void SetNormalizedW(double w) {
-      norm_w_ = w;
-    }
-
-    void SetNormalizedH(double h) {
-      norm_h_ = h;
-    }
-
-   private:
-    double norm_x_;
-    double norm_y_;
-    double norm_w_;
-    double norm_h_;
-  };
-
-  class Highlight {
-   public:
-    Highlight() {}
-    Highlight(EditableShapeType shape_type)
-      : geo_(std::move(std::unique_ptr<Geometry>(new Geometry(0, 0, 0, 0)))),
-        norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
-        shape_type_(shape_type) {
-    }
-
-    Highlight(std::unique_ptr<Geometry> geo, EditableShapeType shape_type)
-      : geo_(std::move(geo)),
-        norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
-        shape_type_(shape_type) {
-    }
-
-    Highlight(tizen_base::Bundle encoded) {
-      Decode(encoded);
-    }
-
-    Highlight(const Highlight& hi) {
-      geo_ = std::unique_ptr<Geometry>(new Geometry(*hi.geo_));
-      norm_geo_ = std::unique_ptr<NormalizedGeometry>(
-          new NormalizedGeometry(*hi.norm_geo_));
-      shape_type_ = hi.shape_type_;
-    }
-
-    const Geometry* GetGeometry() const {
-      return geo_.get();
-    }
-
-    void SetGeometry(Geometry geo) {
-      if (geo_.get() == NULL)
-        geo_ = std::move(std::unique_ptr<Geometry>(new Geometry()));
-      geo_.get()->SetX(geo.GetX());
-      geo_.get()->SetY(geo.GetY());
-      geo_.get()->SetW(geo.GetW());
-      geo_.get()->SetH(geo.GetH());
-    }
-
-    void SetNormalizedGeometry(std::unique_ptr<NormalizedGeometry> geo) {
-      norm_geo_ = std::move(geo);
-    }
-
-    const NormalizedGeometry* GetNormalizedGeometry() const {
-      return norm_geo_.get();
-    }
-
-
-    void Encode(tizen_base::Bundle* encoded) {
-      encoded->Add("SHAPE_TYPE", std::to_string(shape_type_));
-      if (geo_ != nullptr) {
-        encoded->Add("GEO_X", std::to_string(geo_->GetX()));
-        encoded->Add("GEO_Y", std::to_string(geo_->GetY()));
-        encoded->Add("GEO_W", std::to_string(geo_->GetW()));
-        encoded->Add("GEO_H", std::to_string(geo_->GetH()));
-      }
-
-      if (norm_geo_ != nullptr) {
-        encoded->Add("GEO_NORMALIZED_X",
-            std::to_string(norm_geo_->GetNormalizedX()));
-        encoded->Add("GEO_NORMALIZED_Y",
-            std::to_string(norm_geo_->GetNormalizedY()));
-        encoded->Add("GEO_NORMALIZED_W",
-            std::to_string(norm_geo_->GetNormalizedW()));
-        encoded->Add("GEO_NORMALIZED_H",
-            std::to_string(norm_geo_->GetNormalizedH()));
-      }
-    }
-
-    void Decode(tizen_base::Bundle encoded) {
-      std::string shape_str = encoded.GetString("SHAPE_TYPE");
-      if (shape_str.empty())
-        return;
-
-      shape_type_ = (EditableShapeType)stoi(shape_str);
-      std::string x_str = encoded.GetString("GEO_X");
-      if (!x_str.empty()) {
-        std::string y_str = encoded.GetString("GEO_Y");
-        std::string w_str = encoded.GetString("GEO_W");
-        std::string h_str = encoded.GetString("GEO_H");
-        geo_ = std::unique_ptr<Geometry>(new Geometry(
-          stoi(x_str), stoi(y_str), stoi(w_str), stoi(h_str)));
-      }
-
-      std::string norm_x_str = encoded.GetString("GEO_NORMALIZED_X");
-      if (!norm_x_str.empty()) {
-        std::string norm_y_str = encoded.GetString("GEO_NORMALIZED_Y");
-        std::string norm_w_str = encoded.GetString("GEO_NORMALIZED_W");
-        std::string norm_h_str = encoded.GetString("GEO_NORMALIZED_H");
-        norm_geo_ = std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(
-          stof(norm_x_str), stof(norm_y_str), stof(norm_w_str), stof(norm_h_str)));
-      }
-    }
-
-    const EditableShapeType GetShapeType() const {
-      return shape_type_;
-    }
-
-    void SetShapeType(EditableShapeType shape_type) {
-      shape_type_ = shape_type;
-    }
-
-   private:
-    std::unique_ptr<Geometry> geo_;
-    std::unique_ptr<NormalizedGeometry> norm_geo_;
-    EditableShapeType shape_type_ = Circle;
-  };
-  virtual ~IEditable() = default;
-  virtual int GetEditableId() const = 0;
-  virtual int SetEditableId(int id) = 0;
-  virtual std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const = 0;
-  virtual int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) = 0;
-  virtual std::shared_ptr<tizen_base::Bundle> GetCurData() const = 0;
-  virtual std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const = 0;
-  virtual int GetCurDataIdx() const = 0;
-  virtual int SetCurDataIdx(int cur_data_idx) = 0;
-  virtual int GetLastDataIdx() const = 0;
-  virtual int UpdateLastData() = 0;
-  virtual const std::string& GetLabel() const = 0;
-  virtual void SetLabel(const std::string& name) = 0;
-  virtual void OnEditableUpdated(int selected_idx, EditableState state) = 0;
-  virtual void SetState(EditableState state) = 0;
-  virtual EditableState GetState() const = 0;
-  virtual std::string GetSetupAppId() const = 0;
-  virtual int SetContext(std::unique_ptr<tizen_base::Bundle> context) = 0;
-  virtual std::unique_ptr<tizen_base::Bundle>& GetContext() const = 0;
-  virtual int UpdateLastContext() = 0;
-  virtual std::unique_ptr<tizen_base::Bundle>& GetLastContext() const = 0;
-  virtual std::shared_ptr<Highlight> GetHighlight() const = 0;
-  virtual int SetHighlight(std::shared_ptr<Highlight> highlight) = 0;
-  void SetEditSequence(int seq) {
-    edit_sequence_ = seq;
-  }
-
-  int GetEditSequence() {
-    return edit_sequence_;
-  }
-
- private:
-  int edit_sequence_ = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
diff --git a/watchface-complication/editable-interface.hh b/watchface-complication/editable-interface.hh
new file mode 100644 (file)
index 0000000..1162567
--- /dev/null
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
+#include <bundle_cpp.h>
+
+#include <string>
+#include <list>
+#include <memory>
+
+#include "watchface-complication/include/watchface-editable.h"
+
+namespace watchface_complication {
+
+class IEditable {
+ public:
+  enum EditableShapeType {
+    Circle = WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE,
+    Rectangle = WATCHFACE_EDITABLE_SHAPE_TYPE_RECT
+  };
+
+  enum EditableState {
+    Complete = WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE,
+    OnGoing = WATCHFACE_EDITABLE_EDIT_STATE_ONGOING,
+    Cancel = WATCHFACE_EDITABLE_EDIT_STATE_CANCEL
+  };
+
+  class Geometry {
+   public:
+    Geometry()
+        : x_(0), y_(0), w_(0), h_(0) {
+    }
+
+    Geometry(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {
+    }
+
+    Geometry(Geometry&& info)
+        : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
+    }
+
+    Geometry(const Geometry& info)
+        : x_(info.x_), y_(info.y_), w_(info.w_), h_(info.h_) {
+    }
+
+    Geometry& operator = (const Geometry& info) {
+      if (this != &info) {
+        x_ = info.GetX();
+        y_ = info.GetY();
+        w_ = info.GetW();
+        h_ = info.GetH();
+      }
+      return *this;
+    }
+
+    Geometry& operator = (Geometry&& info) noexcept {
+      if (this != &info) {
+        x_ = info.GetX();
+        y_ = info.GetY();
+        w_ = info.GetW();
+        h_ = info.GetH();
+      }
+      return *this;
+    }
+
+    const int GetX() const {
+      return x_;
+    }
+
+    const int GetY() const {
+      return y_;
+    }
+
+    const int GetW() const {
+      return w_;
+    }
+
+    const int GetH() const {
+      return h_;
+    }
+
+    void SetX(int x) {
+      x_ = x;
+    }
+
+    void SetY(int y) {
+      y_ = y;
+    }
+
+    void SetW(int w) {
+      w_ = w;
+    }
+
+    void SetH(int h) {
+      h_ = h;
+    }
+
+   private:
+    int x_;
+    int y_;
+    int w_;
+    int h_;
+  };
+
+  class NormalizedGeometry {
+   public:
+    NormalizedGeometry()
+        : norm_x_(0), norm_y_(0), norm_w_(0), norm_h_(0) {
+    }
+
+    NormalizedGeometry(double norm_x, double norm_y, double norm_w, double norm_h)
+        : norm_x_(norm_x), norm_y_(norm_y), norm_w_(norm_w), norm_h_(norm_h) {
+    }
+
+    NormalizedGeometry(NormalizedGeometry&& info)
+        : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
+          norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
+    }
+
+    NormalizedGeometry(const NormalizedGeometry& info)
+        : norm_x_(info.norm_x_), norm_y_(info.norm_y_),
+          norm_w_(info.norm_w_), norm_h_(info.norm_h_) {
+    }
+
+    NormalizedGeometry& operator = (const NormalizedGeometry& info) {
+      if (this != &info) {
+        norm_x_ = info.GetNormalizedX();
+        norm_y_ = info.GetNormalizedY();
+        norm_w_ = info.GetNormalizedW();
+        norm_h_ = info.GetNormalizedH();
+      }
+      return *this;
+    }
+
+    NormalizedGeometry& operator = (NormalizedGeometry&& info) noexcept {
+      if (this != &info) {
+        norm_x_ = info.GetNormalizedX();
+        norm_y_ = info.GetNormalizedY();
+        norm_w_ = info.GetNormalizedW();
+        norm_h_ = info.GetNormalizedH();
+      }
+      return *this;
+    }
+
+    const double GetNormalizedX() const {
+      return norm_x_;
+    }
+
+    const double GetNormalizedY() const {
+      return norm_y_;
+    }
+
+    const double GetNormalizedW() const {
+      return norm_w_;
+    }
+
+    const double GetNormalizedH() const {
+      return norm_h_;
+    }
+
+    void SetNormalizedX(double x) {
+      norm_x_ = x;
+    }
+
+    void SetNormalizedY(double y) {
+      norm_y_ = y;
+    }
+
+    void SetNormalizedW(double w) {
+      norm_w_ = w;
+    }
+
+    void SetNormalizedH(double h) {
+      norm_h_ = h;
+    }
+
+   private:
+    double norm_x_;
+    double norm_y_;
+    double norm_w_;
+    double norm_h_;
+  };
+
+  class Highlight {
+   public:
+    Highlight() {}
+    Highlight(EditableShapeType shape_type)
+      : geo_(std::move(std::unique_ptr<Geometry>(new Geometry(0, 0, 0, 0)))),
+        norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
+        shape_type_(shape_type) {
+    }
+
+    Highlight(std::unique_ptr<Geometry> geo, EditableShapeType shape_type)
+      : geo_(std::move(geo)),
+        norm_geo_(std::move(std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(0, 0, 0, 0)))),
+        shape_type_(shape_type) {
+    }
+
+    Highlight(tizen_base::Bundle encoded) {
+      Decode(encoded);
+    }
+
+    Highlight(const Highlight& hi) {
+      geo_ = std::unique_ptr<Geometry>(new Geometry(*hi.geo_));
+      norm_geo_ = std::unique_ptr<NormalizedGeometry>(
+          new NormalizedGeometry(*hi.norm_geo_));
+      shape_type_ = hi.shape_type_;
+    }
+
+    const Geometry* GetGeometry() const {
+      return geo_.get();
+    }
+
+    void SetGeometry(Geometry geo) {
+      if (geo_.get() == NULL)
+        geo_ = std::move(std::unique_ptr<Geometry>(new Geometry()));
+      geo_.get()->SetX(geo.GetX());
+      geo_.get()->SetY(geo.GetY());
+      geo_.get()->SetW(geo.GetW());
+      geo_.get()->SetH(geo.GetH());
+    }
+
+    void SetNormalizedGeometry(std::unique_ptr<NormalizedGeometry> geo) {
+      norm_geo_ = std::move(geo);
+    }
+
+    const NormalizedGeometry* GetNormalizedGeometry() const {
+      return norm_geo_.get();
+    }
+
+
+    void Encode(tizen_base::Bundle* encoded) {
+      encoded->Add("SHAPE_TYPE", std::to_string(shape_type_));
+      if (geo_ != nullptr) {
+        encoded->Add("GEO_X", std::to_string(geo_->GetX()));
+        encoded->Add("GEO_Y", std::to_string(geo_->GetY()));
+        encoded->Add("GEO_W", std::to_string(geo_->GetW()));
+        encoded->Add("GEO_H", std::to_string(geo_->GetH()));
+      }
+
+      if (norm_geo_ != nullptr) {
+        encoded->Add("GEO_NORMALIZED_X",
+            std::to_string(norm_geo_->GetNormalizedX()));
+        encoded->Add("GEO_NORMALIZED_Y",
+            std::to_string(norm_geo_->GetNormalizedY()));
+        encoded->Add("GEO_NORMALIZED_W",
+            std::to_string(norm_geo_->GetNormalizedW()));
+        encoded->Add("GEO_NORMALIZED_H",
+            std::to_string(norm_geo_->GetNormalizedH()));
+      }
+    }
+
+    void Decode(tizen_base::Bundle encoded) {
+      std::string shape_str = encoded.GetString("SHAPE_TYPE");
+      if (shape_str.empty())
+        return;
+
+      shape_type_ = (EditableShapeType)stoi(shape_str);
+      std::string x_str = encoded.GetString("GEO_X");
+      if (!x_str.empty()) {
+        std::string y_str = encoded.GetString("GEO_Y");
+        std::string w_str = encoded.GetString("GEO_W");
+        std::string h_str = encoded.GetString("GEO_H");
+        geo_ = std::unique_ptr<Geometry>(new Geometry(
+          stoi(x_str), stoi(y_str), stoi(w_str), stoi(h_str)));
+      }
+
+      std::string norm_x_str = encoded.GetString("GEO_NORMALIZED_X");
+      if (!norm_x_str.empty()) {
+        std::string norm_y_str = encoded.GetString("GEO_NORMALIZED_Y");
+        std::string norm_w_str = encoded.GetString("GEO_NORMALIZED_W");
+        std::string norm_h_str = encoded.GetString("GEO_NORMALIZED_H");
+        norm_geo_ = std::unique_ptr<NormalizedGeometry>(new NormalizedGeometry(
+          stof(norm_x_str), stof(norm_y_str), stof(norm_w_str), stof(norm_h_str)));
+      }
+    }
+
+    const EditableShapeType GetShapeType() const {
+      return shape_type_;
+    }
+
+    void SetShapeType(EditableShapeType shape_type) {
+      shape_type_ = shape_type;
+    }
+
+   private:
+    std::unique_ptr<Geometry> geo_;
+    std::unique_ptr<NormalizedGeometry> norm_geo_;
+    EditableShapeType shape_type_ = Circle;
+  };
+  virtual ~IEditable() = default;
+  virtual int GetEditableId() const = 0;
+  virtual int SetEditableId(int id) = 0;
+  virtual std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const = 0;
+  virtual int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) = 0;
+  virtual std::shared_ptr<tizen_base::Bundle> GetCurData() const = 0;
+  virtual std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const = 0;
+  virtual int GetCurDataIdx() const = 0;
+  virtual int SetCurDataIdx(int cur_data_idx) = 0;
+  virtual int GetLastDataIdx() const = 0;
+  virtual int UpdateLastData() = 0;
+  virtual const std::string& GetLabel() const = 0;
+  virtual void SetLabel(const std::string& name) = 0;
+  virtual void OnEditableUpdated(int selected_idx, EditableState state) = 0;
+  virtual void SetState(EditableState state) = 0;
+  virtual EditableState GetState() const = 0;
+  virtual std::string GetSetupAppId() const = 0;
+  virtual int SetContext(std::unique_ptr<tizen_base::Bundle> context) = 0;
+  virtual std::unique_ptr<tizen_base::Bundle>& GetContext() const = 0;
+  virtual int UpdateLastContext() = 0;
+  virtual std::unique_ptr<tizen_base::Bundle>& GetLastContext() const = 0;
+  virtual std::shared_ptr<Highlight> GetHighlight() const = 0;
+  virtual int SetHighlight(std::shared_ptr<Highlight> highlight) = 0;
+  void SetEditSequence(int seq) {
+    edit_sequence_ = seq;
+  }
+
+  int GetEditSequence() {
+    return edit_sequence_;
+  }
+
+ private:
+  int edit_sequence_ = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
diff --git a/watchface-complication/editables-container-event-interface.h b/watchface-complication/editables-container-event-interface.h
deleted file mode 100644 (file)
index 779f1f4..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
-#include <bundle_cpp.h>
-
-#include <string>
-#include <list>
-#include <memory>
-
-#include "watchface-complication/complication.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IEditablesContainerEvent {
- public:
-  virtual void OnEditResult(std::shared_ptr<IEditable> editable, int result) = 0;
-  virtual void OnRequestEdit(const std::string& appid,
-                             std::list<std::shared_ptr<IEditable>> e_list) = 0;
-  virtual void OnSetupReply(const std::string& appid, int editable_id,
-                             std::unique_ptr<tizen_base::Bundle> context) = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
diff --git a/watchface-complication/editables-container-event-interface.hh b/watchface-complication/editables-container-event-interface.hh
new file mode 100644 (file)
index 0000000..e9b7f27
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
+#include <bundle_cpp.h>
+
+#include <string>
+#include <list>
+#include <memory>
+
+#include "watchface-complication/complication.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API IEditablesContainerEvent {
+ public:
+  virtual void OnEditResult(std::shared_ptr<IEditable> editable, int result) = 0;
+  virtual void OnRequestEdit(const std::string& appid,
+                             std::list<std::shared_ptr<IEditable>> e_list) = 0;
+  virtual void OnSetupReply(const std::string& appid, int editable_id,
+                             std::unique_ptr<tizen_base::Bundle> context) = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
diff --git a/watchface-complication/editables-container-implementation.h b/watchface-complication/editables-container-implementation.h
deleted file mode 100644 (file)
index 7e71326..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-
-namespace watchface_complication {
-
-class EditablesContainer::Impl : IGDBus::IGDBusEvent {
- public:
-  virtual ~Impl();
-
- private:
-  friend class EditablesContainer;
-
-  void OnSignal(GDBusConnection* connection,
-                const std::string& sender_name,
-                const std::string& object_path,
-                const std::string& interface_name,
-                const std::string& signal_name,
-                GVariant* parameters) override;
-  void OnVanish(const std::string& name) override;
-  void OnAppear(const std::string& name, const std::string& name_owner) override;
-  void CancelEditing();
-  explicit Impl(EditablesContainer* parent);
-  Impl(Impl const& other) = default;
-  Impl(Impl && other) = default;
-  Impl& operator=(Impl const& other) = default;
-  Impl& operator=(Impl && other) = default;
-
- private:
-  EditablesContainer* parent_;
-  int subscribe_id_;
-  std::string editor_id_;
-  std::string sender_name_;
-  int watcher_id_ = -1;
-  std::list<std::shared_ptr<IEditable>> ed_list_;
-  std::unique_ptr<IGDBus> gdbus_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
-
-
-
diff --git a/watchface-complication/editables-container-implementation.hh b/watchface-complication/editables-container-implementation.hh
new file mode 100644 (file)
index 0000000..4d3d555
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+
+namespace watchface_complication {
+
+class EditablesContainer::Impl : IGDBus::IGDBusEvent {
+ public:
+  virtual ~Impl();
+
+ private:
+  friend class EditablesContainer;
+
+  void OnSignal(GDBusConnection* connection,
+                const std::string& sender_name,
+                const std::string& object_path,
+                const std::string& interface_name,
+                const std::string& signal_name,
+                GVariant* parameters) override;
+  void OnVanish(const std::string& name) override;
+  void OnAppear(const std::string& name, const std::string& name_owner) override;
+  void CancelEditing();
+  explicit Impl(EditablesContainer* parent);
+  Impl(Impl const& other) = default;
+  Impl(Impl && other) = default;
+  Impl& operator=(Impl const& other) = default;
+  Impl& operator=(Impl && other) = default;
+
+ private:
+  EditablesContainer* parent_;
+  int subscribe_id_;
+  std::string editor_id_;
+  std::string sender_name_;
+  int watcher_id_ = -1;
+  std::list<std::shared_ptr<IEditable>> ed_list_;
+  std::unique_ptr<IGDBus> gdbus_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_IMPLEMENTATION_H_
+
+
+
index 6a6cee7ae1b1b1871a6761f8ccda3187466c4635..c29bbdd82f552ec00bd02471caebafa2ad7d4a22 100644 (file)
 #include <utility>
 #include <vector>
 
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/editables-container-implementation.h"
-#include "watchface-complication/complication-internal.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-complication/gdbus-interface.h"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/editables-container-implementation.hh"
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-complication/gdbus-interface.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-complication/editables-container.h b/watchface-complication/editables-container.h
deleted file mode 100644 (file)
index bb0b1a8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-editor/editables-editor-event-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API EditablesContainer : IEditablesEditorEvent {
- public:
-  EditablesContainer();
-  virtual ~EditablesContainer(); /* LCOV_EXCL_LINE */
-  int Add(std::shared_ptr<IEditable> ed, int editable_id);
-  int Remove(std::shared_ptr<IEditable> ed);
-  int RequestEdit();
-  void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
-      IEditable::EditableState state) override;
-  void OnEditReady(const std::string& editor_id) override;
-  bool IsExist(int editable_id);
-  bool SendEditResult(int editable_id, int edit_seq, int result);
-
- private:
-  bool SendEventToEditor(std::string cmd, GVariant* data);
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
diff --git a/watchface-complication/editables-container.hh b/watchface-complication/editables-container.hh
new file mode 100644 (file)
index 0000000..9a38649
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-editor/editables-editor-event-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API EditablesContainer : IEditablesEditorEvent {
+ public:
+  EditablesContainer();
+  virtual ~EditablesContainer(); /* LCOV_EXCL_LINE */
+  int Add(std::shared_ptr<IEditable> ed, int editable_id);
+  int Remove(std::shared_ptr<IEditable> ed);
+  int RequestEdit();
+  void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
+      IEditable::EditableState state) override;
+  void OnEditReady(const std::string& editor_id) override;
+  bool IsExist(int editable_id);
+  bool SendEditResult(int editable_id, int edit_seq, int result);
+
+ private:
+  bool SendEventToEditor(std::string cmd, GVariant* data);
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_H_
diff --git a/watchface-complication/editables-manager-implementation.h b/watchface-complication/editables-manager-implementation.h
deleted file mode 100644 (file)
index a1663b1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <app_common.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/complication.h"
-#include "watchface-complication/complication-connector.h"
-
-namespace watchface_complication {
-
-class EditablesManager::Impl {
- public:
-  virtual ~Impl() {
-    if (setting_db_ != NULL)
-      sqlite3_close(setting_db_);
-    if (context_db_ != NULL)
-      sqlite3_close(context_db_);
-  }
-
- private:
-  friend class EditablesManager;
-  Impl();
-  static std::string GetEditablesDataPath() {
-    char* app_data_path = app_get_data_path();
-    char setting_data_path[PATH_MAX] = {0, };
-
-    if (app_data_path != NULL) {
-      snprintf(setting_data_path, PATH_MAX, "%s.watchface_editables.db",
-          app_data_path);
-      LOGI("get setting data path %s", setting_data_path);
-      free(app_data_path);
-    }
-
-    return std::string(setting_data_path);
-  }
-
- private:
-  sqlite3* setting_db_ = NULL;
-  sqlite3* context_db_ = NULL;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
diff --git a/watchface-complication/editables-manager-implementation.hh b/watchface-complication/editables-manager-implementation.hh
new file mode 100644 (file)
index 0000000..3e3b29c
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <app_common.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/complication.hh"
+#include "watchface-complication/complication-connector.hh"
+
+namespace watchface_complication {
+
+class EditablesManager::Impl {
+ public:
+  virtual ~Impl() {
+    if (setting_db_ != NULL)
+      sqlite3_close(setting_db_);
+    if (context_db_ != NULL)
+      sqlite3_close(context_db_);
+  }
+
+ private:
+  friend class EditablesManager;
+  Impl();
+  static std::string GetEditablesDataPath() {
+    char* app_data_path = app_get_data_path();
+    char setting_data_path[PATH_MAX] = {0, };
+
+    if (app_data_path != NULL) {
+      snprintf(setting_data_path, PATH_MAX, "%s.watchface_editables.db",
+          app_data_path);
+      LOGI("get setting data path %s", setting_data_path);
+      free(app_data_path);
+    }
+
+    return std::string(setting_data_path);
+  }
+
+ private:
+  sqlite3* setting_db_ = NULL;
+  sqlite3* context_db_ = NULL;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_IMPLEMENTATION_H_
index 33ef6c0a5b27183a3d1dba2877f993c7a8fef58e..0b5df461b191b2e8c63de2dfc4d007390c28e5f4 100644 (file)
@@ -20,8 +20,8 @@
 #include <aul.h>
 #include <sqlite3.h>
 
-#include "watchface-complication/editables-manager.h"
-#include "watchface-complication/editables-manager-implementation.h"
+#include "watchface-complication/editables-manager.hh"
+#include "watchface-complication/editables-manager-implementation.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-complication/editables-manager.h b/watchface-complication/editables-manager.h
deleted file mode 100644 (file)
index 4b0f3e1..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
-#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
-
-#include <gio/gio.h>
-#include <watchface-common.h>
-#include <bundle_cpp.h>
-
-#include <string>
-#include <memory>
-
-namespace watchface_complication {
-
-class EXPORT_API EditablesManager {
- public:
-  static EditablesManager& GetInst();
-  int StoreSetting(int editable_id, bundle_raw* raw_data);
-  std::unique_ptr<tizen_base::Bundle> LoadSetting(int editable_id);
-  int StoreContext(int editable_id, const char* provider_id,
-      tizen_base::Bundle* context);
-  std::unique_ptr<tizen_base::Bundle> LoadContext(
-      int editable_id, const char* provider_id);
-  int DeleteContext(int editable_id, const char* provider_id);
-
- private:
-  EditablesManager();
-  virtual ~EditablesManager();
-  int Init();
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
diff --git a/watchface-complication/editables-manager.hh b/watchface-complication/editables-manager.hh
new file mode 100644 (file)
index 0000000..4b0f3e1
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
+#define WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
+
+#include <gio/gio.h>
+#include <watchface-common.h>
+#include <bundle_cpp.h>
+
+#include <string>
+#include <memory>
+
+namespace watchface_complication {
+
+class EXPORT_API EditablesManager {
+ public:
+  static EditablesManager& GetInst();
+  int StoreSetting(int editable_id, bundle_raw* raw_data);
+  std::unique_ptr<tizen_base::Bundle> LoadSetting(int editable_id);
+  int StoreContext(int editable_id, const char* provider_id,
+      tizen_base::Bundle* context);
+  std::unique_ptr<tizen_base::Bundle> LoadContext(
+      int editable_id, const char* provider_id);
+  int DeleteContext(int editable_id, const char* provider_id);
+
+ private:
+  EditablesManager();
+  virtual ~EditablesManager();
+  int Init();
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_EDITABLES_MANAGER_H_
diff --git a/watchface-complication/gdbus-interface.h b/watchface-complication/gdbus-interface.h
deleted file mode 100644 (file)
index 66c3033..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
-
-#include <string>
-
-namespace watchface_complication {
-
-class IGDBus {
- public:
-  enum SigType {
-    Complication,
-    Editable
-  };
-  class IGDBusEvent {
-   public:
-    virtual void OnSignal(GDBusConnection* connection,
-                              const std::string& sender_name,
-                              const std::string& object_path,
-                              const std::string& interface_name,
-                              const std::string& signal_name,
-                              GVariant* parameters) = 0;
-    virtual void OnVanish(const std::string& name) = 0;
-    virtual void OnAppear(const std::string& name,
-                              const std::string& name_owner) = 0;
-  };
-  virtual ~IGDBus() = default;
-  virtual int Watch(std::string id, IGDBusEvent* listener) = 0;
-  virtual void UnWatch(int watcher_id) = 0;
-  virtual bool EmitSignal(SigType type, std::string target_id, std::string id,
-                  int sub_id, std::string cmd, GVariant* data) = 0;
-  virtual int SubscribeSignal(SigType type, std::string id, int sub_id,
-                  IGDBusEvent* listener) = 0;
-  virtual void UnSubscribeSignal(int subscribe_id) = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
diff --git a/watchface-complication/gdbus-interface.hh b/watchface-complication/gdbus-interface.hh
new file mode 100644 (file)
index 0000000..66c3033
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
+
+#include <string>
+
+namespace watchface_complication {
+
+class IGDBus {
+ public:
+  enum SigType {
+    Complication,
+    Editable
+  };
+  class IGDBusEvent {
+   public:
+    virtual void OnSignal(GDBusConnection* connection,
+                              const std::string& sender_name,
+                              const std::string& object_path,
+                              const std::string& interface_name,
+                              const std::string& signal_name,
+                              GVariant* parameters) = 0;
+    virtual void OnVanish(const std::string& name) = 0;
+    virtual void OnAppear(const std::string& name,
+                              const std::string& name_owner) = 0;
+  };
+  virtual ~IGDBus() = default;
+  virtual int Watch(std::string id, IGDBusEvent* listener) = 0;
+  virtual void UnWatch(int watcher_id) = 0;
+  virtual bool EmitSignal(SigType type, std::string target_id, std::string id,
+                  int sub_id, std::string cmd, GVariant* data) = 0;
+  virtual int SubscribeSignal(SigType type, std::string id, int sub_id,
+                  IGDBusEvent* listener) = 0;
+  virtual void UnSubscribeSignal(int subscribe_id) = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_GDBUS_INTERFACE_H_
diff --git a/watchface-complication/gdbus.h b/watchface-complication/gdbus.h
deleted file mode 100644 (file)
index 0a8bd35..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_GDBUS_H_
-#define WATCHFACE_COMPLICATION_GDBUS_H_
-
-#include <unistd.h>
-#include <dlog.h>
-
-#include <memory>
-#include <list>
-#include <string>
-
-#include "watchface-common/watchface-util.h"
-#include "watchface-complication/gdbus-interface.h"
-
-#define COMPLICATION_INTERFACE "org.tizen.watchface_complication"
-
-namespace watchface_complication {
-
-class GDBus : public IGDBus {
- public:
-  GDBus(GDBusConnection* conn)
-      : conn_(conn) { }
-
-  virtual ~GDBus() {
-    for (auto& id : subscribe_list_) {
-      g_dbus_connection_signal_unsubscribe(conn_, id);
-    }
-  }
-
-  int Watch(std::string appid, IGDBus::IGDBusEvent* listener) {
-    int watcher_id;
-    std::string name;
-
-    LOGI("watch on : %s", appid.c_str());
-    name = util::EncodeStr(util::EncodeType::Name, appid);
-    watcher_id = g_bus_watch_name_on_connection(
-        conn_,
-        name.c_str(),
-        G_BUS_NAME_WATCHER_FLAGS_NONE,
-        AppearCb,
-        VanishCb,
-        listener,
-        NULL);
-    LOGI("watch %s, %d", name.c_str(), watcher_id);
-
-    if (watcher_id == 0) {
-      LOGI("watch on name failed %s, %d", name.c_str(), watcher_id);
-      THROW(WATCHFACE_COMPLICATION_ERROR_IO_ERROR);
-    }
-
-    return watcher_id;
-  }
-
-  void UnWatch(int watcher_id) {
-    LOGI("unwatch : %d", watcher_id);
-    g_bus_unwatch_name(watcher_id);
-  }
-
-  bool EmitSignal(SigType type, std::string target_id, std::string id,
-      int sub_id, std::string cmd, GVariant* data) {
-    GError* err = NULL;
-    gboolean result = TRUE;
-    std::string path = util::EncodeStr(
-        type == Complication ?
-          util::EncodeType::CompPath : util::EncodeType::EditablePath,
-          id, sub_id);
-    std::string name = util::EncodeStr(util::EncodeType::Name, target_id);
-
-    LOGI("emit : %s, %s, %d, %s", target_id.c_str(), id.c_str(), sub_id,
-                                  cmd.c_str());
-    LOGI("emit signal %s, %s", name.empty() ? NULL : name.c_str(), path.c_str());
-    result = g_dbus_connection_emit_signal(
-              conn_,
-              name.empty() ? NULL : name.c_str(),
-              path.c_str(),
-              COMPLICATION_INTERFACE,
-              cmd.c_str(), data, &err);
-    if (result == FALSE) {
-      LOGE("g_dbus_connection_emit_signal() is failed");
-      if (err != NULL) {
-        LOGE("g_dbus_connection_emit_signal() err : %s",
-            err->message);
-        g_error_free(err);
-      }
-    } else {
-      LOGI("Successfully emit signal to %s, %s, %s", name.c_str(), path.c_str(),
-          cmd.c_str());
-    }
-    return result;
-  }
-
-  void UnSubscribeSignal(int subscribe_id) {
-    LOGI("unsubscribe : %d", subscribe_id);
-    g_dbus_connection_signal_unsubscribe(conn_, subscribe_id);
-  }
-
-  int SubscribeSignal(SigType type, std::string id,
-      int sub_id, IGDBus::IGDBusEvent* listener) {
-    LOGI("subscribe : %s, %d", id.c_str(), sub_id);
-    std::string path = util::EncodeStr(
-                  type == Complication ?
-                    util::EncodeType::CompPath : util::EncodeType::EditablePath,
-                    id, sub_id);
-    int subscribe_id = g_dbus_connection_signal_subscribe(
-                    conn_,
-                    NULL,
-                    COMPLICATION_INTERFACE,
-                    NULL,
-                    path.c_str(),
-                    NULL,
-                    G_DBUS_SIGNAL_FLAGS_NONE,
-                    SignalCb,
-                    listener,
-                    NULL);
-    if (subscribe_id == 0) {
-      LOGE("subscribe fail (%s)", path.c_str());
-      return 0;
-    }
-
-    LOGI("subscribe %s, %d", path.c_str(), subscribe_id);
-    subscribe_list_.push_back(subscribe_id);
-
-    return subscribe_id;
-  }
-
- private:
-  static void SignalCb(GDBusConnection* connection,
-                      const gchar* sender_name,
-                      const gchar* object_path,
-                      const gchar* interface_name,
-                      const gchar* signal_name,
-                      GVariant* parameters,
-                      void* user_data) {
-    IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
-
-    rs->OnSignal(connection, sender_name, object_path, interface_name,
-                 signal_name, parameters);
-  }
-
-  static void VanishCb(GDBusConnection* connection,
-      const gchar* name, gpointer user_data) {
-    IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
-    rs->OnVanish(name);
-  }
-
-  static void AppearCb(GDBusConnection* connection,
-      const gchar* name, const gchar* name_owner, gpointer user_data) {
-    IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
-    rs->OnAppear(name, name_owner);
-  }
-
- private:
-  std::list<int> subscribe_list_;
-  GDBusConnection* conn_ = nullptr;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_GDBUS_H_
diff --git a/watchface-complication/gdbus.hh b/watchface-complication/gdbus.hh
new file mode 100644 (file)
index 0000000..d47ec47
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_GDBUS_H_
+#define WATCHFACE_COMPLICATION_GDBUS_H_
+
+#include <unistd.h>
+#include <dlog.h>
+
+#include <memory>
+#include <list>
+#include <string>
+
+#include "watchface-common/watchface-util.hh"
+#include "watchface-complication/gdbus-interface.hh"
+
+#define COMPLICATION_INTERFACE "org.tizen.watchface_complication"
+
+namespace watchface_complication {
+
+class GDBus : public IGDBus {
+ public:
+  GDBus(GDBusConnection* conn)
+      : conn_(conn) { }
+
+  virtual ~GDBus() {
+    for (auto& id : subscribe_list_) {
+      g_dbus_connection_signal_unsubscribe(conn_, id);
+    }
+  }
+
+  int Watch(std::string appid, IGDBus::IGDBusEvent* listener) {
+    int watcher_id;
+    std::string name;
+
+    LOGI("watch on : %s", appid.c_str());
+    name = util::EncodeStr(util::EncodeType::Name, appid);
+    watcher_id = g_bus_watch_name_on_connection(
+        conn_,
+        name.c_str(),
+        G_BUS_NAME_WATCHER_FLAGS_NONE,
+        AppearCb,
+        VanishCb,
+        listener,
+        NULL);
+    LOGI("watch %s, %d", name.c_str(), watcher_id);
+
+    if (watcher_id == 0) {
+      LOGI("watch on name failed %s, %d", name.c_str(), watcher_id);
+      THROW(WATCHFACE_COMPLICATION_ERROR_IO_ERROR);
+    }
+
+    return watcher_id;
+  }
+
+  void UnWatch(int watcher_id) {
+    LOGI("unwatch : %d", watcher_id);
+    g_bus_unwatch_name(watcher_id);
+  }
+
+  bool EmitSignal(SigType type, std::string target_id, std::string id,
+      int sub_id, std::string cmd, GVariant* data) {
+    GError* err = NULL;
+    gboolean result = TRUE;
+    std::string path = util::EncodeStr(
+        type == Complication ?
+          util::EncodeType::CompPath : util::EncodeType::EditablePath,
+          id, sub_id);
+    std::string name = util::EncodeStr(util::EncodeType::Name, target_id);
+
+    LOGI("emit : %s, %s, %d, %s", target_id.c_str(), id.c_str(), sub_id,
+                                  cmd.c_str());
+    LOGI("emit signal %s, %s", name.empty() ? NULL : name.c_str(), path.c_str());
+    result = g_dbus_connection_emit_signal(
+              conn_,
+              name.empty() ? NULL : name.c_str(),
+              path.c_str(),
+              COMPLICATION_INTERFACE,
+              cmd.c_str(), data, &err);
+    if (result == FALSE) {
+      LOGE("g_dbus_connection_emit_signal() is failed");
+      if (err != NULL) {
+        LOGE("g_dbus_connection_emit_signal() err : %s",
+            err->message);
+        g_error_free(err);
+      }
+    } else {
+      LOGI("Successfully emit signal to %s, %s, %s", name.c_str(), path.c_str(),
+          cmd.c_str());
+    }
+    return result;
+  }
+
+  void UnSubscribeSignal(int subscribe_id) {
+    LOGI("unsubscribe : %d", subscribe_id);
+    g_dbus_connection_signal_unsubscribe(conn_, subscribe_id);
+  }
+
+  int SubscribeSignal(SigType type, std::string id,
+      int sub_id, IGDBus::IGDBusEvent* listener) {
+    LOGI("subscribe : %s, %d", id.c_str(), sub_id);
+    std::string path = util::EncodeStr(
+                  type == Complication ?
+                    util::EncodeType::CompPath : util::EncodeType::EditablePath,
+                    id, sub_id);
+    int subscribe_id = g_dbus_connection_signal_subscribe(
+                    conn_,
+                    NULL,
+                    COMPLICATION_INTERFACE,
+                    NULL,
+                    path.c_str(),
+                    NULL,
+                    G_DBUS_SIGNAL_FLAGS_NONE,
+                    SignalCb,
+                    listener,
+                    NULL);
+    if (subscribe_id == 0) {
+      LOGE("subscribe fail (%s)", path.c_str());
+      return 0;
+    }
+
+    LOGI("subscribe %s, %d", path.c_str(), subscribe_id);
+    subscribe_list_.push_back(subscribe_id);
+
+    return subscribe_id;
+  }
+
+ private:
+  static void SignalCb(GDBusConnection* connection,
+                      const gchar* sender_name,
+                      const gchar* object_path,
+                      const gchar* interface_name,
+                      const gchar* signal_name,
+                      GVariant* parameters,
+                      void* user_data) {
+    IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+
+    rs->OnSignal(connection, sender_name, object_path, interface_name,
+                 signal_name, parameters);
+  }
+
+  static void VanishCb(GDBusConnection* connection,
+      const gchar* name, gpointer user_data) {
+    IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+    rs->OnVanish(name);
+  }
+
+  static void AppearCb(GDBusConnection* connection,
+      const gchar* name, const gchar* name_owner, gpointer user_data) {
+    IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+    rs->OnAppear(name, name_owner);
+  }
+
+ private:
+  std::list<int> subscribe_list_;
+  GDBusConnection* conn_ = nullptr;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_GDBUS_H_
index 9a73cd3d5dbf9fb9b637727f48855f14f793e633..fac7fef0dcfe87c2c8488dc9bb2f6eafc5f73ef2 100644 (file)
@@ -29,6 +29,10 @@ int watchface_complication_data_get_aod_icon_path(const bundle *shared_data,
         char **icon_path);
 int watchface_complication_data_get_aod_image_path(const bundle *shared_data,
         char **image_path);
+int watchface_complication_data_get_aod_small_image_path(const bundle* data,
+        char** image_path);
+int watchface_complication_data_get_small_image_path(const bundle* data,
+        char** image_path);
 
 typedef struct complication_denied_list_ *complication_denied_list_h;
 typedef struct complication_priority_list_ *complication_priority_list_h;
diff --git a/watchface-complication/package-manager-interface.h b/watchface-complication/package-manager-interface.h
deleted file mode 100644 (file)
index c6041f8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
-#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
-
-#include <string>
-
-namespace watchface_complication {
-
-class IPackageManager {
- public:
-  class IPackageEvent {
-   public:
-    virtual void OnAppDisabled(const std::string& appid) = 0;
-    virtual void OnAppUninstalled(const std::string& appid) = 0;
-  };
-  virtual void Watch(IPackageEvent* pe) = 0;
-  virtual void UnWatch(IPackageEvent* pe) = 0;
-  virtual bool CheckDisabled(const std::string& appid) = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
diff --git a/watchface-complication/package-manager-interface.hh b/watchface-complication/package-manager-interface.hh
new file mode 100644 (file)
index 0000000..c6041f8
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
+#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
+
+#include <string>
+
+namespace watchface_complication {
+
+class IPackageManager {
+ public:
+  class IPackageEvent {
+   public:
+    virtual void OnAppDisabled(const std::string& appid) = 0;
+    virtual void OnAppUninstalled(const std::string& appid) = 0;
+  };
+  virtual void Watch(IPackageEvent* pe) = 0;
+  virtual void UnWatch(IPackageEvent* pe) = 0;
+  virtual bool CheckDisabled(const std::string& appid) = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_INTERFACE_H_
diff --git a/watchface-complication/package-manager.h b/watchface-complication/package-manager.h
deleted file mode 100644 (file)
index 7ba04cb..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
-#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
-
-#include <unistd.h>
-#include <dlog.h>
-
-#include <memory>
-#include <list>
-#include <string>
-
-namespace watchface_complication {
-
-class PackageManager : public IPackageManager {
- public:
-  PackageManager() { }
-  void Watch(IPackageEvent* pe) override {
-    ComplicationConnector::GetInst().WatchPackageEvent(pe);
-  }
-  void UnWatch(IPackageEvent* pe) override {
-    ComplicationConnector::GetInst().UnWatchPackageEvent(pe);
-  }
-  bool CheckDisabled(const std::string& appid) override {
-    pkgmgrinfo_appinfo_h app_handle;
-    int ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid.c_str(), &app_handle);
-    if (ret != PMINFO_R_OK)
-      return false;
-    pkgmgrinfo_appinfo_destroy_appinfo(app_handle);
-    return true;
-  }
- private:
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
diff --git a/watchface-complication/package-manager.hh b/watchface-complication/package-manager.hh
new file mode 100644 (file)
index 0000000..7ba04cb
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
+#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
+
+#include <unistd.h>
+#include <dlog.h>
+
+#include <memory>
+#include <list>
+#include <string>
+
+namespace watchface_complication {
+
+class PackageManager : public IPackageManager {
+ public:
+  PackageManager() { }
+  void Watch(IPackageEvent* pe) override {
+    ComplicationConnector::GetInst().WatchPackageEvent(pe);
+  }
+  void UnWatch(IPackageEvent* pe) override {
+    ComplicationConnector::GetInst().UnWatchPackageEvent(pe);
+  }
+  bool CheckDisabled(const std::string& appid) override {
+    pkgmgrinfo_appinfo_h app_handle;
+    int ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid.c_str(), &app_handle);
+    if (ret != PMINFO_R_OK)
+      return false;
+    pkgmgrinfo_appinfo_destroy_appinfo(app_handle);
+    return true;
+  }
+ private:
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
diff --git a/watchface-complication/received-editable-implementation.h b/watchface-complication/received-editable-implementation.h
deleted file mode 100644 (file)
index de19fb0..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
-#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/received-editable.h"
-
-namespace watchface_complication {
-
-class ReceivedEditable::Impl {
- public:
-  virtual ~Impl() = default;
-
- private:
-  friend class ReceivedEditable;
-  Impl(ReceivedEditable* parent, std::string raw);
-  Impl(Impl const& other) = default;
-  Impl(Impl && other) = default;
-  Impl& operator=(Impl const& other) = default;
-  Impl& operator=(Impl && other) = default;
-
- private:
-  ReceivedEditable* parent_;
-  int id_ = -1;
-  tizen_base::Bundle* cur_data_ = nullptr;
-  std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
-  std::shared_ptr<IEditable::Highlight> highlight_;
-  EditableShapeType shape_type_ = Circle;
-  std::string name_;
-  std::string setup_appid_;
-  int cur_data_idx_ = -1;
-  int last_data_idx_ = -1;
-  IEditable::EditableState ed_state_ = Complete;
-  std::unique_ptr<tizen_base::Bundle> context_data_;
-  std::unique_ptr<tizen_base::Bundle> last_context_data_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
-
-
-
diff --git a/watchface-complication/received-editable-implementation.hh b/watchface-complication/received-editable-implementation.hh
new file mode 100644 (file)
index 0000000..7303085
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
+#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/received-editable.hh"
+
+namespace watchface_complication {
+
+class ReceivedEditable::Impl {
+ public:
+  virtual ~Impl() = default;
+
+ private:
+  friend class ReceivedEditable;
+  Impl(ReceivedEditable* parent, std::string raw);
+  Impl(Impl const& other) = default;
+  Impl(Impl && other) = default;
+  Impl& operator=(Impl const& other) = default;
+  Impl& operator=(Impl && other) = default;
+
+ private:
+  ReceivedEditable* parent_;
+  int id_ = -1;
+  tizen_base::Bundle* cur_data_ = nullptr;
+  std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
+  std::shared_ptr<IEditable::Highlight> highlight_;
+  EditableShapeType shape_type_ = Circle;
+  std::string name_;
+  std::string setup_appid_;
+  int cur_data_idx_ = -1;
+  int last_data_idx_ = -1;
+  IEditable::EditableState ed_state_ = Complete;
+  std::unique_ptr<tizen_base::Bundle> context_data_;
+  std::unique_ptr<tizen_base::Bundle> last_context_data_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
+
+
+
index 252bf80326e428e7584df3c64402eb27efb55df1..0ac5971a27df76b9f7b4d173a489e9eab5ca095a 100644 (file)
@@ -19,9 +19,9 @@
 #include <utility>
 #include <vector>
 
-#include "watchface-complication/received-editable.h"
-#include "watchface-complication/received-editable-implementation.h"
-#include "watchface-common/watchface-exception.h"
+#include "watchface-complication/received-editable.hh"
+#include "watchface-complication/received-editable-implementation.hh"
+#include "watchface-common/watchface-exception.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-complication/received-editable.h b/watchface-complication/received-editable.h
deleted file mode 100644 (file)
index 7eadb1d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
-#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editable-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API ReceivedEditable : public IEditable {
- public:
-  explicit ReceivedEditable(std::string raw);
-  virtual ~ReceivedEditable();
-  ReceivedEditable(ReceivedEditable const& other) = default;
-  ReceivedEditable(ReceivedEditable && other) = default;
-  ReceivedEditable& operator=(ReceivedEditable const& other) = default;
-  ReceivedEditable& operator=(ReceivedEditable && other) = default;
-
- public:
-  int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
-  std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
-  std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
-  int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
-  std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
-  std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
-  int GetCurDataIdx() const override;
-  int SetCurDataIdx(int cur_data_idx) override;
-  int GetLastDataIdx() const override;
-  int UpdateLastData() override;
-  const std::string& GetLabel() const override;
-  void OnEditableUpdated(int selected_idx,
-                    IEditable::EditableState state) override;
-  int GetEditableId() const override;
-  int SetEditableId(int id) override;
-  void SetLabel(const std::string& name) override;
-  void SetState(IEditable::EditableState state) override;
-  IEditable::EditableState GetState() const override;
-  int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
-  std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
-  int UpdateLastContext() override;
-  std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
-  std::string GetSetupAppId() const override;
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
diff --git a/watchface-complication/received-editable.hh b/watchface-complication/received-editable.hh
new file mode 100644 (file)
index 0000000..7a60797
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
+#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editable-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API ReceivedEditable : public IEditable {
+ public:
+  explicit ReceivedEditable(std::string raw);
+  virtual ~ReceivedEditable();
+  ReceivedEditable(ReceivedEditable const& other) = default;
+  ReceivedEditable(ReceivedEditable && other) = default;
+  ReceivedEditable& operator=(ReceivedEditable const& other) = default;
+  ReceivedEditable& operator=(ReceivedEditable && other) = default;
+
+ public:
+  int SetHighlight(std::shared_ptr<IEditable::Highlight> highlight) override;
+  std::shared_ptr<IEditable::Highlight> GetHighlight() const override;
+  std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+  int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+  std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+  std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+  int GetCurDataIdx() const override;
+  int SetCurDataIdx(int cur_data_idx) override;
+  int GetLastDataIdx() const override;
+  int UpdateLastData() override;
+  const std::string& GetLabel() const override;
+  void OnEditableUpdated(int selected_idx,
+                    IEditable::EditableState state) override;
+  int GetEditableId() const override;
+  int SetEditableId(int id) override;
+  void SetLabel(const std::string& name) override;
+  void SetState(IEditable::EditableState state) override;
+  IEditable::EditableState GetState() const override;
+  int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+  std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
+  int UpdateLastContext() override;
+  std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+  std::string GetSetupAppId() const override;
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
index 83ae20ef946ee52f3e9bcaac9cb759f75ceff171..077dcd4bf8629d7d53f964e86d555c7a47b01075 100644 (file)
 
 #include "watchface-complication/include/watchface-complication.h"
 #include "watchface-complication/include/watchface-complication-internal.h"
-#include "watchface-complication/complication-internal.h"
-#include "watchface-complication/complication.h"
-#include "watchface-common/shared-handle.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-common-internal.h"
+#include "watchface-complication/complication-internal.hh"
+#include "watchface-complication/complication.hh"
+#include "watchface-common/shared-handle.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-common-internal.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -263,7 +263,8 @@ extern "C" EXPORT_API int watchface_complication_create(int complication_id,
                       WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE |
                       WATCHFACE_COMPLICATION_TYPE_TIME |
                       WATCHFACE_COMPLICATION_TYPE_ICON |
-                      WATCHFACE_COMPLICATION_TYPE_IMAGE)) {
+                      WATCHFACE_COMPLICATION_TYPE_IMAGE |
+                      WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE)) {
     LOGE("Invalid param : supported_types(%d)", supported_types);
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -362,7 +363,7 @@ extern "C" EXPORT_API int watchface_complication_get_current_type(
   auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
   int ret = ptr.get()->GetCurType();
   if (WATCHFACE_COMPLICATION_TYPE_NO_DATA <= ret &&
-      WATCHFACE_COMPLICATION_TYPE_IMAGE >= ret) {
+      WATCHFACE_COMPLICATION_TYPE_SMALL_IMAGE >= ret) {
     *cur_type = static_cast<watchface_complication_type_e>(ret);
   } else {
     LOGW("cur type : %d", ret);
@@ -464,6 +465,32 @@ extern "C" EXPORT_API int watchface_complication_data_get_aod_image_path(
   return __get_complication_data(data, AOD_IMAGE_KEY, image_path);
 }
 
+extern "C" EXPORT_API int watchface_complication_data_get_aod_small_image_path(
+    const bundle* data, char** image_path) {
+  if (!watchface_complication::util::CheckWatchFeatureEnabled())
+    return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+  if (data == nullptr || image_path == nullptr) {
+    LOGE("Invalid param !!");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  return __get_complication_data(data, AOD_SMALL_IMAGE_KEY, image_path);
+}
+
+extern "C" EXPORT_API int watchface_complication_data_get_small_image_path(
+    const bundle* data, char** image_path) {
+  if (!watchface_complication::util::CheckWatchFeatureEnabled())
+    return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+  if (data == nullptr || image_path == nullptr) {
+    LOGE("Invalid param !!");
+    return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+  }
+
+  return __get_complication_data(data, SMALL_IMAGE_KEY, image_path);
+}
+
 extern "C" EXPORT_API int watchface_complication_data_get_long_text(
     const bundle* data, char** long_text) {
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
index ba80e2517acdc6c0fdc049f4665e623823d44e4d..d7ea1a2ced3f882047bea4c63cf86a1af2451f60 100644 (file)
 
 #include "watchface-complication/include/watchface-editable.h"
 #include "watchface-complication/include/watchface-editable-internal.h"
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/design-element.h"
-#include "watchface-common/shared-handle.h"
-#include "watchface-complication/editables-manager.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/watchface-exception.h"
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/design-element.hh"
+#include "watchface-common/shared-handle.hh"
+#include "watchface-complication/editables-manager.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/watchface-exception.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-editor/editables-editor-event-interface.h b/watchface-editor/editables-editor-event-interface.h
deleted file mode 100644 (file)
index 1e826d0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
-#define WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
-
-#include <string>
-#include <memory>
-
-#include "watchface-complication/complication.h"
-
-namespace watchface_complication {
-
-class EXPORT_API IEditablesEditorEvent {
- public:
-  virtual void OnEditReady(const std::string& editor_id) = 0;
-  virtual void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
-      IEditable::EditableState state) = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
diff --git a/watchface-editor/editables-editor-event-interface.hh b/watchface-editor/editables-editor-event-interface.hh
new file mode 100644 (file)
index 0000000..b52b103
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
+#define WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
+
+#include <string>
+#include <memory>
+
+#include "watchface-complication/complication.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API IEditablesEditorEvent {
+ public:
+  virtual void OnEditReady(const std::string& editor_id) = 0;
+  virtual void OnUpdate(std::shared_ptr<IEditable> ed, int selected_idx,
+      IEditable::EditableState state) = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_EDITOR_EDITABLES_EDITOR_EVENT_INTERFACE_H_
diff --git a/watchface-editor/editables-editor-implementation.h b/watchface-editor/editables-editor-implementation.h
deleted file mode 100644 (file)
index 08055be..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
-#define WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
-
-#include <gio/gio.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editables-container.h"
-#include "watchface-complication/complication-connector.h"
-#include "watchface-complication/gdbus-interface.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/shared-handle.h"
-
-namespace watchface_complication {
-
-class EditablesEditor::Impl : IGDBus::IGDBusEvent {
- public:
-  virtual ~Impl() = default;
-
- private:
-  friend class EditablesEditor;
-
-  void OnSignal(GDBusConnection* connection,
-                const std::string& sender_name,
-                const std::string& object_path,
-                const std::string& interface_name,
-                const std::string& signal_name,
-                GVariant* parameters) override;
-  void OnVanish(const std::string& name) override;
-  void OnAppear(const std::string& name, const std::string& name_owner) override;
-  int CheckPrivilege();
-  explicit Impl(EditablesEditor* parent);
-  Impl(Impl const& other) = default;
-  Impl(Impl && other) = default;
-  Impl& operator=(Impl const& other) = default;
-  Impl& operator=(Impl && other) = default;
-
- private:
-  EditablesEditor* parent_;
-  int subscribe_id_;
-  std::string edit_appid_;
-  std::unique_ptr<IGDBus> gdbus_;
-  std::list<std::shared_ptr<IEditable>> editable_list_;
-  std::list<SharedHandle<EditablesEditor::EditInfo>*> edit_info_list_;
-  int edit_sequence_ = 0;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
diff --git a/watchface-editor/editables-editor-implementation.hh b/watchface-editor/editables-editor-implementation.hh
new file mode 100644 (file)
index 0000000..0390794
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
+#define WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
+
+#include <gio/gio.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editables-container.hh"
+#include "watchface-complication/complication-connector.hh"
+#include "watchface-complication/gdbus-interface.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/shared-handle.hh"
+
+namespace watchface_complication {
+
+class EditablesEditor::Impl : IGDBus::IGDBusEvent {
+ public:
+  virtual ~Impl() = default;
+
+ private:
+  friend class EditablesEditor;
+
+  void OnSignal(GDBusConnection* connection,
+                const std::string& sender_name,
+                const std::string& object_path,
+                const std::string& interface_name,
+                const std::string& signal_name,
+                GVariant* parameters) override;
+  void OnVanish(const std::string& name) override;
+  void OnAppear(const std::string& name, const std::string& name_owner) override;
+  int CheckPrivilege();
+  explicit Impl(EditablesEditor* parent);
+  Impl(Impl const& other) = default;
+  Impl(Impl && other) = default;
+  Impl& operator=(Impl const& other) = default;
+  Impl& operator=(Impl && other) = default;
+
+ private:
+  EditablesEditor* parent_;
+  int subscribe_id_;
+  std::string edit_appid_;
+  std::unique_ptr<IGDBus> gdbus_;
+  std::list<std::shared_ptr<IEditable>> editable_list_;
+  std::list<SharedHandle<EditablesEditor::EditInfo>*> edit_info_list_;
+  int edit_sequence_ = 0;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_EDITOR_EDITABLES_EDITOR_IMPLEMENTATION_H_
index 7ea4e80cc7d5aa1ea78df6a727ec4905d78ff170..2024f3c357b7a11076cf5b105ff86f1e5090841c 100644 (file)
 #include <stdexcept>
 #include <vector>
 
-#include "watchface-editor/editables-editor.h"
-#include "watchface-editor/editables-editor-implementation.h"
-#include "watchface-complication/received-editable.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/shared-handle.h"
+#include "watchface-editor/editables-editor.hh"
+#include "watchface-editor/editables-editor-implementation.hh"
+#include "watchface-complication/received-editable.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/shared-handle.hh"
 
-#include "watchface-complication/gdbus-interface.h"
+#include "watchface-complication/gdbus-interface.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/watchface-editor/editables-editor.h b/watchface-editor/editables-editor.h
deleted file mode 100644 (file)
index bba638e..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * 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 WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
-#define WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
-
-#include <gio/gio.h>
-#include <bundle_cpp.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "watchface-complication/editables-container-event-interface.h"
-
-namespace watchface_complication {
-
-class EXPORT_API EditablesEditor : IEditablesContainerEvent {
- public:
-  class EditInfo {
-   public:
-    EditInfo(EditablesEditor* editor, int edit_seq, std::shared_ptr<IEditable> editable)
-        : editor_(editor), edit_seq_(edit_seq), edit_timer_(0), editable_(editable) {
-    }
-
-    EditInfo(EditInfo&& info)
-        : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
-          edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
-    }
-
-    EditInfo(const EditInfo& info)
-        : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
-          edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
-    }
-
-    EditInfo& operator = (const EditInfo& info) {
-      if (this != &info) {
-        editor_ = info.GetEditor();
-        edit_seq_ = info.GetSequence();
-        editable_ = info.GetEditable();
-        edit_timer_ = info.GetTimer();
-      }
-      return *this;
-    }
-
-    EditInfo& operator = (EditInfo&& info) noexcept {
-      if (this != &info) {
-        editor_ = info.GetEditor();
-        edit_seq_ = info.GetSequence();
-        editable_ = info.GetEditable();
-        edit_timer_ = info.GetTimer();
-      }
-      return *this;
-    }
-
-    EditablesEditor* GetEditor() const {
-      return editor_;
-    }
-
-    int GetSequence() const {
-      return edit_seq_;
-    }
-
-    int GetTimer() const {
-      return edit_timer_;
-    }
-
-    void SetTimer(int timer) {
-      edit_timer_ = timer;
-    }
-
-    std::shared_ptr<IEditable> GetEditable() const {
-      return editable_;
-    }
-
-   private:
-    EditablesEditor* editor_;
-    int edit_seq_;
-    int edit_timer_;
-    std::shared_ptr<IEditable> editable_;
-  };
-
-  EditablesEditor();
-  virtual ~EditablesEditor();
-  void OnEditResult(std::shared_ptr<IEditable> editable, int result) override;
-  void OnRequestEdit(const std::string& appid,
-                     std::list<std::shared_ptr<IEditable>> e_list) override;
-  void OnSetupReply(const std::string& appid,
-                     int editable_id, std::unique_ptr<tizen_base::Bundle> context) override;
-  int EditPreview(std::shared_ptr<IEditable> ed, int cur_data_idx,
-                     int reply_timeout, bool auto_reply);
-  int EditComplete();
-  int EditCancel();
-  int NotifyEditReady(std::string appid);
-  void RemoveEditInfo(IEditable& ed);
-  std::shared_ptr<EditInfo> FindEditInfo(int edit_id, int edit_seq);
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}  // namespace watchface_complication
-
-#endif  // WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
diff --git a/watchface-editor/editables-editor.hh b/watchface-editor/editables-editor.hh
new file mode 100644 (file)
index 0000000..d447793
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
+#define WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
+
+#include <gio/gio.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "watchface-complication/editables-container-event-interface.hh"
+
+namespace watchface_complication {
+
+class EXPORT_API EditablesEditor : IEditablesContainerEvent {
+ public:
+  class EditInfo {
+   public:
+    EditInfo(EditablesEditor* editor, int edit_seq, std::shared_ptr<IEditable> editable)
+        : editor_(editor), edit_seq_(edit_seq), edit_timer_(0), editable_(editable) {
+    }
+
+    EditInfo(EditInfo&& info)
+        : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
+          edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
+    }
+
+    EditInfo(const EditInfo& info)
+        : editor_(info.GetEditor()), edit_seq_(info.GetSequence()),
+          edit_timer_(info.GetTimer()), editable_(info.GetEditable()) {
+    }
+
+    EditInfo& operator = (const EditInfo& info) {
+      if (this != &info) {
+        editor_ = info.GetEditor();
+        edit_seq_ = info.GetSequence();
+        editable_ = info.GetEditable();
+        edit_timer_ = info.GetTimer();
+      }
+      return *this;
+    }
+
+    EditInfo& operator = (EditInfo&& info) noexcept {
+      if (this != &info) {
+        editor_ = info.GetEditor();
+        edit_seq_ = info.GetSequence();
+        editable_ = info.GetEditable();
+        edit_timer_ = info.GetTimer();
+      }
+      return *this;
+    }
+
+    EditablesEditor* GetEditor() const {
+      return editor_;
+    }
+
+    int GetSequence() const {
+      return edit_seq_;
+    }
+
+    int GetTimer() const {
+      return edit_timer_;
+    }
+
+    void SetTimer(int timer) {
+      edit_timer_ = timer;
+    }
+
+    std::shared_ptr<IEditable> GetEditable() const {
+      return editable_;
+    }
+
+   private:
+    EditablesEditor* editor_;
+    int edit_seq_;
+    int edit_timer_;
+    std::shared_ptr<IEditable> editable_;
+  };
+
+  EditablesEditor();
+  virtual ~EditablesEditor();
+  void OnEditResult(std::shared_ptr<IEditable> editable, int result) override;
+  void OnRequestEdit(const std::string& appid,
+                     std::list<std::shared_ptr<IEditable>> e_list) override;
+  void OnSetupReply(const std::string& appid,
+                     int editable_id, std::unique_ptr<tizen_base::Bundle> context) override;
+  int EditPreview(std::shared_ptr<IEditable> ed, int cur_data_idx,
+                     int reply_timeout, bool auto_reply);
+  int EditComplete();
+  int EditCancel();
+  int NotifyEditReady(std::string appid);
+  void RemoveEditInfo(IEditable& ed);
+  std::shared_ptr<EditInfo> FindEditInfo(int edit_id, int edit_seq);
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}  // namespace watchface_complication
+
+#endif  // WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
index b637b4e6c80371ab358c3d73f2485919e759d2f5..c3a3776ad60cae145e99ab53cd55df418c7e0015 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <watchface-complication.h>
 #include <watchface-editable.h>
-#include <watchface-common-internal.h>
+#include <watchface-common-internal.hh>
 
 #ifdef __cplusplus
 extern "C" {
index ab1a005130f0ade43e6da6a67555d8192db0c17d..b3408ff3ce8bc1c1602d9419f18348d27063babe 100644 (file)
 #include <string>
 
 #include "watchface-editor/include/watchface-editor.h"
-#include "watchface-complication/complication.h"
-#include "watchface-editor/editables-editor.h"
-#include "watchface-common/watchface-util.h"
-#include "watchface-common/shared-handle.h"
+#include "watchface-complication/complication.hh"
+#include "watchface-editor/editables-editor.hh"
+#include "watchface-common/watchface-util.hh"
+#include "watchface-common/shared-handle.hh"
 
 #ifdef LOG_TAG
 #undef LOG_TAG