TizenRefApp-8154 [Gallery] Add application sceleton 82/118682/4
authorIgor Nazarov <i.nazarov@samsung.com>
Fri, 10 Mar 2017 16:02:09 +0000 (18:02 +0200)
committerIgor Nazarov <i.nazarov@samsung.com>
Thu, 16 Mar 2017 11:20:03 +0000 (13:20 +0200)
- Implemented Instance and InstanceManager classes;
- Common headers provided.

Change-Id: I01a004a8b6c1cb4147b05fe7733727e3a264c24d

12 files changed:
.cproject
.project
inc/config.h [new file with mode: 0644]
inc/gallery.h [deleted file]
inc/main/Instance.h [new file with mode: 0644]
inc/main/InstanceManager.h [new file with mode: 0644]
inc/types.h [new file with mode: 0644]
src/common.h [new file with mode: 0644]
src/gallery.cpp [deleted file]
src/main/Instance.cpp [new file with mode: 0644]
src/main/InstanceManager.cpp [new file with mode: 0644]
src/main/main.cpp [new file with mode: 0644]

index e4660dbbe257d7eff9fd1bde728ab28b18a8cfa9..ebee3a1c7a58740c97f354980e8130cea022c55e 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                                </option>
                                                                <option id="gnu.cpp.compiler.option.include.paths.831915180" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1738122246" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                        <listOptionValue builtIn="false" value="DEPRECATION_WARNING"/>
                                                                        <listOptionValue builtIn="false" value="_DEBUG"/>
                                                                </option>
+                                                               <option id="gnu.cpp.compiler.option.dialect.std.220245897" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.592894666" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
                                                        <tool command="arm-linux-gnueabi-gcc" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1433876771" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
                                                                </option>
                                                                <option id="gnu.c.compiler.option.include.paths.2123823065" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks.core.1669459306" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                        <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
                                                                        <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
                                                                </option>
-                                                               <option id="gnu.cpp.link.option.paths.1790921436" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
-                                                               </option>
+                                                               <option id="gnu.cpp.link.option.paths.1790921436" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.791521694" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
                                                                        <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
                                                                        <additionalInput kind="additionalinput" paths="$(LIBS)"/>
                                                                </inputType>
                                                        </tool>
                                                        <tool command="arm-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.2068371360" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                               <option id="gnu.both.asm.option.include.paths.1187156753" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.assembler.input.473129413" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativecore.tool.fnmapgen.999745178" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/src"/>
                                        </sourceEntries>
                                </configuration>
                        </storageModule>
                                                                </option>
                                                                <option id="gnu.cpp.compiler.option.include.paths.2064434934" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1300541916" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                </option>
+                                                               <option id="gnu.cpp.compiler.option.dialect.std.1157770444" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.67986536" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
                                                        <tool command="arm-linux-gnueabi-gcc" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.904054681" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
                                                                </option>
                                                                <option id="gnu.c.compiler.option.include.paths.1214715962" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/ucl/inc}&quot;"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks.core.775372915" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                        <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
                                                                        <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
                                                                </option>
-                                                               <option id="gnu.cpp.link.option.paths.1681339654" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
-                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
-                                                               </option>
+                                                               <option id="gnu.cpp.link.option.paths.1681339654" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1422388061" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
                                                                        <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
                                                                        <additionalInput kind="additionalinput" paths="$(LIBS)"/>
                                                                </inputType>
                                                        </tool>
                                                        <tool command="arm-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1784629853" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                               <option id="gnu.both.asm.option.include.paths.2144441251" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.assembler.input.249179591" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativecore.tool.fnmapgen.1541850139" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
                                                <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/src"/>
                                        </sourceEntries>
                                </configuration>
                        </storageModule>
index ea7151d20b5dbbb205531d37c10c7dea98d4349d..93a255d1024e1a375e942345a5ee6cf10a973141 100644 (file)
--- a/.project
+++ b/.project
@@ -7,6 +7,7 @@
        <buildSpec>
                <buildCommand>
                        <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <triggers>clean,full,incremental,</triggers>
                        <arguments>
                        </arguments>
                </buildCommand>
diff --git a/inc/config.h b/inc/config.h
new file mode 100644 (file)
index 0000000..ab8de83
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __GALLERY_CONFIG_H__
+#define __GALLERY_CONFIG_H__
+
+#define GALLERY_LOG_TAG "GALLERY"
+
+namespace gallery {
+
+       constexpr auto WINDOW_NAME = "org.tizen.gallery";
+
+       constexpr auto BASE_SCALE = 1.3;
+}
+
+#endif // __GALLERY_CONFIG_H__
diff --git a/inc/gallery.h b/inc/gallery.h
deleted file mode 100644 (file)
index 42b8414..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __gallery_H__
-#define __gallery_H__
-
-#include <app.h>
-#include <Elementary.h>
-#include <system_settings.h>
-#include <efl_extension.h>
-#include <dlog.h>
-
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "GALLERY"
-
-#if !defined(PACKAGE)
-#define PACKAGE "org.tizen.gallery"
-#endif
-
-#endif /* __gallery_H__ */
diff --git a/inc/main/Instance.h b/inc/main/Instance.h
new file mode 100644 (file)
index 0000000..4323e01
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __GALLERY_MAIN_INSTANCE_H__
+#define __GALLERY_MAIN_INSTANCE_H__
+
+#include "types.h"
+
+#include "ucl/appfw/IInstance.h"
+#include "ucl/appfw/IInstanceAppControlExt.h"
+
+#include "ucl/appfw/SysEventProvider.h"
+
+namespace gallery {
+
+       class Instance :
+                       public ucl::IInstance,
+                       public ucl::IInstanceAppControlExt {
+       public:
+               Instance(ucl::SysEventProvider &sysEventProvider);
+
+               // IInstance //
+
+               virtual ucl::Result onCreate(
+                               ucl::IInstanceContext *context) final override;
+               virtual void onPause() final override;
+               virtual void onResume() final override;
+
+               // IInstanceAppControlExt //
+
+               virtual void onAppControl(app_control_h appControl) final override;
+
+       private:
+               void onBack(Evas_Object *obj, void *event_info);
+               void onSysEvent(const ucl::SysEvent sysEvent);
+
+       private:
+               ucl::SysEventProvider &m_sysEventProvider;
+               ucl::IInstanceContext *m_context;
+               ucl::WindowSRef m_win;
+       };
+}
+
+#endif // __GALLERY_MAIN_INSTANCE_H__
diff --git a/inc/main/InstanceManager.h b/inc/main/InstanceManager.h
new file mode 100644 (file)
index 0000000..1ca4808
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __GALLERY_MAIN_INSTANCE_MANAGER_H__
+#define __GALLERY_MAIN_INSTANCE_MANAGER_H__
+
+#include "types.h"
+
+#include "ucl/appfw/InstanceManagerBase.h"
+
+namespace gallery {
+
+       class InstanceManager : public ucl::InstanceManagerBase {
+       public:
+               InstanceManager();
+
+               // ucl::InstanceManagerBase //
+
+               virtual ucl::IInstance *newInstance() const final override;
+       };
+}
+
+#endif // __GALLERY_MAIN_INSTANCE_MANAGER_H__
diff --git a/inc/types.h b/inc/types.h
new file mode 100644 (file)
index 0000000..c5b7426
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * 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 __GALLERY_TYPES_H__
+#define __GALLERY_TYPES_H__
+
+#include "config.h"
+
+#include "ucl/util/types.h"
+#include "ucl/util/memory.h"
+#include "ucl/util/delegation.h"
+
+#endif // __GALLERY_TYPES_H__
diff --git a/src/common.h b/src/common.h
new file mode 100644 (file)
index 0000000..8780e89
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __GALLERY_COMMON_H__
+#define __GALLERY_COMMON_H__
+
+#include <algorithm>
+
+#include <Ecore.h>
+
+#include "ucl/util/helpers.h"
+#include "ucl/util/logging.h"
+#include "ucl/util/shortLogs.h"
+
+#include "ucl/gui/stdTheme.h"
+#include "ucl/gui/helpers.h"
+
+#undef UCL_LOG_TAG
+#define UCL_LOG_TAG "GALLERY"
+
+#endif // __GALLERY_COMMON_H__
diff --git a/src/gallery.cpp b/src/gallery.cpp
deleted file mode 100644 (file)
index c2248d6..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#include "gallery.h"
-
-typedef struct appdata {
-       Evas_Object *win;
-       Evas_Object *conform;
-       Evas_Object *label;
-} appdata_s;
-
-static void
-win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       ui_app_exit();
-}
-
-static void
-win_back_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       appdata_s *ad = static_cast<appdata_s *>(data);
-       /* Let window go to hide state. */
-       elm_win_lower(ad->win);
-}
-
-static void
-create_base_gui(appdata_s *ad)
-{
-       /* Window */
-       /* Create and initialize elm_win.
-          elm_win is mandatory to manipulate window. */
-       ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
-       elm_win_autodel_set(ad->win, EINA_TRUE);
-
-       if (elm_win_wm_rotation_supported_get(ad->win)) {
-               int rots[4] = { 0, 90, 180, 270 };
-               elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
-       }
-
-       evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
-       eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);
-
-       /* Conformant */
-       /* Create and initialize elm_conformant.
-          elm_conformant is mandatory for base gui to have proper size
-          when indicator or virtual keypad is visible. */
-       ad->conform = elm_conformant_add(ad->win);
-       elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
-       elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
-       evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(ad->win, ad->conform);
-       evas_object_show(ad->conform);
-
-       /* Label */
-       /* Create an actual view of the base gui.
-          Modify this part to change the view. */
-       ad->label = elm_label_add(ad->conform);
-       elm_object_text_set(ad->label, "<align=center>Hello Gallery</align>");
-       evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_object_content_set(ad->conform, ad->label);
-
-       /* Show window after base gui is set up */
-       evas_object_show(ad->win);
-}
-
-static bool
-app_create(void *data)
-{
-       /* Hook to take necessary actions before main event loop starts
-               Initialize UI resources and application's data
-               If this function returns true, the main loop of application starts
-               If this function returns false, the application is terminated */
-       appdata_s *ad = static_cast<appdata_s *>(data);
-
-       create_base_gui(ad);
-
-       return true;
-}
-
-static void
-app_control(app_control_h app_control, void *data)
-{
-       /* Handle the launch request. */
-}
-
-static void
-app_pause(void *data)
-{
-       /* Take necessary actions when application becomes invisible. */
-}
-
-static void
-app_resume(void *data)
-{
-       /* Take necessary actions when application becomes visible. */
-}
-
-static void
-app_terminate(void *data)
-{
-       /* Release all resources. */
-}
-
-static void
-ui_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LANGUAGE_CHANGED*/
-       char *locale = NULL;
-       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
-       elm_language_set(locale);
-       free(locale);
-       return;
-}
-
-static void
-ui_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
-       return;
-}
-
-static void
-ui_app_region_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void
-ui_app_low_battery(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void
-ui_app_low_memory(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_MEMORY*/
-}
-
-int
-main(int argc, char *argv[])
-{
-       appdata_s ad = {0,};
-       int ret = 0;
-
-       ui_app_lifecycle_callback_s event_callback = {0,};
-       app_event_handler_h handlers[5] = {NULL, };
-
-       event_callback.create = app_create;
-       event_callback.terminate = app_terminate;
-       event_callback.pause = app_pause;
-       event_callback.resume = app_resume;
-       event_callback.app_control = app_control;
-
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
-
-       ret = ui_app_main(argc, argv, &event_callback, &ad);
-       if (ret != APP_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
-       }
-
-       return ret;
-}
diff --git a/src/main/Instance.cpp b/src/main/Instance.cpp
new file mode 100644 (file)
index 0000000..c228752
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "main/Instance.h"
+
+#include <system_settings.h>
+#include <efl_extension.h>
+
+#include "../common.h"
+
+namespace gallery {
+
+       using namespace ucl;
+
+       Instance::Instance(SysEventProvider &sysEventProvider) :
+               m_sysEventProvider(sysEventProvider)
+       {
+       }
+
+       Result Instance::onCreate(IInstanceContext *const context)
+       {
+               m_context = context;
+
+               m_win = m_context->getWindow();
+
+               m_sysEventProvider.addEventHandler(
+                               DELEGATE(Instance::onSysEvent, this));
+
+               eext_object_event_callback_add(*m_win, EEXT_CALLBACK_BACK,
+                               CALLBACK_A(Instance::onBack), this);
+
+               return RES_OK;
+       }
+
+       void Instance::onPause()
+       {
+               ILOG("PAUSED");
+       }
+
+       void Instance::onResume()
+       {
+               ILOG("RESUMED");
+       }
+
+       void Instance::onAppControl(app_control_h appControl)
+       {
+               char *op = {};
+               app_control_get_operation(appControl, &op);
+               ILOG("operation: %s", op);
+               free(op);
+
+               if (!m_win->isVisible()) {
+                       show(*m_win);
+               }
+       }
+
+       void Instance::onBack(Evas_Object *obj, void *event_info)
+       {
+               ILOG("Exiting the application...");
+               m_context->exitApp();
+       }
+
+       void Instance::onSysEvent(const SysEvent sysEvent)
+       {
+               switch(sysEvent) {
+               case SysEvent::LANGUAGE_CHANGED:
+                       ILOG("SysEvent::LANGUAGE_CHANGED");
+                       {
+                               char *locale = NULL;
+                               system_settings_get_value_string(
+                                               SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+                               elm_language_set(locale);
+                               free(locale);
+                       }
+                       break;
+               default:
+                       ILOG("sysEvent: %d", sysEvent);
+                       break;
+               }
+       }
+}
diff --git a/src/main/InstanceManager.cpp b/src/main/InstanceManager.cpp
new file mode 100644 (file)
index 0000000..2f92711
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "main/InstanceManager.h"
+
+#include "main/Instance.h"
+
+namespace gallery {
+
+       using namespace ucl;
+
+       InstanceManager::InstanceManager() :
+               InstanceManagerBase(AppParams().
+                               set(AppParam::WINDOW_NAME, WINDOW_NAME).
+                               set(AppParam::BASE_SCALE, BASE_SCALE))
+       {
+       }
+
+       IInstance *InstanceManager::newInstance() const
+       {
+               return new Instance(getSysEventProvider());
+       }
+}
diff --git a/src/main/main.cpp b/src/main/main.cpp
new file mode 100644 (file)
index 0000000..8fb41e2
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ucl/appfw/UIApp.h"
+
+#include "main/InstanceManager.h"
+
+#include "../common.h"
+
+using namespace ucl;
+using namespace gallery;
+
+int main(int argc, char *argv[])
+{
+       InstanceManager mgr;
+       const int ret = UIApp(mgr).run(argc, argv);
+       ILOG("ret: %d", ret);
+       return ret;
+}