From: Hyerim Kim Date: Tue, 5 Sep 2017 12:13:14 +0000 (+0900) Subject: Modifies Live-tv application for displaying background image on Home X-Git-Tag: accepted/tizen/4.0/unified/20170911.154210^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_5.0;p=profile%2Ftv%2Fapps%2Fnative%2Fair_livetv.git Modifies Live-tv application for displaying background image on Home Change-Id: I4081ad312fd6e77169e55d33a3c9a3755ec8770e Signed-off-by: Hyerim Kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 index fc5e4cb..beafd70 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,19 +38,9 @@ IF(NOT DEFINED MANIFESTDIR) ENDIF(NOT DEFINED MANIFESTDIR) SET(SRCS src/main.c - src/tv.c - src/view_channelinfo.c - src/layout_channelinfo.c - src/layout_channelinfo_list.c - src/layout_channelinfo_search.c - src/view_channelnumber.c - src/view_error.c - src/view_action_menu.c - src/view_pin.c - src/util.c) + src/view_bgimage.c) SET(TARGET_EDJ "${PROJECT_NAME}.edj") -SET(THEME_EDJ "${PROJECT_NAME}-theme.edj") ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"") ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"") @@ -63,16 +53,9 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) pkg_check_modules(PKGS REQUIRED elementary - ecore edje - capi-appfw-application capi-ui-efl-util - app-utils - vconf - gobject-2.0 - tv-service - tzsh-tvsrv - ui-gadget-1) + app-utils) FOREACH(flag ${PKGS_CFLAGS}) SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}") diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt old mode 100644 new mode 100755 index 500ddff..b9bdc81 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -21,12 +21,3 @@ ADD_CUSTOM_TARGET(${TARGET_EDJ} ) ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR}) - -ADD_CUSTOM_TARGET(${THEME_EDJ} - COMMAND edje_cc -id ../res/images -sd ../res/sounds - ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc - ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc -) -ADD_DEPENDENCIES(${PROJECT_NAME} ${THEME_EDJ}) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ} DESTINATION ${EDJEDIR}) diff --git a/data/live-tv-theme.edc b/data/live-tv-theme.edc deleted file mode 100644 index 8be3ca4..0000000 --- a/data/live-tv-theme.edc +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include "../include/define.h" - -collections { - base_scale: 2.0; - #include "widget/button.edc" - #include "widget/notify.edc" -} diff --git a/data/live-tv.edc b/data/live-tv.edc old mode 100644 new mode 100755 index 544a84a..c61e167 --- a/data/live-tv.edc +++ b/data/live-tv.edc @@ -18,8 +18,42 @@ collections { base_scale: 2.0; - #include "view/channelinfo.edc" - #include "view/channelnumber.edc" - #include "view/error.edc" - #include "view/action_menu.edc" + group { + name, GRP_VIEW_BGIMAGE; + images { + image, "background.png" COMP; + } + parts { + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 244 244 244 255; + } + } + part { + name, "part.bgimage"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + image.normal, "background.png"; + rel1 { + to, "bg"; + relative, 0.0 0.0; + } + rel2 { + to, "bg"; + relative, 1.0 1.0; + } + visible, 1; + min, 1920 1080; + align, 0.0 0.0; + fixed, 1 1; + } + } + } + } } diff --git a/data/view/action_menu.edc b/data/view/action_menu.edc deleted file mode 100644 index d7b9485..0000000 --- a/data/view/action_menu.edc +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -group { - name, GRP_VIEW_ACTION_MENU; - parts { - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 0 0 0 150; - } - } - part { - name, "menu_bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 255 255 255 255; - rel1.to, PART_CONTENT; - rel2.to, PART_CONTENT; - } - } - - part { - name, PART_CONTENT; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.0; - min, 500 0; - align, 0.0 0.0; - fixed, 1 0; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - align, 1.0 0.0; - } - } - - part { - name, "view.divider"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 0 0 0 25; - rel1.to, PART_CONTENT; - rel2 { - to, PART_CONTENT; - relative, 0.0 1.0; - } - min, 1 0; - align, 1.0 0.5; - fixed, 1 0; - } - } - - part { - name, "padding.channelinfo"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 0.0 0.0; - min, 40 40; - align, 0.0 0.0; - fixed, 1 1; - } - } - - part { - name, PART_CHANNELINFO; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.channelinfo"; - relative, 1.0 1.0; - } - rel2 { - to, "padding.channelinfo"; - relative, 1.0 1.0; - } - min, 536 174; - align, 0.0 0.0; - fixed, 1 1; - } - } - - } - programs { - program { - signal, SIGNAL_SHOW; - action, STATE_SET "show" 0.0; - target, PART_CONTENT; - transition, CUBIC_BEZIER 0.667 TRANSITION_EASE_IN_OUT; - } - program { - signal, SIGNAL_HIDE; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, PART_CONTENT; - transition, CUBIC_BEZIER 0.334 TRANSITION_EASE_OUT; - after, "hide_finished"; - } - program { - name, "hide_finished"; - action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM; - } - } -} - -group { - name, GRP_ACTION_MENU_TOP; - parts { - part { - name, "area"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - min, 500 346; - } - } - part { - name, "padding.livetv.btn"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel2.relative, 1.0 0.0; - min, 0 120; - align, 0.5 0.0; - fixed, 0 1; - } - } - - part { - name, PART_TOP_BUTTON; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.livetv.btn"; - relative, 0.5 0.5; - } - rel2 { - to, "padding.livetv.btn"; - relative, 0.5 0.5; - } - min, 327 64; - align, 0.5 0.5; - fixed, 1 1; - } - } - - part { - name, "padding.menu.divider.up"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 224 224 224 255; - rel1 { - to, "padding.livetv.btn"; - relative, 0.0 1.0; - } - rel2.to, "padding.livetv.btn"; - min, 0 1; - align, 0.0 1.0; - fixed, 0 1; - } - } - - part { - name, "part.menu.bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1.to, PART_MENU; - rel2.to, PART_MENU; - align, 0.0 0.0; - color, 224 224 224 255; - } - } - - part { - name, PART_MENU; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.menu.divider.up"; - relative, 0.5 1.0; - } - rel2 { - to, "padding.menu.divider.up"; - relative, 0.5 1.0; - } - min, 500 126; - align, 0.5 0.0; - fixed, 1 1; - } - } - - part { - name, "padding.menu.divider.down"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 224 224 224 255; - rel1 { - to, PART_MENU; - relative, 0.0 1.0; - } - rel2 { - to, PART_MENU; - relative, 0.0 1.0; - } - min, 500 1; - align, 0.0 0.0; - fixed, 1 1; - } - } - - part { - name, "padding.favorite"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.menu.divider.down"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.menu.divider.down"; - relative, 1.0 1.0; - } - min, 0 40; - align, 0.0 0.0; - fixed, 1 1; - } - } - - part { - name, "part.favorite.title"; - type, TEXT; - scale, 1; - description { - state: "default" 0.0; - rel1 { - to, "padding.favorite"; - relative, 0.5 1.0; - } - rel2 { - to, "padding.favorite"; - relative, 0.5 1.0; - } - text { - font, FONT_LIGHT; - size, 32; - align, 0.0 0.5; - text, STR_BUTTON_FAVORITE; - } - color, 77 77 77 255; - min, 440 32; - align, 0.5 0.0; - fixed, 1 1; - } - } - - part { - name, "padding.favorite.list"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "part.favorite.title"; - relative, 0.0 1.0; - } - rel2 { - to, "part.favorite.title"; - relative, 1.0 1.0; - } - min, 0 30; - align, 0.0 0.0; - fixed, 1 1; - } - } - } -} - -group { - name, GRP_ACTION_MENU_BOTTOM; - parts { - part { - name, PART_MORE_BUTTON; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - min, 184 116; - align, 0.5 0.0; - } - } - } -} - -group { - name, GRP_ACTION_MENU_NO_FAVORITE; - parts { - part { - name, "part.favorite.no_favorite"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.5 0.0; - rel2.relative, 0.5 0.0; - min, 440 616; - align, 0.5 0.0; - color, COLOR_NOFAVORITE_BG; - } - } - part { - name, "part.favorite.no_favorite.text"; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1.to, "part.favorite.no_favorite"; - rel2.to, "part.favorite.no_favorite"; - text { - font, FONT_LIGHT; - size, 28; - align, 0.5 0.5; - text, STR_NOFAVORITE; - } - color, COLOR_NOFAVORITE_TEXT; - } - } - } -} diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc deleted file mode 100644 index 6ead49c..0000000 --- a/data/view/channelinfo.edc +++ /dev/null @@ -1,1058 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include "../../include/define.h" - -group { - name, GRP_VIEW_CHANNELINFO; - parts { - part { - name, PART_CONTENT; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.0; - rel2.relative, 1.0 1.0; - min, 536 0; - align, 1.0 0.5; - fixed, 1 0; - } - } - } -} - -group { - name, GRP_LAYOUT_CHANNELINFO; - parts { - part { - name, PART_CONTENT; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.5; - rel2.relative, 1.0 0.5; - min, 536 486; - align, 0.0 0.5; - fixed, 1 1; - visible, 0; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - align, 1.0 0.5; - visible, 1; - } - } - } - programs { - program { - signal, SIGNAL_SHOW; - action, STATE_SET "show" 0.0; - target, PART_CONTENT; - transition, CUBIC_BEZIER 0.5 TRANSITION_EASE_IN_OUT; - } - program { - signal, SIGNAL_HIDE; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, PART_CONTENT; - transition, CUBIC_BEZIER 0.167 TRANSITION_EASE_OUT; - after, "hide_finished"; - } - program { - name, "hide_finished"; - action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM; - } - } -} - -group { - name, GRP_LAYOUT_CHANNELINFO_LIST; - images { - image, "btn_navigation_up.png" COMP; - image, "btn_navigation_down.png" COMP; - } - parts { - part { - name, "bg"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.5; - rel2.relative, 1.0 0.5; - min, 536 486; - align, 0.0 0.5; - fixed, 1 1; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - align, 1.0 0.5; - } - } - part { - name, "part.navigation_up"; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - image.normal, "btn_navigation_up.png"; - rel1 { - to, "bg"; - relative, 0.5 0.0; - } - rel2 { - to, "bg"; - relative, 0.5 0.0; - } - min, 98 34; - align, 0.5 0.0; - fixed, 1 1; - visible, 1; - } - } - part { - name, "padding.next_channel"; - type, SPACER; - description { - state, "default" 0.0; - rel1 { - to, "part.navigation_up"; - relative, 0.5 1.0; - } - rel2 { - to, "part.navigation_up"; - relative, 0.5 1.0; - } - min, 0 20; - align, 0.5 0.0; - fixed, 1 1; - } - } - part { - name, "clip_next"; - type, RECT; - description { - state, "default" 0.0; - rel1 { - to, "padding.next_channel"; - relative, 0.5 1.0; - } - rel2 { - to, "padding.next_channel"; - relative, 0.5 1.0; - } - min, 536 70; - align, 0.5 0.0; - fixed, 1 1; - color, 255 255 255 0; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - color, 255 255 255 255; - } - } - part { - name, PART_CHANNELINFO_LIST_NEXT; - type, SWALLOW; - clip_to, "clip_next"; - description { - state, "default" 0.0; - rel1 { - to, "clip_next"; - relative, 0.0 0.5; - offset, 0 20; - } - rel2 { - to, "clip_next"; - relative, 1.0 0.5; - offset, 0 20; - } - align, 0.0 0.5; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - rel1.offset, 0 0; - rel2.offset, 0 0; - } - description { - state, "up" 0.0; - inherit, "show" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 1.0 0.0; - align, 0.0 0.0; - } - description { - state, "down" 0.0; - inherit, "show" 0.0; - rel1.relative, 0.0 1.0; - rel2.relative, 1.0 1.0; - align, 0.0 1.0; - } - } - part { - name, "padding.current_channel"; - type, SPACER; - description { - state, "default" 0.0; - rel1 { - to, "clip_next"; - relative, 0.5 1.0; - } - rel2 { - to, "clip_next"; - relative, 0.5 1.0; - } - min, 0 32; - align, 0.5 0.0; - fixed, 1 1; - } - } - part { - name, "clip_current"; - type, RECT; - description { - state, "default" 0.0; - rel1 { - to, "padding.current_channel"; - relative, 0.5 1.0; - } - rel2 { - to, "padding.current_channel"; - relative, 0.5 1.0; - } - min, 536 174; - align, 0.5 0.0; - fixed, 1 1; - color, 255 255 255 0; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - color, 255 255 255 255; - } - } - part { - name, PART_CHANNELINFO_LIST_CURRENT; - type, SWALLOW; - clip_to, "clip_current"; - description { - state, "default" 0.0; - rel1 { - to, "clip_current"; - relative, 0.0 0.5; - } - rel2 { - to, "clip_current"; - relative, 1.0 0.5; - } - align, 0.0 0.5; - } - description { - state, "up" 0.0; - inherit, "default" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 1.0 0.0; - align, 0.0 0.0; - } - description { - state, "down" 0.0; - inherit, "default" 0.0; - rel1.relative, 0.0 1.0; - rel2.relative, 1.0 1.0; - align, 0.0 1.0; - } - } - part { - name, "padding.prev_channel"; - type, SPACER; - description { - state, "default" 0.0; - rel1 { - to, "clip_current"; - relative, 0.5 1.0; - } - rel2 { - to, "clip_current"; - relative, 0.5 1.0; - } - min, 0 32; - align, 0.5 0.0; - fixed, 1 1; - } - } - part { - name, "clip_prev"; - type, RECT; - description { - state, "default" 0.0; - rel1 { - to, "padding.prev_channel"; - relative, 0.5 1.0; - } - rel2 { - to, "padding.prev_channel"; - relative, 0.5 1.0; - } - min, 536 70; - align, 0.5 0.0; - fixed, 1 1; - color, 255 255 255 0; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - color, 255 255 255 255; - } - } - part { - name, PART_CHANNELINFO_LIST_PREV; - type, SWALLOW; - clip_to, "clip_prev"; - description { - state, "default" 0.0; - rel1 { - to, "clip_prev"; - relative, 0.0 0.5; - offset, 0 -20; - } - rel2 { - to, "clip_prev"; - relative, 1.0 0.5; - offset, 0 -20; - } - align, 0.0 0.5; - } - description { - state, "show" 0.0; - inherit, "default" 0.0; - rel1.offset, 0 0; - rel2.offset, 0 0; - } - description { - state, "up" 0.0; - inherit, "show" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 1.0 0.0; - align, 0.0 0.0; - } - description { - state, "down" 0.0; - inherit, "show" 0.0; - rel1.relative, 0.0 1.0; - rel2.relative, 1.0 1.0; - align, 0.0 1.0; - } - } - part { - name, "padding.navigation_down"; - type, SPACER; - description { - state, "default" 0.0; - rel1 { - to, "clip_prev"; - relative, 0.5 1.0; - } - rel2 { - to, "clip_prev"; - relative, 0.5 1.0; - } - min, 0 20; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, "part.navigation_down"; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - image.normal, "btn_navigation_down.png"; - rel1 { - to, "padding.navigation_down"; - relative, 0.5 1.0; - } - rel2 { - to, "padding.navigation_down"; - relative, 0.5 1.0; - } - min, 98 34; - align, 0.5 0.0; - fixed, 1 1; - visible, 1; - } - } - } - programs { - program { - signal, SIGNAL_SHOW; - action, STATE_SET "show" 0.0; - target, "bg"; - after, "show_current"; - after, "show_other"; - } - program { - name, "show_current"; - action, STATE_SET "show" 0.0; - target, "clip_current"; - transition, CUBIC_BEZIER 0.334 TRANSITION_EASE_IN_OUT; - } - program { - name, "show_other"; - action, STATE_SET "show" 0.0; - target, "clip_next"; - target, PART_CHANNELINFO_LIST_NEXT; - target, "clip_prev"; - target, PART_CHANNELINFO_LIST_PREV; - transition, CUBIC_BEZIER 0.401 TRANSITION_EASE_IN_OUT; - } - program { - signal, SIGNAL_HIDE; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, "bg"; - transition, CUBIC_BEZIER 0.167 TRANSITION_EASE_OUT; - sequence { - action, STATE_SET "default" 0.0; - target, "clip_next"; - target, PART_CHANNELINFO_LIST_NEXT; - target, "clip_prev"; - target, PART_CHANNELINFO_LIST_PREV; - target, "clip_current"; - - action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM; - } - } - program { - signal, SIGNAL_ANIM_MOVE_UP; - source, SOURCE_PROGRAM; - action, STATE_SET "show" 0.0; - target, PART_CHANNELINFO_LIST_NEXT; - target, PART_CHANNELINFO_LIST_CURRENT; - target, PART_CHANNELINFO_LIST_PREV; - sequence { - action, STATE_SET "up" 0.0; - transition, CUBIC_BEZIER 0.667 TRANSITION_EASE_IN_OUT; - target, PART_CHANNELINFO_LIST_NEXT; - target, PART_CHANNELINFO_LIST_CURRENT; - target, PART_CHANNELINFO_LIST_PREV; - after, "anim_end"; - } - } - program { - signal, SIGNAL_ANIM_MOVE_DOWN; - source, SOURCE_PROGRAM; - action, STATE_SET "show" 0.0; - target, PART_CHANNELINFO_LIST_NEXT; - target, PART_CHANNELINFO_LIST_CURRENT; - target, PART_CHANNELINFO_LIST_PREV; - sequence { - action, STATE_SET "down" 0.0; - transition, CUBIC_BEZIER 0.667 TRANSITION_EASE_IN_OUT; - target, PART_CHANNELINFO_LIST_NEXT; - target, PART_CHANNELINFO_LIST_CURRENT; - target, PART_CHANNELINFO_LIST_PREV; - after, "anim_end"; - } - } - program { - name, "anim_end"; - action, SIGNAL_EMIT SIGNAL_ANIM_FINISHED SOURCE_ELM; - } - } -} - -group { - name, GRP_LAYOUT_CHANNELINFO_SEARCH; - parts { - part { - name, PART_CONTENT; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.0; - rel2.relative, 1.0 1.0; - min, 536 0; - align, 1.0 0.0; - fixed, 1 0; - } - } - } -} - -group { - name, GRP_CHANNELINFO; - images { - image, "ic_thumbnail_favorite_01.png" COMP; - image, "ic_thumbnail_lock_01_foc.png" COMP; - image, "ic_thumbnail_lock_01_nor.png" COMP; - } - script { - public is_locked=0, is_favorite=0, is_focused=0; - - public set_states() { - new focused; - new locked; - new favorite; - - focused = get_int(is_focused); - locked = get_int(is_locked); - favorite = get_int(is_favorite); - - if (locked == 1) { - if (focused == 1) - run_program(PROGRAM:"do_focus_locked"); - else - run_program(PROGRAM:"do_locked"); - } - - if (favorite == 1) - run_program(PROGRAM:"do_favorite"); - } - } - parts { - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.0 0.5; - rel2.relative, 0.0 0.5; - min, 536 174; - align, 0.0 0.5; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, COLOR_BG_FOCUSED; - } - } - part { - name, "padding.left_top"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 0.0 0.0; - } - rel2 { - to, "bg"; - relative, 0.0 0.0; - } - min, 28 26; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_CHANNEL; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.left_top"; - relative, 1.0 1.0; - } - rel2 { - to, "padding.left_top"; - relative, 1.0 1.0; - } - text { - font, FONT_LIGHT; - size, 28; - align, 0.0 0.5; - } - color, COLOR_TEXT_NORMAL; - min, 344 32; - align, 0.0 0.0; - fixed, 1 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, COLOR_TEXT_FOCUSED; - } - } - part { - name, "padding.title"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, PART_CHANNELINFO_CHANNEL; - relative, 0.0 1.0; - } - rel2 { - to, PART_CHANNELINFO_CHANNEL; - relative, 0.0 1.0; - } - min, 0 6; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_TITLE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.title"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.title"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - size, 28; - align, 0.0 0.5; - } - color, COLOR_TEXT_NORMAL; - min, 484 32; - align, 0.0 0.0; - fixed, 1 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, COLOR_TEXT_FOCUSED; - } - } - part { - name, "padding.time"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, PART_CHANNELINFO_TITLE; - relative, 0.0 1.0; - } - rel2 { - to, PART_CHANNELINFO_TITLE; - relative, 0.0 1.0; - } - min, 0 24; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_TIME; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.time"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.time"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - size, 28; - align, 0.0 0.5; - } - color, 112 112 112 255; - min, 484 28; - align, 0.0 0.0; - fixed, 1 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, COLOR_TEXT_FOCUSED; - } - } - part { - name, "padding.right_top"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 1.0 0.0; - } - rel2 { - to, "bg"; - relative, 1.0 0.0; - } - min, 22 28; - align, 1.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_STATUS; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.right_top"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.right_top"; - relative, 0.0 1.0; - } - min, 142 28; - align, 1.0 0.0; - fixed, 1 1; - } - } - - part { - name, PART_CHANNELINFO_LOCKED; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - image.normal, "ic_thumbnail_lock_01_nor.png"; - rel1 { - to, PART_CHANNELINFO_STATUS; - relative, 1.0 0.0; - } - rel2 { - to, PART_CHANNELINFO_STATUS; - relative, 1.0 0.0; - } - min, 0 0; - align, 1.0 0.0; - fixed, 1 1; - visible, 0; - } - description { - state, "visible" 0.0; - inherit, "default" 0.0; - min, 28 28; - visible, 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - image.normal, "ic_thumbnail_lock_01_foc.png"; - min, 28 28; - visible, 1; - } - } - part { - name, "padding.channelinfo.locked"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, PART_CHANNELINFO_LOCKED; - relative, 0.0 0.0; - } - rel2 { - to, PART_CHANNELINFO_LOCKED; - relative, 0.0 0.0; - } - min, 0 0; - align, 1.0 0.0; - fixed, 1 1; - } - description { - state, "visible" 0.0; - inherit, "default" 0.0; - min, 10 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - min, 10 0; - } - } - part { - name, PART_CHANNELINFO_FAVORITE; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - image.normal, "ic_thumbnail_favorite_01.png"; - rel1 { - to, "padding.channelinfo.locked"; - relative, 0.0 0.0; - } - rel2 { - to, "padding.channelinfo.locked"; - relative, 0.0 0.0; - } - min, 0 0; - align, 1.0 0.0; - fixed, 1 1; - visible, 0; - } - description { - state, "visible" 0.0; - inherit, "default" 0.0; - min, 28 28; - visible, 1; - } - } - part { - name, "padding.channelinfo.favorite"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, PART_CHANNELINFO_FAVORITE; - relative, 0.0 0.0; - } - rel2 { - to, PART_CHANNELINFO_FAVORITE; - relative, 0.0 0.0; - } - min, 0 0; - align, 1.0 0.0; - fixed, 1 1; - } - description { - state, "visible" 0.0; - inherit, "default" 0.0; - min, 10 0; - } - } - } - programs { - program { - name, "focused"; - signal, SIGNAL_FOCUSED; - source, SOURCE_ELM; - script { - set_int(is_focused, 1); - set_states(); - run_program(PROGRAM:"do_focused"); - } - } - program { - name, "do_focused"; - action, STATE_SET "focused" 0.0; - target, "bg"; - target, PART_CHANNELINFO_CHANNEL; - target, PART_CHANNELINFO_TITLE; - target, PART_CHANNELINFO_TIME; - } - program { - name, "unfocused"; - signal, SIGNAL_UNFOCUSED; - source, SOURCE_ELM; - script { - set_int(is_focused, 0); - set_states(); - run_program(PROGRAM:"do_unfocused"); - } - } - program { - name, "do_unfocused"; - action, STATE_SET "default" 0.0; - target, "bg"; - target, PART_CHANNELINFO_CHANNEL; - target, PART_CHANNELINFO_TITLE; - target, PART_CHANNELINFO_TIME; - } - program { - name, "reset"; - signal, SIGNAL_RESET; - source, SOURCE_PROGRAM; - script { - set_int(is_locked, 0); - set_int(is_favorite, 0); - run_program(PROGRAM:"do_reset"); - } - } - program { - name, "do_reset"; - action, STATE_SET "default" 0.0; - target, PART_CHANNELINFO_FAVORITE; - target, "padding.channelinfo.favorite"; - target, PART_CHANNELINFO_LOCKED; - target, "padding.channelinfo.locked"; - } - program { - name, "set_locked"; - signal, SIGNAL_LOCKED; - source, SOURCE_PROGRAM; - script { - set_int(is_locked, 1); - set_states(); - } - } - program { - name, "set_favorite"; - signal, SIGNAL_FAVORITE; - source, SOURCE_PROGRAM; - script { - set_int(is_favorite, 1); - set_states(); - } - } - program { - name, "do_favorite"; - action, STATE_SET "visible" 0.0; - target, PART_CHANNELINFO_FAVORITE; - target, "padding.channelinfo.favorite"; - } - program { - name, "do_locked"; - action, STATE_SET "visible" 0.0; - target, PART_CHANNELINFO_LOCKED; - target, "padding.channelinfo.locked"; - } - program { - name, "do_focus_locked"; - action, STATE_SET "focused" 0.0; - target, PART_CHANNELINFO_LOCKED; - target, "padding.channelinfo.locked"; - } - } -} - -group { - name, GRP_CHANNELINFO_SIMPLE; - parts { - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - min, 536 70; - align, 0.0 0.0; - visible, 0; - } - } - part { - name, "padding.left"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 0.0 0.0; - } - rel2 { - to, "bg"; - relative, 0.0 0.0; - } - min, 28 0; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_CHANNEL; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.left"; - relative, 1.0 0.0; - } - rel2 { - to, "padding.left"; - relative, 1.0 0.0; - } - text { - font, FONT_LIGHT; - size, 32; - align, 0.0 0.5; - } - color, COLOR_TEXT_TRANS; - min, 480 32; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, "padding.title"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, PART_CHANNELINFO_CHANNEL; - relative, 0.0 1.0; - } - rel2 { - to, PART_CHANNELINFO_CHANNEL; - relative, 0.0 1.0; - } - min, 0 6; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_TITLE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.title"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.title"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - size, 32; - align, 0.0 0.5; - } - color, COLOR_TEXT_TRANS; - min, 480 32; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELINFO_TIME; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - visible, 0; - } - } - } -} diff --git a/data/view/channelnumber.edc b/data/view/channelnumber.edc deleted file mode 100644 index e1caabd..0000000 --- a/data/view/channelnumber.edc +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include "../../include/define.h" - -group { - name, GRP_VIEW_CHANNELNUMBER; - parts { - part { - name, "padding.channelnumber"; - type, SPACER; - description { - state, "default" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 0.0 0.0; - align, 0.0 0.0; - min, 62 48; - fixed, 1 1; - } - } - part { - name, "part.channelnumber.info"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.channelnumber"; - relative, 1.0 1.0; - } - rel2 { - to, "padding.channelnumber"; - relative, 1.0 1.0; - } - min, 340 90; - align, 0.0 0.0; - fixed, 1 1; - visible, 0; - } - - part { - name, "padding.channelnumber.channel_prefix"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 0.0 0.0; - min, 0 34; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, "part.channelnumber.channel_prefix"; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.channelnumber.channel_prefix"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.channelnumber.channel_prefix"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - text, STR_CHANNEL_PREFIX; - size, 46; - align, 1.0 0.5; - min, 1 0; - ellipsis, -1; - } - color, COLOR_TEXT_TRANS; - min, 0 46; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, "padding.channelnumber.channel"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, "part.channelnumber.channel_prefix"; - relative, 1.0 0.0; - } - rel2 { - to_x, "part.channelnumber.channel_prefix"; - relative, 1.0 1.0; - } - min, 8 0; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELNUMBER_NUMBER; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, "padding.channelnumber.channel"; - relative, 1.0 0.0; - } - rel2 { - to_x, "padding.channelnumber.channel"; - relative, 1.0 0.0; - } - text { - font, FONT_LIGHT; - size, 80; - align, 0.0 0.5; - min, 1 0; - ellipsis, -1; - } - color, COLOR_TEXT_TRANS; - min, 0 90; - align, 0.0 0.0; - fixed, 1 1; - } - } - } - part { - name, "padding.list"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "part.channelnumber.info"; - relative, 0.0 1.0; - } - rel2 { - to, "part.channelnumber.info"; - relative, 1.0 1.0; - } - min, 0 38; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_CHANNELNUMBER_LIST; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.list"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.list"; - relative, 0.0 1.0; - } - min, 292 224; - align, 0.0 0.0; - fixed, 1 1; - } - } - } -} - -group { - name, GRP_CHANNELNUMBER_LIST_ITEM; - parts { - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, COLOR_BG_NORMAL; - min, 292 56; - align, 0.0 0.0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, COLOR_BG_FOCUSED; - } - } - part { - name, "padding.left"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 0.0 0.0; - } - rel2 { - to, "bg"; - relative, 0.0 1.0; - } - align, 0.0 0.0; - min, 30 0; - fixed, 1 1; - } - } - part { - name, "padding.right"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 1.0 0.0; - } - rel2 { - to, "bg"; - relative, 1.0 1.0; - } - align, 1.0 0.0; - min, 30 0; - fixed, 1 1; - } - } - part { - name, PART_TEXT; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, "padding.left"; - relative, 1.0 0.0; - } - rel2 { - to_x, "padding.right"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - size, 28; - align, 0.0 0.5; - } - color, COLOR_OPTION_TEXT_NORMAL; - align, 0.0 0.0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, COLOR_TEXT_FOCUSED; - } - } - part { - name, "border.top"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 0.0 0.0; - } - rel2 { - to, "bg"; - relative, 1.0 0.0; - } - color, COLOR_OPTION_BORDER; - min, 0 1; - align, 0.0 0.0; - fixed, 0 1; - visible, 0; - } - description { - state, "first" 0.0; - inherit, "default" 0.0; - visible, 1; - } - } - part { - name, "border.left"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 0.0 0.0; - } - rel2 { - to, "bg"; - relative, 0.0 1.0; - } - color, COLOR_OPTION_BORDER; - min, 1 0; - align, 0.0 0.0; - fixed, 1 0; - } - } - part { - name, "border.bottom"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 0.0 1.0; - } - rel2 { - to, "bg"; - relative, 1.0 1.0; - } - color, COLOR_OPTION_BORDER; - min, 0 1; - align, 0.0 1.0; - fixed, 0 1; - visible, 0; - } - description { - state, "last" 0.0; - inherit, "default" 0.0; - visible, 1; - } - } - part { - name, "border.right"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "bg"; - relative, 1.0 0.0; - } - rel2 { - to, "bg"; - relative, 1.0 1.0; - } - color, COLOR_OPTION_BORDER; - min, 1 0; - align, 1.0 0.0; - fixed, 1 0; - } - } - } - programs { - program { - name, "focused"; - signal, SIGNAL_FOCUSED; - source, SOURCE_ELM; - action, STATE_SET "focused" 0.0; - target, "bg"; - target, PART_TEXT; - } - program { - name, "unfocused"; - signal, SIGNAL_UNFOCUSED; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, "bg"; - target, PART_TEXT; - } - program { - name, "first"; - signal, SIGNAL_FIRST; - source, ""; - action, STATE_SET "first" 0.0; - target, "border.top"; - } - program { - name, "last"; - signal, SIGNAL_LAST; - source, ""; - action, STATE_SET "last" 0.0; - target, "border.bottom"; - } - } -} - diff --git a/data/view/error.edc b/data/view/error.edc deleted file mode 100644 index a405185..0000000 --- a/data/view/error.edc +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include "../../include/define.h" - -group { - name, GRP_VIEW_ERROR; - images { - image, "background.jpg" COMP; - } - parts { - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 244 244 244 255; - } - } - part { - name, "part.bgimage"; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - image.normal, "background.jpg"; - rel1 { - to, "bg"; - relative, 0.0 0.0; - } - rel2 { - to, "bg"; - relative, 1.0 1.0; - } - visible, 0; - min, 1920 1080; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, "part.error"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.5 0.5; - rel2.relative, 0.5 0.5; - min, 0 82; - align, 0.5 0.5; - fixed, 0 1; - } - - part { - name, PART_ERROR_TITLE; - type, TEXT; - scale, 1; - description { - rel1.relative, 0.0 0.0; - rel2.relative, 1.0 0.0; - text { - font, FONT_LIGHT; - size, 36; - align, 0.5 0.5; - min, 1 0; - ellipsis, -1; - } - color, 228 51 51 255; - min, 0 36; - align, 0.5 0.0; - fixed, 1 1; - visible, 0; - } - } - part { - name, PART_ERROR_TEXT; - type, TEXT; - scale, 1; - description { - rel1.relative, 0.0 1.0; - rel2.relative, 1.0 1.0; - text { - font, FONT_LIGHT; - size, 28; - align, 0.5 1.0; - min, 1 0; - ellipsis, -1; - } - color, 116 116 116 255; - min, 0 48; - align, 0.5 1.0; - fixed, 1 1; - visible, 0; - } - } - } - } -} diff --git a/data/widget/button.edc b/data/widget/button.edc deleted file mode 100644 index 330dd36..0000000 --- a/data/widget/button.edc +++ /dev/null @@ -1,1264 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#define STATE_NORMAL 0 -#define STATE_SELECTED 1 - -group { - name, "elm/button/base/style.livetv.button"; - data.item, "focus_highlight" "on"; - parts { - part { - name, "part.bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - min, 0 64; - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - color: 0 119 246 255; - } - } - - part { - name, "padding.text.left"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - min, 20 0; - rel1.to, "part.bg"; - rel2 { - to, "part.bg"; - relative, 0.0 1.0; - } - align, 0.0 0.5; - fixed, 1 0; - } - } - - part { - name, "padding.text.right"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - min, 20 0; - rel1 { - to, "part.bg"; - relative, 1.0 0.0; - } - rel2.to, "part.bg"; - align, 1.0 0.5; - fixed, 1 0; - } - } - - part { - name, "elm.text"; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - color, 87 87 87 255; - rel1 { - to, "padding.text.left"; - relative, 1.0 0.0; - } - rel2 { - to, "padding.text.right"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - size, 28; - align, 0.5 0.5; - } - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - color: 255 255 255 255; - } - description { - state: "disabled" 0.0; - inherit: "default" 0.0; - color: 87 87 87 128; - } - } - - part { - name, "part.inside.line.up"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 194 194 194 255; - rel1.to, "part.bg"; - rel2 { - to, "part.bg"; - relative, 1.0 0.0; - } - min, 0 1; - align, 0.5 0.0; - fixed, 0 1; - } - } - - part { - name, "part.inside.line.left"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 194 194 194 255; - rel1 { - to, "part.inside.line.up"; - relative, 0.0 1.0; - } - rel2 { - to, "part.bg"; - relative, 0.0 1.0; - } - min, 1 0; - align, 0.0 0.5; - fixed, 1 0; - } - } - - part { - name, "part.inside.line.down"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 194 194 194 255; - rel1 { - to, "part.inside.line.left"; - relative, 1.0 1.0; - } - rel2.to, "part.bg"; - min, 0 1; - align, 0.5 1.0; - fixed, 0 1; - } - } - - part { - name, "part.inside.line.right"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 194 194 194 255; - rel1 { - to, "part.inside.line.up"; - relative, 1.0 1.0; - } - rel2 { - to, "part.inside.line.down"; - relative, 1.0 0.0; - } - min, 1 0; - align, 1.0 0.5; - fixed, 1 0; - } - } - } - programs { - program { - name: "disabled"; - signal: "elm,state,disabled"; - source: "elm"; - action: STATE_SET "disabled" 0.0; - target: "part.bg"; - target: "elm.text"; - } - program { - name: "focused"; - signal: "elm,action,focus"; - source: "elm"; - action: STATE_SET "focused" 0.0; - target: "part.bg"; - target: "elm.text"; - } - program { - name: "unfocused"; - signal: "elm,action,unfocus"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "part.bg"; - target: "elm.text"; - } - } -} - -group { - name, "elm/button/base/style.more.button"; - inherit, "elm/button/base/style.livetv.button"; - data.item, "focus_highlight" "on"; - parts { - part { - name, "area"; - type, SPACER; - mouse_events, 0; - scale, 1; - description { - state, "default" 0.0; - min, 184 116; - } - } - - part { - name, "part.bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.0 0.5; - rel2.relative, 1.0 0.5; - min, 0 60; - align, 0.0 0.5; - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - color: 0 119 246 255; - } - } - } -} - -#define DEFAULT 1 -#define SELECTED 2 -#define FOCUSED 3 -#define DISABLED 4 - -group { - name, "elm/button/base/style.action.menu.button"; - data.item, "focus_highlight" "on"; - script { - public is_toggle, is_selected, is_enabled, is_focused, is_init, cur_state; - - public init_values() { - if(get_int(is_init)==0) - { - set_int(is_toggle, 0); - set_int(is_enabled, 1); - set_int(is_focused, 0); - set_int(is_init, 1); - set_int(cur_state, -1); - } - } - public set_states() { - new togg; - new enab; - new foc; - new sel; - new c_state; - togg = get_int(is_toggle); - enab = get_int(is_enabled); - foc = get_int(is_focused); - sel = get_int(is_selected); - c_state = get_int(cur_state); - - if(enab == 0) - { - if(c_state != DISABLED) - { - if (togg == 0) - { - run_program(PROGRAM:"do_disable"); - run_program(PROGRAM:"do_hide.1"); - } - else { - run_program(PROGRAM:"do_disable.1"); - run_program(PROGRAM:"do_hide"); - } - } - } - else - { - if(foc == 1) - { - if(c_state != FOCUSED) - { - if (togg == 0) - { - run_program(PROGRAM:"do_focus"); - run_program(PROGRAM:"do_hide.1"); - } - else { - run_program(PROGRAM:"do_focus.1"); - run_program(PROGRAM:"do_hide"); - } - } - } - else if(sel == 1) - { - if(c_state != SELECTED) - { - if (togg == 0) - { - run_program(PROGRAM:"do_select"); - run_program(PROGRAM:"do_hide.1"); - } - else { - run_program(PROGRAM:"do_select.1"); - run_program(PROGRAM:"do_hide"); - } - } - } - else - { - if(c_state != DEFAULT) - { - if (togg == 0) - { - run_program(PROGRAM:"do_default"); - run_program(PROGRAM:"do_hide.1"); - } - else { - run_program(PROGRAM:"do_default.1"); - run_program(PROGRAM:"do_hide"); - } - } - } - } - } - } - parts { - part { - name, "part.bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - min, 124 124; - color, 255 255 255 255; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 0 119 246 255; - } - } - - part { - name, "padding.icon1"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1.to, "part.bg"; - rel2 { - to, "part.bg"; - relative, 1.0 0.0; - } - min, 0 14; - align, 0.5 0.0; - fixed, 0 1; - } - } - - part { - name, "padding.icon2"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "part.bg"; - relative, 0.0 1.0; - } - rel2.to, "part.bg"; - min, 0 50; - align, 0.5 1.0; - fixed, 0 1; - } - } - - part { - name, "part.icon.bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.icon1"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.icon2"; - relative, 1.0 0.0; - } - align, 0.5 0.5; - min, 60 60; - } - } - - part { - name, "elm.swallow.icon"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect, 1.0 1.0; - aspect_preference, BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - part { - name, "elm.swallow.icon.focus"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect: 1.0 1.0; - aspect_preference: BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - visible, 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 1; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - part { - name, "elm.swallow.icon.select"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect: 1.0 1.0; - aspect_preference: BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - visible, 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 1; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - part { - name, "elm.swallow.icon.disable"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect: 1.0 1.0; - aspect_preference: BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - visible, 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 1; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - - part { - name, "elm.swallow.icon.1"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect, 1.0 1.0; - aspect_preference, BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - part { - name, "elm.swallow.icon.1.focus"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect: 1.0 1.0; - aspect_preference: BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - visible, 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 1; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - part { - name, "elm.swallow.icon.1.select"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect: 1.0 1.0; - aspect_preference: BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - visible, 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 1; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - part { - name, "elm.swallow.icon.1.disable"; - type, SWALLOW; - scale, 1; - clip_to: "part.icon.bg"; - description { - state, "default" 0.0; - aspect: 1.0 1.0; - aspect_preference: BOTH; - rel1 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - rel2 { - to, "part.icon.bg"; - relative, 0.5 0.5; - } - align, 0.5 0.5; - fixed, 1 1; - min, 60 60; - visible, 0; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - visible, 0; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - visible, 1; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - - part { - name, "padding.text"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "part.bg"; - relative, 0.0 1.0; - } - rel2.to, "part.bg"; - min, 0 24; - align, 0.5 1.0; - fixed, 0 1; - } - } - - part { - name, "elm.text"; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - color, 104 104 104 255; - rel1.to, "padding.text"; - rel2 { - to, "padding.text"; - relative, 1.0 0.0; - } - min, 0 20; - align, 0.5 1.0; - fixed, 0 1; - text { - font, FONT_LIGHT; - size, 20; - align, 0.5 0.5; - } - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 255 255 255 255; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - color, 64 136 211 255; - } - description { - state: "disabled" 0.0; - inherit: "default" 0.0; - color: 104 104 104 128; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - - part { - name, "elm.text.1"; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - color, 104 104 104 255; - rel1.to, "padding.text"; - rel2 { - to, "padding.text"; - relative, 1.0 0.0; - } - min, 0 20; - align, 0.5 1.0; - fixed, 0 1; - text { - font, FONT_LIGHT; - size, 20; - align, 0.5 0.5; - } - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 255 255 255 255; - } - description { - state, "selected" 0.0; - inherit, "default" 0.0; - color, 64 136 211 255; - } - description { - state: "disabled" 0.0; - inherit: "default" 0.0; - color: 104 104 104 128; - } - description { - state, "invisible" 0.0; - inherit, "default" 0.0; - visible, 0; - } - } - } - programs { - program { - name: "go_toggle"; - signal: "elm,state,toggle"; - source: "elm"; - script { - init_values(); - set_int(is_toggle, 1); - set_states(); - } - } - program { - name: "go_untoggle"; - signal: "elm,state,untoggle"; - source: "elm"; - script { - init_values(); - set_int(is_toggle, 0); - set_states(); - } - } - program { - name: "go_focused"; - signal: "elm,action,focus"; - source: "elm"; - script { - init_values(); - set_int(is_focused, 1); - set_states(); - } - } - program { - name: "go_unfocused"; - signal: "elm,action,unfocus"; - source: "elm"; - script { - init_values(); - set_int(is_focused, 0); - set_states(); - } - } - program { - name: "go_active"; - signal: "elm,state,selected"; - source: "elm"; - script { - init_values(); - set_int(is_selected, 1); - set_states(); - } - } - program { - name: "go_passive"; - signal: "elm,state,unselected"; - source: "elm"; - script { - init_values(); - set_int(is_selected, 0); - set_states(); - } - } - program { - name: "go_disabled"; - signal: "elm,state,disabled"; - source: "elm"; - script { - init_values(); - set_int(is_enabled, 0); - set_states(); - } - } - program { - name: "go_enabled"; - signal: "elm,state,enabled"; - source: "elm"; - script { - init_values(); - set_int(is_enabled, 1); - set_states(); - } - } - program { - name: "do_hide"; - action: STATE_SET "invisible" 0.0; - target: "elm.text"; - target: "elm.swallow.icon"; - target: "elm.swallow.icon.focus"; - target: "elm.swallow.icon.select"; - target: "elm.swallow.icon.disable"; - } - program { - name: "do_default"; - action: STATE_SET "default" 0.0; - target: "part.bg"; - target: "elm.text"; - target: "elm.swallow.icon"; - target: "elm.swallow.icon.focus"; - target: "elm.swallow.icon.select"; - target: "elm.swallow.icon.disable"; - } - program { - name: "do_focus"; - action: STATE_SET "focused" 0.0; - target: "part.bg"; - target: "elm.text"; - target: "elm.swallow.icon"; - target: "elm.swallow.icon.focus"; - target: "elm.swallow.icon.select"; - target: "elm.swallow.icon.disable"; - } - - program { - name: "do_select"; - action: STATE_SET "selected" 0.0; - target: "part.bg"; - target: "elm.text"; - target: "elm.swallow.icon"; - target: "elm.swallow.icon.focus"; - target: "elm.swallow.icon.select"; - target: "elm.swallow.icon.disable"; - } - - program { - name: "do_disable"; - action: STATE_SET "disabled" 0.0; - target: "part.bg"; - target: "elm.text"; - target: "elm.swallow.icon"; - target: "elm.swallow.icon.focus"; - target: "elm.swallow.icon.select"; - target: "elm.swallow.icon.disable"; - } - - program { - name: "do_hide.1"; - action: STATE_SET "invisible" 0.0; - target: "elm.text.1"; - target: "elm.swallow.icon.1"; - target: "elm.swallow.icon.1.focus"; - target: "elm.swallow.icon.1.select"; - target: "elm.swallow.icon.1.disable"; - } - - program { - name: "do_default.1"; - action: STATE_SET "default" 0.0; - target: "part.bg"; - target: "elm.text.1"; - target: "elm.swallow.icon.1"; - target: "elm.swallow.icon.1.focus"; - target: "elm.swallow.icon.1.select"; - target: "elm.swallow.icon.1.disable"; - } - program { - name: "do_focus.1"; - action: STATE_SET "focused" 0.0; - target: "part.bg"; - target: "elm.text.1"; - target: "elm.swallow.icon.1"; - target: "elm.swallow.icon.1.focus"; - target: "elm.swallow.icon.1.select"; - target: "elm.swallow.icon.1.disable"; - } - - program { - name: "do_select.1"; - action: STATE_SET "selected" 0.0; - target: "part.bg"; - target: "elm.text.1"; - target: "elm.swallow.icon.1"; - target: "elm.swallow.icon.1.focus"; - target: "elm.swallow.icon.1.select"; - target: "elm.swallow.icon.1.disable"; - } - - program { - name: "do_disable.1"; - action: STATE_SET "disabled" 0.0; - target: "part.bg"; - target: "elm.text.1"; - target: "elm.swallow.icon.1"; - target: "elm.swallow.icon.1.focus"; - target: "elm.swallow.icon.1.select"; - target: "elm.swallow.icon.1.disable"; - } - } -} - -group { - name, "elm/button/base/style.action.menu.favorite"; - data.item: "focus_highlight" "on"; - parts { - part { - name: "area"; - type: SPACER; - description { - state: "default" 0.0; - min: 440 292; - fixed: 0 0; - } - } - part { - name: "elm.swallow.content_bg"; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1.relative: 0.0 0.0; - rel2.relative: 1.0 0.0; - align: 0.0 0.0; - min: 440 210; - fixed: 1 1; - } - } - part { - name: "elm.swallow.content"; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1.relative: 0.0 0.0; - rel2.relative: 1.0 0.0; - align: 0.0 0.0; - min: 440 210; - fixed: 1 1; - } - } - part { - name: "elm.swallow.text_bg"; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1.relative: 0.0 1.0; - rel2.relative: 1.0 1.0; - min: 440 82; - align: 0.0 1.0; - fixed: 1 1; - } - } - part { - name: "content.border_top"; - type: RECT; - mouse_events: 0; - scale: 1; - description { - state: "default" 0.0; - rel1.to: "elm.swallow.content"; - rel2 { - to: "elm.swallow.content"; - relative: 1.0 0.0; - } - min: 0 6; - align: 0.5 0.0; - color: 0 119 246 255; - fixed: 0 1; - visible: 0; - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { - name: "content.border_left"; - type: RECT; - mouse_events: 0; - scale: 1; - description { - state: "default" 0.0; - rel1.to: "elm.swallow.content"; - rel2 { - to: "elm.swallow.content"; - relative: 0.0 1.0; - } - min: 6 0; - align: 0.0 0.5; - color: 0 119 246 255; - fixed: 1 0; - visible: 0; - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { - name: "content.border_right"; - type: RECT; - mouse_events: 0; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "elm.swallow.content"; - relative: 1.0 0.0; - } - rel2 { - to: "elm.swallow.content"; - relative: 1.0 1.0; - } - min: 6 0; - align: 1.0 0.5; - color: 0 119 246 255; - fixed: 1 0; - visible: 0; - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { - name: "content.border_bottom"; - type: RECT; - mouse_events: 0; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "elm.swallow.content"; - relative: 0.0 1.0; - } - align: 0.0 0.0; - color: 0 119 246 255; - fixed: 1 1; - visible: 0; - } - description { - state: "focused" 0.0; - inherit: "default" 0.0; - visible: 1; - } - } - part { - name: "elm.text"; - type: TEXT; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "elm.swallow.text_bg"; - relative: 0.5 0.5; - } - rel2 { - to: "elm.swallow.text_bg"; - relative: 0.5 0.5; - } - text { - font: FONT_LIGHT; - size: 28; - align: 0.0 0.5; - } - align: 0.5 0.5; - color: 255 255 255 255; - min: 404 28; - fixed: 1 1; - } - } - part { - name: "event"; - type: RECT; - description { - state: "default" 0.0; - color: 0 0 0 0; - } - } - } - programs { - program { - name: "go_active"; - signal: "elm,action,focus"; - source: "elm"; - action: STATE_SET "focused" 0.0; - target: "elm.swallow.content"; - target: "content.border_top"; - target: "content.border_left"; - target: "content.border_right"; - target: "content.border_bottom"; - } - program { - name: "go_passive"; - signal: "elm,action,unfocus"; - source: "elm"; - action: STATE_SET "default" 0.0; - target: "elm.swallow.content"; - target: "content.border_top"; - target: "content.border_left"; - target: "content.border_right"; - target: "content.border_bottom"; - } - program { - name, "mouse_unclick_after"; - signal, "mouse,clicked,1"; - source, "event"; - action, SIGNAL_EMIT "elm,action,click" ""; - } - } -} diff --git a/data/widget/notify.edc b/data/widget/notify.edc deleted file mode 100644 index 369bcf4..0000000 --- a/data/widget/notify.edc +++ /dev/null @@ -1,157 +0,0 @@ -group { - name: "elm/notify/bottom_left/toast"; - parts { - part { - name: "padding"; - type: SPACER; - description { - state: "default" 0.0; - rel1.relative: 0.0 1.0; - rel2.relative: 0.0 1.0; - min: 40 40; - align: 0.0 1.0; - fixed: 1 1; - } - } - part { - name: "area"; - type: SPACER; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "padding"; - relative: 1.0 0.0; - } - rel2 { - to: "padding"; - relative: 1.0 0.0; - } - min: 536 70; - max: 536 108; - align: 0.0 1.0; - fixed: 1 1; - } - } - part { - name: "base"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - rel1.to: "area"; - rel2.to: "area"; - align: 1.0 1.0; - color: 255 255 255 255; - fixed: 1 1; - } - } - part { - name: "border.top"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 194 194 194 255; - rel1.to: "base"; - rel2.to: "base"; - rel2.relative: 1.0 0.0; - min: 0 1; - align: 0.0 0.0; - fixed: 0 1; - } - } - part { - name: "border.left"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 194 194 194 255; - rel1.to: "base"; - rel2.to: "base"; - rel2.relative, 0.0 1.0; - min, 1 0; - align, 0.0 0.0; - fixed, 1 0; - } - } - part { - name: "border.right"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 194 194 194 255; - rel1.to: "base"; - rel2.to: "base"; - rel1.relative, 1.0 0.0; - min, 1 0; - align, 1.0 0.0; - fixed, 1 0; - } - } - part { - name: "border.bottom"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 194 194 194 255; - rel1.to: "base"; - rel2.to: "base"; - rel1.relative, 0.0 1.0; - min, 0 1; - align, 0.0 1.0; - fixed, 0 1; - } - } - part { - name: "elm.swallow.content"; - type: SWALLOW; - description { - state: "default" 0.0; - rel1 { - to: "base"; - relative: 0.5 0.5; - } - rel2 { - to: "base"; - relative: 0.5 0.5; - } - align: 0.5 0.5; - min: 476 28; - fixed: 1 1; - } - } - } -} - -group { - name: "elm/label/base/toast"; - styles { - style { - name: "toast_style"; - base: "font=BreezeSans:style=Light font_size=28 align=center color=#515151"; - tag: "br" "\n"; - tag: "tab" "\t"; - } - } - parts { - part { - name: "elm.text"; - type: TEXTBLOCK; - mouse_events: 0; - scale: 1; - description { - state: "default" 0.0; - text { - style: "toast_style"; - min: 0 1; - max: 0 1; - } - } - } - } -} - diff --git a/include/define.h b/include/define.h old mode 100644 new mode 100755 index ce3bfb0..aa79cdb --- a/include/define.h +++ b/include/define.h @@ -17,134 +17,7 @@ #ifndef __LIVETV_DEFINE_H__ #define __LIVETV_DEFINE_H__ -#include "strings.h" - -#define KEY_SVCID "service_id" - -#define PART_CONTENT "elm.swallow.content" -#define PART_TEXT "elm.text" -#define PART_ICON "elm.swallow.icon" -#define PART_ICON_FOCUSED "elm.swallow.icon.focus" -#define PART_ICON_SELECTED "elm.swallow.icon.select" -#define PART_ICON_DISABLED "elm.swallow.icon.disable" -#define PART_TEXT_1 "elm.text.1" -#define PART_ICON_1 "elm.swallow.icon.1" -#define PART_ICON_1_FOCUSED "elm.swallow.icon.1.focus" -#define PART_ICON_1_SELECTED "elm.swallow.icon.1.select" -#define PART_ICON_1_DISABLED "elm.swallow.icon.1.disable" -#define PART_TEXT_BG "elm.swallow.text_bg" -#define PART_CONTENT_BG "elm.swallow.content_bg" - -#define SOURCE_PROGRAM "program" -#define SOURCE_ELM "elm" - -#define SIGNAL_FOCUSED "elm,action,focus" -#define SIGNAL_UNFOCUSED "elm,action,unfocus" -#define SIGNAL_RESET "elm,action,reset" -#define SIGNAL_FIRST "elm,state,first" -#define SIGNAL_LAST "elm,state,last" -#define SIGNAL_LOCKED "elm,state,locked" -#define SIGNAL_FAVORITE "elm,state,favorite" -#define SIGNAL_NO_FAVORITE "elm,state,no_favorite" -#define SIGNAL_TOGGLE "elm,state,toggle" -#define SIGNAL_UNTOGGLE "elm,state,untoggle" -#define SIGNAL_SHOW "show" -#define SIGNAL_HIDE "hide" -#define SIGNAL_HIDE_FINISHED "elm,action,hide,finished" -#define SIGNAL_TIMEOUT "timeout" -#define SIGNAL_ANIM_MOVE_UP "anim,move_up" -#define SIGNAL_ANIM_MOVE_DOWN "anim,move_down" -#define SIGNAL_ANIM_FINISHED "anim,finished" - -#define FONT_REGULAR "BreezeSans" -#define FONT_LIGHT "BreezeSans:style=Light" -#define FONT_BOLD "BreezeSans:style=Bold" - -#define COLOR_BG_NORMAL 255 255 255 255 -#define COLOR_BG_FOCUSED 0 119 246 255 -#define COLOR_TEXT_NORMAL 51 51 51 255 -#define COLOR_TEXT_FOCUSED 255 255 255 255 -#define COLOR_TEXT_TRANS 255 255 255 217 -#define COLOR_OPTION_TEXT_NORMAL 87 87 87 255 -#define COLOR_OPTION_TEXT_FOCUSED 255 255 255 255 -#define COLOR_OPTION_BORDER 154 154 154 255 -#define COLOR_NOFAVORITE_BG 229 229 229 255 -#define COLOR_NOFAVORITE_TEXT 0 0 0 178 - -#define TRANSITION_EASE_IN_OUT 0.45 0.03 0.41 1.0 -#define TRANSITION_EASE_OUT 0.25 0.46 0.45 1.0 - -#define IMAGE_FAV_NOR IMAGEDIR"/btn_menu_favorite_nor.png" -#define IMAGE_FAV_FOC IMAGEDIR"/btn_menu_favorite_foc.png" -#define IMAGE_FAV_SEL IMAGEDIR"/btn_menu_favorite_sel.png" -#define IMAGE_FAV_DIS IMAGEDIR"/btn_menu_favorite_dis.png" -#define IMAGE_UNFAV_NOR IMAGEDIR"/btn_menu_remove_favorite_nor.png" -#define IMAGE_UNFAV_FOC IMAGEDIR"/btn_menu_remove_favorite_foc.png" -#define IMAGE_UNFAV_SEL IMAGEDIR"/btn_menu_remove_favorite_sel.png" -#define IMAGE_UNFAV_DIS IMAGEDIR"/btn_menu_remove_favorite_dis.png" -#define IMAGE_LOCK_NOR IMAGEDIR"/btn_menu_lock_nor.png" -#define IMAGE_LOCK_FOC IMAGEDIR"/btn_menu_lock_foc.png" -#define IMAGE_LOCK_SEL IMAGEDIR"/btn_menu_lock_sel.png" -#define IMAGE_LOCK_DIS IMAGEDIR"/btn_menu_lock_dis.png" -#define IMAGE_UNLOCK_NOR IMAGEDIR"/btn_menu_unlock_nor.png" -#define IMAGE_UNLOCK_FOC IMAGEDIR"/btn_menu_unlock_foc.png" -#define IMAGE_UNLOCK_SEL IMAGEDIR"/btn_menu_unlock_sel.png" -#define IMAGE_UNLOCK_DIS IMAGEDIR"/btn_menu_unlock_dis.png" -#define IMAGE_ADD_CH_NOR IMAGEDIR"/btn_menu_add_ch_nor.png" -#define IMAGE_ADD_CH_FOC IMAGEDIR"/btn_menu_add_ch_foc.png" -#define IMAGE_ADD_CH_SEL IMAGEDIR"/btn_menu_add_ch_sel.png" -#define IMAGE_ADD_CH_DIS IMAGEDIR"/btn_menu_add_ch_dis.png" -#define IMAGE_REMOVE_CH_NOR IMAGEDIR"/btn_menu_add_remove_ch_nor.png" -#define IMAGE_REMOVE_CH_FOC IMAGEDIR"/btn_menu_add_remove_ch_foc.png" -#define IMAGE_REMOVE_CH_SEL IMAGEDIR"/btn_menu_add_remove_ch_sel.png" -#define IMAGE_REMOVE_CH_DIS IMAGEDIR"/btn_menu_add_remove_ch_dis.png" -#define IMAGE_FAVORITE_DEFAULT IMAGEDIR"/ic_default_tv.png" - -#define VIEW_CHANNELINFO "VIEW_CHANNELINFO" -#define LAYOUT_CHANNELINFO "LAYOUT_CHANNELINFO" -#define LAYOUT_CHANNELINFO_LIST "LAYOUT_CHANNELINFO_LIST" -#define LAYOUT_CHANNELINFO_SEARCH "LAYOUT_CHANNELINFO_SEARCH" - -#define GRP_VIEW_CHANNELINFO "grp.view.channelinfo" -#define GRP_LAYOUT_CHANNELINFO "grp.lavout.channelinfo.list" -#define GRP_LAYOUT_CHANNELINFO_LIST "grp.layout.channelinfo.list" -#define PART_CHANNELINFO_LIST_NEXT "part.channelinfo.list.next" -#define PART_CHANNELINFO_LIST_CURRENT "part.channelinfo.list.current" -#define PART_CHANNELINFO_LIST_PREV "part.channelinfo.list.prev" -#define GRP_LAYOUT_CHANNELINFO_SEARCH "grp.layout.channelinfo.search" - -#define GRP_CHANNELINFO "grp.channelinfo" -#define GRP_CHANNELINFO_SIMPLE "grp.channelinfo.simple" -#define PART_CHANNELINFO_CHANNEL "part.channelinfo.channel" -#define PART_CHANNELINFO_TITLE "part.channelinfo.title" -#define PART_CHANNELINFO_TIME "part.channelinfo.time" -#define PART_CHANNELINFO_STATUS "part.channelinfo.status" -#define PART_CHANNELINFO_LOCKED "part.channelinfo.locked" -#define PART_CHANNELINFO_FAVORITE "part.channelinfo.favorite" - -#define VIEW_CHANNELNUMBER "VIEW_CHANNELNUMBER" -#define GRP_VIEW_CHANNELNUMBER "grp.view.channelnumber" -#define PART_CHANNELNUMBER_NUMBER "part.channelnumber.number" -#define PART_CHANNELNUMBER_LIST "part.channelnumber.list" -#define GRP_CHANNELNUMBER_LIST_ITEM "grp.channelnumber.list.item" - -#define VIEW_ERROR "VIEW_ERROR" -#define GRP_VIEW_ERROR "grp.view.error" -#define PART_ERROR_TITLE "part.error.title" -#define PART_ERROR_TEXT "part.error.text" - -#define VIEW_ACTION_MENU "VIEW_ACTION_MENU" -#define GRP_VIEW_ACTION_MENU "grp.view.action_menu" -#define PART_CHANNELINFO "part.channelinfo" -#define GRP_ACTION_MENU_TOP "grp.action_menu_top" -#define PART_TOP_BUTTON "part.top.button" -#define PART_MENU "part.menu" -#define GRP_ACTION_MENU_BOTTOM "grp.action_menu_bottom" -#define PART_MORE_BUTTON "part.more.button" -#define GRP_ACTION_MENU_NO_FAVORITE "grp.action_menu_no_favorite" - -#define VIEW_PIN "VIEW_PIN" -#define MESSAGE_SUCCESS "success" -#define MESSAGE_FAIL "fail" +#define VIEW_BGIMAGE "VIEW_BGIMAGE" +#define GRP_VIEW_BGIMAGE "grp.view.bgimage" #endif /* __LIVETV_DEFINE_H__*/ diff --git a/include/layout_channelinfo.h b/include/layout_channelinfo.h deleted file mode 100644 index 5ae049a..0000000 --- a/include/layout_channelinfo.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2015 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 __LAYOUT_CHANNELINFO_H__ -#define __LAYOUT_CHANNELINFO_H__ - -layout_class *layout_channelinfo_get_lclass(void); - -#endif /* __LAYOUT_CHANNELINFO_H__*/ diff --git a/include/layout_channelinfo_list.h b/include/layout_channelinfo_list.h deleted file mode 100644 index 3b7e8ab..0000000 --- a/include/layout_channelinfo_list.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2015 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 __LAYOUT_CHANNELINFO_LIST_H__ -#define __LAYOUT_CHANNELINFO_LIST_H__ - -layout_class *layout_channelinfo_list_get_lclass(void); - -#endif /* __LAYOUT_CHANNELINFO_H__*/ diff --git a/include/layout_channelinfo_search.h b/include/layout_channelinfo_search.h deleted file mode 100644 index f2507c3..0000000 --- a/include/layout_channelinfo_search.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2015 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 __LAYOUT_CHANNELINFO_SEARCH_H__ -#define __LAYOUT_CHANNELINFO_SEARCH_H__ - -layout_class *layout_channelinfo_search_get_lclass(void); - -#endif /* __LAYOUT_CHANNELINFO_SEARCH_H__*/ diff --git a/include/strings.h b/include/strings.h deleted file mode 100644 index 21aba70..0000000 --- a/include/strings.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2015 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 __AIR_LIVETV_STRINGS_H__ -#define __AIR_LIVETV_STRINGS_H__ - -#define STR_NOTITLE "No Information" -#define STR_NOTIME "No Data" -#define STR_CHANNEL_PREFIX "CH." -#define STR_NOCHANNEL_TITLE "No Channel" -#define STR_NOCHANNEL_TEXT "The channel is not found" -#define STR_NOSIGNAL_TITLE "Weak or No Signal" -#define STR_NOSIGNAL_TEXT "Check the antenna cable connection" -#define STR_LIVETV "Live TV" -#define STR_BUTTON_MORE "More" -#define STR_BUTTON_FAVORITE "Favorite" -#define STR_BUTTON_LOCK "Lock" -#define STR_BUTTON_UNLOCK "Unlock" -#define STR_BUTTON_ADD_CHANNEL "Channel" -#define STR_BUTTON_REMOVE_CHANNEL "Channel" -#define STR_NOFAVORITE "No favorite channels" -#define STR_FAVORITE_TOAST "Added to your favorite." -#define STR_UNFAVORITE_TOAST "Removed from your favorite." -#define STR_LOCK_TOAST "Channel is locked." -#define STR_UNLOCK_TOAST "Channel is unlocked." -#define STR_ADD_CHANNEL_TOAST "Added to channel list." -#define STR_REMOVE_CHANNEL_TOAST "Removed from channel list." - -#endif /* __AIR_LIVETV_STRINGS_H__*/ diff --git a/include/tv.h b/include/tv.h deleted file mode 100644 index 1794033..0000000 --- a/include/tv.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014 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 __TV_H__ -#define __TV_H__ - -#include -#include - -#define CHANNEL_NAME_MAX 128 -#define PROG_TITLE_MAX 128 -#define PROG_DESCR_MAX 128 - -#define MAJOR_MAX 135 -#define MINOR_MAX 999 -#define EPG_PROGRAM_OFFSET 25000 - -struct tv_channel_info { - int service_id; - long channel_major; - long channel_minor; - unsigned int channel_type; - - char channel_name[CHANNEL_NAME_MAX]; - time_t start_time; - time_t end_time; - time_t duration; - - int locked; - int digital; - int favorite; - int remembered; - int tune_locked; -}; - -struct tv_program_info { - int service_id; - time_t start_time; - time_t end_time; - time_t duration; - time_t current_time; - char prog_title[PROG_TITLE_MAX]; - char prog_description[PROG_DESCR_MAX]; -}; - -struct tv_program_request { - void (*tv_program_cb)(Eina_List *program_list, void *user_data); - void *user_data; -}; - -int tv_create(void); -int tv_destroy(void); -int tv_pause(void); -int tv_resume(void); - -int tv_overlay_set(void *window_id); - -Eina_List *tv_channel_get_list(void); -Eina_List *tv_channel_get_favorite_list(void); -Eina_List *tv_channel_search_by_number(long major, long minor); -void tv_channel_del_list(Eina_List *channel_list); -int tv_get_current_service_id(int *service_id); -int tv_channel_tune(void); -int tv_channel_tune_prev_channel(void); -int tv_channel_direct_tune(long major, long minor); -int tv_channel_tune_with_service_id(int service_id); -int tv_channel_tune_locked_channel(int service_id, char *password); -int tv_channel_set_favorite(int service_id, Eina_Bool flag); -int tv_channel_add_channel(int service_id); -int tv_channel_del_channel(int service_id); -int tv_channel_lock_channel(int service_id, char *password); -int tv_channel_unlock_channel(int service_id, char *password); -const struct tv_channel_info *tv_channel_get_info(void); -const struct tv_channel_info *tv_channel_clone_info( - const struct tv_channel_info *channel_info); -void tv_channel_del_info(const struct tv_channel_info *channel_info); - -int tv_epg_get_program(int service_id, struct tv_program_request *request); -int tv_epg_get_cache_program(int service_id, - struct tv_program_request *request); -int tv_epg_get_program_list(int service_id, struct tv_program_request *request); - -void tv_signal_cb_set(void (*cb)(void *data, int is_signal), void *data); - -#endif /* __TV_H__ */ diff --git a/include/util.h b/include/util.h deleted file mode 100644 index 66ed9c0..0000000 --- a/include/util.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#include -#include "tv.h" - -#ifndef __UTIL_H__ -#define __UTIL_H__ - -Evas_Object *util_add_layout(Evas_Object *parent, const char *group); -Evas_Object *util_add_box(Evas_Object *parent, bool horizon); -Evas_Object *util_add_scroller(Evas_Object *parent, const char *part); -Evas_Object *util_add_icon(Evas_Object *parent, const char *file, - const char *part); -Evas_Object *util_add_button(Evas_Object *parent, const char *part, - const char *text, const char *style); -Evas_Object *util_add_toast(Evas_Object *parent, char *text); -void util_draw_channel_info(Evas_Object *obj, - const struct tv_channel_info *channel_info); -void util_launch_home(void); - -#endif diff --git a/include/view.h b/include/view.h old mode 100644 new mode 100755 index db1a783..3c4be86 --- a/include/view.h +++ b/include/view.h @@ -17,26 +17,6 @@ #ifndef __LIVETV_VIEW_H__ #define __LIVETV_VIEW_H__ -#include "tv.h" - -enum _update_type { - UPDATE_TYPE_TIMER, - UPDATE_TYPE_INPUT_KEY_DOWN, - UPDATE_TYPE_INPUT_KEY_UP, - UPDATE_TYPE_NOCHANNEL, - UPDATE_TYPE_NOSIGNAL, - UPDATE_TYPE_SHOW_TOAST, -}; - -enum _update_op { - START_HIDE_TIMER, - STOP_HIDE_TIMER -}; - -view_class *view_channelnumber_get_vclass(void); -view_class *view_channelinfo_get_vclass(void); -view_class *view_error_get_vclass(void); -view_class *view_action_menu_get_vclass(void); -view_class *view_pin_get_vclass(void); +view_class *view_bgimage_get_vclass(void); #endif /* __LIVETV_VIEW_H__*/ diff --git a/org.tizen.live-tv.xml.in b/org.tizen.live-tv.xml.in old mode 100644 new mode 100755 index 56d15a7..62e1deb --- a/org.tizen.live-tv.xml.in +++ b/org.tizen.live-tv.xml.in @@ -7,7 +7,4 @@ @DESKTOP_ICON@ - - http://tizen.org/privilege/appmanager.launch - diff --git a/packaging/org.tizen.live-tv.spec b/packaging/org.tizen.live-tv.spec old mode 100644 new mode 100755 index 4ef6481..11a6378 --- a/packaging/org.tizen.live-tv.spec +++ b/packaging/org.tizen.live-tv.spec @@ -10,20 +10,10 @@ Source2: %{name}.path Source3: %{name}.manifest BuildRequires: cmake -BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-ui-efl-util) BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(edje) BuildRequires: pkgconfig(app-utils) -BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(gobject-2.0) -BuildRequires: pkgconfig(tv-service) -BuildRequires: pkgconfig(tzsh-tvsrv) -BuildRequires: pkgconfig(ui-gadget-1) -BuildRequires: gettext-devel -BuildRequires: edje-bin %define _pkgdir %{_prefix}/apps/%{name} %define _bindir %{_pkgdir}/bin diff --git a/res/images/background.jpg b/res/images/background.jpg deleted file mode 100644 index b69f52d..0000000 Binary files a/res/images/background.jpg and /dev/null differ diff --git a/res/images/background.png b/res/images/background.png new file mode 100755 index 0000000..546d3be Binary files /dev/null and b/res/images/background.png differ diff --git a/res/images/btn_menu_add_ch_dis.png b/res/images/btn_menu_add_ch_dis.png deleted file mode 100644 index d2f2052..0000000 Binary files a/res/images/btn_menu_add_ch_dis.png and /dev/null differ diff --git a/res/images/btn_menu_add_ch_foc.png b/res/images/btn_menu_add_ch_foc.png deleted file mode 100644 index 9f59e84..0000000 Binary files a/res/images/btn_menu_add_ch_foc.png and /dev/null differ diff --git a/res/images/btn_menu_add_ch_nor.png b/res/images/btn_menu_add_ch_nor.png deleted file mode 100644 index 3e3e14b..0000000 Binary files a/res/images/btn_menu_add_ch_nor.png and /dev/null differ diff --git a/res/images/btn_menu_add_ch_sel.png b/res/images/btn_menu_add_ch_sel.png deleted file mode 100644 index cdea71b..0000000 Binary files a/res/images/btn_menu_add_ch_sel.png and /dev/null differ diff --git a/res/images/btn_menu_add_remove_ch_dis.png b/res/images/btn_menu_add_remove_ch_dis.png deleted file mode 100644 index b095ef7..0000000 Binary files a/res/images/btn_menu_add_remove_ch_dis.png and /dev/null differ diff --git a/res/images/btn_menu_add_remove_ch_foc.png b/res/images/btn_menu_add_remove_ch_foc.png deleted file mode 100644 index a61de3a..0000000 Binary files a/res/images/btn_menu_add_remove_ch_foc.png and /dev/null differ diff --git a/res/images/btn_menu_add_remove_ch_nor.png b/res/images/btn_menu_add_remove_ch_nor.png deleted file mode 100644 index ec4c147..0000000 Binary files a/res/images/btn_menu_add_remove_ch_nor.png and /dev/null differ diff --git a/res/images/btn_menu_add_remove_ch_sel.png b/res/images/btn_menu_add_remove_ch_sel.png deleted file mode 100644 index 593a830..0000000 Binary files a/res/images/btn_menu_add_remove_ch_sel.png and /dev/null differ diff --git a/res/images/btn_menu_favorite_dis.png b/res/images/btn_menu_favorite_dis.png deleted file mode 100644 index bd9bdd8..0000000 Binary files a/res/images/btn_menu_favorite_dis.png and /dev/null differ diff --git a/res/images/btn_menu_favorite_foc.png b/res/images/btn_menu_favorite_foc.png deleted file mode 100644 index e4915d5..0000000 Binary files a/res/images/btn_menu_favorite_foc.png and /dev/null differ diff --git a/res/images/btn_menu_favorite_nor.png b/res/images/btn_menu_favorite_nor.png deleted file mode 100644 index a472976..0000000 Binary files a/res/images/btn_menu_favorite_nor.png and /dev/null differ diff --git a/res/images/btn_menu_favorite_sel.png b/res/images/btn_menu_favorite_sel.png deleted file mode 100644 index bd2eeee..0000000 Binary files a/res/images/btn_menu_favorite_sel.png and /dev/null differ diff --git a/res/images/btn_menu_lock_dis.png b/res/images/btn_menu_lock_dis.png deleted file mode 100644 index d5827a0..0000000 Binary files a/res/images/btn_menu_lock_dis.png and /dev/null differ diff --git a/res/images/btn_menu_lock_foc.png b/res/images/btn_menu_lock_foc.png deleted file mode 100644 index 5671cfc..0000000 Binary files a/res/images/btn_menu_lock_foc.png and /dev/null differ diff --git a/res/images/btn_menu_lock_nor.png b/res/images/btn_menu_lock_nor.png deleted file mode 100644 index 5f38494..0000000 Binary files a/res/images/btn_menu_lock_nor.png and /dev/null differ diff --git a/res/images/btn_menu_lock_sel.png b/res/images/btn_menu_lock_sel.png deleted file mode 100644 index 1baa790..0000000 Binary files a/res/images/btn_menu_lock_sel.png and /dev/null differ diff --git a/res/images/btn_menu_remove_favorite_dis.png b/res/images/btn_menu_remove_favorite_dis.png deleted file mode 100644 index a85e31f..0000000 Binary files a/res/images/btn_menu_remove_favorite_dis.png and /dev/null differ diff --git a/res/images/btn_menu_remove_favorite_foc.png b/res/images/btn_menu_remove_favorite_foc.png deleted file mode 100644 index 086e864..0000000 Binary files a/res/images/btn_menu_remove_favorite_foc.png and /dev/null differ diff --git a/res/images/btn_menu_remove_favorite_nor.png b/res/images/btn_menu_remove_favorite_nor.png deleted file mode 100644 index fd4a972..0000000 Binary files a/res/images/btn_menu_remove_favorite_nor.png and /dev/null differ diff --git a/res/images/btn_menu_remove_favorite_sel.png b/res/images/btn_menu_remove_favorite_sel.png deleted file mode 100644 index 7a56a9f..0000000 Binary files a/res/images/btn_menu_remove_favorite_sel.png and /dev/null differ diff --git a/res/images/btn_menu_unlock_dis.png b/res/images/btn_menu_unlock_dis.png deleted file mode 100644 index 43dfb60..0000000 Binary files a/res/images/btn_menu_unlock_dis.png and /dev/null differ diff --git a/res/images/btn_menu_unlock_foc.png b/res/images/btn_menu_unlock_foc.png deleted file mode 100644 index 8e35489..0000000 Binary files a/res/images/btn_menu_unlock_foc.png and /dev/null differ diff --git a/res/images/btn_menu_unlock_nor.png b/res/images/btn_menu_unlock_nor.png deleted file mode 100644 index fb89ee9..0000000 Binary files a/res/images/btn_menu_unlock_nor.png and /dev/null differ diff --git a/res/images/btn_menu_unlock_sel.png b/res/images/btn_menu_unlock_sel.png deleted file mode 100644 index b41240a..0000000 Binary files a/res/images/btn_menu_unlock_sel.png and /dev/null differ diff --git a/res/images/btn_navigation_down.png b/res/images/btn_navigation_down.png deleted file mode 100644 index b935681..0000000 Binary files a/res/images/btn_navigation_down.png and /dev/null differ diff --git a/res/images/btn_navigation_up.png b/res/images/btn_navigation_up.png deleted file mode 100644 index f6c1df3..0000000 Binary files a/res/images/btn_navigation_up.png and /dev/null differ diff --git a/res/images/ic_default_tv.png b/res/images/ic_default_tv.png deleted file mode 100644 index 7fc30a1..0000000 Binary files a/res/images/ic_default_tv.png and /dev/null differ diff --git a/res/images/ic_thumbnail_favorite_01.png b/res/images/ic_thumbnail_favorite_01.png deleted file mode 100644 index 6af72f0..0000000 Binary files a/res/images/ic_thumbnail_favorite_01.png and /dev/null differ diff --git a/res/images/ic_thumbnail_lock_01_foc.png b/res/images/ic_thumbnail_lock_01_foc.png deleted file mode 100644 index f7c450d..0000000 Binary files a/res/images/ic_thumbnail_lock_01_foc.png and /dev/null differ diff --git a/res/images/ic_thumbnail_lock_01_nor.png b/res/images/ic_thumbnail_lock_01_nor.png deleted file mode 100644 index dbfc763..0000000 Binary files a/res/images/ic_thumbnail_lock_01_nor.png and /dev/null differ diff --git a/src/layout_channelinfo.c b/src/layout_channelinfo.c deleted file mode 100644 index 83ef39e..0000000 --- a/src/layout_channelinfo.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2014 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. -*/ - -#include -#include -#include -#include -#include - -#include "define.h" -#include "tv.h" -#include "view.h" -#include "util.h" - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev); - -struct _priv { - Evas_Object *base; - Evas_Object *layout; - Evas_Object *channel; - - layoutmgr *lmgr; - const struct tv_channel_info *channel_info; -}; - -static input_handler key_handler = { - .key_down = _key_down_cb, -}; - -static void _update_channel_info(struct _priv *priv) -{ - if (priv->channel_info) { - tv_channel_del_info(priv->channel_info); - priv->channel_info = NULL; - } - - priv->channel_info = tv_channel_get_info(); - if (!priv->channel_info) { - _ERR("failed to get channel info"); - - return; - } - - util_draw_channel_info(priv->channel, priv->channel_info); -} - -static bool _draw_channel_layout(struct _priv *priv) -{ - priv->channel = elm_layout_add(priv->base); - if (!priv->channel) { - _ERR("failed to create channel layout"); - return false; - } - - elm_layout_file_set(priv->channel, EDJEFILE, GRP_CHANNELINFO); - elm_object_content_set(priv->base, priv->channel); - - return true; -} - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_ESC) || - !strcmp(ev->keyname, KEY_EXIT)) - viewmgr_hide_view(VIEW_CHANNELINFO); -} - -static void _hide_finished_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) -{ - struct _priv *priv; - - if (!data) - return; - - priv = data; - - evas_object_hide(priv->base); -} - -static bool _create(layoutmgr *lmgr, void *data) -{ - struct _priv *priv; - Evas_Object *win; - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return false; - } - - win = layoutmgr_get_base(lmgr); - - priv->base = elm_layout_add(win); - if (!priv->base) { - _ERR("failed to create layout"); - free(priv); - - return false; - } - - elm_layout_file_set(priv->base, EDJEFILE, GRP_LAYOUT_CHANNELINFO); - evas_object_size_hint_weight_set(priv->base, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, priv->base); - elm_object_focus_allow_set(priv->base, EINA_TRUE); - - if (!_draw_channel_layout(priv)) { - _ERR("failed to create channel layout"); - - evas_object_del(priv->base); - free(priv); - - return false; - } - - inputmgr_add_callback(priv->base, 0, &key_handler, priv); - elm_layout_signal_callback_add(priv->base, SIGNAL_HIDE_FINISHED, - SOURCE_ELM, _hide_finished_cb, priv); - layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO, priv); - - priv->lmgr = lmgr; - - return true; -} - -static void _destroy(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - if (priv->channel_info) { - tv_channel_del_info(priv->channel_info); - priv->channel_info = NULL; - } - - elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED, - SOURCE_ELM, _hide_finished_cb); - - evas_object_del(priv->base); - free(priv); -} - -static void _show(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - _update_channel_info(priv); - - evas_object_show(priv->base); - - elm_object_focus_set(priv->base, EINA_TRUE); -} - -static void _hide(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - elm_layout_signal_emit(priv->base, SIGNAL_HIDE, SOURCE_ELM); -} - -static void _update(void *layout_data, int update_type, void *data) -{ -} - -static layout_class lclass = { - .layout_id = LAYOUT_CHANNELINFO, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, - .update = _update, -}; - -layout_class *layout_channelinfo_get_lclass(void) -{ - return &lclass; -} diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c deleted file mode 100644 index be1e03b..0000000 --- a/src/layout_channelinfo_list.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) 2014 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. -*/ - -#include -#include -#include -#include -#include - -#include "define.h" -#include "util.h" -#include "tv.h" -#include "view.h" - -#define TUNE_WAIT_TIME 0.1 -#define CHANNEL_PADDING_X 0 -#define CHANNEL_PADDING_Y 5 - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev); - -enum _order { - CHANNEL_NEXT, - CHANNEL_PREV -}; - -struct _priv { - Evas_Object *base; - Evas_Object *prev_channel; - Evas_Object *current_channel; - Evas_Object *next_channel; - Ecore_Timer *tune_timer; - - const struct tv_channel_info *channel_info; - layoutmgr *lmgr; -}; - -static input_handler key_handler = { - .key_down = _key_down_cb, -}; - -static int _set_next_channel(struct _priv *priv, int order) -{ - const struct tv_channel_info *next, *current, *channel; - Eina_List *channel_list, *l; - - if (priv->channel_info) - current = priv->channel_info; - else { - current = tv_channel_get_info(); - if (!current) { - _ERR("failed to get channel info"); - - return -1; - } - - priv->channel_info = current; - } - - channel_list = tv_channel_get_list(); - if (!channel_list) { - _ERR("failed to get channel list"); - return -1; - } - - if (order == CHANNEL_PREV) - channel_list = eina_list_reverse(channel_list); - - next = NULL; - EINA_LIST_FOREACH(channel_list, l, channel) { - if (channel->service_id == current->service_id) { - next = eina_list_data_get(eina_list_next(l)); - break; - } - } - - if (!next) - next = eina_list_data_get(channel_list); - - priv->channel_info = tv_channel_clone_info(next); - - tv_channel_del_info(current); - tv_channel_del_list(channel_list); - - return 0; -} - -static bool _get_next_channel( - const struct tv_channel_info *current, - const struct tv_channel_info **prev, - const struct tv_channel_info **next) -{ - const struct tv_channel_info *channel; - Eina_List *channel_list, *l; - - if (!current) { - _ERR("failed to get current channel"); - - return false; - } - - channel_list = tv_channel_get_list(); - if (!channel_list) { - _ERR("failed to get channel list"); - - return false; - } - - *prev = NULL; - *next = NULL; - EINA_LIST_FOREACH(channel_list, l, channel) { - if (channel->service_id == current->service_id) { - *prev = eina_list_data_get(eina_list_prev(l)); - *next = eina_list_data_get(eina_list_next(l)); - break; - } - } - - if (!*prev) - *prev = eina_list_data_get(eina_list_last(channel_list)); - - if (!*next) - *next = eina_list_data_get(channel_list); - - *prev = tv_channel_clone_info(*prev); - *next = tv_channel_clone_info(*next); - - tv_channel_del_list(channel_list); - - return true; -} - -static void _draw_channel_info(Evas_Object *box, - const struct tv_channel_info *current, char *grp) -{ - const struct tv_channel_info *prev, *next; - Evas_Object *layout; - - if (!current) { - _ERR("failed to get current channel"); - - return; - } - - prev = NULL; - next = NULL; - if (!_get_next_channel(current, &prev, &next) || - !prev || !next) { - _ERR("failed to get next channel"); - - goto err; - } - - elm_box_clear(box); - - layout = util_add_layout(box, grp); - util_draw_channel_info(layout, next); - elm_box_pack_end(box, layout); - - layout = util_add_layout(box, grp); - util_draw_channel_info(layout, current); - elm_box_pack_end(box, layout); - - layout = util_add_layout(box, grp); - util_draw_channel_info(layout, prev); - elm_box_pack_end(box, layout); - -err: - tv_channel_del_info(prev); - tv_channel_del_info(next); -} - -static void _update_channel_info(struct _priv *priv) -{ - const struct tv_channel_info *prev, *current, *next; - - if (priv->channel_info) - current = priv->channel_info; - else { - current = tv_channel_get_info(); - if (!current) { - _ERR("failed to get channel info"); - - return; - } - - priv->channel_info = current; - } - - if (!_get_next_channel(current, &prev, &next)) { - _ERR("failed to get next channel"); - - return; - } - - _draw_channel_info(priv->prev_channel, prev, GRP_CHANNELINFO_SIMPLE); - _draw_channel_info(priv->current_channel, current, GRP_CHANNELINFO); - _draw_channel_info(priv->next_channel, next, GRP_CHANNELINFO_SIMPLE); - - if (prev) - tv_channel_del_info(prev); - - if (next) - tv_channel_del_info(next); -} - -static bool _draw_channel_layout(struct _priv *priv) -{ - priv->next_channel = util_add_box(priv->base, EINA_FALSE); - if (!priv->next_channel) - return false; - elm_box_padding_set(priv->next_channel, - ELM_SCALE_SIZE(CHANNEL_PADDING_X), - ELM_SCALE_SIZE(CHANNEL_PADDING_Y)); - elm_object_part_content_set(priv->base, - PART_CHANNELINFO_LIST_NEXT, priv->next_channel); - - priv->current_channel = util_add_box(priv->base, EINA_FALSE); - if (!priv->current_channel) - return false; - elm_object_part_content_set(priv->base, - PART_CHANNELINFO_LIST_CURRENT, priv->current_channel); - - - priv->prev_channel = util_add_box(priv->base, EINA_FALSE); - if (!priv->prev_channel) - return false; - elm_box_padding_set(priv->prev_channel, - ELM_SCALE_SIZE(CHANNEL_PADDING_X), - ELM_SCALE_SIZE(CHANNEL_PADDING_Y)); - elm_object_part_content_set(priv->base, - PART_CHANNELINFO_LIST_PREV, priv->prev_channel); - - return true; -} - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_ESC) || - !strcmp(ev->keyname, KEY_EXIT)) { - viewmgr_hide_view(VIEW_CHANNELINFO); - } -} - -static void _hide_finished_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) -{ - struct _priv *priv; - - if (!data) - return; - - priv = data; - - evas_object_hide(priv->base); -} - -Eina_Bool _tune_timer(void *data) -{ - struct _priv *priv; - - if (!data) - return ECORE_CALLBACK_CANCEL; - - priv = data; - - tv_channel_tune_with_service_id( - priv->channel_info->service_id); - - priv->tune_timer = NULL; - - return ECORE_CALLBACK_CANCEL; -} - -static void _anim_finished_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) -{ - struct _priv *priv; - - if (!data) - return; - - priv = data; - - if (priv->tune_timer) - ecore_timer_reset(priv->tune_timer); - else - priv->tune_timer = ecore_timer_add(TUNE_WAIT_TIME, - _tune_timer, priv); -} - -static bool _create(layoutmgr *lmgr, void *data) -{ - struct _priv *priv; - Evas_Object *win; - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return false; - } - - win = layoutmgr_get_base(lmgr); - - priv->base = elm_layout_add(win); - if (!priv->base) { - _ERR("failed to create base layout"); - free(priv); - - return false; - } - - elm_layout_file_set(priv->base, EDJEFILE, GRP_LAYOUT_CHANNELINFO_LIST); - - evas_object_size_hint_weight_set(priv->base, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, priv->base); - elm_object_focus_allow_set(priv->base, EINA_TRUE); - - if (!_draw_channel_layout(priv)) { - _ERR("failed to create channel layout"); - - evas_object_del(priv->base); - free(priv); - - return false; - } - - priv->lmgr = lmgr; - layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_LIST, priv); - - inputmgr_add_callback(priv->base, 0, &key_handler, priv); - elm_layout_signal_callback_add(priv->base, SIGNAL_HIDE_FINISHED, - SOURCE_ELM, _hide_finished_cb, priv); - elm_layout_signal_callback_add(priv->base, SIGNAL_ANIM_FINISHED, - SOURCE_ELM, _anim_finished_cb, priv); - - return true; -} - -static void _destroy(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - if (priv->channel_info) - tv_channel_del_info(priv->channel_info); - - if (priv->tune_timer) - ecore_timer_del(priv->tune_timer); - - elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED, - SOURCE_ELM, _hide_finished_cb); - elm_layout_signal_callback_del(priv->base, SIGNAL_ANIM_FINISHED, - SOURCE_ELM, _anim_finished_cb); - - evas_object_del(priv->base); - free(priv); -} - -static void _show(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - evas_object_show(priv->base); - - elm_object_focus_set(priv->base, EINA_TRUE); -} - -static void _hide(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - if (priv->channel_info) { - tv_channel_del_info(priv->channel_info); - priv->channel_info = NULL; - } - - elm_layout_signal_emit(priv->base, SIGNAL_HIDE, SOURCE_ELM); -} - -static void _update(void *layout_data, int type, void *data) -{ - struct _priv *priv; - int r; - - if (!layout_data) { - _ERR("failed to get layout_data and ev"); - return; - } - - priv = layout_data; - - if (type == UPDATE_TYPE_INPUT_KEY_DOWN) { - Evas_Event_Key_Down *ev = data; - - if (!ev) { - _ERR("failed to get ev"); - return; - } - - if (!strcmp(ev->keyname, KEY_CHANNELUP)) { - _update_channel_info(priv); - - elm_object_signal_emit(priv->base, - SIGNAL_ANIM_MOVE_UP, SOURCE_PROGRAM); - - r = _set_next_channel(priv, CHANNEL_NEXT); - if (r < 0) - _ERR("failed to set next channel"); - } else if (!strcmp(ev->keyname, KEY_CHANNELDOWN)) { - _update_channel_info(priv); - - elm_object_signal_emit(priv->base, - SIGNAL_ANIM_MOVE_DOWN, SOURCE_PROGRAM); - - r = _set_next_channel(priv, CHANNEL_PREV); - if (r < 0) - _ERR("failed to set prev channel"); - } - } -} - -static layout_class lclass = { - .layout_id = LAYOUT_CHANNELINFO_LIST, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, - .update = _update, -}; - -layout_class *layout_channelinfo_list_get_lclass(void) -{ - return &lclass; -} diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c deleted file mode 100644 index cf0a97f..0000000 --- a/src/layout_channelinfo_search.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2014 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. -*/ - -#include -#include -#include -#include -#include - -#include "define.h" -#include "util.h" -#include "tv.h" -#include "view.h" - -#define DIVIDER_WIDTH 536 -#define DIVIDER_HEIGHT 1 -#define DIVIDER_COLOR_R 154 -#define DIVIDER_COLOR_G 154 -#define DIVIDER_COLOR_B 154 -#define DIVIDER_COLOR_A 255 - -struct _priv { - Evas_Object *base; - Evas_Object *scroll; - Evas_Object *box; - - layoutmgr *lmgr; -}; - -static void _tune_channel(void *data) -{ - int service_id; - int r; - - if (!data) { - _ERR("failed to get data"); - return; - } - - service_id = (int) data; - if (service_id < 0) { - _ERR("failed to get service id"); - return; - } - - r = tv_channel_tune_with_service_id(service_id); - if (r < 0) - _ERR("failed to tune with service id"); - - viewmgr_hide_view(VIEW_CHANNELINFO); -} - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - int op; - - if (!strcmp(ev->keyname, KEY_ENTER)) { - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - - _tune_channel(data); - } else if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_ESC) || - !strcmp(ev->keyname, KEY_EXIT)) { - viewmgr_hide_view(VIEW_CHANNELINFO); - } else if (!strcmp(ev->keyname, KEY_UP) || - !strcmp(ev->keyname, KEY_DOWN)) { - op = START_HIDE_TIMER; - viewmgr_update_view(VIEW_CHANNELINFO, - UPDATE_TYPE_TIMER, &op); - } -} - -static void _mouse_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Down *ev) -{ - _tune_channel(data); -} - -static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Move *ev) -{ - int op; - - op = START_HIDE_TIMER; - viewmgr_update_view(VIEW_CHANNELINFO, - UPDATE_TYPE_TIMER, &op); -} - -static input_handler channel_handler = { - .key_down = _key_down_cb, - .mouse_down = _mouse_down_cb, - .mouse_move = _mouse_move_cb, -}; - -static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) -{ - Evas_Object *ly, *divider, *first; - Evas *e; - Eina_List *l; - const struct tv_channel_info *channel_info; - int r; - int current_service; - - r = tv_get_current_service_id(¤t_service); - if (r < 0) - current_service = -1; - - e = evas_object_evas_get(priv->base); - - divider = evas_object_rectangle_add(e); - evas_object_color_set(divider, DIVIDER_COLOR_R, - DIVIDER_COLOR_G, DIVIDER_COLOR_B, DIVIDER_COLOR_A); - evas_object_size_hint_min_set(divider, - ELM_SCALE_SIZE(DIVIDER_WIDTH), - ELM_SCALE_SIZE(DIVIDER_HEIGHT)); - evas_object_show(divider); - - elm_box_clear(priv->box); - - first = NULL; - ly = NULL; - EINA_LIST_FOREACH(channel_list, l, channel_info) { - if (!channel_info->remembered) - continue; - - ly = util_add_layout(priv->box, GRP_CHANNELINFO); - if (!ly) - continue; - elm_object_focus_allow_set(ly, EINA_TRUE); - util_draw_channel_info(ly, channel_info); - elm_box_pack_end(priv->box, ly); - - inputmgr_add_callback(ly, 0, &channel_handler, - (void *) channel_info->service_id); - - if (eina_list_next(l)) - elm_box_pack_end(priv->box, divider); - - if (channel_info->service_id == current_service) - elm_object_focus_set(ly, EINA_TRUE); - - if (!first) - first = ly; - } - - if (first && ly) { - elm_object_focus_next_object_set(first, ly, ELM_FOCUS_UP); - elm_object_focus_next_object_set(ly, first, ELM_FOCUS_DOWN); - } -} - -static bool _draw_channel_layout(struct _priv *priv) -{ - priv->scroll = util_add_scroller(priv->base, NULL); - if (!priv->scroll) { - _ERR("failed to create scroll"); - return false; - } - - priv->box = util_add_box(priv->scroll, false); - if (!priv->box) { - _ERR("failed to create box"); - evas_object_del(priv->scroll); - - return false; - } - elm_box_align_set(priv->box, 0.0, 0.5); - - return true; -} - -static void _update_channel_list(struct _priv *priv) -{ - Eina_List *channel_list; - - if (!priv) { - _ERR("failed to get priv"); - return; - } - - channel_list = tv_channel_get_list(); - if (!channel_list) { - _ERR("failed to get channel list"); - return; - } - - _load_channel_list(priv, channel_list); - - tv_channel_del_list(channel_list); -} - -static bool _create(layoutmgr *lmgr, void *data) -{ - struct _priv *priv; - Evas_Object *win; - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return false; - } - - win = layoutmgr_get_base(lmgr); - - priv->base = elm_layout_add(win); - if (!priv->base) { - _ERR("failed to create layout"); - free(priv); - - return false; - } - - elm_layout_file_set(priv->base, EDJEFILE, - GRP_LAYOUT_CHANNELINFO_SEARCH); - evas_object_size_hint_weight_set(priv->base, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, priv->base); - - if (!_draw_channel_layout(priv)) { - _ERR("failed to create channel layout"); - - evas_object_del(priv->base); - free(priv); - - return false; - } - - priv->lmgr = lmgr; - layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_SEARCH, priv); - - return true; -} - -static void _destroy(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - evas_object_del(priv->base); - free(priv); -} - -static void _show(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - _update_channel_list(priv); - - evas_object_show(priv->base); -} - -static void _hide(void *layout_data) -{ - struct _priv *priv; - - if (!layout_data) - return; - - priv = layout_data; - - evas_object_hide(priv->base); -} - -static void _update(void *layout_data, int update_type, void *data) -{ -} - -static layout_class lclass = { - .layout_id = LAYOUT_CHANNELINFO_SEARCH, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, - .update = _update, -}; - -layout_class *layout_channelinfo_search_get_lclass(void) -{ - return &lclass; -} diff --git a/src/main.c b/src/main.c old mode 100644 new mode 100755 index 6df8345..d74bc47 --- a/src/main.c +++ b/src/main.c @@ -17,121 +17,20 @@ #include #include #include -#include #include #include -#include #include -#include #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)); diff --git a/src/tv.c b/src/tv.c deleted file mode 100644 index cfd92dc..0000000 --- a/src/tv.c +++ /dev/null @@ -1,1169 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "define.h" -#include "tv.h" - -#define DEFAULT_SERVICE 1 - -struct _channel_history { - int service_id[2]; - unsigned int idx; -}; - -/** - * The Storage structure to used by tv related functions and events. - */ -struct _tv_info { - /**< The handle to use tv service live api. */ - TvServiceLive live_svc; - /**< The handle to use tv service epg api. */ - TvServiceEpg epg_svc; - - /**< Stores service id if tune to locked channel was succeeded. */ - int viewing_locked_channel; - /**< Stores previous service id. */ - struct _channel_history history; - - /**< The function pointer to pass tv signal event */ - void (*signal_cb)(void *data, int is_signal); - /**< An Additional data to passed to tv signal event */ - void *signal_cb_data; -}; - -static struct _tv_info g_tv_info; - -/** - * Gets the tv_channel_info with supplied TvServiceChannel. - * - * Abstracts tv service data structure. - * - * @param channel The channel data defined by tv service - * @return Channel information, or NULL if fails - */ -static struct tv_channel_info *_tv_channel_get_info(TvServiceChannel *channel) -{ - struct tv_channel_info *channel_info = NULL; - - if (!channel) { - _ERR("failed to get channel"); - return NULL; - } - - channel_info = calloc(1, sizeof(*channel_info)); - if (!channel_info) { - _ERR("failed to calloc channel info"); - return NULL; - } - - channel_info->service_id = channel->service_id; - channel_info->channel_major = channel->major; - channel_info->channel_minor = channel->minor; - channel_info->channel_type = channel->channel_type; - channel_info->locked = channel->locked; - channel_info->digital = channel->digital; - channel_info->favorite = channel->favorite; - channel_info->remembered = channel->remembered; - strncpy(channel_info->channel_name, channel->program_name, - CHANNEL_NAME_MAX); - - if (channel->service_id == g_tv_info.viewing_locked_channel) - channel_info->tune_locked = EINA_TRUE; - - return channel_info; -} - -/** - * Clones the tv_channel_info. - * - * @param channel_info tv_channel_info pointer to be cloned - * @return Channel information, or NULL if fails - */ -const struct tv_channel_info *tv_channel_clone_info( - const struct tv_channel_info *channel_info) -{ - struct tv_channel_info *new_channel_info = NULL; - - if (!channel_info) { - _ERR("failed to get channel info"); - return NULL; - } - - new_channel_info = calloc(1, sizeof(*channel_info)); - if (!new_channel_info) { - _ERR("failed to calloc channel info"); - return NULL; - } - - memcpy(new_channel_info, channel_info, sizeof(*new_channel_info)); - - return new_channel_info; -} - -/** - * Frees the tv_channel_info. - * - * @param channel_info tv_channel_info pointer to be freed - */ -void tv_channel_del_info(const struct tv_channel_info *channel_info) -{ - if (!channel_info) { - _ERR("failed to get channel info"); - return; - } - - free((void *)channel_info); -} - -/** - * Gets current channel's TvServiceChannel data from tv service. - * - * @param channel The pointer to store TvServiceChannel - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -static int _tv_get_channel(TvServiceChannel *channel) -{ - gint svc_id; - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - r = tv_service_live_get_service_id(g_tv_info.live_svc, &svc_id); - if (r < 0) { - _ERR("failed to get service id"); - return -1; - } - - r = tv_service_get_channel(svc_id, channel); - if (r < 0) { - _ERR("failed to get channel"); - return -1; - } - - return 0; -} - -/** - * Returns current channel's info. - * - * tv_channel_get_info retrieves current channel's information - * from tv service. - * - * @return Returns current channel info, or NULL if fails - */ -const struct tv_channel_info *tv_channel_get_info(void) -{ - const struct tv_channel_info *channel_info; - TvServiceChannel channel; - int r; - - r = _tv_get_channel(&channel); - if (r < 0) { - _ERR("failed to get channel"); - return NULL; - } - - channel_info = _tv_channel_get_info(&channel); - - return channel_info; -} - -/** - * Returns tv_program_info with supplied TvServiceEpgEventData. - * - * Abstracts tv service data structure. - * - * @param prog TvServiceEpgEventData passed from tv service - * @return Returns tv_program_info, or NULL if fails - */ -static struct tv_program_info *_tv_get_program_info(TvServiceEpgEventData *prog) -{ - struct tv_program_info *prog_info; - - prog_info = calloc(1, sizeof(*prog_info)); - if (!prog_info) { - _ERR("failed to calloc program info"); - return NULL; - } - - prog_info->service_id = prog->service_id; - prog_info->start_time = prog->start_time; - prog_info->end_time = prog->start_time + prog->length_in_seconds; - prog_info->duration = prog->length_in_seconds; - prog_info->current_time = prog->current_time; - strncpy(prog_info->prog_title, (char *)prog->title_text, - sizeof(prog_info->prog_title) - 1); - strncpy(prog_info->prog_description, (char *)prog->extended_text, - sizeof(prog_info->prog_description) - 1); - - return prog_info; -} - -/** - * Gets current channel's service id from tv service. - * - * @param service_id The pointer to store service id - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_get_current_service_id(int *service_id) -{ - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - r = tv_service_live_get_service_id(g_tv_info.live_svc, service_id); - if (r != TVS_ERROR_OK) { - _ERR("failed to get current service info"); - return -1; - } - - return 0; -} - -/** - * Frees epg list. - * - * @param epg_list Eina_List to be freed - */ -static void _tv_epg_del_list(Eina_List *epg_list) -{ - struct tv_program_info *data; - - EINA_LIST_FREE(epg_list, data) - free(data); -} - -/** - * Callback function to get EPG program list from tv service. - * - * _tv_epg_event_cb is called from tv service when banner - * have requested to get program data. - * If this function is called, then derives program list from epg_list - * and calls banner's callback function which included in user_data. - * - * @param type Event type - * @param epg_list EPG program list - * @param user_data tv_program_request to handle request - */ -static void _tv_epg_event_cb(tvs_epg_event_e type, GList *epg_list, - void *user_data) -{ - int i; - Eina_List *list = NULL; - TvServiceEpgEventData *epg_data; - struct tv_program_info *prog_info; - struct tv_program_request *request; - - if (!user_data) { - _ERR("failed to get user_data"); - return; - } - - for (i = 0; i < g_list_length(epg_list); i++) { - epg_data = (TvServiceEpgEventData *) - g_list_nth_data(epg_list, i); - - if (!epg_data) - continue; - - prog_info = _tv_get_program_info(epg_data); - if (prog_info) - list = eina_list_append(list, prog_info); - } - - request = (struct tv_program_request *) user_data; - if (request->tv_program_cb) - request->tv_program_cb(list, request->user_data); - - if (list) - _tv_epg_del_list(list); - - free(request); -} - -/** - * Send a request to tv service to get a current program with supplied service_id. - * - * Beware that service_id should be current tuned channel. - * If not, calling this function may cause unexpected behavior. - * And note that get a EPG program is asynchronous operation. - * So tv_program_request should be supplied to get a result from tv service. - * - * @param service_id The channel id to get current program - * @param request The structure for return program data which contains function pointer - * and additional data for banner - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_epg_get_program(int service_id, struct tv_program_request *request) -{ - int r; - - if (!g_tv_info.epg_svc) { - _ERR("failed to get epg service"); - return -1; - } - - if (!request) { - _ERR("failed to get tv_program_request"); - return -1; - } - - r = tv_service_epg_get_current_program(g_tv_info.epg_svc, service_id, - (TvServiceEpgCallback) _tv_epg_event_cb, request); - if (r != TVS_ERROR_OK) { - _ERR("failed to get epg get current program : %d", service_id); - return -1; - } - - return 0; -} - -/** - * Gets a cached current program with supplied service_id from tv service. - * - * Note that this function is vaild only when tv service having a cached data - * on that channel. - * To have a cached data, the channel ever been tuned before calling - * this function. - * - * @param service_id The channel id to get current program - * @param request The structure for return program data which contains - * function pointer and additional data for banner - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_epg_get_cache_program(int service_id, struct tv_program_request *request) -{ - Eina_List *list = NULL; - TvServiceEpgEventData epg_data; - struct tv_program_info *prog_info; - - int r; - - if (!g_tv_info.epg_svc) { - _ERR("failed to get epg service"); - return -1; - } - - if (!request) { - _ERR("failed to get tv_program_request"); - return -1; - } - - r = tv_service_epg_get_cache_current_program( - g_tv_info.epg_svc, service_id, &epg_data); - if (r != TVS_ERROR_OK) { - _ERR("failed to get epg get cached current program : %d", - service_id); - return -1; - } - - prog_info = _tv_get_program_info(&epg_data); - if (prog_info) - list = eina_list_append(list, prog_info); - - if (request->tv_program_cb) - request->tv_program_cb(list, request->user_data); - - if (list) - _tv_epg_del_list(list); - - free(request); - - return 0; -} - -/** - * Sends a request to tv service to get programs with supplied service_id. - * - * Beware that service_id should be current tuned channel. - * If not, calling this function may cause unexpected behavior. - * And note that get a EPG program is asynchronous operation. - * So tv_program_request should be supplied to get a result from tv service. - * - * @param service_id The channel id to get current program - * @param request The structure for return program data which contains function pointer and additional data for banner - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_epg_get_program_list(int service_id, - struct tv_program_request *request) -{ - int r; - - if (!g_tv_info.epg_svc) { - _ERR("failed to get epg service"); - return -1; - } - - if (!request) { - _ERR("failed to get tv_program_request"); - return -1; - } - - r = tv_service_epg_get_program_list(g_tv_info.epg_svc, service_id, - TVS_EPG_CURRENT_TIME, EPG_PROGRAM_OFFSET, - (TvServiceEpgCallback) _tv_epg_event_cb, request); - if (r != TVS_ERROR_OK) { - _ERR("failed to get epg get current program"); - return -1; - } - - return 0; -} - -/** - * Frees the TvServiceFilterNode. - * - * @param data TvServiceFilterNode pointer to be freed - */ -static void _tv_channel_free_filter(gpointer data) -{ - TvServiceFilterNode *filter_node; - - if (!data) - return; - - filter_node = (TvServiceFilterNode *) data; - - g_value_unset(filter_node->value); - g_free(filter_node->value); - g_free(filter_node); -} - -/** - * Gets a available channel list. - * - * Note that deleted channels and service channels are excluded by default. - * - * @return Available channel list, or NULL if fails - */ -Eina_List *tv_channel_get_list() -{ - GList *tvs_list = NULL; - Eina_List *channel_list = NULL; - TvServiceChannel *tvs_data = NULL; - const struct tv_channel_info *channel_info; - int r, i; - - r = tv_service_get_channel_list( - TV_SERVICE_CHANNEL_MODE_DIGITAL_ANALOG, - TV_SERVICE_ANTENNA_TYPE_ALL, &tvs_list); - if (r != TVS_ERROR_OK) { - _ERR("failed to get channel list"); - return NULL; - } - - for (i = 0; i < g_list_length(tvs_list); i++) { - tvs_data = (TvServiceChannel *) g_list_nth_data(tvs_list, i); - if (tvs_data) { - channel_info = _tv_channel_get_info(tvs_data); - if (channel_info) - channel_list = eina_list_append(channel_list, - channel_info); - } - } - - tv_service_free_channel_list(tvs_list); - - return channel_list; -} - -/** - * Gets a favorite channel list. - * - * @return Favorite channel list, or NULL if fails - */ -Eina_List *tv_channel_get_favorite_list() -{ - GList *tvs_list = NULL; - Eina_List *channel_list = NULL; - TvServiceChannel *tvs_data = NULL; - const struct tv_channel_info *channel_info; - int r, i; - - r = tv_service_get_channel_list( - TV_SERVICE_CHANNEL_MODE_FAVORITE, - TV_SERVICE_ANTENNA_TYPE_ALL, &tvs_list); - if (r != TVS_ERROR_OK) { - _ERR("failed to get channel list"); - return NULL; - } - - for (i = 0; i < g_list_length(tvs_list); i++) { - tvs_data = (TvServiceChannel *) g_list_nth_data(tvs_list, i); - if (tvs_data) { - channel_info = _tv_channel_get_info(tvs_data); - if (channel_info) - channel_list = eina_list_append(channel_list, - channel_info); - } - } - - tv_service_free_channel_list(tvs_list); - - return channel_list; -} - -TvServiceFilterNode *_tv_channel_get_filter( - TvServiceChannelDataAttr attribute, int type, void *data) -{ - TvServiceFilterNode *filter; - GValue *value; - - filter = g_malloc0(sizeof(*filter)); - if (!filter) - return NULL; - - filter->attribute = attribute; - - value = g_malloc0(sizeof(GValue)); - if (!value) { - g_free(filter); - return NULL; - } - - switch (type) { - case G_TYPE_STRING: - g_value_init(value, G_TYPE_STRING); - g_value_set_string(value, data); - - filter->match_type = CHANNEL_FILTER_MATCH_CONTAIN; - break; - case G_TYPE_INT: - g_value_init(value, G_TYPE_INT); - g_value_set_int(value, (gint) data); - - filter->match_type = CHANNEL_FILTER_MATCH_EQUAL; - break; - } - filter->value = value; - - return filter; -} - -/** - * Search channels that are starts with supplied major and minor number. - * - * Note that deleted channels and service channels are excluded by default. - * - * @param major Major channel number to search - * @param minor Minor channel number to search - * @return Found channel list, or NULL if fails - */ -Eina_List *tv_channel_search_by_number(long major, long minor) -{ - char buf[CHANNEL_FILTER_STRING_MAX_LEN]; - GList *tvs_list = NULL, *filter = NULL; - TvServiceFilterNode *filter_node; - TvServiceChannel *tvs_data; - Eina_List *channel_list = NULL; - const struct tv_channel_info *channel_info; - int i, r; - - if (major > 0 && major < MAJOR_MAX) { - snprintf(buf, CHANNEL_FILTER_STRING_MAX_LEN, "%ld", major); - - filter_node = _tv_channel_get_filter( - TV_SERVICE_CHANNEL_DATA_MAJOR_NUMBER, - G_TYPE_STRING, buf); - if (filter_node) - filter = g_list_append(filter, (gpointer)filter_node); - } - - if (minor > 0 && minor < MINOR_MAX) { - snprintf(buf, CHANNEL_FILTER_STRING_MAX_LEN, "%ld", minor); - - filter_node = _tv_channel_get_filter( - TV_SERVICE_CHANNEL_DATA_MINOR_NUMBER, - G_TYPE_STRING, buf); - if (filter_node) - filter = g_list_append(filter, (gpointer)filter_node); - } - - if (!filter) { - _ERR("failed to get filter"); - return NULL; - } - - r = tv_service_get_channel_list_ex( - TV_SERVICE_CHANNEL_MODE_ALL_DIGITAL_ANALOG, - TV_SERVICE_ANTENNA_TYPE_ALL, &tvs_list, filter, 0); - if (r != TVS_ERROR_OK) { - _ERR("failed to get channel list"); - goto free; - } - - for (i = 0; i < g_list_length(tvs_list); i++) { - tvs_data = (TvServiceChannel *) g_list_nth_data(tvs_list, i); - if (!tvs_data) - continue; - - channel_info = _tv_channel_get_info(tvs_data); - if (channel_info) - channel_list = eina_list_append(channel_list, - channel_info); - } - -free: - tv_service_free_channel_list(tvs_list); - - g_list_foreach(filter, (GFunc) _tv_channel_free_filter, NULL); - g_list_free(filter); - - return channel_list; -} - -/** - * Frees the tv_channel_info. - * - * @param channel_list channel_list pointer to be freed - */ -void tv_channel_del_list(Eina_List *channel_list) -{ - struct tv_channel_info *data; - - EINA_LIST_FREE(channel_list, data) - free(data); -} - -static void _tv_channel_add_history(int service_id) -{ - char buf[128]; - - g_tv_info.history.service_id[g_tv_info.history.idx++ % 2] - = service_id; - - snprintf(buf, sizeof(buf), "%d", service_id); - app_contents_recent_add(CONTENTS_CHANNEL, buf); -} - -static int _tv_channel_get_history(void) -{ - int service_id; - - service_id = g_tv_info.history.service_id[g_tv_info.history.idx % 2]; - - return service_id; -} - -/** - * Tunes to specific channel with service id. - * - * @param service_id The channel id - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_tune_with_service_id(int service_id) -{ - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - r = tv_service_live_tune(g_tv_info.live_svc, service_id); - if (r != TVS_ERROR_OK) { - _ERR("failed to set service"); - return -1; - } - - _tv_channel_add_history(service_id); - - g_tv_info.viewing_locked_channel = -1; - - return 0; -} - -/** - * Tunes to last viewed channel. - * - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_tune(void) -{ - int service_id; - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - r = tv_service_live_get_last_channel(&service_id); - if (r < 0 || service_id < 1) { - _ERR("failed to get current service id"); - service_id = DEFAULT_SERVICE; - } - - r = tv_service_live_tune(g_tv_info.live_svc, service_id); - if (r != TVS_ERROR_OK) { - _ERR("failed to set service"); - return -1; - } - - _tv_channel_add_history(service_id); - - g_tv_info.viewing_locked_channel = -1; - - return 0; -} - -/** - * Tunes to previously viewed channel. - * - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_tune_prev_channel(void) -{ - int service_id; - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - service_id = _tv_channel_get_history(); - if (service_id < 1) { - _ERR("no previous channel"); - return -1; - } - - r = tv_service_live_tune(g_tv_info.live_svc, service_id); - if (r != TVS_ERROR_OK) { - _ERR("failed to set service"); - return -1; - } - - _tv_channel_add_history(service_id); - - g_tv_info.viewing_locked_channel = -1; - - return 0; -} - -/** - * Tunes to specific channel with major and minor. - * - * @param service_id The channel id - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_direct_tune(long major, long minor) -{ - GList *tvs_list = NULL, *filter = NULL; - TvServiceFilterNode *filter_node; - TvServiceChannel *tvs_data; - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - if (major > 0 && major < MAJOR_MAX) { - filter_node = _tv_channel_get_filter( - TV_SERVICE_CHANNEL_DATA_MAJOR_NUMBER, - G_TYPE_INT, (void *) major); - if (filter_node) - filter = g_list_append(filter, (gpointer)filter_node); - } - - if (minor > 0 && minor < MINOR_MAX) { - filter_node = _tv_channel_get_filter( - TV_SERVICE_CHANNEL_DATA_MINOR_NUMBER, - G_TYPE_INT, (void *) minor); - if (filter_node) - filter = g_list_append(filter, (gpointer)filter_node); - } - - if (!filter) { - _ERR("failed to get filter"); - return -1; - } - - r = tv_service_get_channel_list_ex( - TV_SERVICE_CHANNEL_MODE_ALL_DIGITAL_ANALOG, - TV_SERVICE_ANTENNA_TYPE_ALL, &tvs_list, filter, 0); - if (r != TVS_ERROR_OK) - goto free; - - tvs_data = (TvServiceChannel *) g_list_nth_data(tvs_list, 0); - if (tvs_data) - r = tv_channel_tune_with_service_id(tvs_data->service_id); - else { - _ERR("failed to get tvs_data"); - r = -1; - } - - if (r == TVS_ERROR_OK) - g_tv_info.viewing_locked_channel = -1; - - tv_service_free_channel_list(tvs_list); - -free: - g_list_foreach(filter, (GFunc) _tv_channel_free_filter, NULL); - g_list_free(filter); - - return r; -} - -/** - * Tunes to locked channel. - * - * @param service_id The channel id - * @param password 4 digit password - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_tune_locked_channel(int service_id, char *password) -{ - int r; - - if (!g_tv_info.live_svc) { - _ERR("failed to get live service"); - return -1; - } - - r = tv_service_live_tune_locked_channel(g_tv_info.live_svc, - service_id, password); - if (r != TVS_ERROR_OK) { - _ERR("failed to set service"); - return -1; - } - - _tv_channel_add_history(service_id); - - g_tv_info.viewing_locked_channel = service_id; - - return 0; -} - -/** - * Sets the channel's favorite status. - * - * @param service_id The channel id - * @param flag The value to be set - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_set_favorite(int service_id, Eina_Bool flag) -{ - int r; - - if (flag) { - r = tv_service_add_favorite_channel(service_id); - if (r < 0) { - _ERR("failed to add favorite channel"); - return -1; - } - } else { - r = tv_service_delete_favorite_channel(service_id); - if (r < 0) { - _ERR("failed to delete favorite channel"); - return -1; - } - } - - return 0; -} - -/** - * Adds the channel. - * - * If channel is added, the channel will be included at - * tv_channel_next, tv_channel_prev and tv_channel_get_list. - * - * @param service_id The channel id - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_add_channel(int service_id) -{ - int r; - - r = tv_service_add_channel(service_id); - if (r < 0) { - _ERR("failed to add channel"); - return -1; - } - - return 0; -} - -/** - * Deletes the channel. - * - * If channel is deleted, the channel will be omitted at - * tv_channel_next, tv_channel_prev and tv_channel_get_list. - * - * @param service_id The channel id - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_del_channel(int service_id) -{ - int r; - - r = tv_service_delete_channel(service_id); - if (r < 0) { - _ERR("failed to delete channel"); - return -1; - } - - return 0; -} - -/** - * Locks the channel. - * - * @param service_id The channel id - * @param password 4 digits password - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_lock_channel(int service_id, char *password) -{ - int r; - - r = tv_service_lock_channel(service_id, password); - if (r < 0) { - _ERR("failed to lock channel"); - return -1; - } - - return 0; -} - -/** - * Unlocks the channel. - * - * @param service_id The channel id - * @param password 4 digits password - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_channel_unlock_channel(int service_id, char *password) -{ - int r; - - r = tv_service_unlock_channel(service_id, password); - if (r < 0) { - _ERR("failed to unlock channel"); - return -1; - } - - return 0; -} - -/** - * Callback function for receives tv service events. - * - * @param event Event type - * @param user_data Not in use - * @param data Event specific detailed data - */ -void _tv_service_event_cb(TvServiceLiveEvent event, - gpointer user_data, const gpointer data) -{ - gboolean *lock_status; - - switch (event) { - case TV_SERVICE_LIVE_EVENT_TUNER_LOCK: - if (!data) { - _ERR("failed to get data"); - break; - } - - lock_status = (gboolean *) data; - if (g_tv_info.signal_cb) - g_tv_info.signal_cb(g_tv_info.signal_cb_data, - *lock_status); - break; - case TV_SERVICE_LIVE_EVENT_AUTO_DESTROY: - g_tv_info.live_svc = NULL; - break; - case TV_SERVICE_LIVE_EVENT_RESOLUTION: - case TV_SERVICE_LIVE_EVENT_BEGIN: - case TV_SERVICE_LIVE_EVENT_CHANNEL_LOCK: - case TV_SERVICE_LIVE_EVENT_CHANNEL_UNLOCK: - break; - } -} - -/** - * Sets tv signal callback function. - * - * @param cb The function pointer to get callback - * @param data An Additional data to passed to callback - */ -void tv_signal_cb_set(void (*cb)(void *data, int is_signal), void *data) -{ - g_tv_info.signal_cb = cb; - g_tv_info.signal_cb_data = data; -} - -/** - * Destory the tv service handles. - * - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_destroy(void) -{ - int r; - - if (g_tv_info.live_svc) - g_tv_info.live_svc = NULL; - - r = tv_service_channel_info_destroy(); - if (r < 0) - _ERR("failed to destroy channel info service"); - - if (g_tv_info.epg_svc) { - r = tv_service_epg_destroy(g_tv_info.epg_svc); - if (r != 0) - _ERR("failed to destroy epg service"); - g_tv_info.epg_svc = NULL; - } - - return 0; -} - -/** - * Create the tv service handles. - * - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_create(void) -{ - int r; - - r = tv_service_live_create(&g_tv_info.live_svc); - if (r != TVS_ERROR_OK) { - _ERR("failed to create live service"); - goto err; - } - - r = tv_service_live_register_callback(g_tv_info.live_svc, - _tv_service_event_cb, NULL); - if (r != TVS_ERROR_OK) { - _ERR("failed to register live callback"); - goto err; - } - - r = tv_service_channel_info_create(); - if (r != TVS_ERROR_OK) { - _ERR("failed to create channel info service"); - goto err; - } - - /* - r = tv_service_epg_create(&g_tv_info.epg_svc); - if (r != TVS_ERROR_OK) { - _ERR("failed to create epg service"); - goto err; - } - */ - - memset(&g_tv_info.history, 0, sizeof(g_tv_info.history)); - - return 0; -err: - tv_destroy(); - return -1; -} - -/** - * Pause the tv service handles. - * - * @return If the operation was sucessful 0 is returned; otherwise negative value is returned - */ -int tv_pause(void) -{ - int r; - - if (g_tv_info.live_svc) { - r = tv_service_live_tune_pause(g_tv_info.live_svc); - if (r != TVS_ERROR_OK) - _ERR("failed to pause live service"); - } - - return 0; -} - -/** - * Resume the tv service handles. - * - * Live service could be destroyed by tv service while app is pausing. - * If live service is destroyed, then _tv_service_event_cb sets - * g_tv_info.live_svc to NULL. - * So if g_tv_info.live_svc is NULL, then recreates live service and returns 1. - * Therefore, if tv_resume returns 1, then app needs to be set overlay and tune. - * Or returns 0, then app just needs to set overlay. - * - * @return 0 if successful; 1 if live service was destroyed; otherwise negative value is returned - */ -int tv_resume(void) -{ - int r; - - if (!g_tv_info.live_svc) { - r = tv_service_live_create(&g_tv_info.live_svc); - if (r != TVS_ERROR_OK) { - _ERR("failed to create live service"); - goto err; - } - - r = tv_service_live_register_callback(g_tv_info.live_svc, - _tv_service_event_cb, NULL); - if (r != TVS_ERROR_OK) { - _ERR("failed to register live callback"); - goto err; - } - - return 1; - } - - r = tv_service_live_tune_resume(g_tv_info.live_svc); - if (r != TVS_ERROR_OK) { - _ERR("failed to create live service"); - goto err; - } - - r = tv_service_live_register_callback(g_tv_info.live_svc, - _tv_service_event_cb, NULL); - if (r != TVS_ERROR_OK) { - _ERR("failed to register live callback"); - goto err; - } - - return 0; - -err: - tv_destroy(); - return -1; -} diff --git a/src/util.c b/src/util.c deleted file mode 100644 index b1a0711..0000000 --- a/src/util.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#include -#include -#include -#include -#include - -#include "define.h" -#include "view.h" - -#define BUF_MAX 128 -#define TOAST_TIMEOUT 5.0 -#define STYLE_TOAST "toast" - -Evas_Object *util_add_layout(Evas_Object *parent, const char *group) -{ - Evas_Object *ly; - - if (!parent) { - _ERR("failed to get parent"); - return NULL; - } - - ly = elm_layout_add(parent); - if (!ly) { - _ERR("failed to create layout"); - return NULL; - } - elm_layout_file_set(ly, EDJEFILE, group); - - evas_object_show(ly); - - return ly; -} - -Evas_Object *util_add_box(Evas_Object *parent, bool horizon) -{ - Evas_Object *box; - - if (!parent) { - _ERR("failed to get parent"); - return NULL; - } - - box = elm_box_add(parent); - if (!box) { - _ERR("failed to create box"); - return NULL; - } - - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_object_content_set(parent, box); - if (horizon) - elm_box_horizontal_set(box, EINA_TRUE); - else - elm_box_horizontal_set(box, EINA_FALSE); - - evas_object_show(box); - - return box; -} - -Evas_Object *util_add_scroller(Evas_Object *parent, const char *part) -{ - Evas_Object *scroll; - - if (!parent) { - _ERR("failed to get parent"); - return NULL; - } - - scroll = elm_scroller_add(parent); - if (!scroll) { - _ERR("failed to create scroll"); - return NULL; - } - - evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_scroller_policy_set(scroll, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_OFF); - - elm_object_part_content_set(parent, part, scroll); - - evas_object_show(scroll); - - return scroll; -} - -Evas_Object *util_add_icon(Evas_Object *parent, const char *file, - const char *part) -{ - Evas_Object *ic; - - if (!parent) { - _ERR("failed to get parent"); - return NULL; - } - - ic = elm_icon_add(parent); - if (!ic) { - _ERR("failed to create icon"); - return NULL; - } - - if (file) - elm_image_file_set(ic, file, NULL); - - if (part) - elm_object_part_content_set(parent, part, ic); - - elm_image_resizable_set(ic, EINA_FALSE, EINA_TRUE); - - evas_object_show(ic); - - return ic; -} - -Evas_Object *util_add_button(Evas_Object *parent, const char *part, - const char *text, const char *style) -{ - Evas_Object *btn; - - if (!parent) { - _ERR("Invalid argument."); - return NULL; - } - - btn = elm_button_add(parent); - if (!btn) { - _ERR("elm_button_add failed."); - return NULL; - } - - if (part) - elm_object_part_content_set(parent, part, btn); - if (text) - elm_object_text_set(btn, text); - if (style) - elm_object_style_set(btn, style); - - evas_object_show(btn); - - return btn; -} - -static void _notify_timeout_cb(void *data, Evas_Object *obj, void *ei) -{ - if (!obj) - return; - - evas_object_del(obj); -} - -Evas_Object *util_add_toast(Evas_Object *parent, char *text) -{ - Evas_Object *toast, *content; - - if (!parent) { - _ERR("Invalid argument."); - return NULL; - } - - toast = elm_notify_add(parent); - if (!toast) { - _ERR("elm_popup_add failed"); - return NULL; - } - - elm_object_style_set(toast, STYLE_TOAST); - elm_notify_align_set(toast, 0.0, 1.0); - elm_notify_timeout_set(toast, TOAST_TIMEOUT); - evas_object_smart_callback_add(toast, SIGNAL_TIMEOUT, - _notify_timeout_cb, NULL); - - content = elm_label_add(toast); - if (!content) { - _ERR("elm_label_add failed"); - evas_object_del(toast); - return NULL; - } - - elm_object_text_set(content, text); - elm_object_style_set(content, STYLE_TOAST); - elm_object_content_set(toast, content); - evas_object_show(content); - - evas_object_show(toast); - - return toast; -} - -static int _get_program_time(char *buf, int buf_len, time_t start_time, - time_t end_time) -{ - struct tm tm; - int r; - - if (start_time >= end_time) { - _ERR("invalid time"); - return -1; - } - - localtime_r(&start_time, &tm); - r = strftime(buf, buf_len, "%I:%M %P -", &tm); - if (r <= 0) - return -1; - - localtime_r(&end_time, &tm); - r = strftime(buf + r, buf_len - r, " %I:%M %P", &tm); - if (r <= 0) - return -1; - - return 0; -} - -static void _set_icon_box(Evas_Object *obj, - const struct tv_channel_info *channel_info) -{ - elm_object_signal_emit(obj, SIGNAL_RESET, SOURCE_PROGRAM); - - if (channel_info->locked) - elm_object_signal_emit(obj, SIGNAL_LOCKED, SOURCE_PROGRAM); - if (channel_info->favorite) - elm_object_signal_emit(obj, SIGNAL_FAVORITE, SOURCE_PROGRAM); -} - -static void _load_channel_text(Evas_Object *obj, - const struct tv_channel_info *channel_info) -{ - char buf[BUF_MAX]; - - if (channel_info->channel_minor > 0 && - channel_info->channel_minor < MINOR_MAX) - snprintf(buf, sizeof(buf), "%lu-%lu %s", - channel_info->channel_major, - channel_info->channel_minor, - channel_info->channel_name); - else - snprintf(buf, sizeof(buf), "%lu %s", - channel_info->channel_major, - channel_info->channel_name); - - elm_object_part_text_set(obj, - PART_CHANNELINFO_CHANNEL, buf); - - elm_object_part_text_set(obj, - PART_CHANNELINFO_TITLE, - STR_NOTITLE); - elm_object_part_text_set(obj, - PART_CHANNELINFO_TIME, - STR_NOTIME); -} - -static void _load_program_info(Evas_Object *obj, - const struct tv_program_info *prog) -{ - char buf[BUF_MAX]; - int r, service_id; - - service_id = (int) evas_object_data_get(obj, KEY_SVCID); - if (service_id != prog->service_id) - return; - - if (prog->start_time && prog->end_time) { - r = _get_program_time(buf, sizeof(buf), - prog->start_time, - prog->end_time); - if (!r) - elm_object_part_text_set(obj, - PART_CHANNELINFO_TIME, buf); - } - - if (strlen(prog->prog_title) > 0) - elm_object_part_text_set(obj, - PART_CHANNELINFO_TITLE, prog->prog_title); -} - -static void _tv_program_cb(Eina_List *prog_list, void *data) -{ - int op; - Evas_Object *obj; - struct tv_program_info *prog = NULL; - - if (!data) { - _ERR("failed to get data"); - return; - } - - obj = data; - - prog = (struct tv_program_info *) eina_list_nth(prog_list, 0); - if (prog) - _load_program_info(obj, prog); - else - _ERR("failed to get tv_program_info"); - - if (viewmgr_get_view_state(VIEW_CHANNELINFO) == VIEW_STATE_VISIBLE) { - op = START_HIDE_TIMER; - viewmgr_update_view(VIEW_CHANNELINFO, - UPDATE_TYPE_TIMER, &op); - } -} - -void util_draw_channel_info(Evas_Object *obj, - const struct tv_channel_info *channel_info) -{ - struct tv_program_request *prog_req; - int r, op; - int current_service; - - if (!obj || !channel_info) { - _ERR("Invalid argument"); - - return; - } - - r = tv_get_current_service_id(¤t_service); - if (r < 0) - current_service = -1; - - if (viewmgr_get_view_state(VIEW_CHANNELINFO) == VIEW_STATE_VISIBLE) { - op = STOP_HIDE_TIMER; - viewmgr_update_view(VIEW_CHANNELINFO, - UPDATE_TYPE_TIMER, &op); - } - - _load_channel_text(obj, channel_info); - _set_icon_box(obj, channel_info); - evas_object_data_set(obj, KEY_SVCID, (void *)channel_info->service_id); - - prog_req = calloc(1, sizeof(*prog_req)); - if (!prog_req) - goto err; - prog_req->tv_program_cb = _tv_program_cb; - prog_req->user_data = obj; - - r = tv_epg_get_cache_program(channel_info->service_id, - prog_req); - if (r < 0) - free(prog_req); - - if (channel_info->service_id == current_service) { - prog_req = calloc(1, sizeof(*prog_req)); - if (!prog_req) - goto err; - - prog_req->tv_program_cb = _tv_program_cb; - prog_req->user_data = obj; - r = tv_epg_get_program(channel_info->service_id, prog_req); - if (r < 0) - free(prog_req); - } - -err: - if (r < 0 && viewmgr_get_view_state(VIEW_CHANNELINFO) == - VIEW_STATE_VISIBLE) { - op = START_HIDE_TIMER; - viewmgr_update_view(VIEW_CHANNELINFO, - UPDATE_TYPE_TIMER, &op); - } -} - -void util_launch_home(void) -{ - app_control_h app_ctrl; - int r; - - r = app_control_create(&app_ctrl); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to create app control handle"); - return; - } - - r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to set app control operation"); - app_control_destroy(app_ctrl); - return; - } - - r = app_control_set_app_id(app_ctrl, APP_ID_HOME); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to set app control app id"); - app_control_destroy(app_ctrl); - return; - } - - r = app_control_send_launch_request(app_ctrl, NULL, NULL); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to send app control launch request"); - app_control_destroy(app_ctrl); - return; - } - - app_control_destroy(app_ctrl); -} - diff --git a/src/view_action_menu.c b/src/view_action_menu.c deleted file mode 100644 index 65804e5..0000000 --- a/src/view_action_menu.c +++ /dev/null @@ -1,885 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "define.h" -#include "util.h" -#include "view.h" - -#define BUF_MAX 128 -#define BUTTON_MAX 16 -#define BUTTON_BORDER 1 -#define ITEMS_IN_ROW 4 -#define FAVORITE_PADDING_Y 32 -#define FAVORITE_MAX 10 -#define SCROLLER_STEP_SIZE 334 - -#define KEY_BUTTON "KEY_BUTTON" - -#define STYLE_LIVETV_BTN "style.livetv.button" -#define STYLE_MORE_BTN "style.more.button" -#define STYLE_ACTION_MENU_BTN "style.action.menu.button" -#define STYLE_ACTION_MENU_FAVORITE "style.action.menu.favorite" - -#define UNTOGGLE 0 -#define TOGGLE 1 - -enum _button_id { - BUTTON_INVALID = -1, - BUTTON_LIVETV, - BUTTON_MORE, - BUTTON_FAV, - BUTTON_LOCK, - BUTTON_CHANNEL, -}; - -enum _button_state { - STATE_INVALID = -1, - STATE_UNTOGGLE, - STATE_TOGGLE, - STATE_DISABLED, -}; - -struct _priv { - Evas_Object *win; - Evas_Object *base; - Evas_Object *scroller; - Evas_Object *box; - Evas_Object *menu; - Evas_Object *channel_info; - Evas_Object *menu_btn[BUTTON_MAX]; - Evas_Object *favorite; -}; - -struct _button_data { - const char *text; - const char *normal; - const char *focused; - const char *selected; - const char *disabled; -}; - -static void _fav_clicked(void) -{ - const struct tv_channel_info *channel_info; - int r; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return; - } - - r = tv_channel_set_favorite(channel_info->service_id, - !channel_info->favorite); - if (r < 0) - _ERR("failed to set favorite"); - else { - if (channel_info->favorite) - viewmgr_update_view(VIEW_ACTION_MENU, - UPDATE_TYPE_SHOW_TOAST, - STR_UNFAVORITE_TOAST); - else - viewmgr_update_view(VIEW_ACTION_MENU, - UPDATE_TYPE_SHOW_TOAST, - STR_FAVORITE_TOAST); - } - - tv_channel_del_info(channel_info); - - viewmgr_hide_view(VIEW_ACTION_MENU); -} - -static int _fav_state(void) -{ - const struct tv_channel_info *channel_info; - int r; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return STATE_INVALID; - } - - r = channel_info->favorite ? STATE_TOGGLE : STATE_UNTOGGLE; - - tv_channel_del_info(channel_info); - - return r; -} - -static void _lock_clicked(void) -{ - viewmgr_show_view(VIEW_PIN); -} - -static int _lock_state(void) -{ - return STATE_DISABLED; - - /* - FIXME: Temporal fix until video mute is ready. - - const struct tv_channel_info *channel_info; - int r; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return STATE_INVALID; - } - - r = channel_info->locked ? STATE_TOGGLE : STATE_UNTOGGLE; - - tv_channel_del_info(channel_info); - - return r; - */ -} - -static void _channel_clicked(void) -{ - const struct tv_channel_info *channel_info; - int r; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return; - } - - if (channel_info->remembered) - r = tv_channel_del_channel(channel_info->service_id); - else - r = tv_channel_add_channel(channel_info->service_id); - - if (r < 0) - _ERR("failed to set channel"); - else { - if (channel_info->remembered) - viewmgr_update_view(VIEW_ACTION_MENU, - UPDATE_TYPE_SHOW_TOAST, - STR_REMOVE_CHANNEL_TOAST); - else - viewmgr_update_view(VIEW_ACTION_MENU, - UPDATE_TYPE_SHOW_TOAST, - STR_ADD_CHANNEL_TOAST); - } - - tv_channel_del_info(channel_info); - - viewmgr_hide_view(VIEW_ACTION_MENU); -} - -static int _channel_state(void) -{ - const struct tv_channel_info *channel_info; - int r; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return STATE_INVALID; - } - - r = channel_info->remembered ? STATE_TOGGLE : STATE_UNTOGGLE; - - tv_channel_del_info(channel_info); - - return r; -} - -struct _button { - int id; - const char *style; - struct _button_data data[2]; - - void (*clicked)(void); - int (*state)(void); -}; - -static struct _button buttons[] = { - { - .id = BUTTON_FAV, - .style = STYLE_ACTION_MENU_BTN, - .data[UNTOGGLE] = { - .text = STR_BUTTON_FAVORITE, - .normal = IMAGE_UNFAV_NOR, - .focused = IMAGE_UNFAV_FOC, - .selected = IMAGE_UNFAV_SEL, - .disabled = IMAGE_UNFAV_DIS - }, - .data[TOGGLE] = { - .text = STR_BUTTON_FAVORITE, - .normal = IMAGE_FAV_NOR, - .focused = IMAGE_FAV_FOC, - .selected = IMAGE_FAV_SEL, - .disabled = IMAGE_FAV_DIS - }, - .clicked = _fav_clicked, - .state = _fav_state - }, - { - .id = BUTTON_LOCK, - .style = STYLE_ACTION_MENU_BTN, - .data[UNTOGGLE] = { - .text = STR_BUTTON_LOCK, - .normal = IMAGE_UNLOCK_NOR, - .focused = IMAGE_UNLOCK_FOC, - .selected = IMAGE_UNLOCK_SEL, - .disabled = IMAGE_UNLOCK_DIS - }, - .data[TOGGLE] = { - .text = STR_BUTTON_UNLOCK, - .normal = IMAGE_LOCK_NOR, - .focused = IMAGE_LOCK_FOC, - .selected = IMAGE_LOCK_SEL, - .disabled = IMAGE_LOCK_DIS - }, - .clicked = _lock_clicked, - .state = _lock_state - }, - { - .id = BUTTON_CHANNEL, - .style = STYLE_ACTION_MENU_BTN, - .data[UNTOGGLE] = { - .text = STR_BUTTON_ADD_CHANNEL, - .normal = IMAGE_REMOVE_CH_NOR, - .focused = IMAGE_REMOVE_CH_FOC, - .selected = IMAGE_REMOVE_CH_SEL, - .disabled = IMAGE_REMOVE_CH_DIS - }, - .data[TOGGLE] = { - .text = STR_BUTTON_REMOVE_CHANNEL, - .normal = IMAGE_ADD_CH_NOR, - .focused = IMAGE_ADD_CH_FOC, - .selected = IMAGE_ADD_CH_SEL, - .disabled = IMAGE_ADD_CH_DIS - }, - .clicked = _channel_clicked, - .state = _channel_state - }, - { - .id = BUTTON_INVALID - } -}; - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_ESC)) - viewmgr_hide_view(VIEW_ACTION_MENU); - - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; -} - -static input_handler key_handler = { - .key_down = _key_down_cb, -}; - -static void _update_button_state(Evas_Object *obj, struct _button *button) -{ - int state; - - if (!obj || !button->state) { - _ERR("failed to get button state"); - return; - } - - state = button->state(); - - switch (state) { - case STATE_UNTOGGLE: - elm_object_signal_emit(obj, SIGNAL_UNTOGGLE, SOURCE_ELM); - break; - case STATE_TOGGLE: - elm_object_signal_emit(obj, SIGNAL_TOGGLE, SOURCE_ELM); - break; - case STATE_DISABLED: - elm_object_disabled_set(obj, EINA_TRUE); - break; - case STATE_INVALID: - break; - } -} - -static void _launch_favorite(void) -{ - app_control_h app_ctrl; - int r; - - r = app_control_create(&app_ctrl); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to create app control handle"); - return; - } - - r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to set app control operation"); - app_control_destroy(app_ctrl); - return; - } - - r = app_control_set_app_id(app_ctrl, APP_ID_FAVORITE); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to set app control app id"); - app_control_destroy(app_ctrl); - return; - } - - r = app_control_send_launch_request(app_ctrl, NULL, NULL); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to send app control launch request"); - app_control_destroy(app_ctrl); - return; - } - - app_control_destroy(app_ctrl); -} - -static void _button_clicked(Evas_Object *obj, int id, void *data) -{ - struct _button *button; - - switch (id) { - case BUTTON_MORE: - _launch_favorite(); - - viewmgr_hide_view(VIEW_ACTION_MENU); - break; - case BUTTON_FAV: - case BUTTON_LOCK: - case BUTTON_CHANNEL: - button = evas_object_data_get(obj, KEY_BUTTON); - if (!button) { - _ERR("failed to get button"); - return; - } - - if (button->clicked) - button->clicked(); - - _update_button_state(obj, button); - - break; - } -} - -static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Up *ev) -{ - if (!strcmp(ev->keyname, KEY_ENTER)) - _button_clicked(obj, id, data); -} - -static void _button_mouse_up_cb(int id, void *data, Evas *e, - Evas_Object *obj, Evas_Event_Mouse_Up *ev) -{ - _button_clicked(obj, id, data); -} - -static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Move *ev) -{ - if (!obj) - return; - - if (!elm_object_focus_get(obj)) - elm_object_focus_set(obj, EINA_TRUE); -} - -static input_handler button_handler = { - .key_up = _button_key_up_cb, - .mouse_up = _button_mouse_up_cb, - .mouse_move = _button_mouse_move_cb, -}; - -static void _favorite_clicked_cb(int id, void *data, Evas_Object *obj) -{ - if (id > 0) - tv_channel_tune_with_service_id(id); - - viewmgr_hide_view(VIEW_ACTION_MENU); -} - -static input_handler favorite_handler = { - .clicked = _favorite_clicked_cb, -}; - -static void _update_channel_info(struct _priv *priv) -{ - const struct tv_channel_info *channel_info; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return; - } - - util_draw_channel_info(priv->channel_info, channel_info); - - tv_channel_del_info(channel_info); -} - -static void _add_favorite_bg(Evas_Object *btn, char *str) -{ - Evas_Object *bg; - struct color_data bright, dark; - - app_contents_get_color(str, &bright, &dark); - bg = evas_object_rectangle_add(btn); - if (!bg) { - _ERR("failed to add content bg"); - return; - } - evas_object_color_set(bg, bright.r, bright.g, - bright.b, bright.a); - elm_object_part_content_set(btn, PART_CONTENT_BG, bg); - - bg = evas_object_rectangle_add(btn); - if (!bg) { - _ERR("failed to add text bg"); - return; - } - evas_object_color_set(bg, dark.r, dark.g, - dark.b, dark.a); - elm_object_part_content_set(btn, PART_TEXT_BG, bg); -} - -static void _update_favorite(struct _priv *priv) -{ - Eina_List *channel_list, *l; - const struct tv_channel_info *channel_info; - Evas_Object *btn, *no_favorite; - char buf[BUF_MAX]; - int i; - - channel_list = tv_channel_get_favorite_list(); - - elm_box_clear(priv->favorite); - - if (!channel_list) { - no_favorite = util_add_layout(priv->favorite, - GRP_ACTION_MENU_NO_FAVORITE); - if (!no_favorite) { - _ERR("failed to create no favorite layout"); - return; - } - - elm_box_pack_end(priv->favorite, no_favorite); - - return; - } - - i = 0; - EINA_LIST_FOREACH(channel_list, l, channel_info) { - if (channel_info->channel_minor > 0 && - channel_info->channel_minor < MINOR_MAX) - snprintf(buf, sizeof(buf), "%lu-%lu %s", - channel_info->channel_major, - channel_info->channel_minor, - channel_info->channel_name); - else - snprintf(buf, sizeof(buf), "%lu %s", - channel_info->channel_major, - channel_info->channel_name); - btn = util_add_button(priv->menu, NULL, buf, - STYLE_ACTION_MENU_FAVORITE); - if (!btn) { - _ERR("failed to create favorite item"); - continue; - } - - util_add_icon(btn, IMAGE_FAVORITE_DEFAULT, PART_CONTENT); - _add_favorite_bg(btn, buf); - - inputmgr_add_callback(btn, channel_info->service_id, - &favorite_handler, NULL); - - elm_box_pack_end(priv->favorite, btn); - - if (++i == FAVORITE_MAX) - break; - } - - tv_channel_del_list(channel_list); -} - -static void _update_menu(struct _priv *priv) -{ - int i; - - i = 0; - while (i < BUTTON_MAX && buttons[i].id != BUTTON_INVALID) { - _update_button_state(priv->menu_btn[i], &buttons[i]); - i++; - } -} - -static bool _draw_channel_info(struct _priv *priv) -{ - Evas_Object *layout; - - layout = util_add_layout(priv->base, GRP_CHANNELINFO); - if (!layout) { - _ERR("failed to create channel info layout"); - return false; - } - - elm_object_part_content_set(priv->base, PART_CHANNELINFO, layout); - - priv->channel_info = layout; - - return true; -} - -static bool _draw_action_area(struct _priv *priv) -{ - Evas_Object *table, *btn; - int i, row, col; - - table = elm_table_add(priv->menu); - if (!table) { - _ERR("failed to create action table"); - return false; - } - elm_table_padding_set(table, - ELM_SCALE_SIZE(BUTTON_BORDER), - ELM_SCALE_SIZE(BUTTON_BORDER)); - evas_object_show(table); - elm_object_part_content_set(priv->menu, PART_MENU, table); - - i = 0; - while (i < BUTTON_MAX && buttons[i].id != BUTTON_INVALID) { - btn = util_add_button(priv->menu, NULL, - buttons[i].data[UNTOGGLE].text, - buttons[i].style); - if (!btn) { - _ERR("failed to create action button"); - evas_object_del(table); - return false; - } - - util_add_icon(btn, buttons[i].data[UNTOGGLE].normal, - PART_ICON); - util_add_icon(btn, buttons[i].data[UNTOGGLE].focused, - PART_ICON_FOCUSED); - util_add_icon(btn, buttons[i].data[UNTOGGLE].selected, - PART_ICON_SELECTED); - util_add_icon(btn, buttons[i].data[UNTOGGLE].disabled, - PART_ICON_DISABLED); - elm_object_part_text_set(btn, PART_TEXT_1, - buttons[i].data[TOGGLE].text); - util_add_icon(btn, buttons[i].data[TOGGLE].normal, - PART_ICON_1); - util_add_icon(btn, buttons[i].data[TOGGLE].focused, - PART_ICON_1_FOCUSED); - util_add_icon(btn, buttons[i].data[TOGGLE].selected, - PART_ICON_1_SELECTED); - util_add_icon(btn, buttons[i].data[TOGGLE].disabled, - PART_ICON_1_DISABLED); - evas_object_data_set(btn, KEY_BUTTON, &buttons[i]); - inputmgr_add_callback(btn, buttons[i].id, - &button_handler, priv); - - col = i % ITEMS_IN_ROW; - row = i / ITEMS_IN_ROW; - elm_table_pack(table, btn, col, row, 1, 1); - - priv->menu_btn[i] = btn; - - i++; - } - - while (col + 1 != ITEMS_IN_ROW) { - btn = util_add_button(priv->menu, NULL, NULL, - STYLE_ACTION_MENU_BTN); - if (!btn) { - _ERR("failed to create action button"); - evas_object_del(table); - return false; - } - - elm_object_disabled_set(btn, EINA_TRUE); - - col = i % ITEMS_IN_ROW; - - elm_table_pack(table, btn, col, row, 1, 1); - - i++; - } - - return true; -} - -static bool _draw_top_area(struct _priv *priv) -{ - Evas_Object *layout, *btn; - - layout = util_add_layout(priv->box, GRP_ACTION_MENU_TOP); - if (!layout) { - _ERR("failed to create menu layout"); - return false; - } - elm_box_pack_end(priv->box, layout); - - btn = util_add_button(layout, - PART_TOP_BUTTON, STR_LIVETV, STYLE_LIVETV_BTN); - if (!btn) { - _ERR("failed to create live button"); - return false; - } - - elm_object_disabled_set(btn, EINA_TRUE); - - priv->menu = layout; - - return _draw_action_area(priv); -} - -static bool _draw_favorite_area(struct _priv *priv) -{ - Evas_Object *box; - - box = elm_box_add(priv->box); - if (!box) { - _ERR("failed to create favorite box"); - return false; - } - elm_box_padding_set(box, 0, ELM_SCALE_SIZE(FAVORITE_PADDING_Y)); - evas_object_show(box); - elm_box_pack_end(priv->box, box); - - priv->favorite = box; - - return true; -} - -static bool _draw_bottom_area(struct _priv *priv) -{ - Evas_Object *layout, *btn; - - layout = util_add_layout(priv->box, GRP_ACTION_MENU_BOTTOM); - if (!layout) { - _ERR("failed to create menu layout"); - return false; - } - elm_box_pack_end(priv->box, layout); - - btn = util_add_button(layout, - PART_MORE_BUTTON, STR_BUTTON_MORE, STYLE_MORE_BTN); - if (!btn) { - _ERR("failed to create more button"); - return false; - } - inputmgr_add_callback(btn, BUTTON_MORE, - &button_handler, priv); - - return true; -} - -static void _draw_view_content(struct _priv *priv) -{ - if (!_draw_channel_info(priv)) { - _ERR("failed to draw channel info"); - return; - } - - if (!_draw_top_area(priv)) { - _ERR("failed to draw top"); - return; - } - - if (!_draw_favorite_area(priv)) { - _ERR("failed to draw favorite"); - return; - } - - if (!_draw_bottom_area(priv)) - _ERR("failed to draw bottom"); -} - -static void _hide_finished_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) -{ - struct _priv *priv; - - if (!data) - return; - - priv = data; - - evas_object_hide(priv->base); -} - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *base, *scroller, *box; - - if (!win) { - _ERR("failed to get win object"); - return NULL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return NULL; - } - - base = elm_layout_add(win); - if (!base) { - _ERR("failed to create base object"); - free(priv); - return NULL; - } - elm_layout_file_set(base, EDJEFILE, GRP_VIEW_ACTION_MENU); - evas_object_size_hint_weight_set(base, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); - - scroller = util_add_scroller(base, NULL); - elm_scroller_step_size_set(scroller, - 0, ELM_SCALE_SIZE(SCROLLER_STEP_SIZE)); - - box = util_add_box(scroller, NULL); - elm_box_align_set(box, 0.5, 0.0); - - priv->box = box; - priv->scroller = scroller; - priv->base = base; - priv->win = win; - - _draw_view_content(priv); - - viewmgr_set_view_data(VIEW_ACTION_MENU, priv); - inputmgr_add_callback(priv->base, 0, &key_handler, priv); - elm_layout_signal_callback_add(priv->base, SIGNAL_HIDE_FINISHED, - SOURCE_ELM, _hide_finished_cb, priv); - - return base; -} - -static void _show(void *data) -{ - struct _priv *priv; - - if (!data) { - _ERR("failed to get data"); - return; - } - priv = data; - - _update_channel_info(priv); - _update_menu(priv); - _update_favorite(priv); - - elm_scroller_region_show(priv->scroller, 0, 0, 0, 0); - - evas_object_show(priv->base); - - elm_object_focus_set(priv->menu_btn[0], EINA_TRUE); -} - -static void _hide(void *data) -{ - struct _priv *priv; - - if (!data) { - _ERR("failed to get data"); - return; - } - priv = data; - - elm_layout_signal_emit(priv->base, SIGNAL_HIDE, SOURCE_ELM); -} - -static void _destroy(void *data) -{ - struct _priv *priv; - - if (!data) { - _ERR("failed to get data"); - return; - } - priv = data; - - elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED, - SOURCE_ELM, _hide_finished_cb); - - evas_object_del(priv->base); - - free(priv); -} - -static void _update(void *view_data, int type, void *data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - switch (type) { - case UPDATE_TYPE_INPUT_KEY_DOWN: - { - Evas_Event_Key_Down *ev = data; - - if (!ev) { - _ERR("failed to get ev"); - return; - } - - viewmgr_show_view(VIEW_ACTION_MENU); - break; - } - case UPDATE_TYPE_SHOW_TOAST: - if (!data) { - _ERR("failed to get data"); - return; - } - - util_add_toast(priv->win, data); - break; - } -} - -static view_class _vclass = { - .view_id = VIEW_ACTION_MENU, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, - .update = _update -}; - -view_class *view_action_menu_get_vclass(void) -{ - return &_vclass; -} diff --git a/src/view_error.c b/src/view_bgimage.c old mode 100644 new mode 100755 similarity index 72% rename from src/view_error.c rename to src/view_bgimage.c index 2983c25..b4cc1f3 --- a/src/view_error.c +++ b/src/view_bgimage.c @@ -46,13 +46,13 @@ static Evas_Object *_create(Evas_Object *win, void *data) free(priv); return NULL; } - elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_ERROR); + elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_BGIMAGE); evas_object_size_hint_weight_set(priv->base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, priv->base); - viewmgr_set_view_data(VIEW_ERROR, priv); + viewmgr_set_view_data(VIEW_BGIMAGE, priv); return priv->base; } @@ -67,7 +67,6 @@ static void _show(void *view_data) } priv = view_data; - evas_object_show(priv->base); } @@ -101,40 +100,15 @@ static void _destroy(void *view_data) free(priv); } -static void _update(void *view_data, int type, void *data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - if (type == UPDATE_TYPE_NOCHANNEL) { - elm_object_part_text_set(priv->base, - PART_ERROR_TITLE, STR_NOCHANNEL_TITLE); - elm_object_part_text_set(priv->base, - PART_ERROR_TEXT, STR_NOCHANNEL_TEXT); - } else if (type == UPDATE_TYPE_NOSIGNAL) { - elm_object_part_text_set(priv->base, - PART_ERROR_TITLE, STR_NOSIGNAL_TITLE); - elm_object_part_text_set(priv->base, - PART_ERROR_TEXT, STR_NOSIGNAL_TEXT); - } -} - static view_class vclass = { - .view_id = VIEW_ERROR, + .view_id = VIEW_BGIMAGE, .create = _create, .show = _show, .hide = _hide, .destroy = _destroy, - .update = _update, }; -view_class *view_error_get_vclass(void) +view_class *view_bgimage_get_vclass(void) { return &vclass; } diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c deleted file mode 100644 index 66af50e..0000000 --- a/src/view_channelinfo.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include -#include -#include -#include -#include - -#include "define.h" -#include "tv.h" -#include "view.h" -#include "layout_channelinfo.h" -#include "layout_channelinfo_list.h" -#include "layout_channelinfo_search.h" - -#define HIDE_DUR 10.0 - -struct _priv { - Evas_Object *base; - Ecore_Timer *hide_timer; - const char *current_layout; - - layoutmgr *lmgr; -}; - -static void _hide_current_layout(struct _priv *priv) -{ - if (!priv->current_layout) - return; - - layoutmgr_hide_layout(priv->lmgr, priv->current_layout); - priv->current_layout = NULL; -} - -static void _set_current_layout(struct _priv *priv, const char *layout_id) -{ - if (!layout_id) - return; - - if (priv->current_layout && strcmp(priv->current_layout, layout_id)) - layoutmgr_hide_layout(priv->lmgr, priv->current_layout); - - layoutmgr_show_layout(priv->lmgr, layout_id); - priv->current_layout = layout_id; -} - -static Eina_Bool _hide_timer(void *data) -{ - struct _priv *priv; - - if (!data) - return ECORE_CALLBACK_CANCEL; - - priv = data; - - priv->hide_timer = NULL; - - viewmgr_hide_view(VIEW_CHANNELINFO); - - return ECORE_CALLBACK_CANCEL; -} - -static void _start_hide_timer(struct _priv *priv) -{ - if (priv->hide_timer) - ecore_timer_reset(priv->hide_timer); - else - priv->hide_timer = ecore_timer_add(HIDE_DUR, _hide_timer, priv); -} - -static void _stop_hide_timer(struct _priv *priv) -{ - if (priv->hide_timer) { - ecore_timer_del(priv->hide_timer); - priv->hide_timer = NULL; - } -} - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - - if (!win) { - _ERR("failed to get win object"); - return NULL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return NULL; - } - - priv->lmgr = layoutmgr_create(win); - layoutmgr_add_layout(priv->lmgr, layout_channelinfo_get_lclass(), NULL); - layoutmgr_add_layout(priv->lmgr, - layout_channelinfo_list_get_lclass(), NULL); - layoutmgr_add_layout(priv->lmgr, - layout_channelinfo_search_get_lclass(), NULL); - - viewmgr_set_view_data(VIEW_CHANNELINFO, priv); - - return win; -} - -static void _show(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - if (!priv->current_layout) - _set_current_layout(priv, LAYOUT_CHANNELINFO); -} - -static void _hide(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - _hide_current_layout(priv); -} - -static void _destroy(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO); - layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO_LIST); - layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO_SEARCH); - layoutmgr_destroy(priv->lmgr); - - free(priv); -} - -static void _update(void *view_data, int type, void *data) -{ - struct _priv *priv; - int r; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - if (type == UPDATE_TYPE_TIMER) { - switch (*(int *) data) { - case START_HIDE_TIMER: - _start_hide_timer(priv); - break; - case STOP_HIDE_TIMER: - _stop_hide_timer(priv); - break; - } - } else if (type == UPDATE_TYPE_INPUT_KEY_DOWN) { - Evas_Event_Key_Down *ev = data; - - if (!ev) { - _ERR("failed to get ev"); - return; - } - - if (!strcmp(ev->keyname, KEY_ENTER)) { - if (!priv->current_layout) - _set_current_layout(priv, LAYOUT_CHANNELINFO); - else - _set_current_layout(priv, - LAYOUT_CHANNELINFO_SEARCH); - } else if (!strcmp(ev->keyname, KEY_CHANNELUP) || - !strcmp(ev->keyname, KEY_CHANNELDOWN)) { - if (priv->current_layout && - !strcmp(priv->current_layout, - LAYOUT_CHANNELINFO_SEARCH)) - return; - - _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); - layoutmgr_update_layout(priv->lmgr, - LAYOUT_CHANNELINFO_LIST, type, ev); - } else if (!strcmp(ev->keyname, KEY_PREVIOUS)) { - r = tv_channel_tune_prev_channel(); - if (r < 0) - _ERR("failed to tune prev channel"); - - _set_current_layout(priv, LAYOUT_CHANNELINFO); - } - - viewmgr_show_view(VIEW_CHANNELINFO); - } -} - -static view_class vclass = { - .view_id = VIEW_CHANNELINFO, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, - .update = _update -}; - -view_class *view_channelinfo_get_vclass(void) -{ - return &vclass; -} diff --git a/src/view_channelnumber.c b/src/view_channelnumber.c deleted file mode 100644 index 9e395ac..0000000 --- a/src/view_channelnumber.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include -#include -#include -#include - -#include "define.h" -#include "util.h" -#include "tv.h" -#include "view.h" - -#define HIDE_DUR 3.0 -#define BUF_MAX 128 -#define INPUT_MAX 4 -#define NUMBER_MAX 2 - -struct _priv { - Evas_Object *base; - Evas_Object *list; - Ecore_Timer *hide_timer; - - int major; - int minor; - char number[INPUT_MAX+1]; -}; - -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_ESC)) - viewmgr_hide_view(VIEW_CHANNELNUMBER); -} - -static input_handler key_handler = { - .key_down = _key_down_cb, -}; - -static void _stop_hide_timer(struct _priv *priv) -{ - if (priv->hide_timer) { - ecore_timer_del(priv->hide_timer); - priv->hide_timer = NULL; - } -} - -static Eina_Bool _done_input(void *data) -{ - struct _priv *priv; - int r; - - if (!data) - return ECORE_CALLBACK_CANCEL; - - priv = data; - - r = tv_channel_direct_tune(priv->major, priv->minor); - if (r < 0) - _ERR("invalid channel"); - - viewmgr_hide_view(VIEW_CHANNELNUMBER); - - return ECORE_CALLBACK_CANCEL; -} - -static void _start_hide_timer(struct _priv *priv) -{ - if (priv->hide_timer) - ecore_timer_reset(priv->hide_timer); - else - priv->hide_timer = ecore_timer_add(HIDE_DUR, _done_input, priv); -} - -static void _tune_channel(void *data) -{ - int service_id; - int r; - - if (!data) { - _ERR("failed to get data"); - return; - } - - service_id = (int) data; - if (service_id < 0) { - _ERR("failed to get service id"); - return; - } - - r = tv_channel_tune_with_service_id(service_id); - if (r < 0) - _ERR("failed to tune with service id"); - - viewmgr_hide_view(VIEW_CHANNELNUMBER); -} - -static void _channel_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - if (!strcmp(ev->keyname, KEY_ENTER)) { - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - - _tune_channel(data); - } -} - -static void _channel_mouse_down_cb(int id, void *data, Evas *e, - Evas_Object *obj, Evas_Event_Mouse_Down *ev) -{ - _tune_channel(data); -} - -static void _channel_focused_cb(int id, void *data, - Evas_Object *obj, Elm_Object_Item *it) -{ - viewmgr_update_view(VIEW_CHANNELNUMBER, - UPDATE_TYPE_TIMER, 0); -} - -static input_handler channel_handler = { - .key_down = _channel_key_down_cb, - .mouse_down = _channel_mouse_down_cb, - .focused = _channel_focused_cb, -}; - -static void _update_channel_list(struct _priv *priv) -{ - Evas_Object *ly, *first; - Eina_List *channel_list, *l; - const struct tv_channel_info *channel_info; - char buf[BUF_MAX]; - - channel_list = tv_channel_search_by_number(priv->major, priv->minor); - - elm_box_clear(priv->list); - - if (!channel_list) { - evas_object_hide(priv->list); - return; - } - - evas_object_show(priv->list); - - first = NULL; - ly = NULL; - EINA_LIST_FOREACH(channel_list, l, channel_info) { - ly = util_add_layout(priv->list, GRP_CHANNELNUMBER_LIST_ITEM); - if (!ly) { - _ERR("failed to create layout"); - return; - } - - elm_object_focus_allow_set(ly, EINA_TRUE); - - if (channel_info->channel_minor > 0 && - channel_info->channel_minor < MINOR_MAX) - snprintf(buf, sizeof(buf), "%lu-%lu %s", - channel_info->channel_major, - channel_info->channel_minor, - channel_info->channel_name); - else - snprintf(buf, sizeof(buf), "%lu %s", - channel_info->channel_major, - channel_info->channel_name); - - elm_object_text_set(ly, buf); - - inputmgr_add_callback(ly, 0, &channel_handler, - (void *) channel_info->service_id); - - elm_box_pack_end(priv->list, ly); - - if (!first) { - first = ly; - elm_object_focus_set(ly, EINA_TRUE); - elm_object_signal_emit(ly, SIGNAL_FIRST, ""); - } - } - - if (first && ly) { - elm_object_focus_next_object_set(first, ly, ELM_FOCUS_UP); - elm_object_focus_next_object_set(ly, first, ELM_FOCUS_DOWN); - elm_object_signal_emit(ly, SIGNAL_LAST, ""); - } - - if (channel_list) - tv_channel_del_list(channel_list); -} - -static void _update_number_info(struct _priv *priv) -{ - char buf[BUF_MAX] = "\0"; - - if (strlen(priv->number) > NUMBER_MAX) { - strncpy(buf, priv->number, NUMBER_MAX); - strncat(buf, "-", 1); - strncat(buf, priv->number + NUMBER_MAX, NUMBER_MAX); - elm_object_part_text_set(priv->base, - PART_CHANNELNUMBER_NUMBER, buf); - } else { - elm_object_part_text_set(priv->base, - PART_CHANNELNUMBER_NUMBER, priv->number); - } - - _update_channel_list(priv); -} - -static int _get_number(const char *keyname) -{ - static const char * const keys[] = { - KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, - KEY_5, KEY_6, KEY_7, KEY_8, KEY_9 - }; - - int i; - - if (!keyname) { - _ERR("failed to get keyname"); - return -1; - } - - for (i = 0; i < sizeof(keys) / sizeof(*keys); i++) { - if (!strcmp(keyname, keys[i])) - return i; - } - - return -1; -} - -static void _number_reset(struct _priv *priv) -{ - memset(priv->number, '\0', sizeof(char) * INPUT_MAX + 1); - priv->major = 0; - priv->minor = 0; - - elm_box_clear(priv->list); -} - -static void _number_tuning(struct _priv *priv, const char *keyname) -{ - char buf[BUF_MAX] = "\0"; - - if (!keyname) { - _ERR("failed to get keyname"); - return; - } - - strncat(priv->number, keyname, 1); - strncpy(buf, priv->number, INPUT_MAX); - - priv->minor = atoi(buf + NUMBER_MAX); - buf[NUMBER_MAX] = '\0'; - priv->major = atoi(buf); - - _update_number_info(priv); - - if (strlen(priv->number) >= INPUT_MAX) - _done_input(priv); -} - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *scroll = NULL; - - if (!win) { - _ERR("failed to get win object"); - return NULL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return NULL; - } - - priv->base = elm_layout_add(win); - if (!priv->base) { - _ERR("failed to create base object"); - goto error; - } - elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_CHANNELNUMBER); - - evas_object_size_hint_weight_set(priv->base, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, priv->base); - elm_object_focus_allow_set(priv->base, EINA_TRUE); - - scroll = util_add_scroller(priv->base, PART_CHANNELNUMBER_LIST); - if (!scroll) { - _ERR("failed to create scroll"); - goto error; - } - - priv->list = util_add_box(scroll, false); - if (!priv->list) { - _ERR("failed to create box"); - goto error; - } - elm_box_align_set(priv->list, 0.5, 0.0); - - viewmgr_set_view_data(VIEW_CHANNELNUMBER, priv); - - inputmgr_add_callback(priv->base, 0, &key_handler, priv); - - return priv->base; - -error: - _ERR("failed to create view"); - - if (priv->list) - evas_object_del(priv->list); - if (scroll) - evas_object_del(scroll); - if (priv->base) - evas_object_del(priv->base); - - free(priv); - - return NULL; -} - -static void _show(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - _start_hide_timer(priv); - - evas_object_show(priv->base); - - viewmgr_hide_view(VIEW_CHANNELINFO); - elm_object_focus_set(priv->base, EINA_TRUE); -} - -static void _hide(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - _stop_hide_timer(priv); - _number_reset(priv); - - evas_object_hide(priv->base); -} - -static void _destroy(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - evas_object_del(priv->base); - - free(priv); -} - -static void _update(void *view_data, int type, void *data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = view_data; - - if (type == UPDATE_TYPE_TIMER) { - _start_hide_timer(priv); - } else if (type == UPDATE_TYPE_INPUT_KEY_DOWN) { - Evas_Event_Key_Down *ev = data; - - if (!ev) { - _ERR("failed to get ev"); - return; - } - - viewmgr_show_view(VIEW_CHANNELNUMBER); - - if (_get_number(ev->keyname) != -1) - _number_tuning(priv, ev->keyname); - } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { - Evas_Event_Key_Up *ev = data; - - if (!ev) { - _ERR("failed to get ev"); - return; - } - } -} - -static view_class vclass = { - .view_id = VIEW_CHANNELNUMBER, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, - .update = _update -}; - -view_class *view_channelnumber_get_vclass(void) -{ - return &vclass; -} diff --git a/src/view_pin.c b/src/view_pin.c deleted file mode 100644 index aa65d5e..0000000 --- a/src/view_pin.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include -#include -#include -#include -#include -#include - -#include "define.h" -#include "view.h" -#include "tv.h" - -struct _priv { - Evas_Object *win; - ui_gadget_h ug; -}; - -static void _send_message(struct _priv *priv, const char *result) -{ - app_control_h app_control; - int r; - - r = app_control_create(&app_control); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to create app_control"); - return; - } - - r = app_control_add_extra_data(app_control, PARAM_PIN, result); - if (r != APP_CONTROL_ERROR_NONE) { - _ERR("failed to add data"); - app_control_destroy(app_control); - return; - } - - ug_send_message(priv->ug, app_control); - - app_control_destroy(app_control); -} - -static void _check_pincode(struct _priv *priv, char *pincode) -{ - const struct tv_channel_info *channel_info; - int r; - - channel_info = tv_channel_get_info(); - if (!channel_info) { - _ERR("failed to get channel info"); - return; - } - - if (channel_info->locked) - r = tv_channel_unlock_channel(channel_info->service_id, - pincode); - else - r = tv_channel_lock_channel(channel_info->service_id, pincode); - - if (r < 0) { - _send_message(priv, MESSAGE_FAIL); - } else { - if (channel_info->locked) - viewmgr_update_view(VIEW_ACTION_MENU, - UPDATE_TYPE_SHOW_TOAST, - STR_UNLOCK_TOAST); - else - viewmgr_update_view(VIEW_ACTION_MENU, - UPDATE_TYPE_SHOW_TOAST, - STR_LOCK_TOAST); - - viewmgr_hide_view(VIEW_PIN); - viewmgr_hide_view(VIEW_ACTION_MENU); - } - - tv_channel_del_info(channel_info); -} - -static void _ug_result_cb(ui_gadget_h ug, app_control_h result, void *p) -{ - char *pincode; - int r; - - if (!p) { - _ERR("Invalid argument"); - return; - } - - r = app_control_get_extra_data(result, PARAM_PIN, &pincode); - if (r != APP_CONTROL_ERROR_NONE || !pincode) { - _ERR("failed to get data"); - return; - } - - _check_pincode(p, pincode); - - free(pincode); -} - -static void _ug_destroy_cb(ui_gadget_h ug, void *p) -{ - viewmgr_hide_view(VIEW_PIN); -} - -static ui_gadget_h _load_ug(struct _priv *priv) -{ - ui_gadget_h ug; - struct ug_cbs cb = {0,}; - - cb.result_cb = _ug_result_cb; - cb.destroy_cb = _ug_destroy_cb; - cb.priv = priv; - - ug = ug_create(NULL, UG_ID_PIN, UG_MODE_FRAMEVIEW, NULL, &cb); - - return ug; -} - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - - if (!win) { - _ERR("Invalid argument"); - return NULL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to calloc priv"); - return NULL; - } - - priv->win = win; - - viewmgr_set_view_data(VIEW_PIN, priv); - - return win; -} - -static void _show(void *data) -{ - struct _priv *priv; - ui_gadget_h ug; - - if (!data) { - _ERR("Invalid argument"); - return; - } - - priv = data; - - ug = _load_ug(priv); - if (!ug) { - _ERR("failed to create ug"); - return; - } - - priv->ug = ug; -} - -static void _hide(void *data) -{ - struct _priv *priv; - - if (!data) { - _ERR("Invalid argument"); - return; - } - - priv = data; - - if (priv->ug) - ug_destroy(priv->ug); -} - -static void _destroy(void *data) -{ - struct _priv *priv; - - if (!data) { - _ERR("Invalid argument"); - return; - } - - priv = data; - - free(priv); -} - -static view_class vclass = { - .view_id = VIEW_PIN, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy -}; - -view_class *view_pin_get_vclass(void) -{ - return &vclass; -}