From d52f95790faec075078afa7418c7e01f83f425f5 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 29 Jun 2015 15:51:13 +0900 Subject: [PATCH 02/14] Initifal commit Change-Id: I4dd1bf891eff98d34f577d6384cc3c401733a220 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 74 ++++++++++++++++++++ data/CMakeLists.txt | 32 +++++++++ data/live-tv-theme.edc | 20 ++++++ data/live-tv.edc | 33 +++++++++ include/define.h | 24 +++++++ include/main_view.h | 22 ++++++ org.tizen.live-tv.png | Bin 0 -> 38658 bytes org.tizen.live-tv.xml.in | 10 +++ packaging/org.tizen.live-tv.spec | 54 +++++++++++++++ src/main.c | 143 +++++++++++++++++++++++++++++++++++++++ src/main_view.c | 118 ++++++++++++++++++++++++++++++++ 11 files changed, 530 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 data/CMakeLists.txt create mode 100644 data/live-tv-theme.edc create mode 100644 data/live-tv.edc create mode 100644 include/define.h create mode 100644 include/main_view.h create mode 100644 org.tizen.live-tv.png create mode 100644 org.tizen.live-tv.xml.in create mode 100644 packaging/org.tizen.live-tv.spec create mode 100644 src/main.c create mode 100644 src/main_view.c diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..bf712d2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,74 @@ +# 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. +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT("live-tv" C) + +IF(NOT DEFINED PACKAGE_NAME) + SET(PACKAGE_NAME "org.tizen.${PROJECT_NAME}") +ENDIF(NOT DEFINED PACKAGE_NAME) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +IF(NOT DEFINED BINDIR) + SET(BINDIR "${PREFIX}/bin") +ENDIF(NOT DEFINED BINDIR) +IF(NOT DEFINED RESDIR) + SET(RESDIR "${PREFIX}/res") +ENDIF(NOT DEFINED RESDIR) +IF(NOT DEFINED IMAGEDIR) + SET(IMAGEDIR "${PREFIX}/res/images") +ENDIF(NOT DEFINED IMAGEDIR) +IF(NOT DEFINED EDJEDIR) + SET(EDJEDIR "${PREFIX}/res/edje") +ENDIF(NOT DEFINED EDJEDIR) +IF(NOT DEFINED MANIFESTDIR) + SET(MANIFESTDIR "/usr/share/packages") +ENDIF(NOT DEFINED MANIFESTDIR) + +SET(SRCS src/main.c + src/main_view.c) + +SET(TARGET_EDJ "${PROJECT_NAME}.edj") +SET(THEME_EDJ "${PROJECT_NAME}-theme.edj") + +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"") +ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"") +ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"") +ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"") +ADD_DEFINITIONS("-DTHEMEFILE=\"${EDJEDIR}/${THEME_EDJ}\"") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +INCLUDE(FindPkgConfig) +pkg_check_modules(PKGS REQUIRED + elementary + ecore + edje + capi-appfw-application + app-utils) + +FOREACH(flag ${PKGS_CFLAGS}) + SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLGAS}") +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS}) +CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) +INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR}) + +ADD_SUBDIRECTORY(data) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..c2bb8f9 --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,32 @@ +# 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. +# + +ADD_CUSTOM_TARGET(${TARGET_EDJ} + COMMAND edje_cc -id images + ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc + ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc +) +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 images -sd 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 new file mode 100644 index 0000000..52e787d --- /dev/null +++ b/data/live-tv-theme.edc @@ -0,0 +1,20 @@ +/* + * 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 { +} diff --git a/data/live-tv.edc b/data/live-tv.edc new file mode 100644 index 0000000..a1cfbd7 --- /dev/null +++ b/data/live-tv.edc @@ -0,0 +1,33 @@ +/* + * 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 { + group { + name: GRP_MAIN_VIEW; + parts { + part { + name, PART_CONTENT; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + } + } + } + } +} diff --git a/include/define.h b/include/define.h new file mode 100644 index 0000000..42bb0dd --- /dev/null +++ b/include/define.h @@ -0,0 +1,24 @@ +/* + * 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 __LIVETV_DEFINE_H__ +#define __LIVETV_DEFINE_H__ + +#define VIEW_MAIN "VIEW_MAIN" +#define GRP_MAIN_VIEW "grp.main.view" +#define PART_CONTENT "part.content" + +#endif /* __LIVETV_DEFINE_H__*/ diff --git a/include/main_view.h b/include/main_view.h new file mode 100644 index 0000000..6beb35d --- /dev/null +++ b/include/main_view.h @@ -0,0 +1,22 @@ +/* + * 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 __LIVETV_MAIN_VIEW_H__ +#define __LIVETV_MAIN_VIEW_H__ + +view_class *view_main_get_vclass(void); + +#endif /* __LIVETV_MAIN_VIEW_H__*/ diff --git a/org.tizen.live-tv.png b/org.tizen.live-tv.png new file mode 100644 index 0000000000000000000000000000000000000000..affa43645cd9689ed9ea1d41404cfbb195a130ae GIT binary patch literal 38658 zcmd3ORdC%*w`F2>%*=KiV~jB~Gc()AiJ4-InVFfH*~iQrGcz+EGaWOIzdQBK!++~O zOwG%bq>{91SNH0zu5Rt!OA1w#mq7Z0|K-!CPe@XdqRO8>L1=#Z^jQ!N<^%bO0MYbu z`s|=AA^fRwg7E0$2F5@}LiE%7KU+>mar_4YZ!4+g@aYo*#y`jBPiYyrA0X@>DLFCN zbx1@AOfDk&laKPhev%RuQgvB5?U0HgTy`va&UEMdM)j46LNNuDruh>~3hR5Qm~vj2 z+>z7*L8{VS))UZuI^Ft2tjcY(BUa0%O~dB755Rj8Y7xewWl%GerdaWrB}Q-pjEjeM ze&62j7=1bPS@0XA%C?7zIlQQeTR@w>zGEM^}t{e`^9iL&_JbgQ4F*57%e2J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Vt#I=$voSgf(hTy&*ME~J*86V(}UmbFO-_4D&oDWD--o~ zxquW5{+x5J$yc>MO-7oy>w_gEgVvM_f@JXbK2)-R6<-^bU(ZTVpc(3;38h1?KNl@d z(4O>cm>kPy;K#hXZU|(z@U{W7w$R*EPgI9*Ims4LD6xZz&WhfZVlG?~*0BE?&N#D7 z!MZtJT!OuqN<<4(Su4J>wl+>#)~^(YJ5tU)Hzj6jPULF-lrFu?oeA`*mj_N({{VFv z&2$Av?(9x(sO)Z>Aw6?TJ6)y1{2Xdkw>`_*DQ@nM$@^880z)8qg3 z8)lwcB)E~|Yn@RTdc$cg)KQmJH>eF^iOSDBKTbb7V)ZO%^MR_>b#xK$vnJw8BOA-C z&ptYF;)FRrEaJGjSbJQs{oQa<>fgdYc>W*v-$Ryj|6}(b?!SgFUYt4};D5RQ9^U)< z$MFDv+x>_8U%;!bEdRIjzlZ-U_& + + + Jinwoo Shin + Live TV application for Tizen TV + + + @DESKTOP_ICON@ + + diff --git a/packaging/org.tizen.live-tv.spec b/packaging/org.tizen.live-tv.spec new file mode 100644 index 0000000..2b9626e --- /dev/null +++ b/packaging/org.tizen.live-tv.spec @@ -0,0 +1,54 @@ +Name: org.tizen.live-tv +Summary: Live TV application for Tizen TV +Version: 0.1 +Release: 1 +Group: Applications +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz + +BuildRequires: cmake +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(edje) +BuildRequires: pkgconfig(app-utils) +BuildRequires: gettext-devel +BuildRequires: edje-bin + +%define _pkgdir %{_prefix}/apps/%{name} +%define _bindir %{_pkgdir}/bin +%define _resdir %{_pkgdir}/res +%define _datadir %{_pkgdir}/data +%define _edjedir %{_resdir}/edje +%define _manifestdir %{_datarootdir}/packages + +%description +Live TV application for Tizen TV. + +%prep +%setup -q + +%build +cmake \ + -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \ + -DPACKAGE_NAME=%{name} \ + -DBINDIR=%{_bindir} \ + -DEDJEDIR=%{_edjedir} \ + -DMANIFESTDIR=%{_manifestdir} \ + -DVERSION=%{version} + +make %{?jobs:-j%jobs} + +%install +%make_install +install --directory %{buildroot}/%{_datadir} + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{_bindir}/* +%{_resdir}/* +%{_datadir} +%{_manifestdir}/%{name}.xml diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..14c9672 --- /dev/null +++ b/src/main.c @@ -0,0 +1,143 @@ +/* + * 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 +#include +#include + +#include "define.h" +#include "main_view.h" + +SET_TAG(PACKAGE) + +struct _appdata { + const char *name; + Evas_Object *win; +}; + +static Evas_Object *_add_win(const char *name) +{ + Evas_Object *win; + + win = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (!win) { + _ERR("failed to create win"); + return NULL; + } + elm_win_alpha_set(win, EINA_FALSE); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_focus_highlight_style_set(win, "invisible"); + + evas_object_show(win); + + return win; +} + +static void _pause(void *data) +{ +} + +static void _resume(void *data) +{ +} + +static bool _create(void *data) +{ + struct _appdata *ad; + Evas_Object *win; + + if (!data) { + _ERR("failed to get data"); + return false; + } + + ad = data; + + elm_theme_overlay_add(NULL, THEMEFILE); + + win = _add_win(ad->name); + if (!win) { + _ERR("failed to create win object"); + return false; + } + + if (!viewmgr_create(win)) { + _ERR("failed to initialize viewmgr"); + evas_object_del(win); + return false; + } + + viewmgr_add_view(view_main_get_vclass(), NULL); + + ad->win = win; + + return true; +} + +static void _terminate(void *data) +{ + struct _appdata *ad; + + if (!data) { + _ERR("failed to get data"); + return; + } + + ad = data; + + viewmgr_remove_view(VIEW_MAIN); + viewmgr_destroy(); + + if (ad->win) { + evas_object_del(ad->win); + ad->win = NULL; + } +} + +static void _control(app_control_h control, void *data) +{ + struct _appdata *ad; + + if (!data) { + _ERR("failed to get data"); + return; + } + + ad = data; + + if (ad->win) + elm_win_activate(ad->win); + + viewmgr_push_view(VIEW_MAIN); +} + +int main(int argc, char *argv[]) +{ + struct _appdata ad; + ui_app_lifecycle_callback_s cbs = { + .create = _create, + .terminate = _terminate, + .pause = _pause, + .resume = _resume, + .app_control = _control, + }; + + memset(&ad, 0x00, sizeof(ad)); + ad.name = PACKAGE; + + return ui_app_main(argc, argv, &cbs, &ad); +} diff --git a/src/main_view.c b/src/main_view.c new file mode 100644 index 0000000..a159cdf --- /dev/null +++ b/src/main_view.c @@ -0,0 +1,118 @@ +/* + * 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 "main_view.h" + +struct _priv { + Evas_Object *base; +}; + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + + 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_MAIN_VIEW); + + evas_object_size_hint_weight_set(base, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + priv->base = base; + viewmgr_set_view_data(VIEW_MAIN, priv); + + return base; +} + +static void _show(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = (struct _priv *) view_data; + + evas_object_show(priv->base); +} + +static void _hide(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = (struct _priv *) view_data; + + 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 = (struct _priv *) view_data; + + evas_object_del(priv->base); + + free(priv); +} + +static view_class vclass = { + .view_id = VIEW_MAIN, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_main_get_vclass(void) +{ + return &vclass; +} -- 2.7.4 From 5079c3495657d255a0182300435d4e7926f46094 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 1 Jul 2015 10:19:45 +0900 Subject: [PATCH 03/14] Add channelinfo view Change-Id: Id78b567acc97d49c7acbcec4690b4b71b8f84533 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 11 +- data/live-tv.edc | 14 +- data/view/channelinfo.edc | 211 +++++ include/define.h | 27 +- include/strings.h | 23 + include/tv.h | 95 +++ include/tv_service.h | 281 +++++++ include/{main_view.h => view_channelinfo.h} | 8 +- packaging/org.tizen.live-tv.spec | 2 + res/images/ic_thumbnail_favorite_01.png | Bin 0 -> 1406 bytes res/images/ic_thumbnail_lock_01_foc.png | Bin 0 -> 1250 bytes res/images/ic_thumbnail_lock_01_nor.png | Bin 0 -> 1266 bytes src/main.c | 161 +++- src/main_view.c | 118 --- src/tv.c | 1105 +++++++++++++++++++++++++++ src/tv_service.c | 776 +++++++++++++++++++ src/view_channelinfo.c | 348 +++++++++ 17 files changed, 3029 insertions(+), 151 deletions(-) create mode 100644 data/view/channelinfo.edc create mode 100644 include/strings.h create mode 100644 include/tv.h create mode 100644 include/tv_service.h rename include/{main_view.h => view_channelinfo.h} (79%) create mode 100644 res/images/ic_thumbnail_favorite_01.png create mode 100644 res/images/ic_thumbnail_lock_01_foc.png create mode 100644 res/images/ic_thumbnail_lock_01_nor.png delete mode 100644 src/main_view.c create mode 100644 src/tv.c create mode 100644 src/tv_service.c create mode 100644 src/view_channelinfo.c diff --git a/CMakeLists.txt b/CMakeLists.txt index bf712d2..ca1a401 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ IF(NOT DEFINED RESDIR) SET(RESDIR "${PREFIX}/res") ENDIF(NOT DEFINED RESDIR) IF(NOT DEFINED IMAGEDIR) - SET(IMAGEDIR "${PREFIX}/res/images") + SET(IMAGEDIR "${PREFIX}/res/images/") ENDIF(NOT DEFINED IMAGEDIR) IF(NOT DEFINED EDJEDIR) SET(EDJEDIR "${PREFIX}/res/edje") @@ -38,7 +38,9 @@ IF(NOT DEFINED MANIFESTDIR) ENDIF(NOT DEFINED MANIFESTDIR) SET(SRCS src/main.c - src/main_view.c) + src/tv.c + src/view_channelinfo.c + src/tv_service.c) SET(TARGET_EDJ "${PROJECT_NAME}.edj") SET(THEME_EDJ "${PROJECT_NAME}-theme.edj") @@ -57,7 +59,9 @@ pkg_check_modules(PKGS REQUIRED ecore edje capi-appfw-application - app-utils) + app-utils + vconf + gobject-2.0) FOREACH(flag ${PKGS_CFLAGS}) SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}") @@ -70,5 +74,6 @@ CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR}) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/images DESTINATION ${RESDIR}) ADD_SUBDIRECTORY(data) diff --git a/data/live-tv.edc b/data/live-tv.edc index a1cfbd7..26d27bf 100644 --- a/data/live-tv.edc +++ b/data/live-tv.edc @@ -17,17 +17,5 @@ #include "../include/define.h" collections { - group { - name: GRP_MAIN_VIEW; - parts { - part { - name, PART_CONTENT; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - } - } - } - } + #include "view/channelinfo.edc" } diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc new file mode 100644 index 0000000..c0e95ad --- /dev/null +++ b/data/view/channelinfo.edc @@ -0,0 +1,211 @@ +/* + * 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, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1.relative, 1.0 0.5; + rel2.relative, 1.0 0.5; + min, 536 174; + align, 1.0 0.5; + fixed, 1 1; + } + 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; + } + } + 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; + } + } + 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; + } + } + 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, SWALLOW; + 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; + } + } + } +} diff --git a/include/define.h b/include/define.h index 42bb0dd..e11b3f4 100644 --- a/include/define.h +++ b/include/define.h @@ -17,8 +17,31 @@ #ifndef __LIVETV_DEFINE_H__ #define __LIVETV_DEFINE_H__ -#define VIEW_MAIN "VIEW_MAIN" -#define GRP_MAIN_VIEW "grp.main.view" +#include "strings.h" + +#define KEY_SVCID "svcid" + +#define VIEW_CHANNELINFO "VIEW_CHANNELINFO" #define PART_CONTENT "part.content" +#define FONT_REGULAR "TizenSans" +#define FONT_LIGHT "TizenSans:style=Light" +#define FONT_BOLD "TizenSans: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 IMG_LOCKED_NOR IMAGEDIR"ic_thumbnail_lock_01_nor.png" +#define IMG_LOCKED_FOC IMAGEDIR"ic_thumbnail_lock_01_foc.png" +#define IMG_FAVORITE_NOR IMAGEDIR"ic_thumbnail_favorite_01.png" +#define IMG_FAVORITE_FOC IMG_FAVORITE_NOR + +#define GRP_VIEW_CHANNELINFO "grp.view.channelinfo" +#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" + #endif /* __LIVETV_DEFINE_H__*/ diff --git a/include/strings.h b/include/strings.h new file mode 100644 index 0000000..026a670 --- /dev/null +++ b/include/strings.h @@ -0,0 +1,23 @@ +/* + * 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" + +#endif /* __AIR_LIVETV_STRINGS_H__*/ diff --git a/include/tv.h b/include/tv.h new file mode 100644 index 0000000..f98574a --- /dev/null +++ b/include/tv.h @@ -0,0 +1,95 @@ +/* + * 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_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_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_next(void); +int tv_channel_prev(void); +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); +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/tv_service.h b/include/tv_service.h new file mode 100644 index 0000000..bae9260 --- /dev/null +++ b/include/tv_service.h @@ -0,0 +1,281 @@ +/* + * 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 + +#define TVS_EPG_CURRENT_TIME -1 +#define PROGRAM_NAME_MAX_LEN 25 +#define CHANNEL_FILTER_STRING_MAX_LEN 100 + +/** + * An enumeration. + * Enumeration for tv service error type + */ +typedef enum +{ + TVS_ERROR_OK = 0, /**< tv service error ok */ + TVS_ERROR_NO_FREE_MEMORY = -1, /**< tv service error no free memory */ + TVS_ERROR_HANDLE_UNINITIALIZED = -2, /**< tv service error handle uninitialized */ + TVS_ERROR_RPC_CALL_FAIL = -3, /**< tv service error rpc call fail */ + TVS_ERROR_INVALID_PARAMETER = -4, /**< tv service error invalid input parameter */ + TVS_ERROR_INVALID_VALUE = -5, /**< tv service error invalid input value */ + TVS_ERROR_NOT_AVAILABLE = -6, /**< tv service error not available */ + TVS_ERROR_SEQLITE_BUSY = -7, /**< tv service error SQLite busy */ + TVS_ERROR_PROCESS_FAIL = -8, /**< tv service error process error*/ + TVS_ERROR_DATABASE_FAIL = -9, /**< tv service error database query fail*/ + TVS_ERROR_AUTHENTICATE_FAIL = -10, /**< tv service error Authenticate fail, ex, lock password match fail*/ + TVS_ERROR_UNKNOWN = -255 /**< tv service error unknown */ +} TvServiceError; + +typedef enum +{ + TV_SERVICE_CHANNEL_MODE_UNDEFINED = -1, /* Unknown mode */ + TV_SERVICE_CHANNEL_MODE_ALL, /* ALL channel mode */ + TV_SERVICE_CHANNEL_MODE_DIGITAL, /* Digital channel mode */ + TV_SERVICE_CHANNEL_MODE_ANALOG, /* Analog channel mode */ + TV_SERVICE_CHANNEL_MODE_DIGITAL_ANALOG, /* Digital & Analog channel mode*/ + TV_SERVICE_CHANNEL_MODE_FAVORITE, /* Analog channel mode */ + TV_SERVICE_CHANNEL_MODE_ALL_DIGITAL_ANALOG /* Digital & Analog channel mode (include delete channel)*/ +} TvServiceChannelMode; + +/** + * An enumeration. + * Enumeration for channel list sort type. + */ +typedef enum +{ + CHANNEL_SORT_TYPE_MAJOR_MINOR_NUMBER = 0x0, + CHANNEL_SORT_TYPE_SERVICE_ID, + CHANNEL_SORT_TYPE_PROGRAM_NAME, + CHANNEL_SORT_TYPE_MAX +} TvServiceChannelSortType; + +typedef enum +{ + TV_SERVICE_LIVE_EVENT_BEGIN, /* live event tune start*/ + TV_SERVICE_LIVE_EVENT_TUNER_LOCK, /* live event tune lock result*/ + TV_SERVICE_LIVE_EVENT_CHANNEL_LOCK, /* live event channel lock(video and audio mute)*/ + TV_SERVICE_LIVE_EVENT_CHANNEL_UNLOCK, /* live event channel unlock*/ + TV_SERVICE_LIVE_EVENT_AUTO_DESTROY, /* live event auto destroy*/ + TV_SERVICE_LIVE_EVENT_RESOLUTION /* live event resolution*/ +} TvServiceLiveEvent; +typedef void (*TvServiceLiveCallback) (TvServiceLiveEvent event, gpointer user_data, const gpointer data); +typedef struct +{ + gint freq; /**the frequence*/ + gint mod; /**the modulation*/ + gint apid; /**the audio pid*/ + gint vpid; /**the videa pid*/ + gint ppid; /**the pmt pid*/ + gint pro_num; /**the program number*/ +} TvServiceLiveTuneInfo; + +typedef struct +{ + // TvServiceGenLive *proxy; /**the live proxy object*/ + guint service_handle; /**the live service handle*/ + gint antenna_type; /**antenna type*/ + gint service_id; /**service id*/ + gint unique; /**identify*/ + TvServiceLiveTuneInfo tune_info; /**tune info*/ + TvServiceLiveCallback call_back; /**the call back function*/ + gpointer user_data; /**the user_data*/ + gpointer window_id; /**the window id*/ +} TvServiceLiveData; + +typedef gpointer TvServiceLive; + +typedef void* TvServiceEpg; + +typedef enum +{ + TVS_EPG_CREATE = 0, + TVS_EPG_DESTROY, + TVS_EPG_GET_CURRENT_PROGRAM, + TVS_EPG_GET_PROGRAM_LIST, + TVS_EPG_AUTO_DESTROY, + TVS_EPG_DATA_UPDATED +} tvs_epg_event_e; + +typedef void (*TvServiceEpgCallback) (tvs_epg_event_e type, gpointer epg_data, gpointer user_data); + +typedef struct +{ + guint service_id; + guint event_id; + guint start_time; + guint etm_location; + guint length_in_seconds; + guint8 title_text[256]; + guint current_time; + guint8 extended_text[256]; +} TvServiceEpgEventData; + +typedef enum +{ + TVS_MODULATION_TYPE_UNKNOWN = -1, + TVS_MODULATION_TYPE_QPSK, + TVS_MODULATION_TYPE_16QAM, + TVS_MODULATION_TYPE_32QAM, + TVS_MODULATION_TYPE_64QAM, + TVS_MODULATION_TYPE_128QAM, + TVS_MODULATION_TYPE_256QAM, + TVS_MODULATION_TYPE_AUTO_QAM, + TVS_MODULATION_TYPE_8VSB, + TVS_MODULATION_TYPE_16VSB, + TVS_MODULATION_TYPE_8PSK, + TVS_MODULATION_TYPE_NTSC, + TVS_MODULATION_TYPE_PAL, + TVS_MODULATION_TYPE_MAX +} TvServiceModulationTpye; +typedef enum +{ + TV_SERVICE_ANTENNA_TYPE_UNDEFINED = -1, /* Unknown type */ + TV_SERVICE_ANTENNA_TYPE_AIR, /* Antenna air type */ + TV_SERVICE_ANTENNA_TYPE_CABLE, /* Antenna cable type */ + TV_SERVICE_ANTENNA_TYPE_ALL /*Antenna all type */ +} TvServiceAntenna; +typedef enum +{ + TVS_VIDEO_TYPE_UNKNOWN = -1, + TVS_VIDEO_TYPE_MPEG2 , + TVS_VIDEO_TYPE_H264, + TVS_VIDEO_TYPE_JPEG, + TVS_VIDEO_TYPE_AVS, + TVS_VIDEO_TYPE_MAX +} TvServiceVideoType; + +typedef enum +{ + TVS_AUDIO_TYPE_UNKNOWN = -1, + TVS_AUDIO_TYPE_AC3, + TVS_AUDIO_TYPE_MPEG2, + TVS_AUDIO_TYPE_AAC, + TVS_AUDIO_TYPE_HE_AAC, + TVS_AUDIO_TYPE_MAX +} TvServiceAudioType; +typedef struct +{ + guint service_id; + guint frequency; + guint service_type; + guint channel_type; + + gulong program_number; + gulong source_id; + gulong stream_id; + gulong pcr_id; + gulong major; + gulong minor; + gulong vpid; + gulong apid; + gulong pmt_pid; + + gboolean hide_guide; + gboolean hidden; + gboolean locked; + gboolean remembered; + gboolean save_by_psi; + gboolean digital; + gboolean favorite; + + gchar program_name[PROGRAM_NAME_MAX_LEN]; + + TvServiceModulationTpye modulation_type; + TvServiceAntenna antenna_type; + TvServiceVideoType video_type; + TvServiceAudioType audio_type; +} TvServiceChannel; + +typedef enum { + CHANNEL_FILTER_MATCH_NONE = 0, + CHANNEL_FILTER_MATCH_EQUAL, + CHANNEL_FILTER_MATCH_MORE, + CHANNEL_FILTER_MATCH_LESS, + CHANNEL_FILTER_MATCH_UNEQUAL, + CHANNEL_FILTER_MATCH_CONTAIN, + CHANNEL_FILTER_MATCH_MAX +} TvServiceChannelFilterMatchType; + +typedef enum { + TV_SERVICE_CHANNEL_DATA_NONE = 0, + TV_SERVICE_CHANNEL_DATA_SERVICE_ID, + TV_SERVICE_CHANNEL_DATA_FREQUENCY, + TV_SERVICE_CHANNEL_DATA_MAJOR_NUMBER, + TV_SERVICE_CHANNEL_DATA_MINOR_NUMBER, + TV_SERVICE_CHANNEL_DATA_PROGRAM_NAME, + TV_SERVICE_CHANNEL_DATA_REMEMBERED, + TV_SERVICE_CHANNEL_DATA_MAX +} TvServiceChannelDataAttr; + +typedef struct { + TvServiceChannelDataAttr attribute; + TvServiceChannelFilterMatchType match_type; + GValue *value; +} TvServiceFilterNode; + +typedef struct { + gint identity; + // TvServiceGenEpg *proxy; + TvServiceEpgCallback cb; + gboolean cb_flag; + gpointer user_data; + GList *event_list; +} EpgProxyData; + +typedef struct { + guint service_id; + guint start_time; + guint duration; + TvServiceEpgCallback event_callback; + gpointer event_callback_userdata; +} EpgProxyEventData; + +gint tv_service_live_get_service_id (TvServiceLive live, gint * service_id); +gint tv_service_get_channel (gint service_id, TvServiceChannel * channel); +gint tv_service_get_channel_list (TvServiceChannelMode mode, TvServiceAntenna type, GList ** channels); +gint tv_service_get_channel_list_ex (TvServiceChannelMode mode, TvServiceAntenna type, GList ** channels, + GList * filter, TvServiceChannelSortType sort_type); +gint tv_service_epg_get_current_program (TvServiceEpg epg, guint service_id, TvServiceEpgCallback callback_func, gpointer user_data); +gint tv_service_epg_get_cache_current_program (TvServiceEpg epg, guint service_id, TvServiceEpgEventData * app_data); +gint tv_service_epg_get_program_list (TvServiceEpg epg, guint service_id, guint start_time, guint duration, TvServiceEpgCallback callback_func, gpointer user_data); +gint tv_service_live_create (TvServiceLive * live); +gint tv_service_live_destroy (TvServiceLive live); +gint tv_service_live_tune_locked_channel (TvServiceLive live, gint service_id, gchar * password); +gint tv_service_epg_create (TvServiceEpg * epg); +gint tv_service_epg_destroy (TvServiceEpg epg); +gint tv_service_live_get_last_channel (gint * service_id); +gint tv_service_live_get_antenna_type (TvServiceLive live, TvServiceAntenna * type); +gint tv_service_live_tune (TvServiceLive live, gint service_id); +gint tv_service_lock_channel (gint service_id, gchar * password); +gint tv_service_unlock_channel (gint service_id, gchar * password); +gint tv_service_live_tune_down(TvServiceLive live, gint channel_mode, + TvServiceAntenna antenna_type); +gint tv_service_live_tune_up(TvServiceLive live, gint channel_mode, + TvServiceAntenna antenna_type); +gint tv_service_add_favorite_channel(gint service_id); +gint tv_service_delete_favorite_channel(gint service_id); +gint tv_service_add_channel(gint service_id); +gint tv_service_delete_channel(gint service_id); +gint tv_service_live_get_audio_mute(TvServiceLive live_svc, gboolean *mute); +gint tv_service_live_set_audio_mute(TvServiceLive live_svc, gboolean mute); +gint tv_service_live_get_volume(TvServiceLive live_svc, gdouble *vol); +gint tv_service_live_set_volume(TvServiceLive live_svc, gdouble vol); +gint tv_service_live_set_window_overlay(TvServiceLive live_svc, void *window_id); +gint tv_service_channel_info_create(); +gint tv_service_channel_info_destroy(); +gint tv_service_live_register_callback(TvServiceLive live_svc, + void *_tv_service_event_cb, void *some_other_variable); diff --git a/include/main_view.h b/include/view_channelinfo.h similarity index 79% rename from include/main_view.h rename to include/view_channelinfo.h index 6beb35d..f5b01e2 100644 --- a/include/main_view.h +++ b/include/view_channelinfo.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#ifndef __LIVETV_MAIN_VIEW_H__ -#define __LIVETV_MAIN_VIEW_H__ +#ifndef __LIVETV_VIEW_CHANNELINFO_H__ +#define __LIVETV_VIEW_CHANNELINFO_H__ -view_class *view_main_get_vclass(void); +view_class *view_channelinfo_get_vclass(void); -#endif /* __LIVETV_MAIN_VIEW_H__*/ +#endif /* __LIVETV_VIEW_CHANNELINFO_H__*/ diff --git a/packaging/org.tizen.live-tv.spec b/packaging/org.tizen.live-tv.spec index 2b9626e..4b27b9c 100644 --- a/packaging/org.tizen.live-tv.spec +++ b/packaging/org.tizen.live-tv.spec @@ -12,6 +12,8 @@ BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(edje) BuildRequires: pkgconfig(app-utils) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(gobject-2.0) BuildRequires: gettext-devel BuildRequires: edje-bin diff --git a/res/images/ic_thumbnail_favorite_01.png b/res/images/ic_thumbnail_favorite_01.png new file mode 100644 index 0000000000000000000000000000000000000000..6af72f0796304885c01b6ad6ec073de3a0aeea56 GIT binary patch literal 1406 zcmbVMZA=?w9KX_n2zD)r;u|qfZ)`dO?cMc_yHKI+wWEO+Qp(nuW#QUh=>@LWT@NV4 zL{`Tlpe{0<;0K2@L6>Yy6g6hb*v6JPUF* zM*$bIpnHvO%pJ3{5w5mJWSe?CzF<#VkPM;K&x5K21qpaoVnBj#kH)El1zqE%;5@Uf zL&2Jf)Mi1~Mfu&0z%Ga^FlzM`K@7)%$)v>%Mw1CI2Ly%_It<>X3fw>$O%!1U8y5<_ ziJ>s%rJWnT;L3tVBq>JebX{Ft+Ah6T5Lrkxgo9XuPAT(kv+U$h}EMA2r((vH(s!r&zIgptf* zUD3G2M1ySBF9-c@U@ISprR*ZhNP_4Sg!XI&G)4qTh)0ANus4~&b9=dHNa%|1%A{xg zv@|PnoovV{3OrbgFU4);pP&f?38j;m(*f1n95%g^plLl}uO#(G2fBd`{hyfWpcq}I zIQ~;C*)3RsndxTf!^LLvuu<4CB5aMm=;x&fA{%$nR$pR1aBp?BT5gdQUYcvUTAw;l zHze*P&fu~|B>iITGk(R)Kux)PM&N$2TfhxPU>n$0+N>vwk7y?BcNxvcJ3Q0$v$ncI zWv^dZp;V-1FJk3^Ta%NRVsKcF`5mrn#bA){9abKFp|QB}GUF^t&3={mJvs2nv1!|4 z;kUL1@T1Mz-6XrbQX^NJFD50k`nyr4s385f;dbS{+?kP@pH(wwPerab0Bvr-+!C9* zvS*S{9xsg_`eD%a&3MkiM^h*34twtwf`&jvSmByR4kT(`>z$B zzHrCl4%{*{F$7q15>X0I^;y(M?+ziVdcgGSN3l1kTaEDsW$k#Yxz&F z_2$i$f2cV;|G~}aJIiwm?uD_319KSAYaa*fln|7@QAFnvuVRA3YU2^fY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pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`kBtHuNWFoz#!AFNG#Ad)HBe}%?0@jth%@)C>7xhtg4GcDhpEegHnt0 zON)|$@sXws(+mtd{1$-}0$pR}Uz7=ql*AmD{N&Qy)VvZ;7h5Huj9yA+ij|AGfwQTx zsgZ$&i-oI+p`nF|fuozNtEq{jo1vw-r4!5yYKL?fq0y6ST@{2R_ z3lyA#%@j1kGxJjN%ZoKZ(F5_VOKMSOS!#+~QGTuhIDD-#vDj~E%gSvZ9pyM>w{j2-#@Fd|Mb`EVXq>8 b2_!Ilei|xffBFq4s1)*a^>bP0l+XkK%>B2e literal 0 HcmV?d00001 diff --git a/src/main.c b/src/main.c index 14c9672..4a9b31d 100644 --- a/src/main.c +++ b/src/main.c @@ -17,25 +17,68 @@ #include #include #include +#include #include #include "define.h" -#include "main_view.h" +#include "view_channelinfo.h" +#include "tv.h" + +#define KEY_MAX 256 SET_TAG(PACKAGE) struct _appdata { const char *name; Evas_Object *win; + + int is_signal; +}; + +struct key_map { + const char *view; + const char *key[KEY_MAX]; +}; + +static struct key_map g_kmap[] = { + { + VIEW_CHANNELINFO, + { + KEY_ENTER, KEY_ENTER_REMOTE, KEY_CHANNELUP, + KEY_CHANNELUP_REMOTE, KEY_CHANNELDOWN, KEY_CHANNELDOWN_REMOTE + } + }, +}; + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + size_t i, j; + + for (i = 0; i < sizeof(g_kmap) / sizeof(*g_kmap); i++) { + j = 0; + while (g_kmap[i].key[j]) { + if (!strcmp(ev->keyname, g_kmap[i].key[j])) { + viewmgr_show_view(g_kmap[i].view); + viewmgr_update_view(g_kmap[i].view, ev); + return; + } + j++; + } + } +} + +static input_handler key_handler = { + .key_up = _key_up_cb, }; static Evas_Object *_add_win(const char *name) { - Evas_Object *win; + Evas_Object *win, *trans; win = elm_win_add(NULL, name, ELM_WIN_BASIC); if (!win) { - _ERR("failed to create win"); + _ERR("elm_win_add failed"); return NULL; } elm_win_alpha_set(win, EINA_FALSE); @@ -44,21 +87,93 @@ static Evas_Object *_add_win(const char *name) evas_object_show(win); + trans = evas_object_rectangle_add(evas_object_evas_get(win)); + if (!trans) { + _ERR("Create transparent layer failed"); + evas_object_del(win); + return NULL; + } + + /* for transparent layer */ + evas_object_color_set(trans, 0, 0, 0, 0); + evas_object_render_op_set(trans, EVAS_RENDER_COPY); + elm_win_resize_object_add(win, trans); + evas_object_size_hint_weight_set(trans, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(trans); + return win; } +int _set_tv_overlay(Evas_Object *win) +{ + int r; + Ecore_Wl_Window *wl_win; + + wl_win = elm_win_wl_window_get(win); + + r = tv_overlay_set(wl_win); + + return r; +} + +static void _tv_signal_cb(void *data, int is_signal) +{ + struct _appdata *ad; + + if (!data) { + _ERR("failed to get data"); + return; + } + + ad = data; + + if (ad->is_signal == is_signal) + return; + + ad->is_signal = is_signal; +} + static void _pause(void *data) { } static void _resume(void *data) { + struct _appdata *ad; + int r; + + if (!data) { + _ERR("failed to get data"); + return; + } + + ad = data; + + r = tv_resume(); + if (r < 0) { + _ERR("Resume tv service failed"); + return; + } else if (r > 0) { + r = tv_channel_tune(); + if (r < 0) { + _ERR("Tune channel failed"); + return; + } + } + + r = _set_tv_overlay(ad->win); + if (r < 0) { + _ERR("Set overlay failed"); + return; + } } static bool _create(void *data) { struct _appdata *ad; Evas_Object *win; + int r; if (!data) { _ERR("failed to get data"); @@ -75,16 +190,32 @@ static bool _create(void *data) return false; } + r = tv_create(); + if (r < 0) { + _ERR("Create TV failed"); + evas_object_del(win); + return false; + } + + r = _set_tv_overlay(ad->win); + if (r < 0) { + _ERR("Set overlay failed"); + evas_object_del(win); + return false; + } + if (!viewmgr_create(win)) { _ERR("failed to initialize viewmgr"); evas_object_del(win); return false; } - viewmgr_add_view(view_main_get_vclass(), NULL); + viewmgr_add_view(view_channelinfo_get_vclass(), NULL); ad->win = win; + tv_signal_cb_set(_tv_signal_cb, ad); + inputmgr_add_callback(ad->win, 0, &key_handler, NULL); return true; } @@ -99,7 +230,11 @@ static void _terminate(void *data) ad = data; - viewmgr_remove_view(VIEW_MAIN); + tv_destroy(); + + inputmgr_remove_callback(ad->win, &key_handler); + + viewmgr_remove_view(VIEW_CHANNELINFO); viewmgr_destroy(); if (ad->win) { @@ -110,19 +245,23 @@ static void _terminate(void *data) 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; - - if (ad->win) - elm_win_activate(ad->win); + r = app_control_get_extra_data(control, KEY_SVCID, &svcid); + if (r == SERVICE_ERROR_NONE) { + tv_channel_tune_with_service_id(atoll(svcid)); + free(svcid); + } else { + tv_channel_tune(); + } - viewmgr_push_view(VIEW_MAIN); + viewmgr_show_view(VIEW_CHANNELINFO); } int main(int argc, char *argv[]) diff --git a/src/main_view.c b/src/main_view.c deleted file mode 100644 index a159cdf..0000000 --- a/src/main_view.c +++ /dev/null @@ -1,118 +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 "main_view.h" - -struct _priv { - Evas_Object *base; -}; - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *base; - - 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_MAIN_VIEW); - - evas_object_size_hint_weight_set(base, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); - - priv->base = base; - viewmgr_set_view_data(VIEW_MAIN, priv); - - return base; -} - -static void _show(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = (struct _priv *) view_data; - - evas_object_show(priv->base); -} - -static void _hide(void *view_data) -{ - struct _priv *priv; - - if (!view_data) { - _ERR("failed to get view data"); - return; - } - - priv = (struct _priv *) view_data; - - 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 = (struct _priv *) view_data; - - evas_object_del(priv->base); - - free(priv); -} - -static view_class vclass = { - .view_id = VIEW_MAIN, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, -}; - -view_class *view_main_get_vclass(void) -{ - return &vclass; -} diff --git a/src/tv.c b/src/tv.c new file mode 100644 index 0000000..abacbe9 --- /dev/null +++ b/src/tv.c @@ -0,0 +1,1105 @@ +/* + * 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 "define.h" +#include "tv.h" +#include "tv_service.h" + +#define DEFAULT_SERVICE 1 + +/** + * 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; + + /**< 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; +} + +/** + * 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); + free(tvs_data); + } + } + + 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(tvs_data); + } + +free: + if (tvs_list) + g_list_free(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); +} + +/** + * 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; + } + + 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) { + _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; + } + + 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 (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; + + g_list_foreach(tvs_list, (GFunc) g_free, NULL); + g_list_free(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; + } + + g_tv_info.viewing_locked_channel = service_id; + + return 0; +} + +/** + * Tunes to next channel. + * + * Note that deleted channels and service channels will skipped. + * + * @return If the operation was sucessful 0 is returned; otherwise negative value is returned + */ +int tv_channel_next(void) +{ + TvServiceAntenna antenna_type; + int r; + + if (!g_tv_info.live_svc) { + _ERR("failed to get live service"); + return -1; + } + + r = tv_service_live_get_antenna_type(g_tv_info.live_svc, &antenna_type); + if (r < 0) { + _ERR("failed to get antenna type"); + return -1; + } + + r = tv_service_live_tune_up(g_tv_info.live_svc, + TV_SERVICE_CHANNEL_MODE_DIGITAL_ANALOG, antenna_type); + if (r < 0) { + _ERR("failed to tune up"); + return -1; + } + + g_tv_info.viewing_locked_channel = -1; + + return 0; +} + +/** + * Tunes to previous channel. + * + * Note that deleted channels and service channels will skipped. + * + * @return If the operation was sucessful 0 is returned; otherwise negative value is returned + */ +int tv_channel_prev(void) +{ + TvServiceAntenna antenna_type; + int r; + + if (!g_tv_info.live_svc) { + _ERR("failed to get live service"); + return -1; + } + + r = tv_service_live_get_antenna_type(g_tv_info.live_svc, &antenna_type); + if (r < 0) { + _ERR("failed to get antenna type"); + return -1; + } + + r = tv_service_live_tune_down(g_tv_info.live_svc, + TV_SERVICE_CHANNEL_MODE_DIGITAL_ANALOG, antenna_type); + if (r < 0) { + _ERR("failed to tune down"); + return -1; + } + + g_tv_info.viewing_locked_channel = -1; + + 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; +} + +/** + * Sets window id for tv overlay. + * + * @param window_id The window id to overlay + * @return If the operation was sucessful 0 is returned; otherwise negative value is returned + */ +int tv_overlay_set(void *window_id) +{ + int r; + + if (!g_tv_info.live_svc) { + _ERR("failed to get live service"); + return -1; + } + + r = tv_service_live_set_window_overlay(g_tv_info.live_svc, window_id); + if (r < 0) { + _ERR("failed to set overlay"); + return -1; + } + + return 0; +} + +/** + * 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) { + r = tv_service_live_destroy(g_tv_info.live_svc); + if (r != TVS_ERROR_OK) + _ERR("failed to destroy live service"); + 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; + } + + 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) +{ + 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) + return 0; + + 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; + +err: + tv_destroy(); + return -1; +} diff --git a/src/tv_service.c b/src/tv_service.c new file mode 100644 index 0000000..ea18fe7 --- /dev/null +++ b/src/tv_service.c @@ -0,0 +1,776 @@ +/* + * 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 "tv.h" +#include "tv_service.h" + +#define DEFAULT_TIMER_INTERVAL 1.0 +#define TVS_VOLUME_MIN 0.0 +#define TVS_VOLUME_MAX 10.0 +#define TVS_PASSWORD "0000" + +#define VCONF_CHANNEL "db/menu/broadcasting/last_channel" + +struct dummy_tv_service_struct +{ + guint service_id; + TvServiceEpgCallback callback_func; + gpointer user_data; +}; + +struct _tv_service_info +{ + gdouble volume; + gboolean is_mute; +}; + +struct _tv_service_info tv_service_info; +GList *channel_list = NULL, *program_list = NULL; + +static void init_constant_channel_data(TvServiceChannel *channel) +{ + memset(channel, 0, sizeof(TvServiceChannel)); + + channel->frequency = 567000000; + channel->service_type = 2; + channel->channel_type = 0; + + channel->program_number = 1; + channel->source_id = 1; + // channel->stream_id = + channel->pcr_id = 17; + channel->minor = 1; + channel->vpid = 17; + // channel->apid = + channel->pmt_pid =16; + + channel->hide_guide = FALSE; + channel->hidden = FALSE; + channel->locked = FALSE; + channel->remembered = TRUE; + channel->save_by_psi = TRUE; + channel->digital = TRUE; + + channel->modulation_type = TVS_MODULATION_TYPE_8VSB; + channel->antenna_type = TV_SERVICE_ANTENNA_TYPE_CABLE; + channel->video_type = TVS_VIDEO_TYPE_MPEG2; + channel->audio_type = TVS_AUDIO_TYPE_AAC; +} + +/* Creates 3 programs for each channel (service_id) + * with one hour duration each. +*/ +static void init_program_data(int service_id, struct timeval tv) +{ + GList *epg_program_glist = NULL; + int i; + for (i = 0; i < 15; i++) + { + TvServiceEpgEventData *epg_data = NULL; + epg_data = (TvServiceEpgEventData *)g_malloc0 (sizeof(TvServiceEpgEventData)); + memset(epg_data, 0, sizeof(TvServiceEpgEventData)); + + epg_data->service_id = service_id; + // epg_data->event_id = + if (i == 0 && service_id % 2 == 0) + { + // Start first programs of some channels 30 minutes earlier than current time + // and substitute the difference with length + epg_data->start_time = tv.tv_sec - 30 * 60; + epg_data->length_in_seconds = 90 * 60; + } else { + epg_data->start_time = tv.tv_sec + i * 60 * 60; + epg_data->length_in_seconds = 60 * 60; + } + epg_data->etm_location= 1; + snprintf(epg_data->title_text, 255, "Awesome Program %d", i + 1); + snprintf(epg_data->extended_text, 255, "Description of Awesome Program %d", i + 1); + epg_data->current_time = tv.tv_sec; + epg_program_glist = g_list_append (epg_program_glist, epg_data); + } + program_list = g_list_append(program_list, (gpointer)epg_program_glist); +} + +static void init_data() +{ + struct timeval tv; + gettimeofday(&tv, NULL); + int i; + for (i = 1; i < 6; i++) + { + TvServiceChannel *channel = NULL; + channel = (TvServiceChannel *)g_malloc0(sizeof(TvServiceChannel)); + init_constant_channel_data(channel); + channel->service_id = i; + channel->major = (5 + i); + channel->favorite = i % 2 == 0 ? TRUE : FALSE; + snprintf(channel->program_name, PROGRAM_NAME_MAX_LEN - 1, "Super Channel %d", i); + channel_list = g_list_append(channel_list, (gpointer)channel); + init_program_data(i, tv); + } + + tv_service_info.volume = TVS_VOLUME_MAX / 2; + tv_service_info.is_mute = FALSE; +} + +/* 9 */ +gint tv_service_live_get_service_id(TvServiceLive live, gint *service_id) +{ + TvServiceLiveData *live_proxy; + + if (!live || !service_id) + return TVS_ERROR_NOT_AVAILABLE; + + live_proxy = (TvServiceLiveData *)live; + *service_id = live_proxy->service_id; + + _DBG("service_id = %d", *service_id); + + return TVS_ERROR_OK; +} + +/* 10 */ +gint tv_service_get_channel(gint service_id, TvServiceChannel *channel) +{ + _DBG("service_id = %d", service_id); + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + TvServiceChannel *local_channel = NULL; + local_channel = (TvServiceChannel *)g_list_nth_data(channel_list, service_id - 1); + memcpy(channel, local_channel, sizeof(TvServiceChannel)); + + return TVS_ERROR_OK; +} + +/* We intentionally make a new copy of the channel_list, + * because live-tv frees the list internally + */ +TvServiceChannel *first_match_channel = NULL; +static gint _get_channel_list(TvServiceChannelMode channel_mode, TvServiceAntenna antenna_type, GList **channels, + GList *filter, TvServiceChannelSortType sort_type) +{ + GList *tmp_list = NULL; + TvServiceChannel *from, *to; + int i, size = g_list_length(channel_list); + if (filter == NULL) + { + // return the whole list + for (i = 0; i < size; i++) + { + from = g_list_nth_data(channel_list, i); + to = (TvServiceChannel *)malloc(sizeof(TvServiceChannel)); + memcpy(to, from, sizeof(TvServiceChannel)); + tmp_list = g_list_append(tmp_list, to); + } + *channels = tmp_list; + return TVS_ERROR_OK; + } + + TvServiceFilterNode *filter_node; + // FIXME: g_list_length(filter) is always 1, why? + filter_node = g_list_nth_data(filter, 0); + switch (filter_node->attribute) + { + case TV_SERVICE_CHANNEL_DATA_MAJOR_NUMBER: + case TV_SERVICE_CHANNEL_DATA_MINOR_NUMBER: + if (filter_node->match_type == CHANNEL_FILTER_MATCH_CONTAIN) + { + _DBG("CHANNEL_FILTER_MATCH_CONTAIN"); + gchar *str_value; + str_value = (gchar *)g_value_get_string((const GValue *)filter_node->value); + gulong gul_major_minor; + int length; + for (i = 0; i < size; i++) + { + from = g_list_nth_data(channel_list, i); + gul_major_minor = filter_node->attribute == TV_SERVICE_CHANNEL_DATA_MAJOR_NUMBER + ? from->major : from->minor; + length = snprintf(NULL, 0, "%lu", gul_major_minor); + char char_major_minor[length + 1]; + snprintf(char_major_minor, length + 1, "%lu", gul_major_minor); + if (strstr(char_major_minor, str_value)) + { + if (first_match_channel == NULL) + { + // reserve a copy for CHANNEL_FILTER_MATCH_EQUAL + first_match_channel = (TvServiceChannel *)malloc(sizeof(TvServiceChannel)); + memcpy(first_match_channel, from, sizeof(TvServiceChannel)); + } + to = (TvServiceChannel *)malloc(sizeof(TvServiceChannel)); + memcpy(to, from, sizeof(TvServiceChannel)); + tmp_list = g_list_append(tmp_list, to); + } + } + } + else + { + // FIXME: filter_node->value is always NULL at this point, why? + // gint *int_value; + // int_value = g_value_get_int(filter_node->value); + if (filter_node->match_type == CHANNEL_FILTER_MATCH_EQUAL) + { + _DBG("CHANNEL_FILTER_MATCH_EQUAL"); + if (first_match_channel) + { + tmp_list = g_list_append(tmp_list, first_match_channel); + first_match_channel = NULL; + } + } + else if (filter_node->match_type == CHANNEL_FILTER_MATCH_MORE) + { + _DBG("[NOT IMPLEMENTED YET] channel_filter_match_more"); + } + else if (filter_node->match_type == CHANNEL_FILTER_MATCH_LESS) + { + _DBG("[NOT IMPLEMENTED YET] channel_filter_match_less"); + } + else if (filter_node->match_type == CHANNEL_FILTER_MATCH_UNEQUAL) + { + _DBG("[NOT IMPLEMENTED YET] channel_filter_match_unequal"); + } + else + { + _ERR("match_type[%d] is out of range", filter_node->match_type); + return TVS_ERROR_PROCESS_FAIL; + } + } + break; + case TV_SERVICE_CHANNEL_DATA_SERVICE_ID: + case TV_SERVICE_CHANNEL_DATA_FREQUENCY: + case TV_SERVICE_CHANNEL_DATA_REMEMBERED: + case TV_SERVICE_CHANNEL_DATA_PROGRAM_NAME: + _DBG("case %d is not implemented yet", filter_node->attribute); + break; + default: + _ERR("attribute[%d] is out of range", filter_node->attribute); + return TVS_ERROR_PROCESS_FAIL; + } + + if (g_list_length(tmp_list) < 1) { + first_match_channel = NULL; + *channels = NULL; + return TVS_ERROR_PROCESS_FAIL; + } + *channels = tmp_list; + return TVS_ERROR_OK; +} + +gint tv_service_get_channel_list(TvServiceChannelMode mode, TvServiceAntenna antenna_type, GList **channels) +{ + _DBG(""); + return _get_channel_list(mode, antenna_type, channels, NULL, 0); +} + +gint tv_service_get_channel_list_ex(TvServiceChannelMode mode, TvServiceAntenna antenna_type, GList **channels, + GList *filter, TvServiceChannelSortType sort_type) +{ + _DBG(""); + return _get_channel_list(mode, antenna_type, channels, filter, sort_type); +} + +static Eina_Bool _tv_service_epg_get_current_program_cb(void *data) +{ + struct dummy_tv_service_struct *tvs_epg; + tvs_epg = data; + TvServiceEpgCallback callback_func = tvs_epg->callback_func; + callback_func(TVS_EPG_GET_CURRENT_PROGRAM, + g_list_nth_data(program_list, tvs_epg->service_id - 1), + tvs_epg->user_data); + free(tvs_epg); + + return ECORE_CALLBACK_CANCEL; +} + +/* 11 */ +gint tv_service_epg_get_current_program(TvServiceEpg epg, guint service_id, + TvServiceEpgCallback callback_func, gpointer user_data) +{ + _DBG("service_id = %d", service_id); + if (service_id < 1 || g_list_length(channel_list) < service_id) + { + return TVS_ERROR_NOT_AVAILABLE; + } + + struct dummy_tv_service_struct *tvs_epg; + tvs_epg = calloc(1, sizeof(*tvs_epg)); + tvs_epg->service_id = service_id; + tvs_epg->callback_func = callback_func; + tvs_epg->user_data = user_data; + ecore_timer_add(DEFAULT_TIMER_INTERVAL, _tv_service_epg_get_current_program_cb, tvs_epg); + + return TVS_ERROR_OK; +} + +gint tv_service_epg_get_cache_current_program(TvServiceEpg epg, guint service_id, + TvServiceEpgEventData *app_data) +{ + _DBG("service_id = %d", service_id); + if (service_id < 1 || g_list_length(channel_list) < service_id) + { + return TVS_ERROR_NOT_AVAILABLE; + } + struct timeval tv; + gettimeofday(&tv, NULL); + GList *prog_list = NULL; + prog_list = g_list_nth_data(program_list, service_id - 1); + TvServiceEpgEventData *epg_data = NULL; + gint result = TVS_ERROR_NOT_AVAILABLE; + int i; + for (i = 0; i < g_list_length(prog_list); i++) + { + epg_data = (TvServiceEpgEventData *)g_list_nth_data(prog_list, i); + if (epg_data == NULL) + { + continue; + } + if (epg_data->start_time <= tv.tv_sec && + epg_data->start_time + epg_data->length_in_seconds > tv.tv_sec) + { + app_data->service_id = epg_data->service_id; + app_data->event_id = epg_data->event_id; + app_data->start_time = epg_data->start_time; + app_data->etm_location = epg_data->etm_location; + app_data->length_in_seconds = epg_data->length_in_seconds; + g_stpcpy ((gchar *)app_data->title_text, (gchar *)epg_data->title_text); + g_stpcpy ((gchar *)app_data->extended_text, (gchar *)epg_data->extended_text); + app_data->current_time = tv.tv_sec; + result = TVS_ERROR_OK; + break; + } + } + + return result; +} + +gint tv_service_epg_get_program_list(TvServiceEpg epg, guint service_id, + guint start_time, guint duration, + TvServiceEpgCallback callback_func, gpointer user_data) +{ + _DBG("service_id = %d", service_id); + if (service_id < 1 || g_list_length(channel_list) < service_id) + { + return TVS_ERROR_NOT_AVAILABLE; + } + + struct dummy_tv_service_struct *tvs_epg; + tvs_epg = calloc(1, sizeof(*tvs_epg)); + tvs_epg->service_id = service_id; + tvs_epg->callback_func = callback_func; + tvs_epg->user_data = user_data; + ecore_timer_add(DEFAULT_TIMER_INTERVAL, _tv_service_epg_get_current_program_cb, tvs_epg); + + return TVS_ERROR_OK; +} + +/* 7 */ +gint tv_service_live_tune(TvServiceLive live, gint service_id) +{ + TvServiceLiveData *live_proxy; + + if (!live) + return TVS_ERROR_NOT_AVAILABLE; + + _DBG("service_id = %d", service_id); + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + live_proxy = (TvServiceLiveData *)live; + live_proxy->service_id = service_id; + + vconf_set_int(VCONF_CHANNEL, service_id); + + return TVS_ERROR_OK; +} + +static gboolean _check_lock_unlock_password(gchar *password) +{ + if (g_strcmp0(TVS_PASSWORD, password)) + { + return FALSE; + } + return TRUE; +} + +gint tv_service_live_tune_locked_channel(TvServiceLive live, gint service_id, gchar * password) +{ + if (!live) + return TVS_ERROR_HANDLE_UNINITIALIZED; + + if (!password) { + _ERR("Password is NULL"); + return TVS_ERROR_INVALID_PARAMETER; + } + + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + TvServiceChannel *channel = NULL; + channel = (TvServiceChannel *)g_list_nth_data(channel_list, service_id - 1); + if (!channel) + return TVS_ERROR_NOT_AVAILABLE; + + if (_check_lock_unlock_password(password)) + return TVS_ERROR_OK; + else + return TVS_ERROR_AUTHENTICATE_FAIL; +} + +gint tv_service_live_tune_up(TvServiceLive live, gint channel_mode, TvServiceAntenna antenna_type) +{ + TvServiceLiveData *live_proxy; + gint service_id; + + if (!live) + return TVS_ERROR_NOT_AVAILABLE; + + live_proxy = (TvServiceLiveData *)live; + service_id = (live_proxy->service_id) % g_list_length(channel_list) + 1; + + return tv_service_live_tune(live, service_id); +} + +gint tv_service_live_get_antenna_type(TvServiceLive live, TvServiceAntenna *type) +{ + _DBG(""); + TvServiceLiveData *live_proxy; + live_proxy = (TvServiceLiveData *)live; + *type = live_proxy->antenna_type; + + return TVS_ERROR_OK; +} + +/* 6 */ +gint tv_service_live_get_last_channel(gint *service_id) +{ + gint r = -1; + + r = vconf_get_int(VCONF_CHANNEL, service_id); + if (r < 0) + return TVS_ERROR_NOT_AVAILABLE; + + if ((*service_id) < 1) + return TVS_ERROR_NOT_AVAILABLE; + + return TVS_ERROR_OK; +} + +gint tv_service_live_tune_down(TvServiceLive live, gint channel_mode, + TvServiceAntenna antenna_type) +{ + TvServiceLiveData *live_proxy; + gint service_id; + + if (!live) + return TVS_ERROR_NOT_AVAILABLE; + + live_proxy = (TvServiceLiveData *)live; + service_id = live_proxy->service_id - 1; + if (service_id == 0) + service_id = g_list_length(channel_list); + + return tv_service_live_tune(live, service_id); +} + +gint tv_service_add_favorite_channel(gint service_id) +{ + TvServiceChannel *channel = NULL; + + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + channel = (TvServiceChannel *) g_list_nth_data(channel_list, service_id - 1); + if (!channel) + return TVS_ERROR_NOT_AVAILABLE; + + channel->favorite = TRUE; + + return TVS_ERROR_OK; +} + +gint tv_service_delete_favorite_channel(gint service_id) +{ + TvServiceChannel *channel = NULL; + + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + channel = (TvServiceChannel *) g_list_nth_data(channel_list, service_id - 1); + if (!channel) + return TVS_ERROR_NOT_AVAILABLE; + + channel->favorite = FALSE; + + return TVS_ERROR_OK; +} + +gint tv_service_add_channel(gint service_id) +{ + TvServiceChannel *channel = NULL; + + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + channel = (TvServiceChannel *) g_list_nth_data(channel_list, service_id - 1); + if (!channel) + return TVS_ERROR_NOT_AVAILABLE; + + channel->remembered = TRUE; + + return TVS_ERROR_OK; +} + +gint tv_service_delete_channel(gint service_id) +{ + TvServiceChannel *channel = NULL; + + if (service_id < 1 || g_list_length(channel_list) < service_id) + return TVS_ERROR_NOT_AVAILABLE; + + channel = (TvServiceChannel *) g_list_nth_data(channel_list, service_id - 1); + if (!channel) + return TVS_ERROR_NOT_AVAILABLE; + + channel->remembered = FALSE; + + return TVS_ERROR_OK; +} + +gint tv_service_lock_channel(gint service_id, gchar *password) +{ + if (!password) + { + _ERR("Password is NULL"); + return TVS_ERROR_INVALID_PARAMETER; + } + if (service_id < 1 || g_list_length(channel_list) < service_id) + { + return TVS_ERROR_NOT_AVAILABLE; + } + TvServiceChannel *channel = NULL; + channel = (TvServiceChannel *)g_list_nth_data(channel_list, service_id - 1); + if (!channel) + { + return TVS_ERROR_NOT_AVAILABLE; + } + if (channel->locked) + { + // if channel is already locked, simply return success code + return TVS_ERROR_OK; + } + + if (_check_lock_unlock_password(password)) + { + channel->locked = TRUE; + return TVS_ERROR_OK; + } + + return TVS_ERROR_AUTHENTICATE_FAIL; +} + +gint tv_service_unlock_channel(gint service_id, gchar *password) +{ + if (!password) + { + _ERR("Password is NULL"); + return TVS_ERROR_INVALID_PARAMETER; + } + if (service_id < 1 || g_list_length(channel_list) < service_id) + { + return TVS_ERROR_NOT_AVAILABLE; + } + TvServiceChannel *channel = NULL; + channel = (TvServiceChannel *)g_list_nth_data(channel_list, service_id - 1); + if (!channel) + { + return TVS_ERROR_NOT_AVAILABLE; + } + if (!channel->locked) + { + // if channel is already unlocked, simply return success code + return TVS_ERROR_OK; + } + + if (_check_lock_unlock_password(password)) + { + channel->locked = FALSE; + return TVS_ERROR_OK; + } + + return TVS_ERROR_AUTHENTICATE_FAIL; +} + +gint tv_service_live_get_audio_mute(TvServiceLive live_svc, gboolean *mute) +{ + if (!live_svc) + return TVS_ERROR_HANDLE_UNINITIALIZED; + + if (!mute) + return TVS_ERROR_INVALID_PARAMETER; + + *mute = tv_service_info.is_mute; + + return TVS_ERROR_OK; +} + +gint tv_service_live_set_audio_mute(TvServiceLive live_svc, gboolean mute) +{ + if (!live_svc) + return TVS_ERROR_HANDLE_UNINITIALIZED; + + if (mute != TRUE && mute != FALSE) + return TVS_ERROR_INVALID_VALUE; + + tv_service_info.is_mute = mute; + + return TVS_ERROR_OK; +} + +gint tv_service_live_get_volume(TvServiceLive live_svc, gdouble *vol) +{ + if (!live_svc) + return TVS_ERROR_HANDLE_UNINITIALIZED; + + if (!vol) + return TVS_ERROR_INVALID_PARAMETER; + + *vol = tv_service_info.volume; + + return TVS_ERROR_OK; +} + +gint tv_service_live_set_volume(TvServiceLive live_svc, gdouble vol) +{ + if (!live_svc) + return TVS_ERROR_HANDLE_UNINITIALIZED; + + if (vol < TVS_VOLUME_MIN || vol > TVS_VOLUME_MAX) + return TVS_ERROR_INVALID_VALUE; + + tv_service_info.is_mute = FALSE; + tv_service_info.volume = vol; + + return TVS_ERROR_OK; +} + +/* 5 */ +/* 8 */ +gint tv_service_live_set_window_overlay(TvServiceLive live_svc, void *window_id) +{ + _DBG(""); + return 0; +} + +/* 1 */ +gint tv_service_live_create(TvServiceLive *live) +{ + _DBG(""); + init_data(); + TvServiceLiveData *local = NULL; + local = (TvServiceLiveData*)g_malloc0 (sizeof (TvServiceLiveData)); + // local->service_handle = + local->antenna_type = TV_SERVICE_ANTENNA_TYPE_CABLE; + local->service_id = -1; + // local->unique = + + local->tune_info.freq = 567000000; + local->tune_info.mod = 7; + // local->tune_info.apid = + local->tune_info.vpid = 17; + local->tune_info.ppid = 17; + local->tune_info.pro_num = 1; + + // local->call_back = + // local->user_data = + // local->window_id = + + *live = (TvServiceLive)local; + + return TVS_ERROR_OK; +} + +void _free_program_data(gpointer data) +{ + GList *epg_program_glist; + epg_program_glist = (GList *) data; + if (epg_program_glist) + g_list_free_full(epg_program_glist, (GDestroyNotify)g_free); +} + +gint tv_service_live_destroy(TvServiceLive live) +{ + _DBG(""); + g_list_free_full(program_list, (GDestroyNotify) _free_program_data); + g_list_free_full(channel_list, (GDestroyNotify)g_free); + + TvServiceLiveData *live_proxy; + live_proxy = (TvServiceLiveData *)live; + g_free (live_proxy); + live_proxy = NULL; + + return TVS_ERROR_OK; +} + +/* 2 */ +gint tv_service_live_register_callback(TvServiceLive live_svc, + void *_tv_service_event_cb, void *some_other_variable) +{ + _DBG(""); + return 0; +} + +/* 3 */ +gint tv_service_channel_info_create() +{ + _DBG(""); + return 0; +} + +gint tv_service_channel_info_destroy() +{ + _DBG(""); + return 0; +} + +/* 4 */ +gint tv_service_epg_create(TvServiceEpg * epg) +{ + _DBG(""); + EpgProxyData *proxy_data = NULL; + proxy_data = (EpgProxyData *)g_malloc0 (sizeof (EpgProxyData)); + // proxy_data->identity = identity; + proxy_data->event_list = NULL; + proxy_data->cb_flag = FALSE; + *epg = proxy_data; + + return TVS_ERROR_OK; +} + +gint tv_service_epg_destroy(TvServiceEpg epg) +{ + _DBG(""); + EpgProxyData *proxy_data = (EpgProxyData *)epg; + // g_object_unref (proxy_data->proxy); + g_list_free_full (proxy_data->event_list, (GDestroyNotify)g_free); + g_free (proxy_data); + + return TVS_ERROR_OK; +} diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c new file mode 100644 index 0000000..365a0f8 --- /dev/null +++ b/src/view_channelinfo.c @@ -0,0 +1,348 @@ +/* + * 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 "tv.h" +#include "view_channelinfo.h" + +#define HIDE_DUR 10.0 +#define BUF_MAX 128 +#define STATUS_BOX_PADDING 10 + +struct _priv { + Evas_Object *base; + Ecore_Timer *hide_timer; + const struct tv_channel_info *channel_info; +}; + +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 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) { + _ERR("failed to get priv"); + return; + } + + if (priv->hide_timer) + ecore_timer_reset(priv->hide_timer); + else + priv->hide_timer = ecore_timer_add(HIDE_DUR, _hide_timer, priv); +} + +static void _add_icon(Evas_Object *box, const char *file) +{ + Evas_Object *ic; + + ic = elm_icon_add(box); + if (!ic) { + _ERR("failed to create icon"); + return; + } + + elm_image_file_set(ic, file, NULL); + elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE); + elm_image_no_scale_set(ic, EINA_TRUE); + evas_object_show(ic); + + elm_box_pack_end(box, ic); +} + +static void _pack_icon_box(struct _priv *priv, + const struct tv_channel_info *channel_info) +{ + Evas_Object *box; + + if (!priv) { + _ERR("failed to get priv"); + return; + } + + box = elm_box_add(priv->base); + if (!box) { + _ERR("failed to create box"); + return; + } + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_horizontal_set(box, EINA_TRUE); + elm_box_padding_set(box, STATUS_BOX_PADDING, 0); + elm_box_align_set(box, 1.0, 0.5); + elm_object_part_content_set(priv->base, PART_CHANNELINFO_STATUS, box); + + if (channel_info->locked) + _add_icon(box, IMG_LOCKED_NOR); + if (channel_info->favorite) + _add_icon(box, IMG_FAVORITE_NOR); +} + +static void _load_channel_text(struct _priv *priv, + const struct tv_channel_info *channel_info) +{ + char buf[BUF_MAX]; + + if (!priv || !channel_info) { + _ERR("failed to get priv and channel info"); + return; + } + + 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(priv->base, + PART_CHANNELINFO_CHANNEL, buf); + + elm_object_part_text_set(priv->base, + PART_CHANNELINFO_TITLE, + STR_NOTITLE); + elm_object_part_text_set(priv->base, + PART_CHANNELINFO_TIME, + STR_NOTIME); +} + +static void _load_program_info(struct _priv *priv, + const struct tv_program_info *prog) +{ + char buf[BUF_MAX]; + int r; + + if (!priv || !prog) { + _ERR("failed to get priv and program data"); + 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(priv->base, + PART_CHANNELINFO_TIME, buf); + } + + if (strlen(prog->prog_title) > 0) + elm_object_part_text_set(priv->base, + PART_CHANNELINFO_TITLE, prog->prog_title); +} + +static void _tv_program_cb(Eina_List *prog_list, void *data) +{ + struct _priv *priv; + struct tv_program_info *prog = NULL; + + if (!data) { + _ERR("failed to get data"); + return; + } + + priv = data; + + prog = (struct tv_program_info *) eina_list_nth(prog_list, 0); + if (prog) { + if (priv->channel_info && + prog->service_id != priv->channel_info->service_id) + return; + else + _load_program_info(priv, prog); + } else { + _ERR("failed to get tv_program_info"); + } + + _start_hide_timer(priv); +} + +static void _update_channel_info(struct _priv *priv) +{ + struct tv_program_request *prog_req; + int r; + + if (!priv) { + _ERR("failed to get priv"); + return; + } + + 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; + } + + if (priv->hide_timer) { + ecore_timer_del(priv->hide_timer); + priv->hide_timer = NULL; + } + + _load_channel_text(priv, priv->channel_info); + _pack_icon_box(priv, priv->channel_info); + + prog_req = calloc(1, sizeof(*prog_req)); + prog_req->tv_program_cb = _tv_program_cb; + prog_req->user_data = priv; + r = tv_epg_get_program(priv->channel_info->service_id, + prog_req); + if (r < 0) + _start_hide_timer(priv); +} + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + + 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_CHANNELINFO); + + evas_object_size_hint_weight_set(base, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + priv->base = base; + viewmgr_set_view_data(VIEW_CHANNELINFO, priv); + + return base; +} + +static void _show(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + _update_channel_info(priv); + + evas_object_show(priv->base); +} + +static void _hide(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + 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 view_class vclass = { + .view_id = VIEW_CHANNELINFO, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_channelinfo_get_vclass(void) +{ + return &vclass; +} -- 2.7.4 From 7894a76bf92cba6de98141d0211ffec377168a5f Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Thu, 2 Jul 2015 14:36:52 +0900 Subject: [PATCH 04/14] Migrate from channelinfo view to channelinfo layout Change-Id: Ie31e582fd2f0048f9194638556e672c14dd73943 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 1 + data/view/channelinfo.edc | 56 +++++++ include/define.h | 12 +- include/layout_channelinfo.h | 22 +++ src/layout_channelinfo.c | 359 +++++++++++++++++++++++++++++++++++++++++++ src/view_channelinfo.c | 254 ++---------------------------- 6 files changed, 465 insertions(+), 239 deletions(-) create mode 100644 include/layout_channelinfo.h create mode 100644 src/layout_channelinfo.c diff --git a/CMakeLists.txt b/CMakeLists.txt index ca1a401..566aebf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ ENDIF(NOT DEFINED MANIFESTDIR) SET(SRCS src/main.c src/tv.c src/view_channelinfo.c + src/layout_channelinfo.c src/tv_service.c) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc index c0e95ad..b30785c 100644 --- a/data/view/channelinfo.edc +++ b/data/view/channelinfo.edc @@ -20,6 +20,25 @@ group { name, GRP_VIEW_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 0; + align, 1.0 0.5; + fixed, 1 0; + } + } + } +} + +group { + name, GRP_CHANNELINFO; + parts { + part { name, "bg"; type, RECT; scale, 1; @@ -80,6 +99,11 @@ group { 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"; @@ -124,6 +148,11 @@ group { 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"; @@ -168,6 +197,11 @@ group { 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"; @@ -208,4 +242,26 @@ group { } } } + programs { + program { + name, "focused"; + signal, SIGNAL_FOCUSED; + source, SOURCE_ELM; + 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; + action, STATE_SET "default" 0.0; + target, "bg"; + target, PART_CHANNELINFO_CHANNEL; + target, PART_CHANNELINFO_TITLE; + target, PART_CHANNELINFO_TIME; + } + } } diff --git a/include/define.h b/include/define.h index e11b3f4..e544292 100644 --- a/include/define.h +++ b/include/define.h @@ -21,8 +21,13 @@ #define KEY_SVCID "svcid" -#define VIEW_CHANNELINFO "VIEW_CHANNELINFO" -#define PART_CONTENT "part.content" +#define PART_CONTENT "elm.swallow.content" + +#define SOURCE_PROGRAM "program" +#define SOURCE_ELM "elm" + +#define SIGNAL_FOCUSED "elm,action,focus" +#define SIGNAL_UNFOCUSED "elm,action,unfocus" #define FONT_REGULAR "TizenSans" #define FONT_LIGHT "TizenSans:style=Light" @@ -38,7 +43,10 @@ #define IMG_FAVORITE_NOR IMAGEDIR"ic_thumbnail_favorite_01.png" #define IMG_FAVORITE_FOC IMG_FAVORITE_NOR +#define VIEW_CHANNELINFO "VIEW_CHANNELINFO" +#define LAYOUT_CHANNELINFO "LAYOUT_CHANNELINFO" #define GRP_VIEW_CHANNELINFO "grp.view.channelinfo" +#define GRP_CHANNELINFO "grp.channelinfo" #define PART_CHANNELINFO_CHANNEL "part.channelinfo.channel" #define PART_CHANNELINFO_TITLE "part.channelinfo.title" #define PART_CHANNELINFO_TIME "part.channelinfo.time" diff --git a/include/layout_channelinfo.h b/include/layout_channelinfo.h new file mode 100644 index 0000000..5ae049a --- /dev/null +++ b/include/layout_channelinfo.h @@ -0,0 +1,22 @@ +/* + * 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/src/layout_channelinfo.c b/src/layout_channelinfo.c new file mode 100644 index 0000000..0a5af8a --- /dev/null +++ b/src/layout_channelinfo.c @@ -0,0 +1,359 @@ +/* + * 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" + +#define HIDE_DUR 10.0 +#define BUF_MAX 128 +#define STATUS_BOX_PADDING 10 + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + + Ecore_Timer *hide_timer; + layoutmgr *lmgr; + const struct tv_channel_info *channel_info; +}; + +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 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 void _add_icon(Evas_Object *box, const char *file) +{ + Evas_Object *ic; + + ic = elm_icon_add(box); + if (!ic) { + _ERR("failed to create icon"); + return; + } + + elm_image_file_set(ic, file, NULL); + elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE); + elm_image_no_scale_set(ic, EINA_TRUE); + evas_object_show(ic); + + elm_box_pack_end(box, ic); +} + +static void _pack_icon_box(struct _priv *priv, + const struct tv_channel_info *channel_info) +{ + Evas_Object *box; + + if (!priv) { + _ERR("failed to get priv"); + return; + } + + box = elm_box_add(priv->layout); + if (!box) { + _ERR("failed to create box"); + return; + } + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_horizontal_set(box, EINA_TRUE); + elm_box_padding_set(box, STATUS_BOX_PADDING, 0); + elm_box_align_set(box, 1.0, 0.5); + elm_object_part_content_set(priv->layout, PART_CHANNELINFO_STATUS, box); + + if (channel_info->locked) + _add_icon(box, IMG_LOCKED_NOR); + if (channel_info->favorite) + _add_icon(box, IMG_FAVORITE_NOR); +} + +static void _load_channel_text(struct _priv *priv, + const struct tv_channel_info *channel_info) +{ + char buf[BUF_MAX]; + + if (!priv || !channel_info) { + _ERR("failed to get priv and channel info"); + return; + } + + 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(priv->layout, + PART_CHANNELINFO_CHANNEL, buf); + + elm_object_part_text_set(priv->layout, + PART_CHANNELINFO_TITLE, + STR_NOTITLE); + elm_object_part_text_set(priv->layout, + PART_CHANNELINFO_TIME, + STR_NOTIME); +} + +static void _load_program_info(struct _priv *priv, + const struct tv_program_info *prog) +{ + char buf[BUF_MAX]; + int r; + + if (!priv || !prog) { + _ERR("failed to get priv and program data"); + 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(priv->layout, + PART_CHANNELINFO_TIME, buf); + } + + if (strlen(prog->prog_title) > 0) + elm_object_part_text_set(priv->layout, + PART_CHANNELINFO_TITLE, prog->prog_title); +} + +static void _tv_program_cb(Eina_List *prog_list, void *data) +{ + struct _priv *priv; + struct tv_program_info *prog = NULL; + + if (!data) { + _ERR("failed to get data"); + return; + } + + priv = data; + + prog = (struct tv_program_info *) eina_list_nth(prog_list, 0); + if (prog) { + if (priv->channel_info && + prog->service_id != priv->channel_info->service_id) + return; + else + _load_program_info(priv, prog); + } else { + _ERR("failed to get tv_program_info"); + } + + _start_hide_timer(priv); +} + +static void _update_channel_info(struct _priv *priv) +{ + struct tv_program_request *prog_req; + int r; + + 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; + } + + _stop_hide_timer(priv); + + _load_channel_text(priv, priv->channel_info); + _pack_icon_box(priv, priv->channel_info); + + prog_req = calloc(1, sizeof(*prog_req)); + prog_req->tv_program_cb = _tv_program_cb; + prog_req->user_data = priv; + r = tv_epg_get_program(priv->channel_info->service_id, + prog_req); + if (r < 0) + _start_hide_timer(priv); +} + +bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + Evas_Object *base, *layout; + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + base = layoutmgr_get_base(lmgr); + + layout = elm_layout_add(base); + if (!layout) { + _ERR("failed to create layout"); + return false; + } + + if (!elm_layout_file_set(layout, EDJEFILE, GRP_CHANNELINFO)) + goto error; + + elm_object_content_set(base, layout); + + priv->base = base; + priv->layout = layout; + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO, priv); + + return true; + +error: + _ERR("failed to create layout"); + evas_object_del(layout); + free(priv); + + return false; +} + +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; + } + + _stop_hide_timer(priv); + + evas_object_del(priv->layout); + free(priv); +} + +void _show(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + _update_channel_info(priv); + + evas_object_show(priv->layout); +} + +void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + _stop_hide_timer(priv); + + evas_object_hide(priv->layout); +} + +void _update(void *layout_data, int update_type, int *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/view_channelinfo.c b/src/view_channelinfo.c index 365a0f8..7c9a593 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -16,248 +16,23 @@ #include #include +#include #include #include #include "define.h" #include "tv.h" -#include "view_channelinfo.h" - -#define HIDE_DUR 10.0 -#define BUF_MAX 128 -#define STATUS_BOX_PADDING 10 +#include "layout_channelinfo.h" struct _priv { Evas_Object *base; - Ecore_Timer *hide_timer; - const struct tv_channel_info *channel_info; -}; - -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 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) { - _ERR("failed to get priv"); - return; - } - - if (priv->hide_timer) - ecore_timer_reset(priv->hide_timer); - else - priv->hide_timer = ecore_timer_add(HIDE_DUR, _hide_timer, priv); -} - -static void _add_icon(Evas_Object *box, const char *file) -{ - Evas_Object *ic; - - ic = elm_icon_add(box); - if (!ic) { - _ERR("failed to create icon"); - return; - } - - elm_image_file_set(ic, file, NULL); - elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE); - elm_image_no_scale_set(ic, EINA_TRUE); - evas_object_show(ic); - - elm_box_pack_end(box, ic); -} - -static void _pack_icon_box(struct _priv *priv, - const struct tv_channel_info *channel_info) -{ - Evas_Object *box; - - if (!priv) { - _ERR("failed to get priv"); - return; - } - - box = elm_box_add(priv->base); - if (!box) { - _ERR("failed to create box"); - return; - } - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_box_horizontal_set(box, EINA_TRUE); - elm_box_padding_set(box, STATUS_BOX_PADDING, 0); - elm_box_align_set(box, 1.0, 0.5); - elm_object_part_content_set(priv->base, PART_CHANNELINFO_STATUS, box); - - if (channel_info->locked) - _add_icon(box, IMG_LOCKED_NOR); - if (channel_info->favorite) - _add_icon(box, IMG_FAVORITE_NOR); -} - -static void _load_channel_text(struct _priv *priv, - const struct tv_channel_info *channel_info) -{ - char buf[BUF_MAX]; - if (!priv || !channel_info) { - _ERR("failed to get priv and channel info"); - return; - } - - 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(priv->base, - PART_CHANNELINFO_CHANNEL, buf); - - elm_object_part_text_set(priv->base, - PART_CHANNELINFO_TITLE, - STR_NOTITLE); - elm_object_part_text_set(priv->base, - PART_CHANNELINFO_TIME, - STR_NOTIME); -} - -static void _load_program_info(struct _priv *priv, - const struct tv_program_info *prog) -{ - char buf[BUF_MAX]; - int r; - - if (!priv || !prog) { - _ERR("failed to get priv and program data"); - 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(priv->base, - PART_CHANNELINFO_TIME, buf); - } - - if (strlen(prog->prog_title) > 0) - elm_object_part_text_set(priv->base, - PART_CHANNELINFO_TITLE, prog->prog_title); -} - -static void _tv_program_cb(Eina_List *prog_list, void *data) -{ - struct _priv *priv; - struct tv_program_info *prog = NULL; - - if (!data) { - _ERR("failed to get data"); - return; - } - - priv = data; - - prog = (struct tv_program_info *) eina_list_nth(prog_list, 0); - if (prog) { - if (priv->channel_info && - prog->service_id != priv->channel_info->service_id) - return; - else - _load_program_info(priv, prog); - } else { - _ERR("failed to get tv_program_info"); - } - - _start_hide_timer(priv); -} - -static void _update_channel_info(struct _priv *priv) -{ - struct tv_program_request *prog_req; - int r; - - if (!priv) { - _ERR("failed to get priv"); - return; - } - - 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; - } - - if (priv->hide_timer) { - ecore_timer_del(priv->hide_timer); - priv->hide_timer = NULL; - } - - _load_channel_text(priv, priv->channel_info); - _pack_icon_box(priv, priv->channel_info); - - prog_req = calloc(1, sizeof(*prog_req)); - prog_req->tv_program_cb = _tv_program_cb; - prog_req->user_data = priv; - r = tv_epg_get_program(priv->channel_info->service_id, - prog_req); - if (r < 0) - _start_hide_timer(priv); -} + layoutmgr *lmgr; +}; static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; - Evas_Object *base; if (!win) { _ERR("failed to get win object"); @@ -270,22 +45,24 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - base = elm_layout_add(win); - if (!base) { + priv->base = elm_layout_add(win); + if (!priv->base) { _ERR("failed to create base object"); free(priv); return NULL; } - elm_layout_file_set(base, EDJEFILE, GRP_VIEW_CHANNELINFO); + elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_CHANNELINFO); - evas_object_size_hint_weight_set(base, + evas_object_size_hint_weight_set(priv->base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); + elm_win_resize_object_add(win, priv->base); + + priv->lmgr = layoutmgr_create(priv->base); + layoutmgr_add_layout(priv->lmgr, layout_channelinfo_get_lclass(), NULL); - priv->base = base; viewmgr_set_view_data(VIEW_CHANNELINFO, priv); - return base; + return priv->base; } static void _show(void *view_data) @@ -299,7 +76,7 @@ static void _show(void *view_data) priv = view_data; - _update_channel_info(priv); + layoutmgr_show_layout(priv->lmgr, LAYOUT_CHANNELINFO); evas_object_show(priv->base); } @@ -329,6 +106,9 @@ static void _destroy(void *view_data) priv = view_data; + layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO); + layoutmgr_destroy(priv->lmgr); + evas_object_del(priv->base); free(priv); -- 2.7.4 From 352ec97a82caafd5b16d149bf5ef8d72e4e73dd7 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Thu, 2 Jul 2015 21:16:50 +0900 Subject: [PATCH 05/14] Add channelinfo and channelinfo list layout Change-Id: If688f404955c9b9037f2efc99d835a135f02de73 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 2 + data/CMakeLists.txt | 4 +- data/view/channelinfo.edc | 290 ++++++++++++++++++++++++++++++++++++- include/define.h | 10 ++ include/layout_channelinfo_list.h | 22 +++ include/util.h | 28 ++++ include/view_channelinfo.h | 2 + res/images/btn_navigation_down.png | Bin 0 -> 3607 bytes res/images/btn_navigation_up.png | Bin 0 -> 3600 bytes src/layout_channelinfo.c | 221 +--------------------------- src/layout_channelinfo_list.c | 173 ++++++++++++++++++++++ src/main.c | 2 +- src/util.c | 126 ++++++++++++++++ src/view_channelinfo.c | 238 ++++++++++++++++++++++++++++++ 14 files changed, 898 insertions(+), 220 deletions(-) create mode 100644 include/layout_channelinfo_list.h create mode 100644 include/util.h create mode 100644 res/images/btn_navigation_down.png create mode 100644 res/images/btn_navigation_up.png create mode 100644 src/layout_channelinfo_list.c create mode 100644 src/util.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 566aebf..58ce3f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,8 @@ SET(SRCS src/main.c src/tv.c src/view_channelinfo.c src/layout_channelinfo.c + src/layout_channelinfo_list.c + src/util.c src/tv_service.c) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index c2bb8f9..500ddff 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -14,7 +14,7 @@ # ADD_CUSTOM_TARGET(${TARGET_EDJ} - COMMAND edje_cc -id images + COMMAND edje_cc -id ../res/images ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc @@ -23,7 +23,7 @@ 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 images -sd sounds + 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 diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc index b30785c..4d8bafe 100644 --- a/data/view/channelinfo.edc +++ b/data/view/channelinfo.edc @@ -36,6 +36,186 @@ group { } group { + name, GRP_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; + min, 536 486; + align, 0.0 0.5; + fixed, 1 1; + } + } + part { + name, "part.navigation_up"; + type, IMAGE; + scale, 1; + description { + 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 { + rel1 { + to_y, "part.navigation_up"; + relative, 0.0 1.0; + } + rel2 { + to_y, "part.navigation_up"; + relative, 1.0 1.0; + } + min, 0 20; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_CHANNELINFO_LIST_NEXT; + type, SWALLOW; + description { + rel1 { + to_y, "padding.next_channel"; + relative, 0.0 1.0; + } + rel2 { + to_y, "padding.next_channel"; + relative, 1.0 1.0; + } + min, 536 70; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, "padding.current_channel"; + type, SPACER; + description { + rel1 { + to_y, PART_CHANNELINFO_LIST_NEXT; + relative, 0.0 1.0; + } + rel2 { + to_y, PART_CHANNELINFO_LIST_NEXT; + relative, 1.0 1.0; + } + min, 0 32; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_CHANNELINFO_LIST_CURRENT; + type, SWALLOW; + description { + rel1 { + to_y, "padding.current_channel"; + relative, 0.0 1.0; + } + rel2 { + to_y, "padding.current_channel"; + relative, 1.0 1.0; + } + min, 536 174; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, "padding.prev_channel"; + type, SPACER; + description { + rel1 { + to_y, PART_CHANNELINFO_LIST_CURRENT; + relative, 0.0 1.0; + } + rel2 { + to_y, PART_CHANNELINFO_LIST_CURRENT; + relative, 1.0 1.0; + } + min, 0 32; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_CHANNELINFO_LIST_PREV; + type, SWALLOW; + description { + rel1 { + to_y, "padding.prev_channel"; + relative, 0.0 1.0; + } + rel2 { + to_y, "padding.prev_channel"; + relative, 1.0 1.0; + } + min, 536 70; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, "padding.navigation_down"; + type, SPACER; + description { + rel1 { + to_y, PART_CHANNELINFO_LIST_PREV; + relative, 0.0 1.0; + } + rel2 { + to_y, PART_CHANNELINFO_LIST_PREV; + relative, 1.0 1.0; + } + min, 0 20; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, "part.navigation_down"; + type, IMAGE; + scale, 1; + description { + image.normal, "btn_navigation_down.png"; + rel1 { + to_y, "padding.navigation_down"; + relative, 0.5 1.0; + } + rel2 { + to_y, "padding.navigation_down"; + relative, 0.5 1.0; + } + min, 98 34; + align, 0.5 0.0; + fixed, 1 1; + visible, 1; + } + } + } +} + +group { name, GRP_CHANNELINFO; parts { part { @@ -44,10 +224,8 @@ group { scale, 1; description { state, "default" 0.0; - rel1.relative, 1.0 0.5; - rel2.relative, 1.0 0.5; min, 536 174; - align, 1.0 0.5; + align, 0.0 0.5; fixed, 1 1; } description { @@ -265,3 +443,109 @@ group { } } } + +group { + name, GRP_CHANNELINFO_SIMPLE; + parts { + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + min, 536 70; + align, 1.0 0.5; + fixed, 1 1; + 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; + } + } + } +} diff --git a/include/define.h b/include/define.h index e544292..83dd802 100644 --- a/include/define.h +++ b/include/define.h @@ -37,6 +37,7 @@ #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 IMG_LOCKED_NOR IMAGEDIR"ic_thumbnail_lock_01_nor.png" #define IMG_LOCKED_FOC IMAGEDIR"ic_thumbnail_lock_01_foc.png" @@ -45,8 +46,17 @@ #define VIEW_CHANNELINFO "VIEW_CHANNELINFO" #define LAYOUT_CHANNELINFO "LAYOUT_CHANNELINFO" +#define LAYOUT_CHANNELINFO_LIST "LAYOUT_CHANNELINFO_LIST" + #define GRP_VIEW_CHANNELINFO "grp.view.channelinfo" + +#define GRP_CHANNELINFO_LIST "grp.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_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" diff --git a/include/layout_channelinfo_list.h b/include/layout_channelinfo_list.h new file mode 100644 index 0000000..3b7e8ab --- /dev/null +++ b/include/layout_channelinfo_list.h @@ -0,0 +1,22 @@ +/* + * 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/util.h b/include/util.h new file mode 100644 index 0000000..25afbc3 --- /dev/null +++ b/include/util.h @@ -0,0 +1,28 @@ +/* + * 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 + +#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); + +#endif diff --git a/include/view_channelinfo.h b/include/view_channelinfo.h index f5b01e2..f9e5068 100644 --- a/include/view_channelinfo.h +++ b/include/view_channelinfo.h @@ -17,6 +17,8 @@ #ifndef __LIVETV_VIEW_CHANNELINFO_H__ #define __LIVETV_VIEW_CHANNELINFO_H__ +void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info); + view_class *view_channelinfo_get_vclass(void); #endif /* __LIVETV_VIEW_CHANNELINFO_H__*/ diff --git a/res/images/btn_navigation_down.png b/res/images/btn_navigation_down.png new file mode 100644 index 0000000000000000000000000000000000000000..b935681d7a6ef0754b7ac8e64f4dbd69ccee3e35 GIT binary patch literal 3607 zcmV+y4(RcTP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uo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SjrVF1_Fj>w*u%1g+kM+ zs%{cdR8`fLbUNMlk1$v|o$garb;Y=LGZYF<1L!ew+bn0#76bvK*v$aC0)fCpxm;c& zqG+{R-N7Pt*=+W1wOZXEqG-8XUJC>Q69Br5oXnDQ(xMYuZ|~8-z`!5? zD2noFeSQ5608C9yy>4o18U}#<{r$wq$jEzHmcIZf0?+`^Ng%Gg1~mZU_=>6(fPH6Y z=i%7c*aHCU=;-J(05mo>_5h&W-QADlM literal 0 HcmV?d00001 diff --git a/res/images/btn_navigation_up.png b/res/images/btn_navigation_up.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c1df3b0cdb6ecea7f528603076ce67dd302d15 GIT binary patch literal 3600 zcmV+r4)5`aP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1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peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0009!Nklfx3z4AUH?_FF1=C z90Vtu!A|Wtbm(9S(q4xf9YVX6W)PRO5CUy;aK*%2+IY$R9DKnl{ojfS{Jsz_{1QP#;QarzaS0fL!w?L?VF-rcFa$$z7=j@(7aWNR;WDsq( zZQoZ_^&tRZS=I&s1OkD60JOEWHPhSM`w@WGN)RozMrfMWQ7V<)Lkt+4W>H z`M`DEl)PtpZEbDvAPj~$7((Rp`CIjReU^v}$8l!j@%SA8R{@;gr?5hvyQ*p0UB_`| zh{&kd>$CZM{?>jN46#3iuq;VypM3iE&__VR;=5o1YC=`mwMY;2^`FxnyI!VzKx%5{W1b zaR7v_>)npyylNC}d3pJ@&*vKk;0MrgM1AK#{5PLwR z(`j{kd;6W7M&?b^d;wq(z~xi6ViY;XplO;fJkOgaB4cM~XFQ!ws|@icgi= 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 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 void _add_icon(Evas_Object *box, const char *file) -{ - Evas_Object *ic; - - ic = elm_icon_add(box); - if (!ic) { - _ERR("failed to create icon"); - return; - } - - elm_image_file_set(ic, file, NULL); - elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE); - elm_image_no_scale_set(ic, EINA_TRUE); - evas_object_show(ic); - - elm_box_pack_end(box, ic); -} - -static void _pack_icon_box(struct _priv *priv, - const struct tv_channel_info *channel_info) -{ - Evas_Object *box; - - if (!priv) { - _ERR("failed to get priv"); - return; - } - - box = elm_box_add(priv->layout); - if (!box) { - _ERR("failed to create box"); - return; - } - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_box_horizontal_set(box, EINA_TRUE); - elm_box_padding_set(box, STATUS_BOX_PADDING, 0); - elm_box_align_set(box, 1.0, 0.5); - elm_object_part_content_set(priv->layout, PART_CHANNELINFO_STATUS, box); - - if (channel_info->locked) - _add_icon(box, IMG_LOCKED_NOR); - if (channel_info->favorite) - _add_icon(box, IMG_FAVORITE_NOR); -} - -static void _load_channel_text(struct _priv *priv, - const struct tv_channel_info *channel_info) -{ - char buf[BUF_MAX]; - - if (!priv || !channel_info) { - _ERR("failed to get priv and channel info"); - return; - } - - 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(priv->layout, - PART_CHANNELINFO_CHANNEL, buf); - - elm_object_part_text_set(priv->layout, - PART_CHANNELINFO_TITLE, - STR_NOTITLE); - elm_object_part_text_set(priv->layout, - PART_CHANNELINFO_TIME, - STR_NOTIME); -} - -static void _load_program_info(struct _priv *priv, - const struct tv_program_info *prog) -{ - char buf[BUF_MAX]; - int r; - - if (!priv || !prog) { - _ERR("failed to get priv and program data"); - 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(priv->layout, - PART_CHANNELINFO_TIME, buf); - } - - if (strlen(prog->prog_title) > 0) - elm_object_part_text_set(priv->layout, - PART_CHANNELINFO_TITLE, prog->prog_title); -} - -static void _tv_program_cb(Eina_List *prog_list, void *data) -{ - struct _priv *priv; - struct tv_program_info *prog = NULL; - - if (!data) { - _ERR("failed to get data"); - return; - } - - priv = data; - - prog = (struct tv_program_info *) eina_list_nth(prog_list, 0); - if (prog) { - if (priv->channel_info && - prog->service_id != priv->channel_info->service_id) - return; - else - _load_program_info(priv, prog); - } else { - _ERR("failed to get tv_program_info"); - } - - _start_hide_timer(priv); -} - static void _update_channel_info(struct _priv *priv) { - struct tv_program_request *prog_req; - int r; - if (priv->channel_info) { tv_channel_del_info(priv->channel_info); priv->channel_info = NULL; @@ -238,21 +46,10 @@ static void _update_channel_info(struct _priv *priv) return; } - _stop_hide_timer(priv); - - _load_channel_text(priv, priv->channel_info); - _pack_icon_box(priv, priv->channel_info); - - prog_req = calloc(1, sizeof(*prog_req)); - prog_req->tv_program_cb = _tv_program_cb; - prog_req->user_data = priv; - r = tv_epg_get_program(priv->channel_info->service_id, - prog_req); - if (r < 0) - _start_hide_timer(priv); + draw_channel_info(priv->layout, priv->channel_info); } -bool _create(layoutmgr *lmgr, void *data) +static bool _create(layoutmgr *lmgr, void *data) { struct _priv *priv; Evas_Object *base, *layout; @@ -292,7 +89,7 @@ error: return false; } -void _destroy(void *layout_data) +static void _destroy(void *layout_data) { struct _priv *priv; @@ -306,13 +103,11 @@ void _destroy(void *layout_data) priv->channel_info = NULL; } - _stop_hide_timer(priv); - evas_object_del(priv->layout); free(priv); } -void _show(void *layout_data) +static void _show(void *layout_data) { struct _priv *priv; @@ -326,7 +121,7 @@ void _show(void *layout_data) evas_object_show(priv->layout); } -void _hide(void *layout_data) +static void _hide(void *layout_data) { struct _priv *priv; @@ -335,12 +130,10 @@ void _hide(void *layout_data) priv = layout_data; - _stop_hide_timer(priv); - evas_object_hide(priv->layout); } -void _update(void *layout_data, int update_type, int *data) +static void _update(void *layout_data, int update_type, void *data) { } diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c new file mode 100644 index 0000000..eb37091 --- /dev/null +++ b/src/layout_channelinfo_list.c @@ -0,0 +1,173 @@ +/* + * 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_channelinfo.h" + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + Evas_Object *prev_channel; + Evas_Object *current_channel; + Evas_Object *next_channel; + + layoutmgr *lmgr; +}; + +static void _update_channel_info(struct _priv *priv) +{ + const struct tv_channel_info *current_channel; + + current_channel = tv_channel_get_info(); + if (!current_channel) { + _ERR("failed to get channel info"); + + return; + } + + draw_channel_info(priv->current_channel, current_channel); + + tv_channel_del_info(current_channel); +} + +static bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + priv->base = layoutmgr_get_base(lmgr); + + priv->layout = elm_layout_add(priv->base); + if (!priv->layout) { + _ERR("failed to create layout"); + return false; + } + if (!elm_layout_file_set(priv->layout, EDJEFILE, GRP_CHANNELINFO_LIST)) + goto error; + elm_object_content_set(priv->base, priv->layout); + + priv->next_channel = util_add_layout(priv->layout, + GRP_CHANNELINFO_SIMPLE); + if (!priv->next_channel) + goto error; + elm_object_part_content_set(priv->layout, + PART_CHANNELINFO_LIST_NEXT, priv->next_channel); + + priv->current_channel = util_add_layout(priv->layout, GRP_CHANNELINFO); + if (!priv->current_channel) + goto error; + elm_object_part_content_set(priv->layout, + PART_CHANNELINFO_LIST_CURRENT, priv->current_channel); + + priv->prev_channel = util_add_layout(priv->layout, + GRP_CHANNELINFO_SIMPLE); + if (!priv->prev_channel) + goto error; + elm_object_part_content_set(priv->layout, + PART_CHANNELINFO_LIST_PREV, priv->prev_channel); + + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_LIST, priv); + + return true; + +error: + _ERR("failed to create layout"); + + if (priv->layout) + evas_object_del(priv->layout); + if (priv->prev_channel) + evas_object_del(priv->prev_channel); + if (priv->current_channel) + evas_object_del(priv->current_channel); + if (priv->next_channel) + evas_object_del(priv->next_channel); + + free(priv); + + return false; +} + +static void _destroy(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + evas_object_del(priv->layout); + 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->layout); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + evas_object_hide(priv->layout); +} + +static void _update(void *layout_data, int update_type, void *data) +{ +} + +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/main.c b/src/main.c index 4a9b31d..e3acd73 100644 --- a/src/main.c +++ b/src/main.c @@ -21,8 +21,8 @@ #include #include "define.h" -#include "view_channelinfo.h" #include "tv.h" +#include "view_channelinfo.h" #define KEY_MAX 256 diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..43c098e --- /dev/null +++ b/src/util.c @@ -0,0 +1,126 @@ +/* + * 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 "util.h" +#include "define.h" + +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); + + if (part) + 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_FALSE); + elm_image_no_scale_set(ic, EINA_TRUE); + evas_object_show(ic); + + return ic; + +} diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index 7c9a593..aab1685 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -23,13 +23,226 @@ #include "define.h" #include "tv.h" #include "layout_channelinfo.h" +#include "layout_channelinfo_list.h" + +#define HIDE_DUR 10.0 +#define BUF_MAX 128 +#define STATUS_BOX_PADDING 10 + +enum _update_type { + START_HIDE_TIMER, + STOP_HIDE_TIMER +}; struct _priv { Evas_Object *base; + Ecore_Timer *hide_timer; layoutmgr *lmgr; }; +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 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 void _add_icon(Evas_Object *box, const char *file) +{ + Evas_Object *ic; + + ic = elm_icon_add(box); + if (!ic) { + _ERR("failed to create icon"); + return; + } + + elm_image_file_set(ic, file, NULL); + elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE); + elm_image_no_scale_set(ic, EINA_TRUE); + evas_object_show(ic); + + elm_box_pack_end(box, ic); +} + +static void _pack_icon_box(Evas_Object *obj, + const struct tv_channel_info *channel_info) +{ + Evas_Object *box; + + box = elm_box_add(obj); + if (!box) { + _ERR("failed to create box"); + return; + } + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_horizontal_set(box, EINA_TRUE); + elm_box_padding_set(box, STATUS_BOX_PADDING, 0); + elm_box_align_set(box, 1.0, 0.5); + elm_object_part_content_set(obj, PART_CHANNELINFO_STATUS, box); + + if (channel_info->locked) + _add_icon(box, IMG_LOCKED_NOR); + if (channel_info->favorite) + _add_icon(box, IMG_FAVORITE_NOR); +} + +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; + + 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) +{ + 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"); + + viewmgr_update_view(VIEW_CHANNELINFO, START_HIDE_TIMER); +} + +void draw_channel_info(Evas_Object *obj, + const struct tv_channel_info *channel_info) +{ + struct tv_program_request *prog_req; + int r; + 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; + + viewmgr_update_view(VIEW_CHANNELINFO, (void *) STOP_HIDE_TIMER); + + _load_channel_text(obj, channel_info); + _pack_icon_box(obj, channel_info); + + prog_req = calloc(1, sizeof(*prog_req)); + prog_req->tv_program_cb = _tv_program_cb; + prog_req->user_data = obj; + + if (channel_info->service_id == current_service) + r = tv_epg_get_program(channel_info->service_id, prog_req); + else + r = tv_epg_get_cache_program(channel_info->service_id, + prog_req); + + if (r < 0) + viewmgr_update_view(VIEW_CHANNELINFO, + (void *) START_HIDE_TIMER); +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -59,6 +272,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) priv->lmgr = layoutmgr_create(priv->base); layoutmgr_add_layout(priv->lmgr, layout_channelinfo_get_lclass(), NULL); + layoutmgr_add_layout(priv->lmgr, + layout_channelinfo_list_get_lclass(), NULL); viewmgr_set_view_data(VIEW_CHANNELINFO, priv); @@ -107,6 +322,7 @@ static void _destroy(void *view_data) priv = view_data; layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO); + layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO_LIST); layoutmgr_destroy(priv->lmgr); evas_object_del(priv->base); @@ -114,12 +330,34 @@ static void _destroy(void *view_data) free(priv); } +static void _update(void *view_data, void *data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + switch ((int) data) { + case START_HIDE_TIMER: + _start_hide_timer(priv); + break; + case STOP_HIDE_TIMER: + _stop_hide_timer(priv); + break; + } +} + 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) -- 2.7.4 From b13602bd7bdb4617198d3b98d1339945febfb1ad Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 6 Jul 2015 10:49:04 +0900 Subject: [PATCH 06/14] Add channelinfo search layout Change-Id: I8c823e6e12c468a89f0e89ddb4cd9ac861cb16fe Signed-off-by: jinwoo.shin --- CMakeLists.txt | 1 + data/view/channelinfo.edc | 11 +- include/define.h | 1 + include/layout_channelinfo_search.h | 22 ++++ src/layout_channelinfo.c | 7 +- src/layout_channelinfo_list.c | 3 +- src/layout_channelinfo_search.c | 208 ++++++++++++++++++++++++++++++++++++ src/view_channelinfo.c | 4 + 8 files changed, 249 insertions(+), 8 deletions(-) create mode 100644 include/layout_channelinfo_search.h create mode 100644 src/layout_channelinfo_search.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 58ce3f2..9bdcd5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ SET(SRCS src/main.c src/view_channelinfo.c src/layout_channelinfo.c src/layout_channelinfo_list.c + src/layout_channelinfo_search.c src/util.c src/tv_service.c) diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc index 4d8bafe..b97ee55 100644 --- a/data/view/channelinfo.edc +++ b/data/view/channelinfo.edc @@ -25,8 +25,8 @@ group { scale, 1; description { state, "default" 0.0; - rel1.relative, 1.0 0.5; - rel2.relative, 1.0 0.5; + rel1.relative, 1.0 0.0; + rel2.relative, 1.0 1.0; min, 536 0; align, 1.0 0.5; fixed, 1 0; @@ -48,6 +48,8 @@ group { scale, 1; description { state, "default" 0.0; + rel1.relative, 0.0 0.5; + rel2.relative, 0.0 0.5; min, 536 486; align, 0.0 0.5; fixed, 1 1; @@ -224,9 +226,10 @@ group { 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; - fixed, 1 1; } description { state, "focused" 0.0; @@ -454,7 +457,7 @@ group { description { state, "default" 0.0; min, 536 70; - align, 1.0 0.5; + align, 0.0 0.0; fixed, 1 1; visible, 0; } diff --git a/include/define.h b/include/define.h index 83dd802..8b4760f 100644 --- a/include/define.h +++ b/include/define.h @@ -47,6 +47,7 @@ #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" diff --git a/include/layout_channelinfo_search.h b/include/layout_channelinfo_search.h new file mode 100644 index 0000000..f2507c3 --- /dev/null +++ b/include/layout_channelinfo_search.h @@ -0,0 +1,22 @@ +/* + * 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/src/layout_channelinfo.c b/src/layout_channelinfo.c index 345adb7..00a58e0 100644 --- a/src/layout_channelinfo.c +++ b/src/layout_channelinfo.c @@ -67,12 +67,9 @@ static bool _create(layoutmgr *lmgr, void *data) _ERR("failed to create layout"); return false; } - if (!elm_layout_file_set(layout, EDJEFILE, GRP_CHANNELINFO)) goto error; - elm_object_content_set(base, layout); - priv->base = base; priv->layout = layout; priv->lmgr = lmgr; @@ -118,7 +115,10 @@ static void _show(void *layout_data) _update_channel_info(priv); + elm_object_content_set(priv->base, priv->layout); evas_object_show(priv->layout); + + elm_object_focus_allow_set(priv->base, EINA_TRUE); } static void _hide(void *layout_data) @@ -131,6 +131,7 @@ static void _hide(void *layout_data) priv = layout_data; evas_object_hide(priv->layout); + elm_object_content_unset(priv->base); } static void _update(void *layout_data, int update_type, void *data) diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c index eb37091..61c85f1 100644 --- a/src/layout_channelinfo_list.c +++ b/src/layout_channelinfo_list.c @@ -70,7 +70,6 @@ static bool _create(layoutmgr *lmgr, void *data) } if (!elm_layout_file_set(priv->layout, EDJEFILE, GRP_CHANNELINFO_LIST)) goto error; - elm_object_content_set(priv->base, priv->layout); priv->next_channel = util_add_layout(priv->layout, GRP_CHANNELINFO_SIMPLE); @@ -139,6 +138,7 @@ static void _show(void *layout_data) _update_channel_info(priv); + elm_object_content_set(priv->base, priv->layout); evas_object_show(priv->layout); } @@ -152,6 +152,7 @@ static void _hide(void *layout_data) priv = layout_data; evas_object_hide(priv->layout); + elm_object_content_unset(priv->base); } static void _update(void *layout_data, int update_type, void *data) diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c new file mode 100644 index 0000000..315f35d --- /dev/null +++ b/src/layout_channelinfo_search.c @@ -0,0 +1,208 @@ +/* + * 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_channelinfo.h" + +#define DIVIDER_WIDTH 536 +#define DIVIDER_HEIGHT 1 +#define DIVIDER_COLOR_R 0 +#define DIVIDER_COLOR_G 0 +#define DIVIDER_COLOR_B 0 +#define DIVIDER_COLOR_A (255 * 0.1) + +struct _priv { + Evas_Object *base; + Evas_Object *scroll; + Evas_Object *box; + + layoutmgr *lmgr; + Eina_List *channel_list; +}; + +static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) +{ + Evas_Object *ly, *divider; + 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, + DIVIDER_WIDTH, DIVIDER_HEIGHT); + evas_object_show(divider); + + elm_box_clear(priv->box); + + 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); + draw_channel_info(ly, channel_info); + + elm_box_pack_end(priv->box, ly); + + if (eina_list_next(l)) + elm_box_pack_end(priv->box, divider); + } +} + +static void _update_channel_list(struct _priv *priv) +{ + if (!priv) { + _ERR("failed to get priv"); + return; + } + + if (priv->channel_list) + tv_channel_del_list(priv->channel_list); + + priv->channel_list = tv_channel_get_list(); + if (!priv->channel_list) { + _ERR("failed to get channel list"); + return; + } + + _load_channel_list(priv, priv->channel_list); +} + +static bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + priv->base = layoutmgr_get_base(lmgr); + + priv->scroll = elm_scroller_add(priv->base); + if (!priv->scroll) { + _ERR("failed to create scroll"); + goto error; + } + evas_object_size_hint_weight_set(priv->scroll, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + priv->box = util_add_box(priv->scroll, false); + if (!priv->box) { + _ERR("failed to create box"); + goto error; + } + elm_box_align_set(priv->box, 0.0, 0.5); + elm_box_padding_set(priv->box, 0, DIVIDER_HEIGHT); + evas_object_color_set(priv->box, DIVIDER_COLOR_R, + DIVIDER_COLOR_G, DIVIDER_COLOR_B, DIVIDER_COLOR_A); + + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_SEARCH, priv); + + return true; + +error: + evas_object_del(priv->scroll); + evas_object_del(priv->box); + free(priv); + + return false; +} + +static void _destroy(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + if (priv->channel_list) + tv_channel_del_list(priv->channel_list); + + evas_object_del(priv->scroll); + free(priv); +} + +static void _show(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + _update_channel_list(priv); + + elm_object_content_set(priv->base, priv->scroll); + evas_object_show(priv->scroll); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + elm_object_content_unset(priv->base); + evas_object_hide(priv->scroll); +} + +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/view_channelinfo.c b/src/view_channelinfo.c index aab1685..cf5396c 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -24,6 +24,7 @@ #include "tv.h" #include "layout_channelinfo.h" #include "layout_channelinfo_list.h" +#include "layout_channelinfo_search.h" #define HIDE_DUR 10.0 #define BUF_MAX 128 @@ -274,6 +275,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) 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); @@ -323,6 +326,7 @@ static void _destroy(void *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); evas_object_del(priv->base); -- 2.7.4 From 10bd6f2814ee5a36d8e10bc0df3bbca4a5c4ca70 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 6 Jul 2015 16:33:07 +0900 Subject: [PATCH 07/14] Add key event support Change-Id: Ibca35a28730f4af9b355ec167ce36b9bece24983 Signed-off-by: jinwoo.shin --- include/view_channelinfo.h | 5 +++ src/layout_channelinfo_list.c | 26 ++++++++++++++ src/layout_channelinfo_search.c | 4 --- src/main.c | 18 +++++----- src/view_channelinfo.c | 79 +++++++++++++++++++++++++++++++++-------- 5 files changed, 106 insertions(+), 26 deletions(-) diff --git a/include/view_channelinfo.h b/include/view_channelinfo.h index f9e5068..6ced573 100644 --- a/include/view_channelinfo.h +++ b/include/view_channelinfo.h @@ -17,6 +17,11 @@ #ifndef __LIVETV_VIEW_CHANNELINFO_H__ #define __LIVETV_VIEW_CHANNELINFO_H__ +enum _update_type { + UPDATE_TYPE_TIMER, + UPDATE_TYPE_INPUT, +}; + void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info); view_class *view_channelinfo_get_vclass(void); diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c index 61c85f1..03249a5 100644 --- a/src/layout_channelinfo_list.c +++ b/src/layout_channelinfo_list.c @@ -157,6 +157,32 @@ static void _hide(void *layout_data) static void _update(void *layout_data, int update_type, void *data) { + Evas_Event_Key_Down *ev = data; + struct _priv *priv; + int r; + + if (!layout_data || !ev) { + _ERR("failed to get layout_data and ev"); + return; + } + + priv = layout_data; + + if (!strcmp(ev->keyname, KEY_CHANNELUP) || + !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE)) { + r = tv_channel_next(); + if (r < 0) + _ERR("failed to tune next channel"); + + _update_channel_info(priv); + } else if (!strcmp(ev->keyname, KEY_CHANNELDOWN) || + !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + r = tv_channel_prev(); + if (r < 0) + _ERR("failed to tune next channel"); + + _update_channel_info(priv); + } } static layout_class lclass = { diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index 315f35d..ba04001 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -74,7 +74,6 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) continue; elm_object_focus_allow_set(ly, EINA_TRUE); draw_channel_info(ly, channel_info); - elm_box_pack_end(priv->box, ly); if (eina_list_next(l)) @@ -127,9 +126,6 @@ static bool _create(layoutmgr *lmgr, void *data) goto error; } elm_box_align_set(priv->box, 0.0, 0.5); - elm_box_padding_set(priv->box, 0, DIVIDER_HEIGHT); - evas_object_color_set(priv->box, DIVIDER_COLOR_R, - DIVIDER_COLOR_G, DIVIDER_COLOR_B, DIVIDER_COLOR_A); priv->lmgr = lmgr; diff --git a/src/main.c b/src/main.c index e3acd73..5b35c61 100644 --- a/src/main.c +++ b/src/main.c @@ -36,22 +36,23 @@ struct _appdata { }; struct key_map { - const char *view; - const char *key[KEY_MAX]; + const char *view; + const char *key[KEY_MAX]; }; static struct key_map g_kmap[] = { { VIEW_CHANNELINFO, { - KEY_ENTER, KEY_ENTER_REMOTE, KEY_CHANNELUP, - KEY_CHANNELUP_REMOTE, KEY_CHANNELDOWN, KEY_CHANNELDOWN_REMOTE + KEY_ENTER, KEY_ENTER_REMOTE, + KEY_CHANNELUP, KEY_CHANNELUP_REMOTE, + KEY_CHANNELDOWN, KEY_CHANNELDOWN_REMOTE } }, }; -static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Up *ev) +static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Down *ev) { size_t i, j; @@ -60,7 +61,8 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, while (g_kmap[i].key[j]) { if (!strcmp(ev->keyname, g_kmap[i].key[j])) { viewmgr_show_view(g_kmap[i].view); - viewmgr_update_view(g_kmap[i].view, ev); + viewmgr_update_view(g_kmap[i].view, + UPDATE_TYPE_INPUT, ev); return; } j++; @@ -69,7 +71,7 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, } static input_handler key_handler = { - .key_up = _key_up_cb, + .key_down = _key_down_cb, }; static Evas_Object *_add_win(const char *name) diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index cf5396c..bcd8488 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -22,6 +22,7 @@ #include "define.h" #include "tv.h" +#include "view_channelinfo.h" #include "layout_channelinfo.h" #include "layout_channelinfo_list.h" #include "layout_channelinfo_search.h" @@ -30,7 +31,7 @@ #define BUF_MAX 128 #define STATUS_BOX_PADDING 10 -enum _update_type { +enum _update_op { START_HIDE_TIMER, STOP_HIDE_TIMER }; @@ -38,6 +39,7 @@ enum _update_type { struct _priv { Evas_Object *base; Ecore_Timer *hide_timer; + const char *current_layout; layoutmgr *lmgr; }; @@ -204,7 +206,8 @@ static void _tv_program_cb(Eina_List *prog_list, void *data) else _ERR("failed to get tv_program_info"); - viewmgr_update_view(VIEW_CHANNELINFO, START_HIDE_TIMER); + viewmgr_update_view(VIEW_CHANNELINFO, + UPDATE_TYPE_TIMER, START_HIDE_TIMER); } void draw_channel_info(Evas_Object *obj, @@ -224,7 +227,8 @@ void draw_channel_info(Evas_Object *obj, if (r < 0) current_service = -1; - viewmgr_update_view(VIEW_CHANNELINFO, (void *) STOP_HIDE_TIMER); + viewmgr_update_view(VIEW_CHANNELINFO, + UPDATE_TYPE_TIMER, (void *)STOP_HIDE_TIMER); _load_channel_text(obj, channel_info); _pack_icon_box(obj, channel_info); @@ -241,7 +245,29 @@ void draw_channel_info(Evas_Object *obj, if (r < 0) viewmgr_update_view(VIEW_CHANNELINFO, - (void *) START_HIDE_TIMER); + UPDATE_TYPE_TIMER, START_HIDE_TIMER); +} + +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 (priv->current_layout && layout_id && + !strcmp(priv->current_layout, layout_id)) + return; + + if (priv->current_layout) + layoutmgr_hide_layout(priv->lmgr, priv->current_layout); + + layoutmgr_show_layout(priv->lmgr, layout_id); + priv->current_layout = layout_id; } static Evas_Object *_create(Evas_Object *win, void *data) @@ -294,8 +320,6 @@ static void _show(void *view_data) priv = view_data; - layoutmgr_show_layout(priv->lmgr, LAYOUT_CHANNELINFO); - evas_object_show(priv->base); } @@ -310,6 +334,8 @@ static void _hide(void *view_data) priv = view_data; + _hide_current_layout(priv); + evas_object_hide(priv->base); } @@ -334,9 +360,10 @@ static void _destroy(void *view_data) free(priv); } -static void _update(void *view_data, void *data) +static void _update(void *view_data, int type, void *data) { struct _priv *priv; + Evas_Event_Key_Down *ev; if (!view_data) { _ERR("failed to get view data"); @@ -345,13 +372,37 @@ static void _update(void *view_data, void *data) priv = view_data; - switch ((int) data) { - case START_HIDE_TIMER: - _start_hide_timer(priv); - break; - case STOP_HIDE_TIMER: - _stop_hide_timer(priv); - break; + 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) { + ev = data; + if (!ev) { + _ERR("failed to get ev"); + return; + } + + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + 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_CHANNELUP_REMOTE) || + !strcmp(ev->keyname, KEY_CHANNELDOWN) || + !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); + layoutmgr_update_layout(priv->lmgr, + LAYOUT_CHANNELINFO_LIST, 0, ev); + } } } -- 2.7.4 From 183923c7714edec234ad2f944492ffb48d83bdfc Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 10 Jul 2015 19:58:27 +0900 Subject: [PATCH 08/14] Add channel next/prev event Change-Id: Ie8a3182aa1db8d16bb0d648b418324bda1d56994 Signed-off-by: jinwoo.shin --- data/view/channelinfo.edc | 18 +++++ include/tv.h | 5 +- include/view_channelinfo.h | 3 +- src/layout_channelinfo_list.c | 170 +++++++++++++++++++++++++++++++++++------- src/main.c | 48 ++++++++---- src/tv.c | 27 +++++++ src/view_channelinfo.c | 24 +++++- 7 files changed, 250 insertions(+), 45 deletions(-) diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc index b97ee55..3beca20 100644 --- a/data/view/channelinfo.edc +++ b/data/view/channelinfo.edc @@ -550,5 +550,23 @@ group { fixed, 1 1; } } + part { + name, PART_CHANNELINFO_STATUS; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + visible, 0; + } + } + part { + name, PART_CHANNELINFO_TIME; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + visible, 0; + } + } } } diff --git a/include/tv.h b/include/tv.h index f98574a..40a1458 100644 --- a/include/tv.h +++ b/include/tv.h @@ -84,10 +84,13 @@ 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_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); diff --git a/include/view_channelinfo.h b/include/view_channelinfo.h index 6ced573..6637f1a 100644 --- a/include/view_channelinfo.h +++ b/include/view_channelinfo.h @@ -19,7 +19,8 @@ enum _update_type { UPDATE_TYPE_TIMER, - UPDATE_TYPE_INPUT, + UPDATE_TYPE_INPUT_KEY_DOWN, + UPDATE_TYPE_INPUT_KEY_UP, }; void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info); diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c index 03249a5..5d9ce51 100644 --- a/src/layout_channelinfo_list.c +++ b/src/layout_channelinfo_list.c @@ -25,6 +25,11 @@ #include "tv.h" #include "view_channelinfo.h" +enum _order { + CHANNEL_NEXT, + CHANNEL_PREV +}; + struct _priv { Evas_Object *base; Evas_Object *layout; @@ -32,23 +37,107 @@ struct _priv { Evas_Object *current_channel; Evas_Object *next_channel; + const struct tv_channel_info *channel_info; layoutmgr *lmgr; }; +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; + } + } + + 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 void _update_channel_info(struct _priv *priv) { - const struct tv_channel_info *current_channel; + const struct tv_channel_info *prev, *current, *next, *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; + } + } - current_channel = tv_channel_get_info(); - if (!current_channel) { - _ERR("failed to get channel info"); + draw_channel_info(priv->current_channel, current); + channel_list = tv_channel_get_list(); + if (!channel_list) { + _ERR("failed to get channel list"); return; } - draw_channel_info(priv->current_channel, current_channel); + 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 (prev == current) + prev = NULL; + } + + if (!next) { + next = eina_list_data_get(channel_list); + if (next == current) + next = NULL; + } - tv_channel_del_info(current_channel); + if (prev) + draw_channel_info(priv->prev_channel, prev); + + if (next) + draw_channel_info(priv->next_channel, next); + + tv_channel_del_list(channel_list); } static bool _create(layoutmgr *lmgr, void *data) @@ -123,6 +212,9 @@ static void _destroy(void *layout_data) priv = layout_data; + if (priv->channel_info) + tv_channel_del_info(priv->channel_info); + evas_object_del(priv->layout); free(priv); } @@ -136,8 +228,6 @@ static void _show(void *layout_data) priv = layout_data; - _update_channel_info(priv); - elm_object_content_set(priv->base, priv->layout); evas_object_show(priv->layout); } @@ -155,33 +245,63 @@ static void _hide(void *layout_data) elm_object_content_unset(priv->base); } -static void _update(void *layout_data, int update_type, void *data) +static void _update(void *layout_data, int type, void *data) { - Evas_Event_Key_Down *ev = data; struct _priv *priv; int r; - if (!layout_data || !ev) { + if (!layout_data) { _ERR("failed to get layout_data and ev"); return; } priv = layout_data; - if (!strcmp(ev->keyname, KEY_CHANNELUP) || - !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE)) { - r = tv_channel_next(); - if (r < 0) - _ERR("failed to tune next channel"); - - _update_channel_info(priv); - } else if (!strcmp(ev->keyname, KEY_CHANNELDOWN) || - !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { - r = tv_channel_prev(); - if (r < 0) - _ERR("failed to tune next channel"); - - _update_channel_info(priv); + 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) || + !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE)) { + r = _set_next_channel(priv, CHANNEL_NEXT); + if (r < 0) + _ERR("failed to set next channel"); + else + _update_channel_info(priv); + } else if (!strcmp(ev->keyname, KEY_CHANNELDOWN) || + !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + r = _set_next_channel(priv, CHANNEL_PREV); + if (r < 0) + _ERR("failed to set prev channel"); + else + _update_channel_info(priv); + } + } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { + Evas_Event_Key_Up *ev = data; + + if (!ev) { + _ERR("failed to get ev"); + return; + } + + if (!strcmp(ev->keyname, KEY_CHANNELUP) || + !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE) || + !strcmp(ev->keyname, KEY_CHANNELDOWN) || + !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + if (!priv->channel_info) { + _ERR("failed to get channel info"); + return; + } + + r = tv_channel_tune_with_service_id( + priv->channel_info->service_id); + if (r < 0) + _ERR("failed to tune next channel"); + } } } diff --git a/src/main.c b/src/main.c index 5b35c61..c8791c4 100644 --- a/src/main.c +++ b/src/main.c @@ -62,7 +62,26 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, if (!strcmp(ev->keyname, g_kmap[i].key[j])) { viewmgr_show_view(g_kmap[i].view); viewmgr_update_view(g_kmap[i].view, - UPDATE_TYPE_INPUT, ev); + UPDATE_TYPE_INPUT_KEY_DOWN, ev); + return; + } + j++; + } + } +} + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + size_t i, j; + + for (i = 0; i < sizeof(g_kmap) / sizeof(*g_kmap); i++) { + j = 0; + while (g_kmap[i].key[j]) { + if (!strcmp(ev->keyname, g_kmap[i].key[j])) { + viewmgr_show_view(g_kmap[i].view); + viewmgr_update_view(g_kmap[i].view, + UPDATE_TYPE_INPUT_KEY_UP, ev); return; } j++; @@ -72,6 +91,7 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, static input_handler key_handler = { .key_down = _key_down_cb, + .key_up = _key_up_cb, }; static Evas_Object *_add_win(const char *name) @@ -192,6 +212,14 @@ static bool _create(void *data) return false; } + if (!viewmgr_create(win)) { + _ERR("failed to initialize viewmgr"); + evas_object_del(win); + return false; + } + + viewmgr_add_view(view_channelinfo_get_vclass(), NULL); + r = tv_create(); if (r < 0) { _ERR("Create TV failed"); @@ -206,14 +234,6 @@ static bool _create(void *data) return false; } - if (!viewmgr_create(win)) { - _ERR("failed to initialize viewmgr"); - evas_object_del(win); - return false; - } - - viewmgr_add_view(view_channelinfo_get_vclass(), NULL); - ad->win = win; tv_signal_cb_set(_tv_signal_cb, ad); @@ -232,14 +252,14 @@ static void _terminate(void *data) ad = data; - tv_destroy(); + if (ad->win) { + tv_destroy(); - inputmgr_remove_callback(ad->win, &key_handler); + inputmgr_remove_callback(ad->win, &key_handler); - viewmgr_remove_view(VIEW_CHANNELINFO); - viewmgr_destroy(); + viewmgr_remove_view(VIEW_CHANNELINFO); + viewmgr_destroy(); - if (ad->win) { evas_object_del(ad->win); ad->win = NULL; } diff --git a/src/tv.c b/src/tv.c index abacbe9..fff8b6d 100644 --- a/src/tv.c +++ b/src/tv.c @@ -90,6 +90,33 @@ static struct tv_channel_info *_tv_channel_get_info(TvServiceChannel *channel) } /** + * 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 diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index bcd8488..9d1c3a2 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -363,7 +363,6 @@ static void _destroy(void *view_data) static void _update(void *view_data, int type, void *data) { struct _priv *priv; - Evas_Event_Key_Down *ev; if (!view_data) { _ERR("failed to get view data"); @@ -381,8 +380,9 @@ static void _update(void *view_data, int type, void *data) _stop_hide_timer(priv); break; } - } else if (type == UPDATE_TYPE_INPUT) { - ev = data; + } else if (type == UPDATE_TYPE_INPUT_KEY_DOWN) { + Evas_Event_Key_Down *ev = data; + if (!ev) { _ERR("failed to get ev"); return; @@ -401,7 +401,23 @@ static void _update(void *view_data, int type, void *data) !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); layoutmgr_update_layout(priv->lmgr, - LAYOUT_CHANNELINFO_LIST, 0, ev); + LAYOUT_CHANNELINFO_LIST, type, ev); + } + } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { + Evas_Event_Key_Up *ev = data; + + if (!ev) { + _ERR("failed to get ev"); + return; + } + + if (!strcmp(ev->keyname, KEY_CHANNELUP) || + !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE) || + !strcmp(ev->keyname, KEY_CHANNELDOWN) || + !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); + layoutmgr_update_layout(priv->lmgr, + LAYOUT_CHANNELINFO_LIST, type, ev); } } } -- 2.7.4 From 7a8d96e57adaa93c25be136c8ae810a773c9b766 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Tue, 14 Jul 2015 14:14:48 +0900 Subject: [PATCH 09/14] Add focus related handlings Change-Id: Ib4023446f1778d0f32e4d7210f2a50ea7519f1eb Signed-off-by: jinwoo.shin --- src/layout_channelinfo_search.c | 14 +++++++++++++- src/main.c | 2 +- src/view_channelinfo.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index ba04001..3a3aac4 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -43,7 +43,7 @@ struct _priv { static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) { - Evas_Object *ly, *divider; + Evas_Object *ly, *divider, *first; Evas *e; Eina_List *l; const struct tv_channel_info *channel_info; @@ -65,6 +65,7 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) elm_box_clear(priv->box); + first = NULL; EINA_LIST_FOREACH(channel_list, l, channel_info) { if (!channel_info->remembered) continue; @@ -78,6 +79,17 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) 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); } } diff --git a/src/main.c b/src/main.c index c8791c4..b67228b 100644 --- a/src/main.c +++ b/src/main.c @@ -104,7 +104,7 @@ static Evas_Object *_add_win(const char *name) return NULL; } elm_win_alpha_set(win, EINA_FALSE); - elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_focus_highlight_enabled_set(win, EINA_FALSE); elm_win_focus_highlight_style_set(win, "invisible"); evas_object_show(win); diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index 9d1c3a2..6e4296a 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -44,6 +44,33 @@ struct _priv { layoutmgr *lmgr; }; +static void _update(void *view_data, int type, void *data); + +static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Down *ev) +{ + _update(data, UPDATE_TYPE_INPUT_KEY_DOWN, ev); +} + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + _update(data, UPDATE_TYPE_INPUT_KEY_UP, ev); +} + +void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + viewmgr_update_view(VIEW_CHANNELINFO, + UPDATE_TYPE_TIMER, START_HIDE_TIMER); +} + +static input_handler key_handler = { + .key_down = _key_down_cb, + .key_up = _key_up_cb, + .mouse_move = _mouse_move_cb, +}; + static int _get_program_time(char *buf, int buf_len, time_t start_time, time_t end_time) { @@ -306,6 +333,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) viewmgr_set_view_data(VIEW_CHANNELINFO, priv); + inputmgr_add_callback(priv->base, 0, &key_handler, priv); + return priv->base; } @@ -355,6 +384,8 @@ static void _destroy(void *view_data) layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO_SEARCH); layoutmgr_destroy(priv->lmgr); + inputmgr_remove_callback(priv->base, &key_handler); + evas_object_del(priv->base); free(priv); @@ -402,6 +433,8 @@ static void _update(void *view_data, int type, void *data) _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); layoutmgr_update_layout(priv->lmgr, LAYOUT_CHANNELINFO_LIST, type, ev); + } else { + _start_hide_timer(priv); } } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { Evas_Event_Key_Up *ev = data; @@ -418,6 +451,10 @@ static void _update(void *view_data, int type, void *data) _set_current_layout(priv, LAYOUT_CHANNELINFO_LIST); layoutmgr_update_layout(priv->lmgr, LAYOUT_CHANNELINFO_LIST, type, ev); + } else if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE) || + !strcmp(ev->keyname, KEY_EXIT)) { + viewmgr_hide_view(VIEW_CHANNELINFO); } } } -- 2.7.4 From 0bd985a4a5477c62a7d9fed3a50757678efdff48 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Tue, 14 Jul 2015 15:11:39 +0900 Subject: [PATCH 10/14] Add tune channel function on search list layout Change-Id: I6455f12d54fc3cd9a69f72c8920ccbe285030695 Signed-off-by: jinwoo.shin --- src/layout_channelinfo_list.c | 5 ++++ src/layout_channelinfo_search.c | 63 ++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c index 5d9ce51..1bcc741 100644 --- a/src/layout_channelinfo_list.c +++ b/src/layout_channelinfo_list.c @@ -241,6 +241,11 @@ static void _hide(void *layout_data) priv = layout_data; + if (priv->channel_info) { + tv_channel_del_info(priv->channel_info); + priv->channel_info = NULL; + } + evas_object_hide(priv->layout); elm_object_content_unset(priv->base); } diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index 3a3aac4..306a59c 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -38,7 +38,48 @@ struct _priv { Evas_Object *box; layoutmgr *lmgr; - Eina_List *channel_list; +}; + +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) +{ + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + _tune_channel(data); +} + +void _mouse_down_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Down *ev) +{ + _tune_channel(data); +} + +static input_handler channel_handler = { + .key_down = _key_down_cb, + .mouse_down = _mouse_down_cb, }; static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) @@ -66,6 +107,7 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) elm_box_clear(priv->box); first = NULL; + ly = NULL; EINA_LIST_FOREACH(channel_list, l, channel_info) { if (!channel_info->remembered) continue; @@ -77,6 +119,9 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) 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); @@ -95,21 +140,22 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) static void _update_channel_list(struct _priv *priv) { + Eina_List *channel_list; + if (!priv) { _ERR("failed to get priv"); return; } - if (priv->channel_list) - tv_channel_del_list(priv->channel_list); - - priv->channel_list = tv_channel_get_list(); - if (!priv->channel_list) { + channel_list = tv_channel_get_list(); + if (!channel_list) { _ERR("failed to get channel list"); return; } - _load_channel_list(priv, priv->channel_list); + _load_channel_list(priv, channel_list); + + tv_channel_del_list(channel_list); } static bool _create(layoutmgr *lmgr, void *data) @@ -162,9 +208,6 @@ static void _destroy(void *layout_data) priv = layout_data; - if (priv->channel_list) - tv_channel_del_list(priv->channel_list); - evas_object_del(priv->scroll); free(priv); } -- 2.7.4 From ad24aef8e4060765ab62c691f42a688ae9835ec1 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 15 Jul 2015 19:30:24 +0900 Subject: [PATCH 11/14] Add function to remove all event callbacks on the box Change-Id: I305f22f66feb41d82498e08b0ab119a572b8423b Signed-off-by: jinwoo.shin --- src/layout_channelinfo_search.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index 306a59c..fbedb1d 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -71,7 +71,7 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, _tune_channel(data); } -void _mouse_down_cb(int id, void *data, Evas *e, Evas_Object *obj, +static void _mouse_down_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Down *ev) { _tune_channel(data); @@ -82,6 +82,24 @@ static input_handler channel_handler = { .mouse_down = _mouse_down_cb, }; +static void _release_channel_handler(Evas_Object *obj) +{ + Eina_List *child, *l; + Evas_Object *ly; + + if (!obj) + return; + + child = elm_box_children_get(obj); + + EINA_LIST_FOREACH(child, l, ly) { + inputmgr_remove_callback(ly, &channel_handler); + } + + if (child) + eina_list_free(child); +} + static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) { Evas_Object *ly, *divider, *first; @@ -104,6 +122,7 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list) DIVIDER_WIDTH, DIVIDER_HEIGHT); evas_object_show(divider); + _release_channel_handler(priv->box); elm_box_clear(priv->box); first = NULL; -- 2.7.4 From 5bd30ea364075b537e787115da47cd88f55873c2 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 15 Jul 2015 19:43:14 +0900 Subject: [PATCH 12/14] Add channel number view for tune by channel number Change-Id: Ied85abe9eacec42646914c348ac4045ed1e1dcfe Signed-off-by: jinwoo.shin --- CMakeLists.txt | 1 + data/live-tv.edc | 1 + data/view/channelnumber.edc | 327 +++++++++++++++++++++++ include/define.h | 10 + include/strings.h | 1 + include/{view_channelinfo.h => view.h} | 7 +- src/layout_channelinfo.c | 2 +- src/layout_channelinfo_list.c | 2 +- src/layout_channelinfo_search.c | 2 +- src/main.c | 13 +- src/view_channelinfo.c | 4 +- src/view_channelnumber.c | 459 +++++++++++++++++++++++++++++++++ 12 files changed, 820 insertions(+), 9 deletions(-) create mode 100644 data/view/channelnumber.edc rename include/{view_channelinfo.h => view.h} (86%) create mode 100644 src/view_channelnumber.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bdcd5b..9b42838 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,7 @@ SET(SRCS src/main.c src/layout_channelinfo.c src/layout_channelinfo_list.c src/layout_channelinfo_search.c + src/view_channelnumber.c src/util.c src/tv_service.c) diff --git a/data/live-tv.edc b/data/live-tv.edc index 26d27bf..8a77133 100644 --- a/data/live-tv.edc +++ b/data/live-tv.edc @@ -18,4 +18,5 @@ collections { #include "view/channelinfo.edc" + #include "view/channelnumber.edc" } diff --git a/data/view/channelnumber.edc b/data/view/channelnumber.edc new file mode 100644 index 0000000..9892029 --- /dev/null +++ b/data/view/channelnumber.edc @@ -0,0 +1,327 @@ +/* + * 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, 216 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, 26 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, "bg.list.border"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding.list"; + relative, 0.0 1.0; + } + rel2 { + to, "padding.list"; + relative, 1.0 1.0; + } + color, COLOR_OPTION_BORDER; + min, 216 224; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, "bg.list"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "bg.list.border"; + relative, 0.5 0.5; + } + rel2 { + to, "bg.list.border"; + relative, 0.5 0.5; + } + color, COLOR_BG_NORMAL; + min, 214 222; + align, 0.5 0.5; + fixed, 1 1; + } + } + part { + name, PART_CHANNELNUMBER_LIST; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "bg.list"; + relative, 0.0 0.0; + } + rel2 { + to, "bg.list"; + relative, 1.0 1.0; + } + 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, 216 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; + } + } + } + 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; + } + } +} + diff --git a/include/define.h b/include/define.h index 8b4760f..79000c3 100644 --- a/include/define.h +++ b/include/define.h @@ -22,6 +22,7 @@ #define KEY_SVCID "svcid" #define PART_CONTENT "elm.swallow.content" +#define PART_TEXT "elm.text" #define SOURCE_PROGRAM "program" #define SOURCE_ELM "elm" @@ -38,6 +39,9 @@ #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 IMG_LOCKED_NOR IMAGEDIR"ic_thumbnail_lock_01_nor.png" #define IMG_LOCKED_FOC IMAGEDIR"ic_thumbnail_lock_01_foc.png" @@ -63,4 +67,10 @@ #define PART_CHANNELINFO_TIME "part.channelinfo.time" #define PART_CHANNELINFO_STATUS "part.channelinfo.status" +#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" + #endif /* __LIVETV_DEFINE_H__*/ diff --git a/include/strings.h b/include/strings.h index 026a670..cb65a19 100644 --- a/include/strings.h +++ b/include/strings.h @@ -19,5 +19,6 @@ #define STR_NOTITLE "No Information" #define STR_NOTIME "No Data" +#define STR_CHANNEL_PREFIX "CH." #endif /* __AIR_LIVETV_STRINGS_H__*/ diff --git a/include/view_channelinfo.h b/include/view.h similarity index 86% rename from include/view_channelinfo.h rename to include/view.h index 6637f1a..936f0fe 100644 --- a/include/view_channelinfo.h +++ b/include/view.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __LIVETV_VIEW_CHANNELINFO_H__ -#define __LIVETV_VIEW_CHANNELINFO_H__ +#ifndef __LIVETV_VIEW_H__ +#define __LIVETV_VIEW_H__ enum _update_type { UPDATE_TYPE_TIMER, @@ -25,6 +25,7 @@ enum _update_type { void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info); +view_class *view_channelnumber_get_vclass(void); view_class *view_channelinfo_get_vclass(void); -#endif /* __LIVETV_VIEW_CHANNELINFO_H__*/ +#endif /* __LIVETV_VIEW_H__*/ diff --git a/src/layout_channelinfo.c b/src/layout_channelinfo.c index 00a58e0..5cdb323 100644 --- a/src/layout_channelinfo.c +++ b/src/layout_channelinfo.c @@ -22,7 +22,7 @@ #include "define.h" #include "tv.h" -#include "view_channelinfo.h" +#include "view.h" struct _priv { Evas_Object *base; diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c index 1bcc741..a6ab0b9 100644 --- a/src/layout_channelinfo_list.c +++ b/src/layout_channelinfo_list.c @@ -23,7 +23,7 @@ #include "define.h" #include "util.h" #include "tv.h" -#include "view_channelinfo.h" +#include "view.h" enum _order { CHANNEL_NEXT, diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index fbedb1d..ef62aca 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -23,7 +23,7 @@ #include "define.h" #include "util.h" #include "tv.h" -#include "view_channelinfo.h" +#include "view.h" #define DIVIDER_WIDTH 536 #define DIVIDER_HEIGHT 1 diff --git a/src/main.c b/src/main.c index b67228b..9cdc317 100644 --- a/src/main.c +++ b/src/main.c @@ -22,7 +22,8 @@ #include "define.h" #include "tv.h" -#include "view_channelinfo.h" +#include "util.h" +#include "view.h" #define KEY_MAX 256 @@ -49,6 +50,14 @@ static struct key_map g_kmap[] = { KEY_CHANNELDOWN, KEY_CHANNELDOWN_REMOTE } }, + { + VIEW_CHANNELNUMBER, + { + KEY_0, KEY_1, KEY_2, KEY_3, + KEY_4, KEY_5, KEY_6, KEY_7, + KEY_8, KEY_9, KEY_MINUS + } + }, }; static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -219,6 +228,7 @@ static bool _create(void *data) } viewmgr_add_view(view_channelinfo_get_vclass(), NULL); + viewmgr_add_view(view_channelnumber_get_vclass(), NULL); r = tv_create(); if (r < 0) { @@ -258,6 +268,7 @@ static void _terminate(void *data) inputmgr_remove_callback(ad->win, &key_handler); viewmgr_remove_view(VIEW_CHANNELINFO); + viewmgr_remove_view(VIEW_CHANNELNUMBER); viewmgr_destroy(); evas_object_del(ad->win); diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index 6e4296a..86618e7 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -22,7 +22,7 @@ #include "define.h" #include "tv.h" -#include "view_channelinfo.h" +#include "view.h" #include "layout_channelinfo.h" #include "layout_channelinfo_list.h" #include "layout_channelinfo_search.h" @@ -58,7 +58,7 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, _update(data, UPDATE_TYPE_INPUT_KEY_UP, ev); } -void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, +static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) { viewmgr_update_view(VIEW_CHANNELINFO, diff --git a/src/view_channelnumber.c b/src/view_channelnumber.c new file mode 100644 index 0000000..f478b31 --- /dev/null +++ b/src/view_channelnumber.c @@ -0,0 +1,459 @@ +/* + * 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 + +struct _priv { + Evas_Object *base; + Evas_Object *list; + Ecore_Timer *hide_timer; + + int major; + int minor; +}; + +static void _update(void *view_data, int type, void *data); + +static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Down *ev) +{ + _update(data, UPDATE_TYPE_INPUT_KEY_DOWN, ev); +} + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + _update(data, UPDATE_TYPE_INPUT_KEY_UP, ev); +} + +static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + viewmgr_update_view(VIEW_CHANNELNUMBER, + UPDATE_TYPE_TIMER, 0); +} + +static input_handler key_handler = { + .key_down = _key_down_cb, + .key_up = _key_up_cb, + .mouse_move = _mouse_move_cb, +}; + +static Eina_Bool _hide_timer(void *data) +{ + struct _priv *priv; + int r; + + if (!data) + return ECORE_CALLBACK_CANCEL; + + priv = data; + + priv->hide_timer = NULL; + + 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, _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 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) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + _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 input_handler channel_handler = { + .key_down = _channel_key_down_cb, + .mouse_down = _channel_mouse_down_cb, +}; + +static void _release_channel_handler(Evas_Object *obj) +{ + Eina_List *child, *l; + Evas_Object *ly; + + if (!obj) + return; + + child = elm_box_children_get(obj); + + EINA_LIST_FOREACH(child, l, ly) { + inputmgr_remove_callback(ly, &channel_handler); + } + + if (child) + eina_list_free(child); +} + +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); + + _release_channel_handler(priv->list); + elm_box_clear(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); + + snprintf(buf, sizeof(buf), "%ld %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); + } + } + + if (first && ly) + elm_object_focus_next_object_set(first, ly, ELM_FOCUS_UP); + + if (channel_list) + tv_channel_del_list(channel_list); +} + +static void _update_number_info(struct _priv *priv) +{ + char buf[BUF_MAX]; + + if (priv->major < 0) { + _ERR("Wrong channel number"); + return; + } + + snprintf(buf, sizeof(buf), "%d", priv->major); + + elm_object_part_text_set(priv->base, PART_CHANNELNUMBER_NUMBER, buf); + + _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) +{ + priv->major = -1; + priv->minor = -1; + + _release_channel_handler(priv->list); + elm_box_clear(priv->list); +} + +static void _number_tuning(struct _priv *priv, const char *keyname) +{ + int num; + + if (!priv || !keyname) { + _ERR("failed to get priv and keyname"); + return; + } + + num = _get_number(keyname); + if (num < 0 || (num == 0 && priv->major <= 0)) + goto error; + + if (priv->major < 0) { + priv->major = num; + } else { + priv->major *= 10; + priv->major += num; + } + + if (priv->major > MAJOR_MAX) + goto error; + + _update_number_info(priv); + + return; + +error: + _number_reset(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); + + scroll = util_add_scroller(priv->base, PART_CHANNELNUMBER_LIST); + if (!scroll) { + _ERR("failed to create scroll"); + goto error; + } + + elm_object_focus_allow_set(scroll, EINA_FALSE); + + 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); + + elm_object_focus_allow_set(priv->list, EINA_TRUE); + elm_object_focus_set(priv->list, EINA_TRUE); + + 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); +} + +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; + + inputmgr_remove_callback(priv->base, &key_handler); + + 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; + } + + if (_get_number(ev->keyname) != -1) + _number_tuning(priv, ev->keyname); + + _start_hide_timer(priv); + } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { + Evas_Event_Key_Up *ev = data; + + if (!ev) { + _ERR("failed to get ev"); + return; + } + + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { + viewmgr_hide_view(VIEW_CHANNELNUMBER); + } + } +} + +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; +} -- 2.7.4 From 3df30c5812af648c8cf4c33f6009a925d8a60df6 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Thu, 16 Jul 2015 13:44:53 +0900 Subject: [PATCH 13/14] Add error view for no channel and no signal Change-Id: I99d426fb19b72817e14b16e3d1f98491136b764b Signed-off-by: jinwoo.shin --- CMakeLists.txt | 1 + data/live-tv.edc | 1 + data/view/error.edc | 86 ++++++++++++++++++++++++ include/define.h | 5 ++ include/strings.h | 4 ++ include/view.h | 5 ++ src/layout_channelinfo_search.c | 3 +- src/main.c | 2 + src/view_channelnumber.c | 3 +- src/view_error.c | 140 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 246 insertions(+), 4 deletions(-) create mode 100644 data/view/error.edc create mode 100644 src/view_error.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b42838..34340b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ SET(SRCS src/main.c src/layout_channelinfo_list.c src/layout_channelinfo_search.c src/view_channelnumber.c + src/view_error.c src/util.c src/tv_service.c) diff --git a/data/live-tv.edc b/data/live-tv.edc index 8a77133..2c43574 100644 --- a/data/live-tv.edc +++ b/data/live-tv.edc @@ -19,4 +19,5 @@ collections { #include "view/channelinfo.edc" #include "view/channelnumber.edc" + #include "view/error.edc" } diff --git a/data/view/error.edc b/data/view/error.edc new file mode 100644 index 0000000..2d1b3e9 --- /dev/null +++ b/data/view/error.edc @@ -0,0 +1,86 @@ +/* + * 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; + parts { + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 244 244 244 255; + } + } + 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, 28; + align, 0.5 0.5; + min, 1 0; + ellipsis, -1; + } + color, 103 103 103 255; + min, 0 36; + align, 0.5 0.0; + fixed, 1 1; + } + } + 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 0.5; + min, 1 0; + ellipsis, -1; + } + color, 116 116 116 255; + min, 0 36; + align, 0.5 1.0; + fixed, 1 1; + } + } + } + } +} diff --git a/include/define.h b/include/define.h index 79000c3..372275a 100644 --- a/include/define.h +++ b/include/define.h @@ -73,4 +73,9 @@ #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" + #endif /* __LIVETV_DEFINE_H__*/ diff --git a/include/strings.h b/include/strings.h index cb65a19..486c0bd 100644 --- a/include/strings.h +++ b/include/strings.h @@ -20,5 +20,9 @@ #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" #endif /* __AIR_LIVETV_STRINGS_H__*/ diff --git a/include/view.h b/include/view.h index 936f0fe..8e0fc8e 100644 --- a/include/view.h +++ b/include/view.h @@ -17,15 +17,20 @@ #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, }; void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info); view_class *view_channelnumber_get_vclass(void); view_class *view_channelinfo_get_vclass(void); +view_class *view_error_get_vclass(void); #endif /* __LIVETV_VIEW_H__*/ diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index ef62aca..bdaabae 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -92,9 +92,8 @@ static void _release_channel_handler(Evas_Object *obj) child = elm_box_children_get(obj); - EINA_LIST_FOREACH(child, l, ly) { + EINA_LIST_FOREACH(child, l, ly) inputmgr_remove_callback(ly, &channel_handler); - } if (child) eina_list_free(child); diff --git a/src/main.c b/src/main.c index 9cdc317..c806937 100644 --- a/src/main.c +++ b/src/main.c @@ -229,6 +229,7 @@ static bool _create(void *data) viewmgr_add_view(view_channelinfo_get_vclass(), NULL); viewmgr_add_view(view_channelnumber_get_vclass(), NULL); + viewmgr_add_view(view_error_get_vclass(), NULL); r = tv_create(); if (r < 0) { @@ -269,6 +270,7 @@ static void _terminate(void *data) viewmgr_remove_view(VIEW_CHANNELINFO); viewmgr_remove_view(VIEW_CHANNELNUMBER); + viewmgr_remove_view(VIEW_ERROR); viewmgr_destroy(); evas_object_del(ad->win); diff --git a/src/view_channelnumber.c b/src/view_channelnumber.c index f478b31..ada44ad 100644 --- a/src/view_channelnumber.c +++ b/src/view_channelnumber.c @@ -152,9 +152,8 @@ static void _release_channel_handler(Evas_Object *obj) child = elm_box_children_get(obj); - EINA_LIST_FOREACH(child, l, ly) { + EINA_LIST_FOREACH(child, l, ly) inputmgr_remove_callback(ly, &channel_handler); - } if (child) eina_list_free(child); diff --git a/src/view_error.c b/src/view_error.c new file mode 100644 index 0000000..2983c25 --- /dev/null +++ b/src/view_error.c @@ -0,0 +1,140 @@ +/* + * 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 "define.h" +#include "view.h" + +struct _priv { + Evas_Object *base; +}; + +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->base = elm_layout_add(win); + if (!priv->base) { + _ERR("failed to create base object"); + free(priv); + return NULL; + } + elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_ERROR); + + 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); + + return priv->base; +} + +static void _show(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + evas_object_show(priv->base); +} + +static void _hide(void *view_data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + 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_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, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update, +}; + +view_class *view_error_get_vclass(void) +{ + return &vclass; +} -- 2.7.4 From 316a7bbd83927bd357f765e0b83a9f87e79ae4e3 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 17 Jul 2015 18:35:10 +0900 Subject: [PATCH 14/14] Change of global key event and focus handling Change-Id: If902c7bf2462132e2c5fad4f36521d0029f8a87d Signed-off-by: jinwoo.shin --- src/layout_channelinfo.c | 2 - src/layout_channelinfo_search.c | 1 + src/main.c | 49 +++++++++++++++------- src/view_channelinfo.c | 91 +++++++++++++++++++++++++---------------- src/view_channelnumber.c | 20 +++------ 5 files changed, 95 insertions(+), 68 deletions(-) diff --git a/src/layout_channelinfo.c b/src/layout_channelinfo.c index 5cdb323..d74ce81 100644 --- a/src/layout_channelinfo.c +++ b/src/layout_channelinfo.c @@ -117,8 +117,6 @@ static void _show(void *layout_data) elm_object_content_set(priv->base, priv->layout); evas_object_show(priv->layout); - - elm_object_focus_allow_set(priv->base, EINA_TRUE); } static void _hide(void *layout_data) diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c index bdaabae..0382a6f 100644 --- a/src/layout_channelinfo_search.c +++ b/src/layout_channelinfo_search.c @@ -61,6 +61,7 @@ static void _tune_channel(void *data) _ERR("failed to tune with service id"); viewmgr_hide_view(VIEW_CHANNELINFO); + viewmgr_show_view(VIEW_CHANNELINFO); } static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, diff --git a/src/main.c b/src/main.c index c806937..bfcfa18 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,8 @@ SET_TAG(PACKAGE) struct _appdata { const char *name; Evas_Object *win; + Ecore_Event_Handler *key_down; + Ecore_Event_Handler *key_up; int is_signal; }; @@ -60,48 +62,58 @@ static struct key_map g_kmap[] = { }, }; -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) +static Eina_Bool _key_down_cb(void *data, int type, void *ei) { + Evas_Event_Key_Down *ev = ei; size_t i, j; + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + if (viewmgr_active_view_count() > 0) + return ECORE_CALLBACK_PASS_ON; + } + for (i = 0; i < sizeof(g_kmap) / sizeof(*g_kmap); i++) { j = 0; while (g_kmap[i].key[j]) { if (!strcmp(ev->keyname, g_kmap[i].key[j])) { - viewmgr_show_view(g_kmap[i].view); viewmgr_update_view(g_kmap[i].view, UPDATE_TYPE_INPUT_KEY_DOWN, ev); - return; + viewmgr_show_view(g_kmap[i].view); + return ECORE_CALLBACK_DONE; } j++; } } + + return ECORE_CALLBACK_PASS_ON; } -static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Up *ev) +static Eina_Bool _key_up_cb(void *data, int type, void *ei) { + Evas_Event_Key_Up *ev = ei; size_t i, j; + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + if (viewmgr_active_view_count() > 0) + return ECORE_CALLBACK_PASS_ON; + } + for (i = 0; i < sizeof(g_kmap) / sizeof(*g_kmap); i++) { j = 0; while (g_kmap[i].key[j]) { if (!strcmp(ev->keyname, g_kmap[i].key[j])) { - viewmgr_show_view(g_kmap[i].view); viewmgr_update_view(g_kmap[i].view, UPDATE_TYPE_INPUT_KEY_UP, ev); - return; + return ECORE_CALLBACK_DONE; } j++; } } -} -static input_handler key_handler = { - .key_down = _key_down_cb, - .key_up = _key_up_cb, -}; + return ECORE_CALLBACK_PASS_ON; +} static Evas_Object *_add_win(const char *name) { @@ -248,7 +260,11 @@ static bool _create(void *data) ad->win = win; tv_signal_cb_set(_tv_signal_cb, ad); - inputmgr_add_callback(ad->win, 0, &key_handler, NULL); + ad->key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + _key_down_cb, NULL); + ad->key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, + _key_up_cb, NULL); + return true; } @@ -266,7 +282,10 @@ static void _terminate(void *data) if (ad->win) { tv_destroy(); - inputmgr_remove_callback(ad->win, &key_handler); + if (ad->key_down) + ecore_event_handler_del(ad->key_down); + if (ad->key_up) + ecore_event_handler_del(ad->key_up); viewmgr_remove_view(VIEW_CHANNELINFO); viewmgr_remove_view(VIEW_CHANNELNUMBER); diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c index 86618e7..c607039 100644 --- a/src/view_channelinfo.c +++ b/src/view_channelinfo.c @@ -44,18 +44,51 @@ struct _priv { layoutmgr *lmgr; }; -static void _update(void *view_data, int type, void *data); +static void _hide_current_layout(struct _priv *priv) +{ + if (!priv->current_layout) + return; -static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) + layoutmgr_hide_layout(priv->lmgr, priv->current_layout); + priv->current_layout = NULL; +} + +static void _set_current_layout(struct _priv *priv, const char *layout_id) { - _update(data, UPDATE_TYPE_INPUT_KEY_DOWN, ev); + if (priv->current_layout && layout_id && + !strcmp(priv->current_layout, layout_id)) + return; + + if (priv->current_layout) + layoutmgr_hide_layout(priv->lmgr, priv->current_layout); + + layoutmgr_show_layout(priv->lmgr, layout_id); + priv->current_layout = layout_id; } -static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Up *ev) +static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Down *ev) { - _update(data, UPDATE_TYPE_INPUT_KEY_UP, ev); + struct _priv *priv; + + if (!data) { + _ERR("failed to get data"); + return; + } + + priv = data; + + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + _set_current_layout(priv, LAYOUT_CHANNELINFO_SEARCH); + } else if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE) || + !strcmp(ev->keyname, KEY_EXIT)) { + viewmgr_hide_view(VIEW_CHANNELINFO); + } else { + viewmgr_update_view(VIEW_CHANNELINFO, + UPDATE_TYPE_TIMER, START_HIDE_TIMER); + } } static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -67,7 +100,6 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, static input_handler key_handler = { .key_down = _key_down_cb, - .key_up = _key_up_cb, .mouse_move = _mouse_move_cb, }; @@ -275,28 +307,6 @@ void draw_channel_info(Evas_Object *obj, UPDATE_TYPE_TIMER, START_HIDE_TIMER); } -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 (priv->current_layout && layout_id && - !strcmp(priv->current_layout, layout_id)) - return; - - if (priv->current_layout) - layoutmgr_hide_layout(priv->lmgr, priv->current_layout); - - layoutmgr_show_layout(priv->lmgr, layout_id); - priv->current_layout = layout_id; -} - static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -319,6 +329,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_CHANNELINFO); + elm_object_focus_allow_set(priv->base, EINA_TRUE); evas_object_size_hint_weight_set(priv->base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -350,6 +361,10 @@ static void _show(void *view_data) priv = view_data; evas_object_show(priv->base); + elm_object_focus_set(priv->base, EINA_TRUE); + + if (!priv->current_layout) + _set_current_layout(priv, LAYOUT_CHANNELINFO); } static void _hide(void *view_data) @@ -430,11 +445,14 @@ static void _update(void *view_data, int type, void *data) !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE) || !strcmp(ev->keyname, KEY_CHANNELDOWN) || !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + 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 { - _start_hide_timer(priv); } } else if (type == UPDATE_TYPE_INPUT_KEY_UP) { Evas_Event_Key_Up *ev = data; @@ -448,13 +466,14 @@ static void _update(void *view_data, int type, void *data) !strcmp(ev->keyname, KEY_CHANNELUP_REMOTE) || !strcmp(ev->keyname, KEY_CHANNELDOWN) || !strcmp(ev->keyname, KEY_CHANNELDOWN_REMOTE)) { + 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_BACK) || - !strcmp(ev->keyname, KEY_BACK_REMOTE) || - !strcmp(ev->keyname, KEY_EXIT)) { - viewmgr_hide_view(VIEW_CHANNELINFO); } } } diff --git a/src/view_channelnumber.c b/src/view_channelnumber.c index ada44ad..f016f86 100644 --- a/src/view_channelnumber.c +++ b/src/view_channelnumber.c @@ -26,6 +26,7 @@ #define HIDE_DUR 3.0 #define BUF_MAX 128 +#define NUMBER_MAX 3 struct _priv { Evas_Object *base; @@ -36,18 +37,13 @@ struct _priv { int minor; }; -static void _update(void *view_data, int type, void *data); - static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) { - _update(data, UPDATE_TYPE_INPUT_KEY_DOWN, ev); -} - -static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Up *ev) -{ - _update(data, UPDATE_TYPE_INPUT_KEY_UP, ev); + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { + viewmgr_hide_view(VIEW_CHANNELNUMBER); + } } static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -59,7 +55,6 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, static input_handler key_handler = { .key_down = _key_down_cb, - .key_up = _key_up_cb, .mouse_move = _mouse_move_cb, }; @@ -435,11 +430,6 @@ static void _update(void *view_data, int type, void *data) _ERR("failed to get ev"); return; } - - if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - viewmgr_hide_view(VIEW_CHANNELNUMBER); - } } } -- 2.7.4