Add code for checking profile to support TV profile 50/123850/3
authorsungwook79.park <sungwook79.park@samsung.com>
Fri, 7 Apr 2017 08:11:53 +0000 (17:11 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 7 Apr 2017 08:45:52 +0000 (01:45 -0700)
Change-Id: I0649a725d7bea1a98e9da94cafa242e6b5abad8d
Signed-off-by: sungwook79.park <sungwook79.park@samsung.com>
CMakeLists.txt
inc/MoreOption.h
inc/w-input-selector.h
packaging/org.tizen.inputdelegator.spec
src/CMakeLists.txt
src/MoreOption.cpp
src/w-input-selector.cpp
src/w-input-stt-tos.cpp
src/w-input-stt-voice.cpp

index 1fa53c2..bef025a 100755 (executable)
@@ -3,20 +3,10 @@ PROJECT(org.tizen.inputdelegator CXX C)
 
 INCLUDE(GNUInstallDirs)
 INCLUDE(FindPkgConfig)
-SET(PKGS_CHECK_MODULES
-        smartreply
-        )
 
 SET(VERSION_MAJOR 1)
 SET(VERSION ${VERSION_MAJOR}.0.0)
 
-pkg_check_modules(PKGS REQUIRED ${PKGS_CHECK_MODULES})
-
-FOREACH(flag ${PKGS_CFLAGS})
-    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-    SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
-ENDFOREACH(flag)
-
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -Wall -fPIE")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -fPIE")
index 9625943..70843ab 100755 (executable)
@@ -16,6 +16,7 @@
 
 #pragma once
 
+#include "w-input-selector.h"
 #include <Elementary.h>
 #include <efl_extension.h>
 
@@ -25,8 +26,9 @@ class MoreOption
 {
        Evas_Object *nf;
        Evas_Object *more_option_layout;
+#ifdef _WEARABLE
        Eext_Object_Item *item;
-
+#endif
        Eina_Bool option_opened;
        void *voicedata;
 
index 3fcd43b..c42c398 100755 (executable)
@@ -52,6 +52,18 @@ enum {
        REPLY_APP_CONTROL,
 };
 
+typedef enum {
+   TIZEN_PROFILE_UNKNOWN = 0,
+   TIZEN_PROFILE_MOBILE = 0x1,
+   TIZEN_PROFILE_WEARABLE = 0x2,
+   TIZEN_PROFILE_TV = 0x4,
+   TIZEN_PROFILE_IVI = 0x8,
+   TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+extern tizen_profile_t _get_tizen_profile();
+#define _TV (_get_tizen_profile() == TIZEN_PROFILE_TV)
+#define _MOBILE (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
+#define _WEARABLE (_get_tizen_profile() == TIZEN_PROFILE_WEARABLE)
 
 typedef struct appdata{
        Evas_Object* win_main;
@@ -59,7 +71,9 @@ typedef struct appdata{
        Evas_Object* conform;
        Evas_Object* naviframe;
        Evas_Object* genlist;
+#ifdef _WEARABLE
        Eext_Circle_Surface *circle_surface;
+#endif
 
        app_control_h source_app_control;
        int app_type;
index 7715e23..9144776 100755 (executable)
@@ -39,6 +39,7 @@ BuildRequires: pkgconfig(stt)
 BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(capi-media-audio-io)
 BuildRequires: pkgconfig(smartreply)
+BuildRequires: pkgconfig(capi-system-info)
 
 %if %{enable_log_manager}
 BuildRequires:  pkgconfig(bundle)
index 53ce08f..24c63a5 100755 (executable)
@@ -15,7 +15,8 @@ pkg_check_modules(CAPI_MEDIA_AUDIO_IO REQUIRED capi-media-audio-io)
 #PKG_CHECK_MODULES(GRAPHICS_EXTENSION REQUIRED graphics-extension)
 #PKG_CHECK_MODULES(WNOTI_SERVICE REQUIRED wnoti-service2)
 #PKG_CHECK_MODULES(SAP_CLIENT_STUB_API REQUIRED sap-client-stub-api)
-
+PKG_CHECK_MODULES(SMARTREPLY REQUIRED smartreply)
+PKG_CHECK_MODULES(CAPI_SYSTEM_INFO REQUIRED capi-system-info)
 
 SET(W_INPUT_SELECTOR inputdelegator)
 FILE(GLOB W_INPUT_SELECTOR_SRCS *.cpp)
@@ -39,7 +40,9 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
                ${DATA_CONTROL_INCLUDE_DIRS}
                ${WNOTI_SERVICE_INCLUDE_DIRS}
                ${SAP_CLIENT_STUB_API_INCLUDE_DIRS}
-               ${CAPI_MEDIA_AUDIO_IO_INCLUDE_DIRS})
+               ${CAPI_MEDIA_AUDIO_IO_INCLUDE_DIRS}
+               ${SMARTREPLY_INCLUDE_DIRS}
+               ${CAPI_SYSTEM_INFO_INCLUDE_DIRS})
 
 
 LINK_DIRECTORIES(${DLOG_LIBRARY_DIRS}
@@ -59,6 +62,8 @@ LINK_DIRECTORIES(${DLOG_LIBRARY_DIRS}
                ${WNOTI_SERVICE_LIBRARY_DIRS}
                ${SAP_CLIENT_STUB_API_LIBRARY_DIRS}
                ${CAPI_MEDIA_AUDIO_IO_LIBRARY_DIRS}
+               ${SMARTREPLY_LIBRARY_DIRS}
+               ${CAPI_SYSTEM_INFO_LIBRARY_DIRS}
                )
 
 ADD_EXECUTABLE(${W_INPUT_SELECTOR}
@@ -79,6 +84,8 @@ TARGET_LINK_LIBRARIES(${W_INPUT_SELECTOR}
                ${STT_LIBRARIES}
                ${VCONF_LIBRARIES}
                ${CAPI_MEDIA_AUDIO_IO_LIBRARIES}
+               ${SMARTREPLY_LIBRARIES}
+               ${CAPI_SYSTEM_INFO_LIBRARIES}
                )
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
index 63505ba..33a335e 100755 (executable)
@@ -33,7 +33,9 @@ extern Evas_Object *g_setting_window;
 MoreOption::MoreOption(Evas_Object *naviframe, void* voicedata)
        : nf(naviframe)
        , more_option_layout(NULL)
+#ifdef _WEARABLE
        , item(NULL)
+#endif
        , option_opened(EINA_FALSE)
        , voicedata(voicedata) {
        /** todo. implement constructor */
index 270adce..4576c70 100755 (executable)
@@ -23,6 +23,7 @@
 #include <vconf.h>
 #include <vconf-keys.h>
 #include <stdint.h>
+#include <system_info.h>
 
 #include "w-input-selector.h"
 #include "w-input-template.h"
@@ -48,6 +49,41 @@ static unsigned int g_template_item_size = 0;                /* Current Template item size */
 
 Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary
 
+tizen_profile_t _get_tizen_profile()
+{
+   static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+   if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+     return profile;
+
+   char *profileName;
+   system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+   switch (*profileName)
+     {
+      case 'm':
+      case 'M':
+         profile = TIZEN_PROFILE_MOBILE;
+         break;
+      case 'w':
+      case 'W':
+         profile = TIZEN_PROFILE_WEARABLE;
+         break;
+      case 't':
+      case 'T':
+         profile = TIZEN_PROFILE_TV;
+         break;
+      case 'i':
+      case 'I':
+         profile = TIZEN_PROFILE_IVI;
+         break;
+      default: // common or unknown ==> ALL ARE COMMON.
+         profile = TIZEN_PROFILE_COMMON;
+     }
+   free(profileName);
+
+   return profile;
+}
+
+
 void _init_app_data(App_Data* app_data);
 static void _app_language_changed(app_event_info_h event_info, void *user_data);
 
@@ -525,10 +561,10 @@ void _back_to_genlist_for_selector()
                reply_to_sender_by_callback(NULL, NULL);
                elm_exit();
        }
-
+#ifdef _WEARABLE
        Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
-
        eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+#endif
 }
 
 static void _item_realized(void *data, Evas_Object *obj, void *event_info) //called when list scrolled
@@ -543,12 +579,12 @@ Evas_Object* _create_genlist(Evas_Object* navi)
                return NULL;
 
        elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
-
+#ifdef _WEARABLE
        Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, app_data->circle_surface);
        eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
        evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
        eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
-
+#endif
        evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
@@ -791,8 +827,9 @@ bool _app_create(void* user_data)
        Evas_Object* conform = NULL;
        Evas_Object* bg = NULL;
        Evas_Object* window = NULL;
+#ifdef _WEARABLE
        Eext_Circle_Surface *surface;
-
+#endif
        if (!user_data) {
                return false;
        }
@@ -827,7 +864,9 @@ bool _app_create(void* user_data)
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
        conform = elm_conformant_add(window);
+#ifdef _WEARABLE
        surface = eext_circle_surface_conformant_add(conform);
+#endif
        evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
 
@@ -840,7 +879,9 @@ bool _app_create(void* user_data)
        app_data->win_main = window;
        app_data->conform = conform;
        app_data->layout_main = layout;
+#ifdef _WEARABLE
        app_data->circle_surface = surface;
+#endif
        app_data->app_type = APP_TYPE_SELECT_MODE;
 
        Evas_Object *naviframe = elm_naviframe_add(layout);
index 8f0a283..bfe6b0b 100755 (executable)
@@ -37,8 +37,9 @@ using namespace std;
 
 #define _EDJ(x)  elm_layout_edje_get(x)
 
+#ifdef _WEARABLE
 static Evas_Object *g_circle_object_first = NULL;
-
+#endif
 #define ISE_PREFERENCE_AGREEMENT "wearable_input_agreement"
 #define VCONFKEY_USER_AGREEMENT "db/wms/user_agreement/svoice"
 #define VCONFKEY_USER_AGREED_TOS            "db/private/ise/stt/tos"
@@ -265,10 +266,10 @@ static Eina_Bool
 _naviframe_pop_cb2(void *data , Elm_Object_Item *it)
 {
     PRINTFUNC(DLOG_DEBUG, "");
-
+#ifdef _WEARABLE
     if (g_circle_object_first)
         eext_rotary_object_event_activated_set(g_circle_object_first, EINA_TRUE);
-
+#endif
     return EINA_TRUE;
 }
 
@@ -411,8 +412,9 @@ Evas_Object *create_tos_second_page(void* data){
     Evas_Object *outer_layout;
     Evas_Object *inner_layout;
     Evas_Object *scroller;
+#ifdef _WEARABLE
     Evas_Object *circle_scroller;
-
+#endif
     std::string terms = "";
 
     string edj_path = get_resource_path();
@@ -431,9 +433,11 @@ Evas_Object *create_tos_second_page(void* data){
     elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
     elm_object_scroll_lock_x_set(scroller, EINA_TRUE);
     evas_object_show(scroller);
+#ifdef _WEARABLE
     circle_scroller = eext_circle_object_scroller_add(scroller, ad->circle_surface);
     eext_circle_object_scroller_policy_set(circle_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
     eext_rotary_object_event_activated_set(circle_scroller, EINA_TRUE);
+#endif
     elm_object_part_content_set(outer_layout, "elm.swallow.content", scroller);
 
 //------------inner layout----------------------
@@ -518,8 +522,9 @@ Evas_Object *create_tos_popup(void *data)
     Evas_Object *outer_layout;
     Evas_Object *inner_layout;
     Evas_Object *scroller;
+#ifdef _WEARABLE
     Evas_Object *circle_scroller;
-
+#endif
     std::string terms = "";
 
     string edj_path = get_resource_path();
@@ -538,11 +543,13 @@ Evas_Object *create_tos_popup(void *data)
     elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
     elm_object_scroll_lock_x_set(scroller, EINA_TRUE);
     evas_object_show(scroller);
+#ifdef _WEARABLE
     circle_scroller = eext_circle_object_scroller_add(scroller, ad->circle_surface);
     eext_circle_object_scroller_policy_set(circle_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
     eext_rotary_object_event_activated_set(circle_scroller, EINA_TRUE);
-    elm_object_part_content_set(outer_layout, "elm.swallow.content", scroller);
     g_circle_object_first = circle_scroller;
+#endif
+    elm_object_part_content_set(outer_layout, "elm.swallow.content", scroller);
 
 //------------inner layout----------------------
     inner_layout = elm_layout_add(scroller);
@@ -649,8 +656,9 @@ Evas_Object *create_tos_n66_popup(void *data)
     Evas_Object *outer_layout;
     Evas_Object *inner_layout;
     Evas_Object *scroller;
+#ifdef _WEARABLE
     Evas_Object *circle_scroller;
-
+#endif
     std::string terms = "";
 
     string edj_path = get_resource_path();
@@ -691,11 +699,13 @@ Evas_Object *create_tos_n66_popup(void *data)
     elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
     elm_object_scroll_lock_x_set(scroller, EINA_TRUE);
     evas_object_show(scroller);
+#ifdef _WEARABLE
     circle_scroller = eext_circle_object_scroller_add(scroller, ad->circle_surface);
     eext_circle_object_scroller_policy_set(circle_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
     eext_rotary_object_event_activated_set(circle_scroller, EINA_TRUE);
-    elm_object_part_content_set(outer_layout, "elm.swallow.content", scroller);
     g_circle_object_first = circle_scroller;
+#endif
+    elm_object_part_content_set(outer_layout, "elm.swallow.content", scroller);
 
 //------------inner layout----------------------
     inner_layout = elm_layout_add(scroller);
index 7305ddb..7193560 100755 (executable)
@@ -1512,11 +1512,12 @@ void activate_circle_scroller_for_stt_textbox(void* data, Eina_Bool bActivate)
        VoiceData *voicedata = (VoiceData *)data;
 
        Evas_Object *scroller = NULL;
-       Evas_Object *circle_scroller = NULL;
-
        scroller = elm_layout_content_get((Evas_Object *)voicedata->layout_main, "text_area");
+#ifdef _WEARABLE
+       Evas_Object *circle_scroller = NULL;
        circle_scroller = (Evas_Object *) evas_object_data_get(scroller, "circle");
        eext_rotary_object_event_activated_set(circle_scroller, bActivate);
+#endif
 }
 
 static Evas_Object *create_textblock(void* data)
@@ -1545,13 +1546,11 @@ static Evas_Object *create_textblock(void* data)
        elm_scroller_page_scroll_limit_set(scroller, 0, 1);
 
        elm_object_scroll_lock_x_set(scroller, EINA_TRUE);
-
-//     uxt_scroller_set_auto_scroll_enabled(scroller, EINA_FALSE);
-
+#ifdef _WEARABLE
        circle_scroller = eext_circle_object_scroller_add(scroller, app_data->circle_surface);
        eext_circle_object_scroller_policy_set(circle_scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
        eext_rotary_object_event_activated_set(circle_scroller, EINA_TRUE);
-
+#endif
        box = elm_box_add(scroller);
 
        inner_layout = elm_layout_add(scroller);