diff options
author | Hyerim Kim <rimi.kim@samsung.com> | 2017-09-05 21:13:14 +0900 |
---|---|---|
committer | Hyerim Kim <rimi.kim@samsung.com> | 2017-09-06 16:24:08 +0900 |
commit | b6609f50613e23d1882331fa5911adca5836b7f9 (patch) | |
tree | cf3632c7140369494fd8c831bb745f45b180d714 /src/main.c | |
parent | f0e37edfb011436627c84eef75af65014a57ad6d (diff) | |
download | air_livetv-accepted/tizen_4.0_unified.tar.gz air_livetv-accepted/tizen_4.0_unified.tar.bz2 air_livetv-accepted/tizen_4.0_unified.zip |
Modifies Live-tv application for displaying background image on Hometizen_8.0_m2_releasetizen_7.0_m2_releasetizen_6.5.m2_releasetizen_6.0.m2_releasetizen_5.5.m2_releasetizen_4.0.m2_releasetizen_4.0.IoT.p2_releasetizen_4.0.IoT.p1_releasesubmit/tizen_6.5/20211029.140001submit/tizen_6.5/20211028.164001submit/tizen_6.0_hotfix/20201103.115105submit/tizen_6.0_hotfix/20201102.192905submit/tizen_6.0/20201029.205505submit/tizen_5.5_wearable_hotfix/20201026.184309submit/tizen_5.5_mobile_hotfix/20201026.185109submit/tizen_5.5/20191031.000013submit/tizen_5.5/20191031.000011submit/tizen_5.5/20191031.000009submit/tizen_5.0/20181106.000001submit/tizen_5.0/20181101.000009submit/tizen_4.0/20170907.043947submit/tizen/20170906.103347accepted/tizen/unified/20170911.155614accepted/tizen/8.0/unified/20231005.100105accepted/tizen/7.0/unified/hotfix/20221116.112006accepted/tizen/7.0/unified/20221110.061740accepted/tizen/6.0/unified/hotfix/20201103.044959accepted/tizen/6.0/unified/20201030.103300accepted/tizen/5.5/unified/wearable/hotfix/20201027.095200accepted/tizen/5.5/unified/mobile/hotfix/20201027.071204accepted/tizen/5.5/unified/20191031.034729accepted/tizen/5.0/unified/20181106.202933accepted/tizen/4.0/unified/20170911.154210tizen_8.0tizen_7.0_hotfixtizen_7.0tizen_6.5tizen_6.0_hotfixtizen_6.0tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5_mobile_hotfixtizen_5.5tizen_5.0tizen_4.0tizenaccepted/tizen_unifiedaccepted/tizen_8.0_unifiedaccepted/tizen_7.0_unified_hotfixaccepted/tizen_7.0_unifiedaccepted/tizen_6.0_unified_hotfixaccepted/tizen_6.0_unifiedaccepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified_mobile_hotfixaccepted/tizen_5.5_unifiedaccepted/tizen_5.0_unifiedaccepted/tizen_4.0_unified
Change-Id: I4081ad312fd6e77169e55d33a3c9a3755ec8770e
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
Diffstat (limited to 'src/main.c')
-rwxr-xr-x[-rw-r--r--] | src/main.c | 315 |
1 files changed, 3 insertions, 312 deletions
diff --git a/src/main.c b/src/main.c index 6df8345..d74bc47 100644..100755 --- a/src/main.c +++ b/src/main.c @@ -17,121 +17,20 @@ #include <app.h> #include <Elementary.h> #include <viewmgr.h> -#include <inputmgr.h> #include <app_debug.h> #include <app_define.h> -#include <tzsh_tvsrv.h> #include <efl_util.h> -#include <ui-gadget.h> #include "define.h" -#include "tv.h" -#include "util.h" #include "view.h" -#define KEY_MAX 256 -#define PAUSE_WAIT_TIME 0.5 - SET_TAG(PACKAGE) struct _appdata { const char *name; Evas_Object *win; - Ecore_Event_Handler *key_down; - Ecore_Event_Handler *key_up; - tzsh_h tzsh; - tzsh_tvsrv_h ta; - Ecore_Timer *pause_timer; - int service_id; - - int is_signal; - int is_channel; - int is_tuned; }; -struct key_map { - const char *view; - const char *key[KEY_MAX]; -}; - -static struct key_map g_kmap[] = { - { - VIEW_CHANNELINFO, - { - KEY_ENTER, - KEY_CHANNELUP, - KEY_CHANNELDOWN, - KEY_PREVIOUS, - } - }, - { - VIEW_CHANNELNUMBER, - { - KEY_0, KEY_1, KEY_2, KEY_3, - KEY_4, KEY_5, KEY_6, KEY_7, - KEY_8, KEY_9, KEY_MINUS - } - }, - { - VIEW_ACTION_MENU, - { - } - }, -}; - -static Eina_Bool _event(void *data, Evas_Object *obj, Evas_Object *src, - Evas_Callback_Type type, void *ei) -{ - struct _appdata *ad; - size_t i, j; - char *keyname; - int update_type; - - if (type == EVAS_CALLBACK_KEY_DOWN && - !strcmp(((Evas_Event_Key_Down *)ei)->keyname, - KEY_SUPER_L)) { - util_launch_home(); - return EINA_TRUE; - } - - if (!data) { - _ERR("failed to get data"); - return EINA_FALSE; - } - - ad = data; - - if (!ad->is_channel) - return EINA_TRUE; - - switch (type) { - case EVAS_CALLBACK_KEY_DOWN: - keyname = ((Evas_Event_Key_Down *)ei)->keyname; - update_type = UPDATE_TYPE_INPUT_KEY_DOWN; - break; - case EVAS_CALLBACK_KEY_UP: - keyname = ((Evas_Event_Key_Up *)ei)->keyname; - update_type = UPDATE_TYPE_INPUT_KEY_UP; - break; - default: - return EINA_FALSE; - } - - for (i = 0; i < sizeof(g_kmap) / sizeof(*g_kmap); i++) { - j = 0; - while (g_kmap[i].key[j]) { - if (!strcmp(keyname, g_kmap[i].key[j])) { - viewmgr_update_view(g_kmap[i].view, - update_type, ei); - return EINA_TRUE; - } - j++; - } - } - - return EINA_FALSE; -} - static Evas_Object *_add_win(const char *name) { Evas_Object *win; @@ -151,140 +50,10 @@ static Evas_Object *_add_win(const char *name) return win; } -static tzsh_tvsrv_h _bind_win(Evas_Object *win, tzsh_h tzsh) -{ - tzsh_window tz_win; - tzsh_tvsrv_h ta; - - tz_win = elm_win_window_id_get(win); - if (!tz_win) { - _ERR("failed to get window ID"); - return NULL; - } - - ta = tzsh_tvsrv_create(tzsh, tz_win); - if (!ta) { - _ERR("failed to create tvsrv"); - return NULL; - } - tzsh_tvsrv_bind(ta); - - return ta; -} - -static void _tv_signal_cb(void *data, int is_signal) -{ - struct _appdata *ad; - - if (!data) { - _ERR("failed to get data"); - return; - } - - ad = data; - - ad->is_signal = is_signal; - ad->is_tuned = true; - - if (is_signal) { - viewmgr_hide_view(VIEW_ERROR); - } else { - viewmgr_show_view(VIEW_ERROR); - viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOSIGNAL, NULL); - } -} - -Eina_Bool _tv_pause(void *data) -{ - struct _appdata *ad; - int r; - - if (!data) { - _ERR("failed to get data"); - return ECORE_CALLBACK_CANCEL; - } - - ad = data; - - r = tv_pause(); - if (r < 0) - _ERR("Pause tv service failed"); - - ad->pause_timer = NULL; - - return ECORE_CALLBACK_CANCEL; -} - -static void _pause(void *data) -{ - struct _appdata *ad; - - if (!data) { - _ERR("failed to get data"); - return; - } - - ad = data; - - ad->pause_timer = ecore_timer_add(PAUSE_WAIT_TIME, _tv_pause, ad); -} - -static void _resume(void *data) -{ - struct _appdata *ad; - int r; - - if (!data) { - _ERR("failed to get data"); - return; - } - - ad = data; - - if (ad->pause_timer) { - ecore_timer_del(ad->pause_timer); - ad->pause_timer = NULL; - } - - r = tv_resume(); - if (r < 0) { - _ERR("Resume tv service failed"); - ui_app_exit(); - - return; - } else if (r > 0) { - ad->is_tuned = false; - } - - /* Try to tune with service id if supplied from app control */ - if (ad->service_id > 0) { - r = tv_channel_tune_with_service_id(ad->service_id); - ad->service_id = 0; - - if (!r) { - ad->is_channel = true; - return; - } - } - - if (ad->is_tuned) - return; - - r = tv_channel_tune(); - if (r < 0) { - ad->is_channel = false; - viewmgr_show_view(VIEW_ERROR); - viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOCHANNEL, NULL); - } else { - ad->is_channel = true; - } -} - static bool _create(void *data) { struct _appdata *ad; Evas_Object *win; - int r; if (!data) { _ERR("failed to get data"); @@ -294,13 +63,6 @@ static bool _create(void *data) ad = data; elm_app_base_scale_set(APP_BASE_SCALE); - elm_theme_overlay_add(NULL, THEMEFILE); - - ad->tzsh = tzsh_create(TZSH_TOOLKIT_TYPE_EFL); - if (!ad->tzsh) { - _ERR("failed to create tzsh"); - return false; - } win = _add_win(ad->name); if (!win) { @@ -308,42 +70,16 @@ static bool _create(void *data) return false; } - ad->ta = _bind_win(win, ad->tzsh); - if (!ad->ta) { - _ERR("failed to bind win object"); - evas_object_del(win); - return false; - } - - r = ug_init_efl(win, UG_OPT_INDICATOR_ENABLE); - if (r < 0) - _ERR("failed to init ug"); - if (!viewmgr_create(win)) { _ERR("failed to initialize viewmgr"); evas_object_del(win); return false; } - viewmgr_add_view(view_error_get_vclass(), NULL); - viewmgr_add_view(view_channelinfo_get_vclass(), NULL); - viewmgr_add_view(view_channelnumber_get_vclass(), NULL); - viewmgr_add_view(view_action_menu_get_vclass(), NULL); - viewmgr_add_view(view_pin_get_vclass(), NULL); - - r = tv_create(); - if (r < 0) { - _ERR("Create TV failed"); - evas_object_del(win); - return false; - } - + viewmgr_add_view(view_bgimage_get_vclass(), NULL); ad->win = win; - tv_signal_cb_set(_tv_signal_cb, ad); - elm_object_event_callback_add(win, _event, ad); - - elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); + viewmgr_show_view(VIEW_BGIMAGE); return true; } @@ -359,53 +95,11 @@ static void _terminate(void *data) ad = data; - if (ad->pause_timer) { - ecore_timer_del(ad->pause_timer); - ad->pause_timer = NULL; - } - if (ad->win) { - tv_destroy(); - - elm_object_event_callback_del(ad->win, _event, ad); - - viewmgr_remove_view(VIEW_CHANNELINFO); - viewmgr_remove_view(VIEW_CHANNELNUMBER); - viewmgr_remove_view(VIEW_ERROR); - viewmgr_remove_view(VIEW_ACTION_MENU); - viewmgr_remove_view(VIEW_PIN); - viewmgr_destroy(); - + viewmgr_remove_view(VIEW_BGIMAGE); evas_object_del(ad->win); ad->win = NULL; - - if (ad->ta) - tzsh_tvsrv_destroy(ad->ta); - - if (ad->tzsh) - tzsh_destroy(ad->tzsh); - } -} - -static void _control(app_control_h control, void *data) -{ - struct _appdata *ad; - char *svcid; - int r; - - if (!data) { - _ERR("failed to get data"); - return; } - - ad = data; - - r = app_control_get_extra_data(control, KEY_SVCID, &svcid); - if (r != APP_CONTROL_ERROR_NONE) - return; - - ad->service_id = atoll(svcid); - free(svcid); } int main(int argc, char *argv[]) @@ -414,9 +108,6 @@ int main(int argc, char *argv[]) ui_app_lifecycle_callback_s cbs = { .create = _create, .terminate = _terminate, - .pause = _pause, - .resume = _resume, - .app_control = _control, }; memset(&ad, 0x00, sizeof(ad)); |