From 8c86faef56056db0b76672496f2b95b7768b9995 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Mon, 8 Jun 2015 21:55:46 +0900 Subject: [PATCH 01/16] initial commit Change-Id: I96bb0e2cb8aeca228b791834df2fd45486b7914d Signed-off-by: Jehun Lim --- CMakeLists.txt | 82 ++++++++++++++++++ include/common/define.h | 32 +++++++ include/layout/menu_layout.h | 22 +++++ include/view/movie_view.h | 22 +++++ org.tizen.mediahub.xml.in | 9 ++ packaging/org.tizen.mediahub.manifest | 5 ++ packaging/org.tizen.mediahub.spec | 50 +++++++++++ res/edc/CMakeLists.txt | 17 ++++ res/edc/layout/menu_layout.edc | 19 +++++ res/edc/mediahub-theme.edc | 18 ++++ res/edc/mediahub.edc | 22 +++++ res/edc/view/movie_view.edc | 19 +++++ src/layout/menu_layout.c | 126 ++++++++++++++++++++++++++++ src/main.c | 151 ++++++++++++++++++++++++++++++++++ src/view/movie_view.c | 131 +++++++++++++++++++++++++++++ 15 files changed, 725 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 include/common/define.h create mode 100644 include/layout/menu_layout.h create mode 100644 include/view/movie_view.h create mode 100644 org.tizen.mediahub.xml.in create mode 100644 packaging/org.tizen.mediahub.manifest create mode 100644 packaging/org.tizen.mediahub.spec create mode 100644 res/edc/CMakeLists.txt create mode 100644 res/edc/layout/menu_layout.edc create mode 100644 res/edc/mediahub-theme.edc create mode 100644 res/edc/mediahub.edc create mode 100644 res/edc/view/movie_view.edc create mode 100644 src/layout/menu_layout.c create mode 100644 src/main.c create mode 100644 src/view/movie_view.c diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6c46965 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,82 @@ +# 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("mediahub" C) + +INCLUDE(FindPkgConfig) +pkg_check_modules(PKGS REQUIRED + elementary + capi-appfw-application + app-utils) + +IF(NOT DEFINED PACKAGE_NAME) + SET(PACKAGE_NAME "org.tizen.mediahub") +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 EDJEDIR) + SET(EDJEDIR "${PREFIX}/res/edje") +ENDIF(NOT DEFINED EDJEDIR) +IF(NOT DEFINED LOCALEDIR) + SET(LOCALEDIR "${PREFIX}/res/locale") +ENDIF(NOT DEFINED LOCALEDIR) +IF(NOT DEFINED IMAGEDIR) + SET(IMAGEDIR "${PREFIX}/res/images") +ENDIF(NOT DEFINED IMAGEDIR) +IF(NOT DEFINED PACKAGEDIR) + SET(PACKAGEDIR "/usr/share/packages") +ENDIF(NOT DEFINED PACKAGEDIR) + +SET(SRCS +src/main.c +src/view/movie_view.c +src/layout/menu_layout.c +) + +SET(TARGET_EDJ "${PROJECT_NAME}.edj") +SET(THEME_EDJ "${PROJECT_NAME}-theme.edj") + +ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"") +ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"") +ADD_DEFINITIONS("-DTHEMEFILE=\"${EDJEDIR}/${THEME_EDJ}\"") +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"") +ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") +ADD_DEFINITIONS("-DDOMAIN_NAME=\"${PROJECT_NAME}\"") +ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/common) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/view) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/layout) + +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) + +FOREACH(flag ${PKGS_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +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 ${PACKAGEDIR}) +ADD_SUBDIRECTORY(res/edc) diff --git a/include/common/define.h b/include/common/define.h new file mode 100644 index 0000000..be85a9d --- /dev/null +++ b/include/common/define.h @@ -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. + */ + +#ifndef __AIR_MEDIAHUB_DEFINE_H__ +#define __AIR_MEDIAHUB_DEFINE_H__ + +#define VIEW_MOVIE "VIEW_MOVIE" +#define LAYOUT_MENU "LAYOUT_MENU" + +#define GRP_MOVIE_VIEW "group.movie_view" +#define GRP_MENU_LAYOUT "group.menu_layout" + +#define PART_MENU_LAYOUT "part.menu_layout" +#define PART_PLAY_INFO_LAYOUT "part.playinfo_layout" +#define PART_CONTENT_LAYOUT "part.content_layout" + +#define STYLE_INVISIBLE "invisible" + +#endif /* __AIR_MEDIAHUB_DEFINE_H__ */ diff --git a/include/layout/menu_layout.h b/include/layout/menu_layout.h new file mode 100644 index 0000000..edeec12 --- /dev/null +++ b/include/layout/menu_layout.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 __AIR_MEDIAHUB_MENU_LAYOUT_H__ +#define __AIR_MEDIAHUB_MENU_LAYOUT_H__ + +layout_class *layout_menu_get_lclass(void); + +#endif /* __AIR_MEDIAHUB_MENU_LAYOUT_H__ */ diff --git a/include/view/movie_view.h b/include/view/movie_view.h new file mode 100644 index 0000000..96e6c79 --- /dev/null +++ b/include/view/movie_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 __AIR_MEDIAHUB_MOVIE_VIEW_H__ +#define __AIR_MEDIAHUB_MOVIE_VIEW_H__ + +view_class *view_movie_get_vclass(void); + +#endif /* __AIR_MEDIAHUB_MOVIE_VIEW_H__ */ diff --git a/org.tizen.mediahub.xml.in b/org.tizen.mediahub.xml.in new file mode 100644 index 0000000..1c659b4 --- /dev/null +++ b/org.tizen.mediahub.xml.in @@ -0,0 +1,9 @@ + + + + Jehun Lim + Media Hub + + + + diff --git a/packaging/org.tizen.mediahub.manifest b/packaging/org.tizen.mediahub.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/packaging/org.tizen.mediahub.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/org.tizen.mediahub.spec b/packaging/org.tizen.mediahub.spec new file mode 100644 index 0000000..d5a7724 --- /dev/null +++ b/packaging/org.tizen.mediahub.spec @@ -0,0 +1,50 @@ +Name: org.tizen.mediahub +Summary: Media Hub application +Version: 0.1 +Release: 1 +Group: Applications/Core Applications +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest + +BuildRequires: cmake +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(app-utils) + +%define _appdir /usr/apps/%{name} +%define _bindir %{_appdir}/bin +%define _resdir %{_appdir}/res +%define _localedir %{_resdir}/locale +%define _pkgdir %{_datadir}/packages + +%description +Media Hub Application + +%prep +%setup -q +cp %{SOURCE1} . + +cmake \ + -DCMAKE_INSTALL_PREFIX=%{_appdir} \ + -DPACKAGE_NAME=%{name} \ + -DBINDIR=%{_bindir} \ + -DLOCALEDIR=%{_localedir} \ + -DPACKAGEDIR=%{_pkgdir} \ + -DVERSION=%{version} + +make %{?jobs:-j%jobs} + +%install +%make_install + +%clean +rm -rf %{buildroot} + +%files +%manifest %{name}.manifest +%defattr(-,root,root,-) +%{_bindir}/* +%{_resdir}/* +%{_pkgdir}/%{name}.xml +%defattr(-,app,app,-) diff --git a/res/edc/CMakeLists.txt b/res/edc/CMakeLists.txt new file mode 100644 index 0000000..0cd5335 --- /dev/null +++ b/res/edc/CMakeLists.txt @@ -0,0 +1,17 @@ +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 + ${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/res/edc/layout/menu_layout.edc b/res/edc/layout/menu_layout.edc new file mode 100644 index 0000000..ec1e28f --- /dev/null +++ b/res/edc/layout/menu_layout.edc @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +group { + name: GRP_MENU_LAYOUT; +} diff --git a/res/edc/mediahub-theme.edc b/res/edc/mediahub-theme.edc new file mode 100644 index 0000000..b7002c0 --- /dev/null +++ b/res/edc/mediahub-theme.edc @@ -0,0 +1,18 @@ +/* + * 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. + */ + +collections { +} diff --git a/res/edc/mediahub.edc b/res/edc/mediahub.edc new file mode 100644 index 0000000..e025f0c --- /dev/null +++ b/res/edc/mediahub.edc @@ -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. + */ + +#include "../../include/common/define.h" + +collections { + #include "view/movie_view.edc" + #include "layout/menu_layout.edc" +} diff --git a/res/edc/view/movie_view.edc b/res/edc/view/movie_view.edc new file mode 100644 index 0000000..f0de4bf --- /dev/null +++ b/res/edc/view/movie_view.edc @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +group { + name: GRP_MOVIE_VIEW; +} diff --git a/src/layout/menu_layout.c b/src/layout/menu_layout.c new file mode 100644 index 0000000..60563a1 --- /dev/null +++ b/src/layout/menu_layout.c @@ -0,0 +1,126 @@ +/* + * 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 "menu_layout.h" + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + + layoutmgr *lmgr; +}; + +static 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); + if (!base) { + _ERR("failed to get base object"); + free(priv); + return false; + } + + layout = elm_layout_add(base); + if (!layout) { + _ERR("failed to create layout"); + free(priv); + return false; + } + + if (!elm_layout_file_set(layout, EDJEFILE, GRP_MENU_LAYOUT)) { + _ERR("failed to set layout file"); + evas_object_del(layout); + free(priv); + } + + layoutmgr_set_layout_data(lmgr, LAYOUT_MENU, priv); + + priv->base = base; + priv->layout = layout; + priv->lmgr = lmgr; + + return true; +} + +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; + + evas_object_show(priv->layout); + elm_object_part_content_set(priv->base, PART_MENU_LAYOUT, priv->layout); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) + return; + + priv = layout_data; + + evas_object_hide(priv->layout); + elm_object_part_content_unset(priv->base, PART_MENU_LAYOUT); +} + +static void _update(void *layout_data, int update_type, void *data) +{ +} + +static layout_class _lclass = { + .layout_id = LAYOUT_MENU, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update, +}; + +layout_class *layout_menu_get_lclass(void) +{ + return &_lclass; +} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..1e25021 --- /dev/null +++ b/src/main.c @@ -0,0 +1,151 @@ +/* + * 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 "movie_view.h" + +#define MEDIAHUB_WIN_TITLE "Media Hub" + +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_util_standard_add(NULL, name); + if (!win) + return NULL; + + elm_win_title_set(win, MEDIAHUB_WIN_TITLE); + + evas_object_show(win); + + return win; +} + +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); + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); + + 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_movie_get_vclass(), NULL); + + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + elm_win_focus_highlight_style_set(win, STYLE_INVISIBLE); + + 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_MOVIE); + + viewmgr_destroy(); + + if (ad->win) { + evas_object_del(ad->win); + ad->win = NULL; + } +} + +static void _app_control(app_control_h app_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_MOVIE); +} + +static void _pause(void *data) +{ + +} + +static void _resume(void *data) +{ + +} + +int main(int argc, char **argv) +{ + struct _appdata ad; + ui_app_lifecycle_callback_s cb = { + .create = _create, + .terminate = _terminate, + .app_control = _app_control, + .pause = _pause, + .resume = _resume, + }; + + memset(&ad, 0x0, sizeof(ad)); + ad.name = PACKAGE; + + ui_app_main(argc, argv, &cb, &ad); + + return 0; +} diff --git a/src/view/movie_view.c b/src/view/movie_view.c new file mode 100644 index 0000000..2f8f74f --- /dev/null +++ b/src/view/movie_view.c @@ -0,0 +1,131 @@ +/* + * 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 "movie_view.h" +#include "menu_layout.h" + +struct _priv { + Evas_Object *win; + Evas_Object *base; + + layoutmgr *lmgr; +}; + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + layoutmgr *lmgr; + + 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_MOVIE_VIEW); + + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + lmgr = layoutmgr_create(base); + layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); + layoutmgr_show_layout(lmgr, LAYOUT_MENU); + + priv->win = win; + priv->base = base; + priv->lmgr = lmgr; + + viewmgr_set_view_data(VIEW_MOVIE, 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; + + 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; + + layoutmgr_destroy(priv->lmgr); + evas_object_del(priv->base); + + free(priv); +} + +static view_class _vclass = { + .view_id = VIEW_MOVIE, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_movie_get_vclass(void) +{ + return &_vclass; +} -- 2.7.4 From 342fcad5a96d5152126a1b89627d91268c693d5b Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 11 Jun 2015 16:59:32 +0900 Subject: [PATCH 02/16] add cflags - Wall and Werror Change-Id: If317b9b7db473e2331dc53454b97df87d2e9bdcb Signed-off-by: Minkyu Kang --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c46965..a0040fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) FOREACH(flag ${PKGS_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror") TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS}) CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml) -- 2.7.4 From 8f7338ece6e88479981cf7dc82c80b8a2567b11d Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Mon, 15 Jun 2015 15:55:41 +0900 Subject: [PATCH 03/16] add viewer view Change-Id: I9ce1ea071af506ea608b420048480dfc2ed2ce73 Signed-off-by: Minkyu Kang --- CMakeLists.txt | 5 +- include/define.h | 42 +++++ include/{layout/menu_layout.h => layout.h} | 7 +- include/{common/define.h => layout/menu.h} | 12 +- include/{view/movie_view.h => view.h} | 10 +- include/view/movie.h | 24 +++ include/view/viewer.h | 31 +++ res/edc/mediahub.edc | 3 +- res/edc/view/viewer.edc | 291 +++++++++++++++++++++++++++++ src/layout/menu_layout.c | 1 - src/main.c | 4 +- src/view/movie_view.c | 3 +- src/view/viewer.c | 121 ++++++++++++ 13 files changed, 531 insertions(+), 23 deletions(-) create mode 100644 include/define.h rename include/{layout/menu_layout.h => layout.h} (84%) rename include/{common/define.h => layout/menu.h} (70%) rename include/{view/movie_view.h => view.h} (79%) create mode 100644 include/view/movie.h create mode 100644 include/view/viewer.h create mode 100644 res/edc/view/viewer.edc create mode 100644 src/view/viewer.c diff --git a/CMakeLists.txt b/CMakeLists.txt index a0040fb..5163127 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ ENDIF(NOT DEFINED PACKAGEDIR) SET(SRCS src/main.c src/view/movie_view.c +src/view/viewer.c src/layout/menu_layout.c ) @@ -63,9 +64,7 @@ ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") ADD_DEFINITIONS("-DDOMAIN_NAME=\"${PROJECT_NAME}\"") ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"") -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/common) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/view) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include/layout) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) diff --git a/include/define.h b/include/define.h new file mode 100644 index 0000000..5faf611 --- /dev/null +++ b/include/define.h @@ -0,0 +1,42 @@ +/* + * 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 __AIR_MEDIAHUB_DEFINE_H__ +#define __AIR_MEDIAHUB_DEFINE_H__ + +/* views */ +#include "view/movie.h" +#include "view/viewer.h" + +/* layouts */ +#include "layout/menu.h" + +/* defines */ +#define STYLE_INVISIBLE "invisible" + +#define FONT_REGULAR "TizenSans" +#define FONT_LIGHT "TizenSans:style=Light" +#define FONT_BOLD "TizenSans:style=Bold" + +#define COLOR_TEXT_TITLE 51 51 51 255 +#define COLOR_TEXT_MENU 104 104 104 255 +#define COLOR_TEXT_INDEX 77 77 77 255 +#define COLOR_TEXT_NORMAL 87 87 87 255 +#define COLOR_TEXT_FOCUS 255 255 255 255 +#define COLOR_TEXT_SELECTED 64 136 211 255 +#define COLOR_TEXT_DISABLED 87 87 87 128 + +#endif /* __AIR_MEDIAHUB_DEFINE_H__ */ diff --git a/include/layout/menu_layout.h b/include/layout.h similarity index 84% rename from include/layout/menu_layout.h rename to include/layout.h index edeec12..5b3f2b5 100644 --- a/include/layout/menu_layout.h +++ b/include/layout.h @@ -14,9 +14,10 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_MENU_LAYOUT_H__ -#define __AIR_MEDIAHUB_MENU_LAYOUT_H__ +#ifndef __AIR_MEDIAHUB_LAYOUT_H__ +#define __AIR_MEDIAHUB_LAYOUT_H__ +/* menu */ layout_class *layout_menu_get_lclass(void); -#endif /* __AIR_MEDIAHUB_MENU_LAYOUT_H__ */ +#endif /* __AIR_MEDIAHUB_LAYOUT_H__ */ diff --git a/include/common/define.h b/include/layout/menu.h similarity index 70% rename from include/common/define.h rename to include/layout/menu.h index be85a9d..2232c2e 100644 --- a/include/common/define.h +++ b/include/layout/menu.h @@ -14,19 +14,13 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_DEFINE_H__ -#define __AIR_MEDIAHUB_DEFINE_H__ +#ifndef __AIR_MEDIAHUB_LAYOUT_MENU_H__ +#define __AIR_MEDIAHUB_LAYOUT_MENU_H__ -#define VIEW_MOVIE "VIEW_MOVIE" #define LAYOUT_MENU "LAYOUT_MENU" -#define GRP_MOVIE_VIEW "group.movie_view" #define GRP_MENU_LAYOUT "group.menu_layout" #define PART_MENU_LAYOUT "part.menu_layout" -#define PART_PLAY_INFO_LAYOUT "part.playinfo_layout" -#define PART_CONTENT_LAYOUT "part.content_layout" -#define STYLE_INVISIBLE "invisible" - -#endif /* __AIR_MEDIAHUB_DEFINE_H__ */ +#endif /* __AIR_MEDIAHUB_LAYOUT_MENU_H__ */ diff --git a/include/view/movie_view.h b/include/view.h similarity index 79% rename from include/view/movie_view.h rename to include/view.h index 96e6c79..5428cfe 100644 --- a/include/view/movie_view.h +++ b/include/view.h @@ -14,9 +14,13 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_MOVIE_VIEW_H__ -#define __AIR_MEDIAHUB_MOVIE_VIEW_H__ +#ifndef __AIR_MEDIAHUB_VIEW_H__ +#define __AIR_MEDIAHUB_VIEW_H__ +/* movie */ view_class *view_movie_get_vclass(void); -#endif /* __AIR_MEDIAHUB_MOVIE_VIEW_H__ */ +/* viewer */ +view_class *view_viewer_get_vclass(void); + +#endif /* __AIR_MEDIAHUB_VIEW_H__ */ diff --git a/include/view/movie.h b/include/view/movie.h new file mode 100644 index 0000000..323843b --- /dev/null +++ b/include/view/movie.h @@ -0,0 +1,24 @@ +/* + * 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 __AIR_MEDIAHUB_VIEW_MOVIE_H__ +#define __AIR_MEDIAHUB_VIEW_MOVIE_H__ + +#define VIEW_MOVIE "VIEW_MOVIE" + +#define GRP_MOVIE_VIEW "group.movie_view" + +#endif /* __AIR_MEDIAHUB_VIEW_MOVIE_H__ */ diff --git a/include/view/viewer.h b/include/view/viewer.h new file mode 100644 index 0000000..b1a46e9 --- /dev/null +++ b/include/view/viewer.h @@ -0,0 +1,31 @@ +/* + * 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 __AIR_MEDIAHUB_VIEW_VIEWER_H__ +#define __AIR_MEDIAHUB_VIEW_VIEWER_H__ + +#define VIEW_VIEWER "VIEW_VIEWER" + +#define GRP_VIEWER_VIEW "group.viewer_view" + +#define PART_VIEWER_CONTENT "part.viewer_content" +#define PART_VIEWER_TITLE "part.viewer_title" +#define PART_VIEWER_DATE "part.viewer_date" +#define PART_VIEWER_PAGE "part.viewer_page" +#define PART_VIEWER_PROGRESS "part.viewer_progress" +#define PART_VIEWER_TOTAL "part.viewer_total" + +#endif /* __AIR_MEDIAHUB_VIEW_VIEWER_H__ */ diff --git a/res/edc/mediahub.edc b/res/edc/mediahub.edc index e025f0c..a80e853 100644 --- a/res/edc/mediahub.edc +++ b/res/edc/mediahub.edc @@ -14,9 +14,10 @@ * limitations under the License. */ -#include "../../include/common/define.h" +#include "../../include/define.h" collections { #include "view/movie_view.edc" + #include "view/viewer.edc" #include "layout/menu_layout.edc" } diff --git a/res/edc/view/viewer.edc b/res/edc/view/viewer.edc new file mode 100644 index 0000000..1a2f0b2 --- /dev/null +++ b/res/edc/view/viewer.edc @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +group { + name: GRP_VIEWER_VIEW; + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 0 0 0 255; + } + } + part { + name: PART_VIEWER_CONTENT; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + } + } + + /* TOP */ + part { + name: "toparea"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + min: 0 104; + rel2 { + relative: 1.0 0.0; + } + align: 0.5 0.0; + fixed: 0 1; + } + description { + state: "hide" 0.0; + inherit: "default" 0.0; + align: 0.5 1.0; + visible: 0; + } + } + part { + name: "toparea_bg"; + type: RECT; + scale: 1; + clip_to: "toparea"; + description { + state: "default" 0.0; + color: 255 255 255 255; + rel1.to: "toparea"; + rel2.to: "toparea"; + } + } + part { + name: "padding_title"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + min: 35 0; + rel1 { + to: "toparea"; + } + rel2 { + to: "toparea"; + relative: 0.0 1.0; + } + fixed: 1 0; + align: 0.0 0.5; + } + } + part { + name: PART_VIEWER_TITLE; + type: TEXT; + clip_to: "toparea"; + scale: 1; + description { + state: "default" 0.0; + min: 1600 0; + rel1 { + to: "padding_title"; + relative: 1.0 0.0; + } + rel2 { + to: "padding_title"; + } + text { + font: FONT_LIGHT; + size: 42; + align: 0.0 0.5; + } + color: COLOR_TEXT_TITLE; + fixed: 1 0; + align: 0.0 0.5; + } + } + part { + name: PART_VIEWER_DATE; + type: TEXT; + clip_to: "toparea"; + scale: 1; + description { + state: "default" 0.0; + min: 470 0; + rel1 { + to: "padding_title"; + relative: 1.0 0.0; + } + rel2 { + to: "padding_title"; + } + text { + font: FONT_REGULAR; + size: 46; + align: 0.0 0.5; + } + color: COLOR_TEXT_TITLE; + fixed: 1 0; + align: 0.0 0.5; + } + } + part { + name: PART_VIEWER_PAGE; + type: TEXT; + clip_to: "toparea"; + scale: 1; + description { + state: "default" 0.0; + min: 470 0; + rel1 { + to: "toparea"; + relative: 0.5 0.5; + } + rel2 { + to: "toparea"; + relative: 0.5 0.5; + } + text { + font: FONT_REGULAR; + size: 46; + align: 0.5 0.5; + } + color: COLOR_TEXT_TITLE; + fixed: 1 0; + align: 0.5 0.5; + } + } + + /* BOTTOM */ + part { + name: "bottomarea"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + min: 0 143; + rel1 { + relative: 0.0 1.0; + } + align: 0.5 1.0; + fixed: 0 1; + } + description { + state: "hide" 0.0; + inherit: "default" 0.0; + align: 0.5 0.0; + visible: 0; + } + } + part { + name: "bottomarea_bg"; + type: RECT; + scale: 1; + clip_to: "bottomarea"; + description { + state: "default" 0.0; + color: 255 255 255 255; + rel1.to: "bottomarea"; + rel2.to: "bottomarea"; + } + } + part { + name: "controls_bg"; + type: RECT; + clip_to: "bottomarea"; + scale: 1; + description { + state: "default" 0.0; + min: 900 143; + rel1 { + to: "bottomarea"; + relative: 0.5 0.5; + } + rel2 { + to: "bottomarea"; + relative: 0.5 0.5; + } + fixed: 1 1; + align: 0.5 0.5; + } + } + + part { + name: "padding_time"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + min: 35 0; + rel1 { + to: "bottomarea"; + } + rel2 { + to: "bottomarea"; + relative: 0.0 1.0; + } + fixed: 1 0; + align: 0.0 0.5; + } + } + part { + name: PART_VIEWER_PROGRESS; + type: TEXT; + clip_to: "bottomarea"; + scale: 1; + description { + state: "default" 0.0; + min: 125 0; + rel1 { + to: "padding_time"; + relative: 1.0 0.0; + } + rel2 { + to: "padding_time"; + } + text { + font: FONT_LIGHT; + size: 31; + align: 0.0 0.5; + } + color: COLOR_TEXT_SELECTED; + fixed: 1 0; + align: 0.0 0.5; + } + } + part { + name: PART_VIEWER_TOTAL; + type: TEXT; + clip_to: "bottomarea"; + scale: 1; + description { + state: "default" 0.0; + min: 150 0; + rel1 { + to: PART_VIEWER_PROGRESS; + relative: 1.0 0.0; + } + rel2 { + to: PART_VIEWER_PROGRESS; + } + text { + font: FONT_LIGHT; + size: 31; + align: 0.0 0.5; + } + color: COLOR_TEXT_INDEX; + fixed: 1 0; + align: 0.0 0.5; + } + } + } +} diff --git a/src/layout/menu_layout.c b/src/layout/menu_layout.c index 60563a1..a5c2cb1 100644 --- a/src/layout/menu_layout.c +++ b/src/layout/menu_layout.c @@ -19,7 +19,6 @@ #include #include "define.h" -#include "menu_layout.h" struct _priv { Evas_Object *base; diff --git a/src/main.c b/src/main.c index 1e25021..9fd990e 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,7 @@ #include #include "define.h" -#include "movie_view.h" +#include "view.h" #define MEDIAHUB_WIN_TITLE "Media Hub" @@ -74,6 +74,7 @@ static bool _create(void *data) } viewmgr_add_view(view_movie_get_vclass(), NULL); + viewmgr_add_view(view_viewer_get_vclass(), NULL); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); elm_win_focus_highlight_style_set(win, STYLE_INVISIBLE); @@ -95,6 +96,7 @@ static void _terminate(void *data) ad = data; viewmgr_remove_view(VIEW_MOVIE); + viewmgr_remove_view(VIEW_VIEWER); viewmgr_destroy(); diff --git a/src/view/movie_view.c b/src/view/movie_view.c index 2f8f74f..4e82af6 100644 --- a/src/view/movie_view.c +++ b/src/view/movie_view.c @@ -20,8 +20,7 @@ #include #include "define.h" -#include "movie_view.h" -#include "menu_layout.h" +#include "layout.h" struct _priv { Evas_Object *win; diff --git a/src/view/viewer.c b/src/view/viewer.c new file mode 100644 index 0000000..656ae4d --- /dev/null +++ b/src/view/viewer.c @@ -0,0 +1,121 @@ +/* + * 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" + +struct _priv { + Evas_Object *win; + 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_VIEWER_VIEW); + + evas_object_size_hint_weight_set(base, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + priv->win = win; + priv->base = base; + + viewmgr_set_view_data(VIEW_VIEWER, 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; + + 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_VIEWER, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_viewer_get_vclass(void) +{ + return &_vclass; +} -- 2.7.4 From a0b8f3941ed08470269edf9ec1a21a390dfe341e Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Mon, 15 Jun 2015 20:57:59 +0900 Subject: [PATCH 04/16] viewer: add favorite icon Change-Id: Ib3e38b3b844d26fe533985148fdbf22003f65cdb Signed-off-by: Minkyu Kang --- include/view/viewer.h | 6 +++++ res/edc/images/ic_title_favorite.png | Bin 0 -> 1923 bytes res/edc/view/viewer.edc | 44 +++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 res/edc/images/ic_title_favorite.png diff --git a/include/view/viewer.h b/include/view/viewer.h index b1a46e9..019f5c8 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -17,10 +17,13 @@ #ifndef __AIR_MEDIAHUB_VIEW_VIEWER_H__ #define __AIR_MEDIAHUB_VIEW_VIEWER_H__ +/* view */ #define VIEW_VIEWER "VIEW_VIEWER" +/* group */ #define GRP_VIEWER_VIEW "group.viewer_view" +/* part */ #define PART_VIEWER_CONTENT "part.viewer_content" #define PART_VIEWER_TITLE "part.viewer_title" #define PART_VIEWER_DATE "part.viewer_date" @@ -28,4 +31,7 @@ #define PART_VIEWER_PROGRESS "part.viewer_progress" #define PART_VIEWER_TOTAL "part.viewer_total" +/* images */ +#define IMAGE_VIEWER_FAVORITE "ic_title_favorite.png" + #endif /* __AIR_MEDIAHUB_VIEW_VIEWER_H__ */ diff --git a/res/edc/images/ic_title_favorite.png b/res/edc/images/ic_title_favorite.png new file mode 100644 index 0000000000000000000000000000000000000000..33e21b03ea8ce73ef7e2453aff4ab29be85a9b2b GIT binary patch literal 1923 zcmbVNd05kC7>`^-1y-Dj!@0#G(*Zqc(l$^b^pFl)vEW0eqJ}m=l{TdfYX!#PjSdmn z*aT7LR0KA>inoB{aU#=+cujnU>n1Xo;K4OK#!?lxKYaGb@+A4b_sjeHz4w#6XyqKw zalYdK0PvJYN>tPu;CS5KsQ1~%^NXnEZBnWxV~9l3f|+mt)e;FfDA!|2xC+O#D^t(o zp#b2VsEbvTYQV_E{9s99Vf}1raosrZL z2GGHXB@k((h)#L>A_Torp?F1XFuzO`l`@tUGqN~LHcPK}#PwX;OsepI+<2|FId-KH zXQ^;Ak!I3R^+@y^1yi~EZ$l16${S>!Nk~A_^4eSW%nf(`cEt(HsKgam|_VcWwZmLlL?YAClf|c90P;1;&cWrVKIN; zD9?*%CAdlVF|L)F2tD{bzliQN_W1%>$d&PfApskeLL3gt7DhzCJQPJaJV`L0iu(mt z`+suAqMTtln&V&1GI~UHpkw>0^(o=i@Zbh&VocO%r0IgGIdwiPm!PrMwtFANM;2id zv+8@E+?~iDO46w#P>Ij=8gYQFi5;sV0%ql%=w&`eH>^5w523F*)m&a()6G0PV+J;V z_>20|%D$xDk#lJ~h84wKPwRT(OIvaq+btQF?85tfr#rU~mC_2%-89fVZ~4;)$!ndH z8uFs<_Z|BB!O#Xe;py!uTj07a=uscv7TK=&{ql$J zhgC3|uB~;kiR2k7>y=B+`wIIP2lU7frtV(a*kv0*GgLwEbajrgT}<41GeNoU{Pjn`q5K|qkER1f{e$-I356zH8LkwpPDy9-WQ~C?2lz$( zYho-r`|q@@$@cJC*}Re8Tvza9%%eSX(}=bo%A9r@m(5&1&)HsE{W&}>Fz{kc%iNK1 z2gk-43)k_-F5_QXbAS5jyGu6PgtE*{H?^+mgJT{!dlnRa99SE(XxlG;_I?wx-Mgu_ zR?u4T-swOXzTt1XoN(dZGJ8n^ywQK#;)-idP~ncRWPY0Nj<(w+E6Ois1R-UhHfxJ& zVOTsf*Kn)VAFr?&cEM=9obhaVPKiBqT2HWf`t^`w6QuRO44gZ5B+K_*+nhUysMllg za=-h)_#1DmKeYsyC(bVNeGJ`foqcpl;xn&#pMBWlTylNavl*Xk&KlF;9j=Y32Ocy2 z=-=7lNk+Aeb)UM!Y9;};MC&VP9DJKr-lldmu|e{w Date: Thu, 18 Jun 2015 16:41:08 +0900 Subject: [PATCH 05/16] add initial gallery and music view Change-Id: Iff418e86900d0a16ca1cc0a5888442163a36f483 Signed-off-by: Jehun Lim --- CMakeLists.txt | 4 +- include/define.h | 2 + include/view.h | 6 ++ include/view/gallery.h | 24 ++++++ include/view/music.h | 24 ++++++ res/edc/mediahub.edc | 4 +- res/edc/view/gallery.edc | 73 ++++++++++++++++ res/edc/view/{movie_view.edc => movie.edc} | 0 res/edc/view/music.edc | 73 ++++++++++++++++ src/main.c | 4 + src/view/gallery.c | 130 +++++++++++++++++++++++++++++ src/view/{movie_view.c => movie.c} | 0 src/view/music.c | 130 +++++++++++++++++++++++++++++ 13 files changed, 472 insertions(+), 2 deletions(-) create mode 100644 include/view/gallery.h create mode 100644 include/view/music.h create mode 100644 res/edc/view/gallery.edc rename res/edc/view/{movie_view.edc => movie.edc} (100%) create mode 100644 res/edc/view/music.edc create mode 100644 src/view/gallery.c rename src/view/{movie_view.c => movie.c} (100%) create mode 100644 src/view/music.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 5163127..9aef68f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,9 @@ ENDIF(NOT DEFINED PACKAGEDIR) SET(SRCS src/main.c -src/view/movie_view.c +src/view/movie.c +src/view/gallery.c +src/view/music.c src/view/viewer.c src/layout/menu_layout.c ) diff --git a/include/define.h b/include/define.h index 5faf611..82d8927 100644 --- a/include/define.h +++ b/include/define.h @@ -19,6 +19,8 @@ /* views */ #include "view/movie.h" +#include "view/gallery.h" +#include "view/music.h" #include "view/viewer.h" /* layouts */ diff --git a/include/view.h b/include/view.h index 5428cfe..c28e0d1 100644 --- a/include/view.h +++ b/include/view.h @@ -20,6 +20,12 @@ /* movie */ view_class *view_movie_get_vclass(void); +/* gallery */ +view_class *view_gallery_get_vclass(void); + +/* music */ +view_class *view_music_get_vclass(void); + /* viewer */ view_class *view_viewer_get_vclass(void); diff --git a/include/view/gallery.h b/include/view/gallery.h new file mode 100644 index 0000000..830899f --- /dev/null +++ b/include/view/gallery.h @@ -0,0 +1,24 @@ +/* + * 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 __AIR_MEDIAHUB_VIEW_GALLERY_H__ +#define __AIR_MEDIAHUB_VIEW_GALLERY_H__ + +#define VIEW_GALLERY "VIEW_GALLERY" + +#define GRP_GALLERY_VIEW "group.gallery_view" + +#endif /* __AIR_MEDIAHUB_VIEW_GALLERY_H__ */ diff --git a/include/view/music.h b/include/view/music.h new file mode 100644 index 0000000..d727a59 --- /dev/null +++ b/include/view/music.h @@ -0,0 +1,24 @@ +/* + * 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 __AIR_MEDIAHUB_VIEW_MUSIC_H__ +#define __AIR_MEDIAHUB_VIEW_MUSIC_H__ + +#define VIEW_MUSIC "VIEW_MUSIC" + +#define GRP_MUSIC_VIEW "group.music_view" + +#endif /* __AIR_MEDIAHUB_VIEW_MUSIC_H__ */ diff --git a/res/edc/mediahub.edc b/res/edc/mediahub.edc index a80e853..bacbbec 100644 --- a/res/edc/mediahub.edc +++ b/res/edc/mediahub.edc @@ -17,7 +17,9 @@ #include "../../include/define.h" collections { - #include "view/movie_view.edc" + #include "view/movie.edc" + #include "view/gallery.edc" + #include "view/music.edc" #include "view/viewer.edc" #include "layout/menu_layout.edc" } diff --git a/res/edc/view/gallery.edc b/res/edc/view/gallery.edc new file mode 100644 index 0000000..cd292a7 --- /dev/null +++ b/res/edc/view/gallery.edc @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +group { + name: GRP_GALLERY_VIEW; + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 255 255 255 255; + } + } + part { + name: PART_MENU_LAYOUT; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel2.relative: 1.0 0.0; + align: 0.5 0.0; + } + } + part { + name: "padding_content_layout"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_MENU_LAYOUT; + relative: 0.0 1.0; + } + rel2.to: PART_MENU_LAYOUT; + min: 0 71; + align: 0.5 0.0; + color: 223 223 223 255; + fixed: 0 1; + } + } + part { + name: PART_CONTENT_LAYOUT; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_content_layout"; + relative: 0.0 1.0; + } + rel2.to: "padding_content_layout"; + min: 0 678; + align: 0.5 0.0; + fixed: 0 1; + } + } + } +} diff --git a/res/edc/view/movie_view.edc b/res/edc/view/movie.edc similarity index 100% rename from res/edc/view/movie_view.edc rename to res/edc/view/movie.edc diff --git a/res/edc/view/music.edc b/res/edc/view/music.edc new file mode 100644 index 0000000..946f756 --- /dev/null +++ b/res/edc/view/music.edc @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +group { + name: GRP_MUSIC_VIEW; + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 255 255 255 255; + } + } + part { + name: PART_MENU_LAYOUT; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel2.relative: 1.0 0.0; + align: 0.5 0.0; + } + } + part { + name: "padding_content_layout"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_MENU_LAYOUT; + relative: 0.0 1.0; + } + rel2.to: PART_MENU_LAYOUT; + min: 0 71; + align: 0.5 0.0; + color: 223 223 223 255; + fixed: 0 1; + } + } + part { + name: PART_CONTENT_LAYOUT; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_content_layout"; + relative: 0.0 1.0; + } + rel2.to: "padding_content_layout"; + min: 0 678; + align: 0.5 0.0; + fixed: 0 1; + } + } + } +} diff --git a/src/main.c b/src/main.c index 9fd990e..538d955 100644 --- a/src/main.c +++ b/src/main.c @@ -74,6 +74,8 @@ static bool _create(void *data) } viewmgr_add_view(view_movie_get_vclass(), NULL); + viewmgr_add_view(view_gallery_get_vclass(), NULL); + viewmgr_add_view(view_music_get_vclass(), NULL); viewmgr_add_view(view_viewer_get_vclass(), NULL); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); @@ -96,6 +98,8 @@ static void _terminate(void *data) ad = data; viewmgr_remove_view(VIEW_MOVIE); + viewmgr_remove_view(VIEW_GALLERY); + viewmgr_remove_view(VIEW_MUSIC); viewmgr_remove_view(VIEW_VIEWER); viewmgr_destroy(); diff --git a/src/view/gallery.c b/src/view/gallery.c new file mode 100644 index 0000000..970ca82 --- /dev/null +++ b/src/view/gallery.c @@ -0,0 +1,130 @@ +/* + * 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 "layout.h" + +struct _priv { + Evas_Object *win; + Evas_Object *base; + + layoutmgr *lmgr; +}; + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + layoutmgr *lmgr; + + 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_GALLERY_VIEW); + + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + lmgr = layoutmgr_create(base); + layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); + layoutmgr_show_layout(lmgr, LAYOUT_MENU); + + priv->win = win; + priv->base = base; + priv->lmgr = lmgr; + + viewmgr_set_view_data(VIEW_GALLERY, 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; + + 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; + + layoutmgr_destroy(priv->lmgr); + evas_object_del(priv->base); + + free(priv); +} + +static view_class _vclass = { + .view_id = VIEW_GALLERY, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_gallery_get_vclass(void) +{ + return &_vclass; +} diff --git a/src/view/movie_view.c b/src/view/movie.c similarity index 100% rename from src/view/movie_view.c rename to src/view/movie.c diff --git a/src/view/music.c b/src/view/music.c new file mode 100644 index 0000000..4280f66 --- /dev/null +++ b/src/view/music.c @@ -0,0 +1,130 @@ +/* + * 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 "layout.h" + +struct _priv { + Evas_Object *win; + Evas_Object *base; + + layoutmgr *lmgr; +}; + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + layoutmgr *lmgr; + + 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_MUSIC_VIEW); + + evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + lmgr = layoutmgr_create(base); + layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); + layoutmgr_show_layout(lmgr, LAYOUT_MENU); + + priv->win = win; + priv->base = base; + priv->lmgr = lmgr; + + viewmgr_set_view_data(VIEW_MUSIC, 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; + + 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; + + layoutmgr_destroy(priv->lmgr); + evas_object_del(priv->base); + + free(priv); +} + +static view_class _vclass = { + .view_id = VIEW_MUSIC, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, +}; + +view_class *view_music_get_vclass(void) +{ + return &_vclass; +} -- 2.7.4 From ce128cedad25d38a08e9f5c95ca2ccf9b9a2521e Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Fri, 19 Jun 2015 14:35:10 +0900 Subject: [PATCH 06/16] add initial base view : convert movie, gallery, music view to movie, gallery, music layout Change-Id: Ie8a2034ec4d2e12eb5019a9a194d9876546d9e83 Signed-off-by: Jehun Lim --- CMakeLists.txt | 8 +- include/define.h | 8 +- include/layout.h | 10 +- include/layout/gallery.h | 24 ++++ include/{view/gallery.h => layout/movie.h} | 10 +- include/{view => layout}/music.h | 10 +- include/view.h | 10 +- include/{layout/menu.h => view/base.h} | 14 ++- include/view/movie.h => res/edc/layout/gallery.edc | 11 +- res/edc/{view => layout}/movie.edc | 2 +- res/edc/layout/{menu_layout.edc => music.edc} | 2 +- res/edc/mediahub.edc | 8 +- res/edc/view/{gallery.edc => base.edc} | 32 +++-- res/edc/view/music.edc | 73 ----------- src/layout/gallery.c | 137 +++++++++++++++++++++ src/layout/{menu_layout.c => movie.c} | 32 +++-- src/layout/music.c | 137 +++++++++++++++++++++ src/main.c | 10 +- src/view/{movie.c => base.c} | 13 +- src/view/gallery.c | 130 ------------------- src/view/music.c | 130 ------------------- 21 files changed, 397 insertions(+), 414 deletions(-) create mode 100644 include/layout/gallery.h rename include/{view/gallery.h => layout/movie.h} (75%) rename include/{view => layout}/music.h (75%) rename include/{layout/menu.h => view/base.h} (66%) rename include/view/movie.h => res/edc/layout/gallery.edc (76%) rename res/edc/{view => layout}/movie.edc (96%) rename res/edc/layout/{menu_layout.edc => music.edc} (96%) rename res/edc/view/{gallery.edc => base.edc} (72%) delete mode 100644 res/edc/view/music.edc create mode 100644 src/layout/gallery.c rename src/layout/{menu_layout.c => movie.c} (77%) create mode 100644 src/layout/music.c rename src/view/{movie.c => base.c} (86%) delete mode 100644 src/view/gallery.c delete mode 100644 src/view/music.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aef68f..d6ee7b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,11 +48,11 @@ ENDIF(NOT DEFINED PACKAGEDIR) SET(SRCS src/main.c -src/view/movie.c -src/view/gallery.c -src/view/music.c +src/view/base.c src/view/viewer.c -src/layout/menu_layout.c +src/layout/movie.c +src/layout/gallery.c +src/layout/music.c ) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/include/define.h b/include/define.h index 82d8927..8fd4bf9 100644 --- a/include/define.h +++ b/include/define.h @@ -18,13 +18,13 @@ #define __AIR_MEDIAHUB_DEFINE_H__ /* views */ -#include "view/movie.h" -#include "view/gallery.h" -#include "view/music.h" +#include "view/base.h" #include "view/viewer.h" /* layouts */ -#include "layout/menu.h" +#include "layout/movie.h" +#include "layout/gallery.h" +#include "layout/music.h" /* defines */ #define STYLE_INVISIBLE "invisible" diff --git a/include/layout.h b/include/layout.h index 5b3f2b5..d20ddee 100644 --- a/include/layout.h +++ b/include/layout.h @@ -17,7 +17,13 @@ #ifndef __AIR_MEDIAHUB_LAYOUT_H__ #define __AIR_MEDIAHUB_LAYOUT_H__ -/* menu */ -layout_class *layout_menu_get_lclass(void); +/* movie */ +layout_class *layout_movie_get_lclass(void); + +/* gallery */ +layout_class *layout_gallery_get_lclass(void); + +/* music */ +layout_class *layout_music_get_lclass(void); #endif /* __AIR_MEDIAHUB_LAYOUT_H__ */ diff --git a/include/layout/gallery.h b/include/layout/gallery.h new file mode 100644 index 0000000..aa7e914 --- /dev/null +++ b/include/layout/gallery.h @@ -0,0 +1,24 @@ +/* + * 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 __AIR_MEDIAHUB_LAYOUT_GALLERY_H__ +#define __AIR_MEDIAHUB_LAYOUT_GALLERY_H__ + +#define LAYOUT_GALLERY "LAYOUT_GALLERY" + +#define GRP_GALLERY_LAYOUT "group.gallery_layout" + +#endif /* __AIR_MEDIAHUB_LAYOUT_GALLERY_H__ */ diff --git a/include/view/gallery.h b/include/layout/movie.h similarity index 75% rename from include/view/gallery.h rename to include/layout/movie.h index 830899f..a0aaa9f 100644 --- a/include/view/gallery.h +++ b/include/layout/movie.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_VIEW_GALLERY_H__ -#define __AIR_MEDIAHUB_VIEW_GALLERY_H__ +#ifndef __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ +#define __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ -#define VIEW_GALLERY "VIEW_GALLERY" +#define LAYOUT_MOVIE "LAYOUT_MOVIE" -#define GRP_GALLERY_VIEW "group.gallery_view" +#define GRP_MOVIE_LAYOUT "group.movie_layout" -#endif /* __AIR_MEDIAHUB_VIEW_GALLERY_H__ */ +#endif /* __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ */ diff --git a/include/view/music.h b/include/layout/music.h similarity index 75% rename from include/view/music.h rename to include/layout/music.h index d727a59..89ac040 100644 --- a/include/view/music.h +++ b/include/layout/music.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_VIEW_MUSIC_H__ -#define __AIR_MEDIAHUB_VIEW_MUSIC_H__ +#ifndef __AIR_MEDIAHUB_LAYOUT_MUSIC_H__ +#define __AIR_MEDIAHUB_LAYOUT_MUSIC_H__ -#define VIEW_MUSIC "VIEW_MUSIC" +#define LAYOUT_MUSIC "LAYOUT_MUSIC" -#define GRP_MUSIC_VIEW "group.music_view" +#define GRP_MUSIC_LAYOUT "group.music_layout" -#endif /* __AIR_MEDIAHUB_VIEW_MUSIC_H__ */ +#endif /* __AIR_MEDIAHUB_LAYOUT_MUSIC_H__ */ diff --git a/include/view.h b/include/view.h index c28e0d1..aabb6ae 100644 --- a/include/view.h +++ b/include/view.h @@ -17,14 +17,8 @@ #ifndef __AIR_MEDIAHUB_VIEW_H__ #define __AIR_MEDIAHUB_VIEW_H__ -/* movie */ -view_class *view_movie_get_vclass(void); - -/* gallery */ -view_class *view_gallery_get_vclass(void); - -/* music */ -view_class *view_music_get_vclass(void); +/* base */ +view_class *view_base_get_vclass(void); /* viewer */ view_class *view_viewer_get_vclass(void); diff --git a/include/layout/menu.h b/include/view/base.h similarity index 66% rename from include/layout/menu.h rename to include/view/base.h index 2232c2e..201d07f 100644 --- a/include/layout/menu.h +++ b/include/view/base.h @@ -14,13 +14,15 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_LAYOUT_MENU_H__ -#define __AIR_MEDIAHUB_LAYOUT_MENU_H__ +#ifndef __AIR_MEDIAHUB_VIEW_BASE_H__ +#define __AIR_MEDIAHUB_VIEW_BASE_H__ -#define LAYOUT_MENU "LAYOUT_MENU" +#define VIEW_BASE "VIEW_BASE" -#define GRP_MENU_LAYOUT "group.menu_layout" +#define GRP_BASE_VIEW "group.base_view" -#define PART_MENU_LAYOUT "part.menu_layout" +#define PART_MENU_AREA "part.menu_area" +#define PART_THUMBNAIL_AREA "part.thumbnail_area" +#define PART_BOTTOM_AREA "part.bottom_area" -#endif /* __AIR_MEDIAHUB_LAYOUT_MENU_H__ */ +#endif /* __AIR_MEDIAHUB_VIEW_BASE_H__ */ diff --git a/include/view/movie.h b/res/edc/layout/gallery.edc similarity index 76% rename from include/view/movie.h rename to res/edc/layout/gallery.edc index 323843b..520e09a 100644 --- a/include/view/movie.h +++ b/res/edc/layout/gallery.edc @@ -14,11 +14,6 @@ * limitations under the License. */ -#ifndef __AIR_MEDIAHUB_VIEW_MOVIE_H__ -#define __AIR_MEDIAHUB_VIEW_MOVIE_H__ - -#define VIEW_MOVIE "VIEW_MOVIE" - -#define GRP_MOVIE_VIEW "group.movie_view" - -#endif /* __AIR_MEDIAHUB_VIEW_MOVIE_H__ */ +group { + name: GRP_GALLERY_LAYOUT; +} diff --git a/res/edc/view/movie.edc b/res/edc/layout/movie.edc similarity index 96% rename from res/edc/view/movie.edc rename to res/edc/layout/movie.edc index f0de4bf..85385a5 100644 --- a/res/edc/view/movie.edc +++ b/res/edc/layout/movie.edc @@ -15,5 +15,5 @@ */ group { - name: GRP_MOVIE_VIEW; + name: GRP_MOVIE_LAYOUT; } diff --git a/res/edc/layout/menu_layout.edc b/res/edc/layout/music.edc similarity index 96% rename from res/edc/layout/menu_layout.edc rename to res/edc/layout/music.edc index ec1e28f..e2b0788 100644 --- a/res/edc/layout/menu_layout.edc +++ b/res/edc/layout/music.edc @@ -15,5 +15,5 @@ */ group { - name: GRP_MENU_LAYOUT; + name: GRP_MUSIC_LAYOUT; } diff --git a/res/edc/mediahub.edc b/res/edc/mediahub.edc index bacbbec..1366e00 100644 --- a/res/edc/mediahub.edc +++ b/res/edc/mediahub.edc @@ -17,9 +17,9 @@ #include "../../include/define.h" collections { - #include "view/movie.edc" - #include "view/gallery.edc" - #include "view/music.edc" + #include "view/base.edc" #include "view/viewer.edc" - #include "layout/menu_layout.edc" + #include "layout/movie.edc" + #include "layout/gallery.edc" + #include "layout/music.edc" } diff --git a/res/edc/view/gallery.edc b/res/edc/view/base.edc similarity index 72% rename from res/edc/view/gallery.edc rename to res/edc/view/base.edc index cd292a7..029bb9c 100644 --- a/res/edc/view/gallery.edc +++ b/res/edc/view/base.edc @@ -15,7 +15,7 @@ */ group { - name: GRP_GALLERY_VIEW; + name: GRP_BASE_VIEW; parts { part { name: "bg"; @@ -27,7 +27,7 @@ group { } } part { - name: PART_MENU_LAYOUT; + name: PART_MENU_AREA; type: SWALLOW; scale: 1; description { @@ -37,16 +37,16 @@ group { } } part { - name: "padding_content_layout"; + name: "padding_thumbnail_area"; type: RECT; scale: 1; description { state: "default" 0.0; rel1 { - to: PART_MENU_LAYOUT; + to: PART_MENU_AREA; relative: 0.0 1.0; } - rel2.to: PART_MENU_LAYOUT; + rel2.to: PART_MENU_AREA; min: 0 71; align: 0.5 0.0; color: 223 223 223 255; @@ -54,19 +54,31 @@ group { } } part { - name: PART_CONTENT_LAYOUT; + name: PART_THUMBNAIL_AREA; type: SWALLOW; scale: 1; description { state: "default" 0.0; rel1 { - to: "padding_content_layout"; + to: "padding_thumbnail_area"; relative: 0.0 1.0; } - rel2.to: "padding_content_layout"; - min: 0 678; + rel2.to: "padding_thumbnail_area"; + align: 0.5 0.0; + } + } + part { + name: PART_BOTTOM_AREA; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_THUMBNAIL_AREA; + relative: 0.0 1.0; + } + rel2.to: PART_THUMBNAIL_AREA; align: 0.5 0.0; - fixed: 0 1; } } } diff --git a/res/edc/view/music.edc b/res/edc/view/music.edc deleted file mode 100644 index 946f756..0000000 --- a/res/edc/view/music.edc +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -group { - name: GRP_MUSIC_VIEW; - parts { - part { - name: "bg"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 255 255 255 255; - } - } - part { - name: PART_MENU_LAYOUT; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel2.relative: 1.0 0.0; - align: 0.5 0.0; - } - } - part { - name: "padding_content_layout"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: PART_MENU_LAYOUT; - relative: 0.0 1.0; - } - rel2.to: PART_MENU_LAYOUT; - min: 0 71; - align: 0.5 0.0; - color: 223 223 223 255; - fixed: 0 1; - } - } - part { - name: PART_CONTENT_LAYOUT; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "padding_content_layout"; - relative: 0.0 1.0; - } - rel2.to: "padding_content_layout"; - min: 0 678; - align: 0.5 0.0; - fixed: 0 1; - } - } - } -} diff --git a/src/layout/gallery.c b/src/layout/gallery.c new file mode 100644 index 0000000..85df1b1 --- /dev/null +++ b/src/layout/gallery.c @@ -0,0 +1,137 @@ +/* + * 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" + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + + layoutmgr *lmgr; +}; + +static bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + Evas_Object *base, *layout; + + if (!lmgr) { + _ERR("failed to get layoutmgr"); + return false; + } + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + base = layoutmgr_get_base(lmgr); + if (!base) { + _ERR("failed to get base object"); + free(priv); + return false; + } + + layout = elm_layout_add(base); + if (!layout) { + _ERR("failed to create layout"); + free(priv); + return false; + } + + if (!elm_layout_file_set(layout, EDJEFILE, GRP_GALLERY_LAYOUT)) { + _ERR("failed to set layout file"); + evas_object_del(layout); + free(priv); + } + + priv->base = base; + priv->layout = layout; + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_GALLERY, priv); + + return true; +} + +static void _destroy(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get 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) { + _ERR("failed to layout data"); + return; + } + + priv = layout_data; + + evas_object_show(priv->layout); + elm_object_part_content_set(priv->base, + PART_THUMBNAIL_AREA, priv->layout); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + evas_object_hide(priv->layout); + elm_object_part_content_unset(priv->base, PART_THUMBNAIL_AREA); +} + +static void _update(void *layout_data, int update_type, void *data) +{ +} + +static layout_class _lclass = { + .layout_id = LAYOUT_GALLERY, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update, +}; + +layout_class *layout_gallery_get_lclass(void) +{ + return &_lclass; +} diff --git a/src/layout/menu_layout.c b/src/layout/movie.c similarity index 77% rename from src/layout/menu_layout.c rename to src/layout/movie.c index a5c2cb1..14a8c16 100644 --- a/src/layout/menu_layout.c +++ b/src/layout/movie.c @@ -32,6 +32,11 @@ static bool _create(layoutmgr *lmgr, void *data) struct _priv *priv; Evas_Object *base, *layout; + if (!lmgr) { + _ERR("failed to get layoutmgr"); + return false; + } + priv = calloc(1, sizeof(*priv)); if (!priv) { _ERR("failed to allocate priv"); @@ -52,18 +57,18 @@ static bool _create(layoutmgr *lmgr, void *data) return false; } - if (!elm_layout_file_set(layout, EDJEFILE, GRP_MENU_LAYOUT)) { + if (!elm_layout_file_set(layout, EDJEFILE, GRP_MOVIE_LAYOUT)) { _ERR("failed to set layout file"); evas_object_del(layout); free(priv); } - layoutmgr_set_layout_data(lmgr, LAYOUT_MENU, priv); - priv->base = base; priv->layout = layout; priv->lmgr = lmgr; + layoutmgr_set_layout_data(lmgr, LAYOUT_MOVIE, priv); + return true; } @@ -71,8 +76,10 @@ static void _destroy(void *layout_data) { struct _priv *priv; - if (!layout_data) + if (!layout_data) { + _ERR("failed to get layout data"); return; + } priv = layout_data; @@ -84,26 +91,31 @@ static void _show(void *layout_data) { struct _priv *priv; - if (!layout_data) + if (!layout_data) { + _ERR("failed to layout data"); return; + } priv = layout_data; evas_object_show(priv->layout); - elm_object_part_content_set(priv->base, PART_MENU_LAYOUT, priv->layout); + elm_object_part_content_set(priv->base, + PART_THUMBNAIL_AREA, priv->layout); } static void _hide(void *layout_data) { struct _priv *priv; - if (!layout_data) + if (!layout_data) { + _ERR("failed to get layout data"); return; + } priv = layout_data; evas_object_hide(priv->layout); - elm_object_part_content_unset(priv->base, PART_MENU_LAYOUT); + elm_object_part_content_unset(priv->base, PART_THUMBNAIL_AREA); } static void _update(void *layout_data, int update_type, void *data) @@ -111,7 +123,7 @@ static void _update(void *layout_data, int update_type, void *data) } static layout_class _lclass = { - .layout_id = LAYOUT_MENU, + .layout_id = LAYOUT_MOVIE, .create = _create, .show = _show, .hide = _hide, @@ -119,7 +131,7 @@ static layout_class _lclass = { .update = _update, }; -layout_class *layout_menu_get_lclass(void) +layout_class *layout_movie_get_lclass(void) { return &_lclass; } diff --git a/src/layout/music.c b/src/layout/music.c new file mode 100644 index 0000000..4a95782 --- /dev/null +++ b/src/layout/music.c @@ -0,0 +1,137 @@ +/* + * 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" + +struct _priv { + Evas_Object *base; + Evas_Object *layout; + + layoutmgr *lmgr; +}; + +static bool _create(layoutmgr *lmgr, void *data) +{ + struct _priv *priv; + Evas_Object *base, *layout; + + if (!lmgr) { + _ERR("failed to get layoutmgr"); + return false; + } + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("failed to allocate priv"); + return false; + } + + base = layoutmgr_get_base(lmgr); + if (!base) { + _ERR("failed to get base object"); + free(priv); + return false; + } + + layout = elm_layout_add(base); + if (!layout) { + _ERR("failed to create layout"); + free(priv); + return false; + } + + if (!elm_layout_file_set(layout, EDJEFILE, GRP_MUSIC_LAYOUT)) { + _ERR("failed to set layout file"); + evas_object_del(layout); + free(priv); + } + + priv->base = base; + priv->layout = layout; + priv->lmgr = lmgr; + + layoutmgr_set_layout_data(lmgr, LAYOUT_MUSIC, priv); + + return true; +} + +static void _destroy(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get 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) { + _ERR("failed to layout data"); + return; + } + + priv = layout_data; + + evas_object_show(priv->layout); + elm_object_part_content_set(priv->base, + PART_THUMBNAIL_AREA, priv->layout); +} + +static void _hide(void *layout_data) +{ + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + evas_object_hide(priv->layout); + elm_object_part_content_unset(priv->base, PART_THUMBNAIL_AREA); +} + +static void _update(void *layout_data, int update_type, void *data) +{ +} + +static layout_class _lclass = { + .layout_id = LAYOUT_MUSIC, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update, +}; + +layout_class *layout_music_get_lclass(void) +{ + return &_lclass; +} diff --git a/src/main.c b/src/main.c index 538d955..3b01bb5 100644 --- a/src/main.c +++ b/src/main.c @@ -73,9 +73,7 @@ static bool _create(void *data) return false; } - viewmgr_add_view(view_movie_get_vclass(), NULL); - viewmgr_add_view(view_gallery_get_vclass(), NULL); - viewmgr_add_view(view_music_get_vclass(), NULL); + viewmgr_add_view(view_base_get_vclass(), NULL); viewmgr_add_view(view_viewer_get_vclass(), NULL); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); @@ -97,9 +95,7 @@ static void _terminate(void *data) ad = data; - viewmgr_remove_view(VIEW_MOVIE); - viewmgr_remove_view(VIEW_GALLERY); - viewmgr_remove_view(VIEW_MUSIC); + viewmgr_remove_view(VIEW_BASE); viewmgr_remove_view(VIEW_VIEWER); viewmgr_destroy(); @@ -124,7 +120,7 @@ static void _app_control(app_control_h app_control, void *data) if (ad->win) elm_win_activate(ad->win); - viewmgr_push_view(VIEW_MOVIE); + viewmgr_push_view(VIEW_BASE); } static void _pause(void *data) diff --git a/src/view/movie.c b/src/view/base.c similarity index 86% rename from src/view/movie.c rename to src/view/base.c index 4e82af6..92d5399 100644 --- a/src/view/movie.c +++ b/src/view/base.c @@ -53,20 +53,21 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - elm_layout_file_set(base, EDJEFILE, GRP_MOVIE_VIEW); + elm_layout_file_set(base, EDJEFILE, GRP_BASE_VIEW); evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, base); lmgr = layoutmgr_create(base); - layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); - layoutmgr_show_layout(lmgr, LAYOUT_MENU); + layoutmgr_add_layout(lmgr, layout_movie_get_lclass(), NULL); + layoutmgr_add_layout(lmgr, layout_gallery_get_lclass(), NULL); + layoutmgr_add_layout(lmgr, layout_music_get_lclass(), NULL); priv->win = win; priv->base = base; priv->lmgr = lmgr; - viewmgr_set_view_data(VIEW_MOVIE, priv); + viewmgr_set_view_data(VIEW_BASE, priv); return base; } @@ -117,14 +118,14 @@ static void _destroy(void *view_data) } static view_class _vclass = { - .view_id = VIEW_MOVIE, + .view_id = VIEW_BASE, .create = _create, .show = _show, .hide = _hide, .destroy = _destroy, }; -view_class *view_movie_get_vclass(void) +view_class *view_base_get_vclass(void) { return &_vclass; } diff --git a/src/view/gallery.c b/src/view/gallery.c deleted file mode 100644 index 970ca82..0000000 --- a/src/view/gallery.c +++ /dev/null @@ -1,130 +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 "layout.h" - -struct _priv { - Evas_Object *win; - Evas_Object *base; - - layoutmgr *lmgr; -}; - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *base; - layoutmgr *lmgr; - - 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_GALLERY_VIEW); - - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); - - lmgr = layoutmgr_create(base); - layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); - layoutmgr_show_layout(lmgr, LAYOUT_MENU); - - priv->win = win; - priv->base = base; - priv->lmgr = lmgr; - - viewmgr_set_view_data(VIEW_GALLERY, 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; - - 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; - - layoutmgr_destroy(priv->lmgr); - evas_object_del(priv->base); - - free(priv); -} - -static view_class _vclass = { - .view_id = VIEW_GALLERY, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, -}; - -view_class *view_gallery_get_vclass(void) -{ - return &_vclass; -} diff --git a/src/view/music.c b/src/view/music.c deleted file mode 100644 index 4280f66..0000000 --- a/src/view/music.c +++ /dev/null @@ -1,130 +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 "layout.h" - -struct _priv { - Evas_Object *win; - Evas_Object *base; - - layoutmgr *lmgr; -}; - -static Evas_Object *_create(Evas_Object *win, void *data) -{ - struct _priv *priv; - Evas_Object *base; - layoutmgr *lmgr; - - 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_MUSIC_VIEW); - - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, base); - - lmgr = layoutmgr_create(base); - layoutmgr_add_layout(lmgr, layout_menu_get_lclass(), NULL); - layoutmgr_show_layout(lmgr, LAYOUT_MENU); - - priv->win = win; - priv->base = base; - priv->lmgr = lmgr; - - viewmgr_set_view_data(VIEW_MUSIC, 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; - - 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; - - layoutmgr_destroy(priv->lmgr); - evas_object_del(priv->base); - - free(priv); -} - -static view_class _vclass = { - .view_id = VIEW_MUSIC, - .create = _create, - .show = _show, - .hide = _hide, - .destroy = _destroy, -}; - -view_class *view_music_get_vclass(void) -{ - return &_vclass; -} -- 2.7.4 From f7fed81cffcd28b00fcd255275e4de42407bdae1 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Mon, 22 Jun 2015 14:22:01 +0900 Subject: [PATCH 07/16] viewer: add control buttons and images Change-Id: I097ac4b84184aedc980ed6f9b5fc46b65affd4b0 Signed-off-by: Minkyu Kang --- include/define.h | 1 + include/view/viewer.h | 17 ++ res/edc/images/btn_view_contr_forward_foc.png | Bin 0 -> 727 bytes res/edc/images/btn_view_contr_forward_nor.png | Bin 0 -> 706 bytes res/edc/images/btn_view_contr_next_foc.png | Bin 0 -> 720 bytes res/edc/images/btn_view_contr_next_nor.png | Bin 0 -> 716 bytes res/edc/images/btn_view_contr_pause_foc.png | Bin 0 -> 412 bytes res/edc/images/btn_view_contr_pause_nor.png | Bin 0 -> 422 bytes res/edc/images/btn_view_contr_play_foc.png | Bin 0 -> 769 bytes res/edc/images/btn_view_contr_play_nor.png | Bin 0 -> 791 bytes res/edc/images/btn_view_contr_previous_foc.png | Bin 0 -> 734 bytes res/edc/images/btn_view_contr_previous_nor.png | Bin 0 -> 718 bytes res/edc/images/btn_view_contr_rewind_foc.png | Bin 0 -> 735 bytes res/edc/images/btn_view_contr_rewind_nor.png | Bin 0 -> 710 bytes res/edc/images/btn_view_slide_next_foc.png | Bin 0 -> 854 bytes res/edc/images/btn_view_slide_next_nor.png | Bin 0 -> 843 bytes res/edc/images/btn_view_slide_previous_foc.png | Bin 0 -> 847 bytes res/edc/images/btn_view_slide_previous_nor.png | Bin 0 -> 873 bytes res/edc/images/ic_title_favorite.png | Bin 1923 -> 1080 bytes res/edc/mediahub-theme.edc | 3 + res/edc/view/viewer.edc | 102 ++++++- res/edc/widgets/button.edc | 384 +++++++++++++++++++++++++ 22 files changed, 506 insertions(+), 1 deletion(-) create mode 100644 res/edc/images/btn_view_contr_forward_foc.png create mode 100644 res/edc/images/btn_view_contr_forward_nor.png create mode 100644 res/edc/images/btn_view_contr_next_foc.png create mode 100644 res/edc/images/btn_view_contr_next_nor.png create mode 100644 res/edc/images/btn_view_contr_pause_foc.png create mode 100644 res/edc/images/btn_view_contr_pause_nor.png create mode 100644 res/edc/images/btn_view_contr_play_foc.png create mode 100644 res/edc/images/btn_view_contr_play_nor.png create mode 100644 res/edc/images/btn_view_contr_previous_foc.png create mode 100644 res/edc/images/btn_view_contr_previous_nor.png create mode 100644 res/edc/images/btn_view_contr_rewind_foc.png create mode 100644 res/edc/images/btn_view_contr_rewind_nor.png create mode 100644 res/edc/images/btn_view_slide_next_foc.png create mode 100644 res/edc/images/btn_view_slide_next_nor.png create mode 100644 res/edc/images/btn_view_slide_previous_foc.png create mode 100644 res/edc/images/btn_view_slide_previous_nor.png create mode 100644 res/edc/widgets/button.edc diff --git a/include/define.h b/include/define.h index 8fd4bf9..01e05bf 100644 --- a/include/define.h +++ b/include/define.h @@ -40,5 +40,6 @@ #define COLOR_TEXT_FOCUS 255 255 255 255 #define COLOR_TEXT_SELECTED 64 136 211 255 #define COLOR_TEXT_DISABLED 87 87 87 128 +#define COLOR_BTN_FOCUS 22 120 224 255 #endif /* __AIR_MEDIAHUB_DEFINE_H__ */ diff --git a/include/view/viewer.h b/include/view/viewer.h index 019f5c8..4de2b2b 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -31,7 +31,24 @@ #define PART_VIEWER_PROGRESS "part.viewer_progress" #define PART_VIEWER_TOTAL "part.viewer_total" +/* signal */ +#define SIG_SET_PLAY "set,play,icon" +#define SIG_SET_PAUSE "set,pause,icon" + /* images */ #define IMAGE_VIEWER_FAVORITE "ic_title_favorite.png" +#define IMAGE_VIEWER_PREV_FOCUS "btn_view_contr_previous_foc.png" +#define IMAGE_VIEWER_PREV_NORMAL "btn_view_contr_previous_nor.png" +#define IMAGE_VIEWER_REW_FOCUS "btn_view_contr_rewind_foc.png" +#define IMAGE_VIEWER_REW_NORMAL "btn_view_contr_rewind_nor.png" +#define IMAGE_VIEWER_PLAY_FOCUS "btn_view_contr_play_foc.png" +#define IMAGE_VIEWER_PLAY_NORMAL "btn_view_contr_play_nor.png" +#define IMAGE_VIEWER_PAUSE_FOCUS "btn_view_contr_pause_foc.png" +#define IMAGE_VIEWER_PAUSE_NORMAL "btn_view_contr_pause_nor.png" +#define IMAGE_VIEWER_FF_FOCUS "btn_view_contr_forward_foc.png" +#define IMAGE_VIEWER_FF_NORMAL "btn_view_contr_forward_nor.png" +#define IMAGE_VIEWER_NEXT_FOCUS "btn_view_contr_next_foc.png" +#define IMAGE_VIEWER_NEXT_NORMAL "btn_view_contr_next_nor.png" + #endif /* __AIR_MEDIAHUB_VIEW_VIEWER_H__ */ diff --git a/res/edc/images/btn_view_contr_forward_foc.png b/res/edc/images/btn_view_contr_forward_foc.png new file mode 100644 index 0000000000000000000000000000000000000000..6f66d10eb36ef1361fd60e8fad54ea6d7161847d GIT binary patch literal 727 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq`kBr;B4q#jUq@7UqQnO1M6} z>*UJH)$Y8wP(@(DGR_GKvlI%iYNW{aAK<>QAVAf^$uod=+cc|HtF$tl9w-HLl-;sC zYxQ69TKO9>^VfcAldUI5&Qdy5^q%`iyo6LzM#n;wS&kFmV$A|>kmu#B;Rp#tg zjg*!PC+n^iSsY(9!O%&ay>db`w?5a(-eWxp4Ap z&6&N&T+NkR{nkBomNV6}lGHBQG^@Pw+Kv}VTP~dRx|g!K@S^kkbcS@hlNM*+zkIq= zto2;Q`WGsZyINS+exEzU%fZuvKB z_s@GfUaYHoare&rkF^ipxH4XK-hcjAPyUW{eXkX=zjEh2bAP<3>)v^Wa~0P%2H11% z-gNc1-~2RFeIrvnpkIrdS%ZJuRyEQ$<}j1XC-#)jTI)pD`vTJ|1B0ilpUXO@geCw` C7DGV* literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_forward_nor.png b/res/edc/images/btn_view_contr_forward_nor.png new file mode 100644 index 0000000000000000000000000000000000000000..0fdcfd5f039f7d8eed903ad1c4a4544edf6bcd50 GIT binary patch literal 706 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq|*h)5S5Q;?~={irHa_GHoA! z%S!Lquw_YZ<<*%i?HQ6h2Ng8LZeP$huy6dqdS_Qxrsu^)FC4nptjoH*Wy=DC8EMV) zK1_dIDYv)oC*S|#!b1;r-@kEpnUP(4;Qyfu0?y7nyoM%6=*pPz^BVh~b3fU4+8fS{ zkl9k#69475TYh@_qg^ju-K*?MwEH&)#FQ+4e&OWWH&1;EFLv&8R-autb?Ku;+&8sAuG%2f7ghL^Y#i` zMV_0zMqK=CkBC*|sna=P;=MhhR*`4o@__1k#H=DuOwIwS>k+q_d3teyC6pNRO`ukycQ^`5WT z@xtN#!uS;B<40Y^fARg*x&C?Wju$TH7nT=Ws~>eW|Hb>)pu9LLrX=Or{NF~uY8U@E mY-^K{O3LV1s5n53KP)%>qUD$5EN=p)O$JX_KbLh*2~7aesw?LJ literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_next_foc.png b/res/edc/images/btn_view_contr_next_foc.png new file mode 100644 index 0000000000000000000000000000000000000000..f859c5a61442576d0eff8ededde4bf970ec337f0 GIT binary patch literal 720 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq`kdr;B4q#jUru_GXC$%Cvnn zcjV^Qw%&bZx_{|6l9JymM{N?|oA~&x6PI!uLq&$g^?JIi2~xBwtI*OWXdr zWg+`d%WUn*Z%XDEd{J;uKf7tt+hl(cPTOn8cQ2mySY7Wp8|D_jp z@0_}Qt^1cy^)G&EH?wRP?blkkee)!sD(5R4e=VE#hI9V2Tlx1TrWwDxu-?e>nQVn+GT&dN?Vo|JtWVvuaQV*Lh5jq&07Gj|`&{$) trzBtR?F&v{v;Rf#ak|DAW+Iu8UmfDPduFB9Sztn1 z=PYCHKfm~Tvj2|rM>*To=NSK%5`4Cb{f|Bmuc6723j)s0^krCv**zk)OzN)7ph)7$=O!Csp?3@+jhTcpY^=2Dj$2LSh8u#_Q-W|hJNx3CkNj=H}jQX z@)sei$TO?gg!D_Sn}6Y?)4cSxRYwABTmAe}w6Cvn=eZpIBE_zMQ=Dy5$2}+Y;+^w* zUkN&=eP2Gg`J%jOmE2!$_nmXkz7niozx_h{&Y8!rD!0AR{xUu0?B!R2hrfvYQkedE z7tp-FE%(l6-3tfWG5tdI&M9|6_6q(=)_dmswWF}AqW|96o%f8t3sk8;|GX0D5@>p8c~^ tfALlIU-OeQIu0t}AI z|NfueD9)m|L37T^{sNuw^fS$ec2+m;7qC()ae2{kL2#k6lY2`ahpZs=1!8uKSA6}m wF;(YW?z2U-u_k%l{)6m#)OR|b@R%rV^qEy&_toyLz))xKboFyt=akR{09`4QPyhe` literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_pause_nor.png b/res/edc/images/btn_view_contr_pause_nor.png new file mode 100644 index 0000000000000000000000000000000000000000..8fda0f208de32c2d182fd4e75a7d7fe224308d20 GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq^mC)5S5Q;?~7kCn} z_rRH-e>SH2u*nzizj-G~k2W?Lt$UyUp{bjeUcm^TCu})#Z1T#J-2{Q*&*16m=d#Wz Gp$Py9zLebn literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_play_foc.png b/res/edc/images/btn_view_contr_play_foc.png new file mode 100644 index 0000000000000000000000000000000000000000..c62f119b7cc2fd292e474194f5aea92482beb8a7 GIT binary patch literal 769 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fr06Sr;B4q#jUq@4D-(h%Cvvf zf0?nxaJFa8)QH=y;TOUkR=ONIu;$V^wy?~-49?q)3_4hx#jOlW1Px0rc1XRuQ1am3 zuCvAG-oO93r|ErdQBje9-euw6f)7((GydmxcIM$VG&yoXfG&(*ytbFC4t#uN{$+Md zp6x@6uhPGq%r;LmUYjm6UHI<5=^HL?xNCDF>swU+%((XpC#P6%|Fq}poXk*;xhm3; zXUblCUVibt&n`zVI`Z7gYsUX#rwZF{ntVIbfBWSB%feo$R8Bp*C)@Vji&ZhQ>}j9P z`ipjb?OD94e3ARUr*(4A(_c@Vyjsf2^Ip29e)Rb{A$wOpKJYUqO*cLI{0yI`K$B)a zUGwFC*&2B(&5va=ZZDSn-k$u_`qze?IZqS!=O2GK=f%Xl`+d&bb4z}e$(*}-@n`z0 zqAMb0n*qXU{)aB_(=1p2 zyjXS2;;Qrd=XrM9G@uI=NDSFLq( zU)$Pw99vmh`X)tjx>njckzKFL?^lGb>+8L9V)-@YWq}V}@}GM>%T9my-$lIgd++t) z7k_O|&#lR{eO&QHde@cR`FrZ>Pt98Sg+2c9SLvz*t(w;oEOd!#%w$!^+-;V7>iMts RUSQH@@O1TaS?83{1OS6-TcH2| literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_play_nor.png b/res/edc/images/btn_view_contr_play_nor.png new file mode 100644 index 0000000000000000000000000000000000000000..f3e0408b68708cf5e6d2bc5a4cdab928f5ba3687 GIT binary patch literal 791 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fr06sr;B4q#jUq@_j^xGlxh3; zy2HZK)%%LZS=KzZwVZ*)jr9)pE0*F=10v@u&V>NknTjR{IKv_nHht+ixK&6>ZAN-7eqXJI>FZmUleNnOP=r zrYqmnc^j>D+wbj?y@*1J|Q;mhS~tCO28`?k*5x%5Kl{o21ptT;BdOdEu`wQh&EynIpEZ jw4{kHQI0E-J>eId;Fsy}BP0r#;2At!{an^LB{Ts5XH{Y( literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_previous_foc.png b/res/edc/images/btn_view_contr_previous_foc.png new file mode 100644 index 0000000000000000000000000000000000000000..da1bb3bde014d12df3602f8dfe3f16de1949b252 GIT binary patch literal 734 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq`kMr;B4q#jUq@_Gbkb%Cvnn zKk6iFRk~{Sy2z#7O`_%-Cr_@|TkwT#56k)mkCrtnln8{J2ohv9e}3-n9hQR!9XIH4 zEuAxGiOanFy5r9$f8}{!DRk(h<%El#E)gr`KI}IzIdVb3*_nsekgkj+b1$gZ$8EM* zCwD9N%9;Q7{>oatvP@I`eewjU~b3uA$%IYeY{faI3&LkeYs+^W-|K;hP(^FpwZr)lfdpCEEzivvN?U$=HXO_Ma z{G4g|rR-k%;;JKiZt>QtPhJz=KO=ti!uL-@^}_ls`pul*KXVOR?LNo9d!hVO&+6T? zrRStaUE(OP0}Ec4u8cKZ31Raw);^xykgpV}$|wAuaj!pVp&bfb1+}*PV==TCA zb^Ff-{;S=6F8>SuaJep3|NbiXlI-W~-jCb9T-|tu-qDAiW`6Q&wOW2I&|JU_Ot%c4 Lu6{1-oD!MtegRokU|r=2~@@h37l$W!lU1_L&kFUz5l#ji7^`vDW36S1ObQXoRRA zd^l%vO69(Pk3Y{g-ec1uAmpL8U-^*J*M|SC3l-biB&3ouI_S$#U&a1q>#y&-3n%w6 z%h%V2>@A&DIQJrV<+S#z%FD8!^}I_oJYT%K>WI!`&RV1O#ha^+tUiD9wD&+8GObHC&E~$jTJECz>xGl|#+=Ff+L8CR-EUv2ZamPvlFlzu z?87$&+a~QRZ1LkOvW>o~{7lmO#gp`FpH~4r`b&(vU3u!&uyAVA#bGv>TXC89ZJ6T-G@yGywqiwmH-Q literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_rewind_foc.png b/res/edc/images/btn_view_contr_rewind_foc.png new file mode 100644 index 0000000000000000000000000000000000000000..8389b19fe9a2cf09e9e36f95f9db49d95f951fcd GIT binary patch literal 735 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq`k6r;B4q#jUq@H)e$dO1M6( zZElQM;w8F!)SI^ zvTx02|Csxk<%JP5dCVs}v>7U``MU4G|3eo9oSk`i4NZ>Fl`-Ke*WV}dI#rV4PuKLa zKfbZ!Ma8c8goB&y5UOCN6$ss%I75dSQ0u#M`~y?_RavJEddY z+s(A9{oc94Wxd@(S?%+ll&&+^>ss+g#`bKxrQmb@Q!Au@x!rpn^?1>QRSU~Mn??6_ z2W7SGn;vNEX@(0ab>zh}hT`%VAfsq}wZTX-?>?eiDjDW>-p>oX2SJR&EaIz}!-p3CP03oZc@ OE`z75pUXO@geCy8Bs(4e literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_contr_rewind_nor.png b/res/edc/images/btn_view_contr_rewind_nor.png new file mode 100644 index 0000000000000000000000000000000000000000..b49a2d7169699d302240d00b0d07f0c09698f617 GIT binary patch literal 710 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq|*l)5S5Q;?~={irG^WW!gUe z=3$qbHf>90tgKk8W|WAp_oA||+$-iM)G@_w?r3tHaIi~B*e5GC?y`x1mT%DTnvv{>jm%1x!p&P7W{SA zPq$9*?q=K7Za33BQd2MLh3v1Ad(V6dFSL;&`vic%sIwrw4r2hWT1XsPIh*f6$;36}04<(59Kwa#eR*icG4n)b@&Y+a-I( z`P{dUK7aGB|EOJWUhuW@-Mg7-%Q98wEGpe8{v+OKi-vRez!57XF67DuK8Z`(aqW5B z0;k+(ni9!f?{|i;jBgRHox$|t!-S1@R$o~!_@Mqhms~MJgPi-1iPdwfTrDovTInzw zocz0DxfPSi7t14D48eCgJ!P4t_Fa6&$`G5T9OS-ZasAaNn$-+5l4m(|JL_a*e3}!> zaHhyctaQri)aRhvGK;we89`FdTqQs4 zy}r$9o8AW%KAM}+p#SEvEkpW_In^_}p4MI3nqK@XVBV|lo8>DFZi-7JZCmEA`t|3V z-908InbE&ug65yzcUnsLbKk$u_oTnP-~ao>-zDucbYCV{&eKo1pL+J>K8LrNf9nkQ zOsSnN*p|1nT=nzRH@ib-%_uMFPTj^_Fm?0J=_@1NsmCUpExrCUbKf+no7-1fY_wBj zy>WuenqkMm%tLGBd3T*OvS!?I^rXd^iwkDkB%3pAw-oENymowv?=-JxJ2TEqTwuQ8 zL>$9Ax8G9Sk78t5z2C4uV02gh*P+H%a!~0p!$*RD-VHI~L}_0IG?GtF0Ab)wfV_e+zO zPF}M*&pLf~MQ!!<*OhvfGnZ*ZzyBI(60j;pL6jxxW24a&77Im|Ecl*XJv{WdH5AHW8oCxxCW6@F#8h`Gbu4w>N#6qn*oV zGTr6@_lFNQuRJfrY&tys!2*rM3pn5WOx(JL zd0tV;OT*c@N+#lWUq=_5(Dv@X8DqR~XU5g<4>nAnCbxO!GN;d*L+u;V_ip$yqjxs< zS^u!V9DNmaFAb$lC1;)fx3A=JeEqK(Jhh8I=P~J5<$=V-t9EnevFTfH0_ot|dzW>4 z!{T|7RcF#>aqhiqxxF!5Hm>T-vsoOq&71Ss*H>1793c1Q>$zRbdmc_O46pTVzV~d6 z^}*^NRDzn`fvy#y{UueSlqV?lBwos-u~!A0)H? z-3bhWe6}xLm)|iTmz{CKhPmpfr}Y8OY~z{f4)rhU3NHOydB%8wf5h>XCqeYh_eb9B vUwqT(-5irGocUks7df?Sm8=*H#4qmPX9;yK1`GBAGYNyItDnm{r-UW|0|1iQ literal 0 HcmV?d00001 diff --git a/res/edc/images/btn_view_slide_previous_foc.png b/res/edc/images/btn_view_slide_previous_foc.png new file mode 100644 index 0000000000000000000000000000000000000000..df8a0723ff9feda7554cba64488b914b9da163fa GIT binary patch literal 847 zcmeAS@N?(olHy`uVBq!ia0vp^TYz{12Mdto{@FQ`fq_}f)5S5Q;?~BF>#8fQMP z>pSwctinn5=u3=hv40d0o78;XjGb*6uPHpSIqJf3I}sV(IgpdeL@hZN|rvJm~zK(GByGD=CFdCe(nR}_YN>p5Gn&l}QhUyu5w#&jNE_^8NUcsYd z`u;7W-aFa7LGA1|PXb>`?(O22U2-GbeZjz`6trae%DnaAk>F6XwEw`2!rYQS-W|KvHhlvQBp#wH+w~wPEpEqnfNq3_icxz_t|O6<{m*F|Ag#? zB$q!vm-l;Kao(PFpHIH7e7>vjZspe(wXb&-pS`x#WxB8Jga1Jbokgue29Aie``YmH z?VtD8t>=7docezGJj>-5^?z}lez!H}{uSqEredTqge9h~1`VQLwnXlzo<8NCFeU7+byuL!F zCVBmRpq8C(O?K}*Kdg1#?`xa3xtICxCglg#)qkwM&Nyq%^`*P7N&b!8#7dDD&t;kI zZ#|v9@_5c#!3Fa_^ZYoeXYX&Dwz`+WcJ~*VU+mJ#4)(8E3z|c(LqyMBj$<;9D!qFp zdD}IK3o^wrZ@&DTab>YX@s-sN)WqGE$g$5_zK1RE+sf?aa+`0uHN}-5k$xcdJl6Q@ zoU^7vCa>px5ZiIJGTh%b-ME+a?5^W`nDdJBR9;MC8P{wd)fTjG zUN@`i+%YM^S*GoCnRd@DeR`$X?9z-2Yb;YF-)u}eex>-Cxt2*b-!B0jtIdB`9&b%M z%Y3fEdhVR6Gke_Hp2@SXdGKiI?R&?1dC%Ve_WJ~*yuWQq+~$S*m+@bDA#Ur_$`|?~ dU@#D0^_vvp6H@P6gQu&X%Q~loCIDiplxF|{ literal 0 HcmV?d00001 diff --git a/res/edc/images/ic_title_favorite.png b/res/edc/images/ic_title_favorite.png index 33e21b03ea8ce73ef7e2453aff4ab29be85a9b2b..fdb043f87a2b9c53c79a6ca9036e261d5e99a840 100644 GIT binary patch delta 1060 zcmV+<1l#+A54Z@BBYy+`Nkl$958EQJ@l)5Moi9wG{zs zTD4WHHX_N!Ae9Q0H9N#Zl`4>6$+|)j5?#?stXP>HjY5Q~R!T+N#Eug`CVr)EVtXE* z#4PLq6UFIFdP9Q5znnSe>bw5$J?CDJ)MzyLFUYgs08S;}xqmsjuK- z0`M*Z?H36;-U39CC4zo=5P|lK0`&vuLVo412QBEyg9dtjFr;*Q+D2=w(=k9kNT8Fp z?Y2bQF9I|GoPTMz-PV9W`$d3W*lN42ut57ofKChqm2F?N>>mK$*>BJQa3&Z~ItGZc zU;6cjlK?%y@4y>wlD%GuBmF*(zSO;ATs*C@QZ(JNS-|I!XzUyKd+js;`Q^i1ymGkP z?SRkJv7sK04fQyVuWB2pMN`g|Ov!#`TdxC=)Qa)bLVrr5s%;2|b*gN^;NGK3HCHmP zMxwE=w}Ju`fw5f4yn63ZrJ5}m|0BRv|{lvStFe{zNcyR^iJ_kI>t0GoX#8HYUbwU zBLhDA4n1F^N#_ifRDBirC=!j`a+2e;;I9E6l*;vqxrOTL^Hhb!jLwp({{p-TID&Ko zYU>v8*-FWE@djXXvq83C)PQq9+D-0mTIl(3V1IWT%j1y<1>|0Kah-Mx8U#)S{kvbI zt={kY;^!9h(hFgqPm)|_wW;ms=i5urjz>CM&-%|z_DX~TauApHy8#UWqdVE2$s0`H ze`+nHG%B^um0>qWKR2KqZLhcbbTX^Y0I%mt=7;wmS1OtO_UDC`{TFdzzZ=kPZO^Zo z%zw_US!%(&4vYYC;5*<%GON!dG8*+Q=LOj-5pLRlS~TdkwkNYX^UGSi1$d2S+qD%3 zM%03NeRgim%CG*j_V&Bn{Z2v0UJUyb+xGH$vrlL8#uP9N%yh`JS`!$VU)JKuw(~;k z-hb)N&CxEApcD4JJ(V+f5U-X><@z{q1%Fs~kUs+qXY$6>!(@%}x`nrCe;;s46le%I z+1=$Kk=9sN^%!s*xb1L~w$_0wrE-1zLA+W@4kGOePa^1OLK#WP!>4-WX(DYq(p%>fFA_`ZXNe$ryU;~ er2oG&3D%#E{BEZMhF~iI0000`^-1y-Dj!@0#G(*Zqc(l$^b^pFl)vEW0eqJ}m=l{TdfYX!#PjSdmn z*aT7LR0KA>inoB{aU#=+cujnU>n1Xo;K4OK#!?lxKYaGb@+A4b_sjeHz4w#6XyqKw zalYdK0PvJYN>tPu;CS5KsQ1~%^NXnEZBnWxV~9l3f|+mt)e;FfDA!|2xC+O#D^t(o zp#b2VsEbvTYQV_E{9s99Vf}1raosrZL z2GGHXB@k((h)#L>A_Torp?F1XFuzO`l`@tUGqN~LHcPK}#PwX;OsepI+<2|FId-KH zXQ^;Ak!I3R^+@y^1yi~EZ$l16${S>!Nk~A_^4eSW%nf(`cEt(HsKgam|_VcWwZmLlL?YAClf|c90P;1;&cWrVKIN; zD9?*%CAdlVF|L)F2tD{bzliQN_W1%>$d&PfApskeLL3gt7DhzCJQPJaJV`L0iu(mt z`+suAqMTtln&V&1GI~UHpkw>0^(o=i@Zbh&VocO%r0IgGIdwiPm!PrMwtFANM;2id zv+8@E+?~iDO46w#P>Ij=8gYQFi5;sV0%ql%=w&`eH>^5w523F*)m&a()6G0PV+J;V z_>20|%D$xDk#lJ~h84wKPwRT(OIvaq+btQF?85tfr#rU~mC_2%-89fVZ~4;)$!ndH z8uFs<_Z|BB!O#Xe;py!uTj07a=uscv7TK=&{ql$J zhgC3|uB~;kiR2k7>y=B+`wIIP2lU7frtV(a*kv0*GgLwEbajrgT}<41GeNoU{Pjn`q5K|qkER1f{e$-I356zH8LkwpPDy9-WQ~C?2lz$( zYho-r`|q@@$@cJC*}Re8Tvza9%%eSX(}=bo%A9r@m(5&1&)HsE{W&}>Fz{kc%iNK1 z2gk-43)k_-F5_QXbAS5jyGu6PgtE*{H?^+mgJT{!dlnRa99SE(XxlG;_I?wx-Mgu_ zR?u4T-swOXzTt1XoN(dZGJ8n^ywQK#;)-idP~ncRWPY0Nj<(w+E6Ois1R-UhHfxJ& zVOTsf*Kn)VAFr?&cEM=9obhaVPKiBqT2HWf`t^`w6QuRO44gZ5B+K_*+nhUysMllg za=-h)_#1DmKeYsyC(bVNeGJ`foqcpl;xn&#pMBWlTylNavl*Xk&KlF;9j=Y32Ocy2 z=-=7lNk+Aeb)UM!Y9;};MC&VP9DJKr-lldmu|e{w Date: Mon, 22 Jun 2015 11:42:47 +0900 Subject: [PATCH 08/16] base: draw title and menu area Change-Id: I21a91148f38e55f6e38753b52cfd510864edd8e9 Signed-off-by: Jehun Lim --- include/define.h | 3 +- include/view/base.h | 3 + res/edc/view/base.edc | 62 +++++++++++++++++- res/edc/widgets/button.edc | 107 ++++++++++++++++++++++++++++++ src/view/base.c | 160 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 332 insertions(+), 3 deletions(-) diff --git a/include/define.h b/include/define.h index 01e05bf..c0e2317 100644 --- a/include/define.h +++ b/include/define.h @@ -40,6 +40,7 @@ #define COLOR_TEXT_FOCUS 255 255 255 255 #define COLOR_TEXT_SELECTED 64 136 211 255 #define COLOR_TEXT_DISABLED 87 87 87 128 -#define COLOR_BTN_FOCUS 22 120 224 255 +#define COLOR_BTN_FOCUS 0 119 246 255 +#define COLOR_BTN_SELECTED 64 136 211 255 #endif /* __AIR_MEDIAHUB_DEFINE_H__ */ diff --git a/include/view/base.h b/include/view/base.h index 201d07f..965493c 100644 --- a/include/view/base.h +++ b/include/view/base.h @@ -21,8 +21,11 @@ #define GRP_BASE_VIEW "group.base_view" +#define PART_TITLE "part.title" #define PART_MENU_AREA "part.menu_area" #define PART_THUMBNAIL_AREA "part.thumbnail_area" #define PART_BOTTOM_AREA "part.bottom_area" +#define STYLE_MENU_BTN "menu_btn" + #endif /* __AIR_MEDIAHUB_VIEW_BASE_H__ */ diff --git a/res/edc/view/base.edc b/res/edc/view/base.edc index 029bb9c..2d98689 100644 --- a/res/edc/view/base.edc +++ b/res/edc/view/base.edc @@ -27,13 +27,69 @@ group { } } part { + name: "padding_title"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel2.relative: 1.0 0.0; + min: 0 44; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_TITLE; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_title"; + relative: 0.0 1.0; + } + rel2.to: "padding_title"; + text { + font: FONT_REGULAR; + size: 46; + align: 0.5 0.5; + } + min: 0 46; + align: 0.5 0.0; + color: COLOR_TEXT_TITLE; + fixed: 0 1; + } + } + part { + name: "padding_menu_area"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_TITLE; + relative: 0.0 1.0; + } + rel2.to: PART_TITLE; + min: 0 12; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { name: PART_MENU_AREA; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel2.relative: 1.0 0.0; + rel1 { + to: "padding_menu_area"; + relative: 0.0 1.0; + } + rel2.to: "padding_menu_area"; + min: 0 82; align: 0.5 0.0; + fixed: 0 1; } } part { @@ -47,7 +103,7 @@ group { relative: 0.0 1.0; } rel2.to: PART_MENU_AREA; - min: 0 71; + min: 0 70; align: 0.5 0.0; color: 223 223 223 255; fixed: 0 1; @@ -64,7 +120,9 @@ group { relative: 0.0 1.0; } rel2.to: "padding_thumbnail_area"; + min: 0 678; align: 0.5 0.0; + fixed: 0 1; } } part { diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index d837845..4971c8d 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -18,6 +18,113 @@ #define STATE_PAUSE 1 group { + name: "elm/button/base/menu_btn"; + data.item: "focus_highlight" "on"; + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + min: 200 81; + } + description { + state: "focused" 0.0; + inherit: "default" 0.0; + color: COLOR_BTN_FOCUS; + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + } + } + part { + name: "elm.text"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + text { + font: FONT_LIGHT; + size: 31; + align: 0.5 0.5; + } + min: 82 0; + align: 0.0 0.5; + color: COLOR_TEXT_MENU; + align: 0.0 0.0; + } + description { + state: "focused" 0.0; + inherit: "default" 0.0; + text.font: "TizenSans"; + color: COLOR_TEXT_FOCUS; + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + text.font: "TizenSans"; + color: COLOR_TEXT_SELECTED; + } + } + part { + name: "bottom_line"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "bg"; + relative: 0.5 1.0; + } + rel2 { + to: "bg"; + relative: 0.5 1.0; + } + min: 142 3; + align: 0.5 1.0; + color: 0 0 0 0; + fixed: 1 1; + } + description { + state: "focused" 0.0; + inherit: "default" 0.0; + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + color: COLOR_BTN_SELECTED; + } + } + } + programs { + program { + name: "focused"; + signal: "elm,action,focus"; + source: "elm"; + action: STATE_SET "focused" 0.0; + target: "bg"; + target: "elm.text"; + target: "bottom_line"; + transition: LINEAR 0.17; + } + program { + name: "unfocused"; + signal: "elm,action,unfocus"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "bg"; + target: "elm.text"; + target: "bottom_line"; + transition: LINEAR 0.17; + } + } +} + +group { name: "elm/button/base/viewer_btn_prev"; data.item, "focus_highlight" "on"; images { diff --git a/src/view/base.c b/src/view/base.c index 92d5399..fb118f0 100644 --- a/src/view/base.c +++ b/src/view/base.c @@ -16,19 +16,164 @@ #include #include +#include #include #include #include "define.h" #include "layout.h" +#define TITLE_TEXT "Media Hub" + +#define MENU_BTN_SIZE 3 + struct _priv { Evas_Object *win; Evas_Object *base; + Evas_Object *btn[MENU_BTN_SIZE]; layoutmgr *lmgr; + + int current_layout; +}; + +struct _menu_item { + const char *name; + const char *layout_id; }; +static struct _menu_item g_menu_item[MENU_BTN_SIZE] = { + { + "Movie", + LAYOUT_MOVIE + }, + { + "Gallery", + LAYOUT_GALLERY + }, + { + "Music", + LAYOUT_MUSIC + } +}; + +static void _mouse_move_cb(int id, void *data, Evas *e, + Evas_Object *obj, Evas_Event_Mouse_Move *ev) +{ + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); +} + +static void _focused_cb(int id, void *data, Evas_Object *obj, + Elm_Object_Item *it) +{ + struct _priv *priv; + int i; + + if (!data) { + _ERR("failed to get data"); + return; + } + + priv = data; + + for (i = 0; i < MENU_BTN_SIZE; i++) { + if (priv->btn[i] == obj) + break; + } + + if (i == priv->current_layout || i == MENU_BTN_SIZE) + return; + + layoutmgr_hide_layout(priv->lmgr, + g_menu_item[priv->current_layout].layout_id); + layoutmgr_show_layout(priv->lmgr, g_menu_item[i].layout_id); + + priv->current_layout = i; +} + +static input_handler handler = { + .mouse_move = _mouse_move_cb, + .focused = _focused_cb +}; + +static bool _draw_title(struct _priv *priv) +{ + if (!priv) + return false; + + elm_object_part_text_set(priv->base, PART_TITLE, TITLE_TEXT); + + return true; +} + +static bool _draw_menu_btn(struct _priv *priv) +{ + Evas_Object *box, *btn; + int i; + + if (!priv) + return false; + + box = elm_box_add(priv->base); + if (!box) { + _ERR("failed to create box object"); + return false; + } + + elm_box_horizontal_set(box, EINA_TRUE); + + evas_object_size_hint_weight_set(box, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + + for (i = 0; i < MENU_BTN_SIZE; i++) { + btn = elm_button_add(box); + if (!btn) { + _ERR("failed to create button object"); + return false; + } + + elm_object_style_set(btn, STYLE_MENU_BTN); + elm_object_text_set(btn, g_menu_item[i].name); + + elm_box_pack_end(box, btn); + + evas_object_show(btn); + + inputmgr_add_callback(btn, 0, &handler, priv); + + priv->btn[i] = btn; + } + + evas_object_show(box); + + elm_object_part_content_set(priv->base, PART_MENU_AREA, box); + + elm_object_focus_set(priv->btn[0], EINA_TRUE); + + elm_object_focus_next_object_set(priv->btn[MENU_BTN_SIZE - 1], + priv->btn[0], ELM_FOCUS_RIGHT); + elm_object_focus_next_object_set(priv->btn[0], + priv->btn[MENU_BTN_SIZE - 1], ELM_FOCUS_LEFT); + + return true; +} + +static bool _draw_items(struct _priv *priv) +{ + if (!priv) + return false; + + if (!_draw_title(priv)) + return false; + + if (!_draw_menu_btn(priv)) + return false; + + return true; +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -67,6 +212,12 @@ static Evas_Object *_create(Evas_Object *win, void *data) priv->base = base; priv->lmgr = lmgr; + if (!_draw_items(priv)) { + _ERR("failed to draw items"); + free(priv); + return NULL; + } + viewmgr_set_view_data(VIEW_BASE, priv); return base; @@ -103,6 +254,7 @@ static void _hide(void *view_data) static void _destroy(void *view_data) { struct _priv *priv; + int i; if (!view_data) { _ERR("failed to get view data"); @@ -111,7 +263,15 @@ static void _destroy(void *view_data) priv = view_data; + for (i = 0; i < MENU_BTN_SIZE; i++) + inputmgr_remove_callback(priv->btn[i], &handler); + + layoutmgr_remove_layout(priv->lmgr, LAYOUT_MOVIE); + layoutmgr_remove_layout(priv->lmgr, LAYOUT_GALLERY); + layoutmgr_remove_layout(priv->lmgr, LAYOUT_MUSIC); + layoutmgr_destroy(priv->lmgr); + evas_object_del(priv->base); free(priv); -- 2.7.4 From 72abe77be60ffcb3251f65c99ab28b1c877b0c53 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Tue, 23 Jun 2015 20:27:41 +0900 Subject: [PATCH 09/16] controller: add click event signal at buttons Change-Id: I54b8f9420713d1364a4b09c80264dfe529e906d2 Signed-off-by: Minkyu Kang --- include/view/viewer.h | 2 + res/edc/widgets/button.edc | 262 ++++++++++++++++++--------------------------- 2 files changed, 108 insertions(+), 156 deletions(-) diff --git a/include/view/viewer.h b/include/view/viewer.h index 4de2b2b..685e1f7 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -34,6 +34,8 @@ /* signal */ #define SIG_SET_PLAY "set,play,icon" #define SIG_SET_PAUSE "set,pause,icon" +#define SIG_BTN_CLICKED "btn,clicked" +#define SIG_BTN_CALLBACK "btn,callback" /* images */ #define IMAGE_VIEWER_FAVORITE "ic_title_favorite.png" diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index 4971c8d..f58ba5c 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -165,6 +165,22 @@ group { } programs { program { + name: "button_clicked"; + signal: "mouse,clicked,1"; + source: "bg"; + action: SIGNAL_EMIT "elm,action,click" ""; + } + program { + name: SIG_BTN_CLICKED; + signal: SIG_BTN_CLICKED; + source: ""; + after: "emit,signal"; + } + program { + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "prev"; + } + program { name: "focused"; signal: "elm,action,focus"; source: "elm"; @@ -187,68 +203,109 @@ group { group { name: "elm/button/base/viewer_btn_rew"; - data.item, "focus_highlight" "on"; + inherit: "elm/button/base/viewer_btn_prev"; images { image: IMAGE_VIEWER_REW_NORMAL COMP; image: IMAGE_VIEWER_REW_FOCUS COMP; } parts { part { - name: "color"; - type: RECT; + name: "bg"; scale: 1; description { state: "default" 0.0; + image { + normal: IMAGE_VIEWER_REW_NORMAL; + } } description { state: "selected" 0.0; - color: COLOR_BTN_FOCUS; + inherit: "default" 0.0; + image { + normal: IMAGE_VIEWER_REW_FOCUS; + } } } + } + programs { + program { + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "rew"; + } + } +} + +group { + name: "elm/button/base/viewer_btn_ff"; + inherit: "elm/button/base/viewer_btn_prev"; + images { + image: IMAGE_VIEWER_FF_NORMAL COMP; + image: IMAGE_VIEWER_FF_FOCUS COMP; + } + parts { part { name: "bg"; scale: 1; description { state: "default" 0.0; - min: 180 143; image { - normal: IMAGE_VIEWER_REW_NORMAL; + normal: IMAGE_VIEWER_FF_NORMAL; } } description { state: "selected" 0.0; inherit: "default" 0.0; image { - normal: IMAGE_VIEWER_REW_FOCUS; + normal: IMAGE_VIEWER_FF_FOCUS; } } } } programs { program { - name: "focused"; - signal: "elm,action,focus"; - source: "elm"; - script { - set_state(PART:"bg", "selected", 0.0); - set_state(PART:"color", "selected", 0.0); + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "ff"; + } + } +} + +group { + name: "elm/button/base/viewer_btn_next"; + inherit: "elm/button/base/viewer_btn_prev"; + images { + image: IMAGE_VIEWER_NEXT_NORMAL COMP; + image: IMAGE_VIEWER_NEXT_FOCUS COMP; + } + parts { + part { + name: "bg"; + scale: 1; + description { + state: "default" 0.0; + image { + normal: IMAGE_VIEWER_NEXT_NORMAL; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + image { + normal: IMAGE_VIEWER_NEXT_FOCUS; + } } } + } + programs { program { - name: "unfocused"; - signal: "elm,action,unfocus"; - source: "elm"; - script { - set_state(PART:"bg", "default", 0.0); - set_state(PART:"color", "default", 0.0); - } + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "next"; } } } group { name: "elm/button/base/viewer_btn_play"; - data.item, "focus_highlight" "on"; + inherit: "elm/button/base/viewer_btn_prev"; images { image: IMAGE_VIEWER_PLAY_NORMAL COMP; image: IMAGE_VIEWER_PLAY_FOCUS COMP; @@ -260,23 +317,10 @@ group { } parts { part { - name: "color"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - } - description { - state: "selected" 0.0; - color: COLOR_BTN_FOCUS; - } - } - part { name: "bg"; scale: 1; description { state: "default" 0.0; - min: 180 143; image { normal: IMAGE_VIEWER_PLAY_NORMAL; } @@ -334,6 +378,34 @@ group { } } program { + name: "button_clicked"; + signal: "mouse,clicked,1"; + source: "bg"; + action: SIGNAL_EMIT "elm,action,click" ""; + } + program { + name: SIG_BTN_CLICKED; + signal: SIG_BTN_CLICKED; + source: ""; + after: "emit,signal"; + script { + new state; + state = get_int(cur_state); + + if (state == STATE_PLAY) { + set_int(cur_state, STATE_PAUSE); + set_state(PART:"bg", "selected_pause", 0.0); + } else { + set_int(cur_state, STATE_PLAY); + set_state(PART:"bg", "selected", 0.0); + } + } + } + program { + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "play"; + } + program { name: "focused"; signal: "elm,action,focus"; source: "elm"; @@ -367,125 +439,3 @@ group { } } } - -group { - name: "elm/button/base/viewer_btn_ff"; - data.item, "focus_highlight" "on"; - images { - image: IMAGE_VIEWER_FF_NORMAL COMP; - image: IMAGE_VIEWER_FF_FOCUS COMP; - } - parts { - part { - name: "color"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - } - description { - state: "selected" 0.0; - color: COLOR_BTN_FOCUS; - } - } - part { - name: "bg"; - scale: 1; - description { - state: "default" 0.0; - min: 180 143; - image { - normal: IMAGE_VIEWER_FF_NORMAL; - } - } - description { - state: "selected" 0.0; - inherit: "default" 0.0; - image { - normal: IMAGE_VIEWER_FF_FOCUS; - } - } - } - } - programs { - program { - name: "focused"; - signal: "elm,action,focus"; - source: "elm"; - script { - set_state(PART:"bg", "selected", 0.0); - set_state(PART:"color", "selected", 0.0); - } - } - program { - name: "unfocused"; - signal: "elm,action,unfocus"; - source: "elm"; - script { - set_state(PART:"bg", "default", 0.0); - set_state(PART:"color", "default", 0.0); - } - } - } -} - -group { - name: "elm/button/base/viewer_btn_next"; - data.item, "focus_highlight" "on"; - images { - image: IMAGE_VIEWER_NEXT_NORMAL COMP; - image: IMAGE_VIEWER_NEXT_FOCUS COMP; - } - parts { - part { - name: "color"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - } - description { - state: "selected" 0.0; - color: COLOR_BTN_FOCUS; - } - } - part { - name: "bg"; - scale: 1; - description { - state: "default" 0.0; - min: 180 143; - image { - normal: IMAGE_VIEWER_NEXT_NORMAL; - } - } - description { - state: "selected" 0.0; - inherit: "default" 0.0; - image { - normal: IMAGE_VIEWER_NEXT_FOCUS; - } - } - } - } - programs { - program { - name: "focused"; - signal: "elm,action,focus"; - source: "elm"; - script { - set_state(PART:"bg", "selected", 0.0); - set_state(PART:"color", "selected", 0.0); - } - } - program { - name: "unfocused"; - signal: "elm,action,unfocus"; - source: "elm"; - script { - set_state(PART:"bg", "default", 0.0); - set_state(PART:"color", "default", 0.0); - } - } - } -} -- 2.7.4 From 787b9c0d2922a17acd3f840db785f70c2446d94c Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Tue, 23 Jun 2015 20:39:57 +0900 Subject: [PATCH 10/16] add gridmgr Change-Id: Id1fcf7b33b9a35dbfae2adff0925777381333ec0 Signed-off-by: Jehun Lim --- CMakeLists.txt | 1 + include/util/gridmgr.h | 39 ++++++++++++ src/util/gridmgr.c | 169 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 include/util/gridmgr.h create mode 100644 src/util/gridmgr.c diff --git a/CMakeLists.txt b/CMakeLists.txt index d6ee7b0..ea4d6aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ src/view/viewer.c src/layout/movie.c src/layout/gallery.c src/layout/music.c +src/util/gridmgr.c ) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/include/util/gridmgr.h b/include/util/gridmgr.h new file mode 100644 index 0000000..97ba910 --- /dev/null +++ b/include/util/gridmgr.h @@ -0,0 +1,39 @@ +/* + * 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 _AIR_MEDIAHUB_GRIDMGR_H__ +#define _AIR_MEDIAHUB_GRIDMGR_H__ + +#include + +struct gridmgr; + +struct grid_class { + const char *grid_style; + + char *(*text_get)(void *data, Evas_Object *obj, const char *part); + Evas_Object *(*content_get)(void *data, Evas_Object *obj, + const char *part); + /* It will be added later */ +}; + +struct gridmgr *gridmgr_create(void); +bool gridmgr_destroy(struct gridmgr *gmgr); +bool gridmgr_add_grid(struct gridmgr *gmgr, const char *grid_id, + Evas_Object *grid, struct grid_class *gclass); +bool gridmgr_update_grid(struct gridmgr *gmgr, const char *grid_id, Eina_List *item_list); + +#endif /* _AIR_MEDIAHUB_GRIDMGR_H__ */ diff --git a/src/util/gridmgr.c b/src/util/gridmgr.c new file mode 100644 index 0000000..2a7cad9 --- /dev/null +++ b/src/util/gridmgr.c @@ -0,0 +1,169 @@ +/* + * 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 "define.h" +#include "util/gridmgr.h" + +struct gridmgr { + Eina_List *list; +}; + +struct grid_item { + const char *id; + Evas_Object *grid; + struct grid_class *gclass; +}; + +struct grid_item *_get_item_from_id(struct gridmgr *gmgr, const char *id) +{ + Eina_List *l; + struct grid_item *gitem; + + if (!gmgr || !id) + return NULL; + + gitem = NULL; + EINA_LIST_FOREACH(gmgr->list, l, gitem) { + if (!strcmp(gitem->id, id)) + break; + } + + return gitem; +} + +Elm_Gengrid_Item_Class *_get_item_class(struct grid_class *gclass) +{ + Elm_Gengrid_Item_Class *ic; + + if (!gclass) + return NULL; + + ic = elm_gengrid_item_class_new(); + if (!ic) { + _ERR("failed to create item class"); + return NULL; + } + + ic->func.text_get = gclass->text_get; + ic->func.content_get = gclass->content_get; + + ic->item_style = gclass->grid_style; + + return ic; +} + +struct gridmgr *gridmgr_create(void) +{ + struct gridmgr *gmgr; + + gmgr = calloc(1, sizeof(*gmgr)); + if (!gmgr) { + _ERR("failed to create gridmgr"); + return NULL; + } + + return gmgr; +} + +bool gridmgr_destroy(struct gridmgr *gmgr) +{ + struct grid_item *gitem; + + if (!gmgr) { + _ERR("failed to get gridmgr"); + return false; + } + + EINA_LIST_FREE(gmgr->list, gitem) + free(gitem); + + free(gmgr); + gmgr = NULL; + + return true; +} + +bool gridmgr_add_grid(struct gridmgr *gmgr, const char *grid_id, + Evas_Object *grid, struct grid_class *gclass) +{ + struct grid_item *gitem; + + if (!gmgr) { + _ERR("failed to get gridmgr"); + return false; + } + + if (!gclass || !gclass->text_get || !gclass->content_get) { + _ERR("failed to get grid class"); + return false; + } + + gitem = calloc(1, sizeof(*gitem)); + if (!gitem) { + _ERR("failed to create gengrid item"); + return false; + } + + gitem->id = grid_id; + gitem->grid = grid; + gitem->gclass = gclass; + + gmgr->list = eina_list_append(gmgr->list, gitem); + + return true; +} + +bool gridmgr_update_grid(struct gridmgr *gmgr, const char *grid_id, + Eina_List *item_list) +{ + Eina_List *l; + Elm_Object_Item *it; + Elm_Gengrid_Item_Class *ic; + struct grid_item *gitem; + void *data; + + if (!gmgr) { + _ERR("failed to get gridmgr"); + return false; + } + + gitem = _get_item_from_id(gmgr, grid_id); + if (!gitem) { + _ERR("%s doesn't exist", grid_id); + return false; + } + + elm_gengrid_clear(gitem->grid); + + ic = _get_item_class(gitem->gclass); + if (!ic) { + _ERR("failed to get item class"); + return false; + } + + EINA_LIST_FOREACH(item_list, l, data) { + it = elm_gengrid_item_append(gitem->grid, ic, data, NULL, NULL); + + elm_object_item_data_set(it, data); + } + + elm_gengrid_item_class_free(ic); + + return true; +} -- 2.7.4 From be9e1cb5f8ad1cb76498e279435a57d023a0b021 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 24 Jun 2015 15:58:16 +0900 Subject: [PATCH 11/16] util: add a controller managing module Change-Id: Ibd4066264e61e109fc45008c8c4ff63d21bd3c99 Signed-off-by: Minkyu Kang --- CMakeLists.txt | 1 + include/util/controller.h | 36 ++++++ src/util/controller.c | 291 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 328 insertions(+) create mode 100644 include/util/controller.h create mode 100644 src/util/controller.c diff --git a/CMakeLists.txt b/CMakeLists.txt index ea4d6aa..27ecebe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ src/layout/movie.c src/layout/gallery.c src/layout/music.c src/util/gridmgr.c +src/util/controller.c ) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/include/util/controller.h b/include/util/controller.h new file mode 100644 index 0000000..8a6a4c3 --- /dev/null +++ b/include/util/controller.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +struct controller; + +struct controller_ops { + void (*show)(void *handle); + void (*hide)(void *handle); + bool (*add_control)(void *handle, const char *name, int loc, + const char *style, const char *part); + void (*add_callback)(void *handle, + void (*func)(void *, const char *), void *data); + void (*focus)(void *handle, int loc, bool foc); + void (*signal)(void *handle, int loc, const char *signal); +}; + +struct controller { + void *handle; + struct controller_ops *ops; +}; + +struct controller *controller_create(Evas_Object *base); +void controller_destroy(struct controller *m); diff --git a/src/util/controller.c b/src/util/controller.c new file mode 100644 index 0000000..f4b3799 --- /dev/null +++ b/src/util/controller.c @@ -0,0 +1,291 @@ +/* + * 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/controller.h" + +struct _event_cb { + void (*func)(void *data, const char *ev); + void *data; +}; + +struct _control { + Evas_Object *obj; + char *part; +}; + +struct _priv { + Evas_Object *base; + Eina_List *list; + struct _event_cb cb; +}; + +static void _btn_cb(void *data, Evas_Object *obj, + const char *emission, const char *source) +{ + struct _priv *p; + + if (!data) { + _ERR("invalid parameter"); + return; + } + + p = data; + + if (p->cb.func) + p->cb.func(p->cb.data, source); +} + +static void _mouse_move_cb(int id, void *data, Evas *e, + Evas_Object *obj, Evas_Event_Mouse_Move *ev) +{ + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); +} + +static void _clicked_cb(int id, void *data, Evas_Object *obj) +{ + elm_object_signal_emit(obj, SIG_BTN_CLICKED, ""); +} + +static input_handler _handler = { + .mouse_move = _mouse_move_cb, + .clicked = _clicked_cb, +}; + +static Evas_Object *_add_btn(Evas_Object *base, const char *style) +{ + Evas_Object *btn; + + btn = elm_button_add(base); + if (!btn) + return NULL; + + elm_object_style_set(btn, style); + evas_object_show(btn); + + return btn; +} + +static bool _add_control(void *handle, const char *name, int loc, + const char *style, const char *part) +{ + struct _priv *p; + struct _control *ctl; + Evas_Object *btn; + char buf[32]; + + if (!handle || !name || !style || !part) { + _ERR("invalid parameter"); + return false; + } + + p = handle; + + snprintf(buf, sizeof(buf), "%s_%s", style, name); + btn = _add_btn(p->base, buf); + if (!btn) { + _ERR("failed to add button"); + return false; + } + + snprintf(buf, sizeof(buf), "%s%d", part, loc); + + ctl = calloc(1, sizeof(*ctl)); + if (!ctl) { + _ERR("failed to allocate"); + return false; + } + + ctl->obj = btn; + ctl->part = strdup(buf); + + p->list = eina_list_append(p->list, ctl); + + inputmgr_add_callback(btn, 0, &_handler, p); + elm_object_signal_callback_add(btn, SIG_BTN_CALLBACK, name, _btn_cb, p); + + return true; +} + +static void _add_callback(void *handle, + void (*func)(void *, const char *), void *data) +{ + struct _priv *p; + + if (!handle) { + _ERR("invalid parameter"); + return; + } + + p = handle; + p->cb.func = func; + p->cb.data = data; +} + +static void _focus(void *handle, int loc, bool foc) +{ + struct _priv *p; + struct _control *ctl; + + if (!handle) { + _ERR("invalid parameter"); + return; + } + + p = handle; + ctl = eina_list_nth(p->list, loc); + + if (ctl && ctl->obj) + elm_object_focus_set(ctl->obj, foc); +} + +static void _signal(void *handle, int loc, const char *signal) +{ + struct _priv *p; + struct _control *ctl; + + if (!handle) { + _ERR("invalid parameter"); + return; + } + + p = handle; + ctl = eina_list_nth(p->list, loc); + + if (ctl && ctl->obj) + elm_object_signal_emit(ctl->obj, signal, ""); +} + +static void _show(void *handle) +{ + struct _priv *p; + struct _control *ctl; + Eina_List *l; + + if (!handle) { + _ERR("invalid parameter"); + return; + } + + p = handle; + + EINA_LIST_FOREACH(p->list, l, ctl) { + if (!ctl->obj) + continue; + + evas_object_freeze_events_set(ctl->obj, EINA_FALSE); + elm_object_focus_allow_set(ctl->obj, EINA_TRUE); + + evas_object_show(ctl->obj); + elm_object_part_content_set(p->base, ctl->part, ctl->obj); + } +} + +static void _hide(void *handle) +{ + struct _priv *p; + struct _control *ctl; + Eina_List *l; + + if (!handle) { + _ERR("invalid parameter"); + return; + } + + p = handle; + + EINA_LIST_FOREACH(p->list, l, ctl) { + if (!ctl->obj) + continue; + + evas_object_freeze_events_set(ctl->obj, EINA_TRUE); + elm_object_focus_allow_set(ctl->obj, EINA_FALSE); + + evas_object_hide(ctl->obj); + elm_object_part_content_unset(p->base, ctl->part); + } +} + +static struct controller_ops _operations = { + .add_control = _add_control, + .add_callback = _add_callback, + .focus = _focus, + .signal = _signal, + .show = _show, + .hide = _hide, +}; + +struct controller *controller_create(Evas_Object *base) +{ + struct controller *m; + struct _priv *p; + + if (!base) { + _ERR("invalid parameter"); + return NULL; + } + + m = calloc(1, sizeof(*m)); + if (!m) { + _ERR("failed to allocate"); + return NULL; + } + + p = calloc(1, sizeof(*p)); + if (!p) { + _ERR("failed to allocate"); + free(m); + return NULL; + } + + p->base = base; + + m->handle = (void *)p; + m->ops = &_operations; + + return m; +} + +void controller_destroy(struct controller *m) +{ + struct _priv *p; + struct _control *ctl; + + if (!m) + return; + + p = m->handle; + if (!p) + goto out; + + EINA_LIST_FREE(p->list, ctl) { + if (ctl->obj) + inputmgr_remove_callback(ctl->obj, &_handler); + free(ctl->part); + free(ctl); + } + + free(p); + +out: + free(m); +} -- 2.7.4 From 924da909486660b90c78758bf9861033138b9462 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 24 Jun 2015 18:28:40 +0900 Subject: [PATCH 12/16] add transition for buttons Change-Id: Id08e1e47af5449382ee46d34a1690211f72a4516 Signed-off-by: Minkyu Kang --- res/edc/widgets/button.edc | 71 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 18 deletions(-) diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index f58ba5c..1c65ac3 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -16,6 +16,7 @@ #define STATE_PLAY 0 #define STATE_PAUSE 1 +#define TRANSITION_TIME 0.17 group { name: "elm/button/base/menu_btn"; @@ -109,7 +110,7 @@ group { target: "bg"; target: "elm.text"; target: "bottom_line"; - transition: LINEAR 0.17; + transition: LINEAR TRANSITION_TIME; } program { name: "unfocused"; @@ -119,7 +120,7 @@ group { target: "bg"; target: "elm.text"; target: "bottom_line"; - transition: LINEAR 0.17; + transition: LINEAR TRANSITION_TIME; } } } @@ -184,19 +185,19 @@ group { name: "focused"; signal: "elm,action,focus"; source: "elm"; - script { - set_state(PART:"bg", "selected", 0.0); - set_state(PART:"color", "selected", 0.0); - } + action: STATE_SET "selected" 0.0; + target: "bg"; + target: "color"; + transition: LINEAR TRANSITION_TIME; } program { name: "unfocused"; signal: "elm,action,unfocus"; source: "elm"; - script { - set_state(PART:"bg", "default", 0.0); - set_state(PART:"color", "default", 0.0); - } + action: STATE_SET "default" 0.0; + target: "bg"; + target: "color"; + transition: LINEAR TRANSITION_TIME; } } } @@ -317,6 +318,16 @@ group { } parts { part { + name: "color"; + description { + state: "default_pause" 0.0; + } + description { + state: "selected_pause" 0.0; + color: COLOR_BTN_FOCUS; + } + } + part { name: "bg"; scale: 1; description { @@ -414,11 +425,9 @@ group { state = get_int(cur_state); if (state == STATE_PLAY) - set_state(PART:"bg", "selected", 0.0); + run_program(PROGRAM:"focused,play"); else - set_state(PART:"bg", "selected_pause", 0.0); - - set_state(PART:"color", "selected", 0.0); + run_program(PROGRAM:"focused,pause"); } } program { @@ -430,12 +439,38 @@ group { state = get_int(cur_state); if (state == STATE_PLAY) - set_state(PART:"bg", "default", 0.0); + run_program(PROGRAM:"unfocused,play"); else - set_state(PART:"bg", "default_pause", 0.0); - - set_state(PART:"color", "default", 0.0); + run_program(PROGRAM:"unfocused,pause"); } } + program { + name: "focused,play"; + action: STATE_SET "selected" 0.0; + target: "bg"; + target: "color"; + transition: LINEAR TRANSITION_TIME; + } + program { + name: "focused,pause"; + action: STATE_SET "selected_pause" 0.0; + target: "bg"; + target: "color"; + transition: LINEAR TRANSITION_TIME; + } + program { + name: "unfocused,play"; + action: STATE_SET "default" 0.0; + target: "bg"; + target: "color"; + transition: LINEAR TRANSITION_TIME; + } + program { + name: "unfocused,pause"; + action: STATE_SET "default_pause" 0.0; + target: "bg"; + target: "color"; + transition: LINEAR TRANSITION_TIME; + } } } -- 2.7.4 From 125beccbf516484393bd186706890c785b2eb144 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 24 Jun 2015 21:18:27 +0900 Subject: [PATCH 13/16] viewer: add prev/next button for photo viewer Change-Id: Ia198f3df32f0dfadbc32617b0f2b4368a7025468 Signed-off-by: Minkyu Kang --- res/edc/widgets/button.edc | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index 1c65ac3..92b6046 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -305,6 +305,74 @@ group { } group { + name: "elm/button/base/viewer_btn_prev_photo"; + inherit: "elm/button/base/viewer_btn_prev"; + images { + image: IMAGE_VIEWER_PHOTO_PREV_NORMAL COMP; + image: IMAGE_VIEWER_PHOTO_PREV_FOCUS COMP; + } + parts { + part { + name: "bg"; + scale: 1; + description { + state: "default" 0.0; + image { + normal: IMAGE_VIEWER_PHOTO_PREV_NORMAL; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + image { + normal: IMAGE_VIEWER_PHOTO_PREV_FOCUS; + } + } + } + } + programs { + program { + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "prev"; + } + } +} + +group { + name: "elm/button/base/viewer_btn_next_photo"; + inherit: "elm/button/base/viewer_btn_prev"; + images { + image: IMAGE_VIEWER_PHOTO_NEXT_NORMAL COMP; + image: IMAGE_VIEWER_PHOTO_NEXT_FOCUS COMP; + } + parts { + part { + name: "bg"; + scale: 1; + description { + state: "default" 0.0; + image { + normal: IMAGE_VIEWER_PHOTO_NEXT_NORMAL; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + image { + normal: IMAGE_VIEWER_PHOTO_NEXT_FOCUS; + } + } + } + } + programs { + program { + name: "emit,signal"; + action: SIGNAL_EMIT SIG_BTN_CALLBACK "next"; + } + } +} + +group { name: "elm/button/base/viewer_btn_play"; inherit: "elm/button/base/viewer_btn_prev"; images { -- 2.7.4 From c797c6a1d5df48baf0692feff3dcdb3c2de22190 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 25 Jun 2015 13:27:32 +0900 Subject: [PATCH 14/16] add defines for images Change-Id: I4c0687865e4432310d6cbdce190d643a805f6c31 Signed-off-by: Minkyu Kang --- include/view/viewer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/view/viewer.h b/include/view/viewer.h index 685e1f7..f50bc40 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -52,5 +52,9 @@ #define IMAGE_VIEWER_FF_NORMAL "btn_view_contr_forward_nor.png" #define IMAGE_VIEWER_NEXT_FOCUS "btn_view_contr_next_foc.png" #define IMAGE_VIEWER_NEXT_NORMAL "btn_view_contr_next_nor.png" +#define IMAGE_VIEWER_PHOTO_PREV_FOCUS "btn_view_slide_previous_foc.png" +#define IMAGE_VIEWER_PHOTO_PREV_NORMAL "btn_view_slide_previous_nor.png" +#define IMAGE_VIEWER_PHOTO_NEXT_FOCUS "btn_view_slide_next_foc.png" +#define IMAGE_VIEWER_PHOTO_NEXT_NORMAL "btn_view_slide_next_nor.png" #endif /* __AIR_MEDIAHUB_VIEW_VIEWER_H__ */ -- 2.7.4 From 2ed28c4a6d51095df454ae2ef7f9be1264d5e816 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Thu, 25 Jun 2015 10:59:09 +0900 Subject: [PATCH 15/16] data: add mediadata for creating media list Change-Id: I65a5626abcbdbe5d62c93367cbbf51bbfbb9ce65 Signed-off-by: Jehun Lim --- CMakeLists.txt | 1 + include/data/mediadata.h | 40 ++++++++ src/data/mediadata.c | 246 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 include/data/mediadata.h create mode 100644 src/data/mediadata.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 27ecebe..15adc8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ src/layout/gallery.c src/layout/music.c src/util/gridmgr.c src/util/controller.c +src/data/mediadata.c ) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/include/data/mediadata.h b/include/data/mediadata.h new file mode 100644 index 0000000..59431b4 --- /dev/null +++ b/include/data/mediadata.h @@ -0,0 +1,40 @@ +/* + * 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 _AIR_MEDIAHUB_MEDIADATA_H__ +#define _AIR_MEDIAHUB_MEDIADATA_H__ + +#include + +struct mediadata; + +enum source_type { + E_SOURCE_INTERNAL = 0, + E_SOURCE_EXTERNAL, + E_SOURCE_ALL, + E_SOURCE_MAX +}; + +struct folderdata { + char *name; + time_t modified_time; + Eina_List *list; +}; + +struct mediadata *mediadata_create(const char *media_type, int source_type); +void mediadata_destroy(struct mediadata *md); + +#endif /* _AIR_MEDIAHUB_MEDIADATA_H__ */ diff --git a/src/data/mediadata.c b/src/data/mediadata.c new file mode 100644 index 0000000..ce8858c --- /dev/null +++ b/src/data/mediadata.c @@ -0,0 +1,246 @@ +/* + * 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 "data/mediadata.h" + +enum _filter_type { + E_FILTER_FOLDER = 0, + E_FILTER_MEDIA +}; + +struct mediadata { + Eina_List *list; +}; + +struct _data { + const char *media_type; + int source_type; + Eina_List *item_list; + Eina_List *folder_list; +}; + +static bool _create_filter(struct _data *data, filter_h *filter, int type) +{ + filter_h tmp_filter; + int ret; + char buf[1024]; + + ret = media_filter_create(&tmp_filter); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to create media filter"); + return false; + } + + snprintf(buf, sizeof(buf), "%s", data->media_type); + + if (type == E_FILTER_FOLDER && data->source_type != E_SOURCE_ALL) { + char s[64]; + + snprintf(s, sizeof(s), " AND MEDIA_STORAGE_TYPE=%d", + data->source_type); + strcat(buf, s); + } + + media_filter_set_condition(tmp_filter, buf, + MEDIA_CONTENT_COLLATE_DEFAULT); + media_filter_set_order(tmp_filter, MEDIA_CONTENT_ORDER_DESC, + MEDIA_MODIFIED_TIME, MEDIA_CONTENT_COLLATE_NOCASE); + + *filter = tmp_filter; + + return true; +} + +static void _destroy_medialist(Eina_List *list) +{ + struct folderdata *fd; + app_media *am; + + EINA_LIST_FREE(list, fd) { + free(fd->name); + EINA_LIST_FREE(fd->list, am) + app_media_destroy(am); + fd->list = NULL; + } +} + +static bool _get_each_media_info(media_info_h media_h, void *dt) +{ + app_media *am; + struct _data *data; + + if (!dt) + return false; + + data = dt; + + am = app_media_create(media_h); + if (!am) { + _ERR("failed to create app media"); + return false; + } + + data->item_list = eina_list_append(data->item_list, am); + + return true; +} + +static bool _get_each_folder_info(media_folder_h folder, void *dt) +{ + filter_h filter; + struct _data *data; + struct folderdata *fd; + int ret; + char *uuid; + + if (!dt) + return false; + + data = dt; + + fd = calloc(1, sizeof(*fd)); + if (!fd) { + _ERR("failed to create folderdata"); + return false; + } + + if (media_folder_get_name(folder, &(fd->name)) + != MEDIA_CONTENT_ERROR_NONE) { + _ERR("Media folder id Fetch error"); + goto err; + } + + if (media_folder_get_modified_time(folder, &(fd->modified_time)) + != MEDIA_CONTENT_ERROR_NONE) { + _ERR("Media folder modified time Fetch error"); + goto err; + } + + if (media_folder_get_folder_id(folder, &uuid) + != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to fetch media folder id"); + goto err; + } + + if (!_create_filter(data, &filter, E_FILTER_MEDIA)) { + _ERR("failed to create filter"); + goto err; + } + + ret = media_folder_foreach_media_from_db(uuid, filter, + _get_each_media_info, data); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to get media info"); + goto err; + } + + fd->list = data->item_list; + data->item_list = NULL; + + data->folder_list = eina_list_append(data->folder_list, fd); + + media_filter_destroy(filter); + free(uuid); + + return true; + +err: + media_filter_destroy(filter); + free(uuid); + _destroy_medialist(data->folder_list); + return false; +} + +static bool _get_medialist(struct _data *data) +{ + filter_h filter; + int ret; + + if (!_create_filter(data, &filter, E_FILTER_FOLDER)) { + _ERR("failed to create filter"); + return false; + } + + ret = media_folder_foreach_folder_from_db(filter, + _get_each_folder_info, data); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to get folder info"); + media_filter_destroy(filter); + return false; + } + + media_filter_destroy(filter); + + return true; +} + +struct mediadata *mediadata_create(const char *media_type, int source_type) +{ + struct mediadata *md; + struct _data data; + int ret; + + if (!media_type || source_type < 0 || source_type >= E_SOURCE_MAX) { + _ERR("invalid argument"); + return NULL; + } + + md = calloc(1, sizeof(*md)); + if (!md) { + _ERR("failed to create mediadata"); + return NULL; + } + + ret = media_content_connect(); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to connect to media content"); + free(md); + return NULL; + } + + data.media_type = media_type; + data.source_type = source_type; + data.item_list = NULL; + data.folder_list = NULL; + + if (!_get_medialist(&data)) { + _ERR("failed to get medialist"); + free(md); + media_content_disconnect(); + return NULL; + } + + media_content_disconnect(); + + md->list = data.folder_list; + + return md; +} + +void mediadata_destroy(struct mediadata *md) +{ + if (!md) { + _ERR("failed to get mediadata"); + return; + } + + _destroy_medialist(md->list); +} -- 2.7.4 From 76620eb9ec0edad160228b74ea0e96dd00c082e6 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 25 Jun 2015 17:58:31 +0900 Subject: [PATCH 16/16] viewer: add movie/video/photo viewer Initiall support for UI of viewers. This patch is including test codes for making media list. Change-Id: I896f5a3463643f38bdb5644f806b070442b1b402 Signed-off-by: Minkyu Kang --- CMakeLists.txt | 1 + include/view/viewer.h | 3 +- res/edc/view/viewer.edc | 10 +- res/{edc => }/images/ic_title_favorite.png | Bin src/view/viewer.c | 382 +++++++++++++++++++++++++++++ 5 files changed, 387 insertions(+), 9 deletions(-) rename res/{edc => }/images/ic_title_favorite.png (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15adc8e..5f67dbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,4 +83,5 @@ CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${PACKAGEDIR}) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/images DESTINATION ${RESDIR}) ADD_SUBDIRECTORY(res/edc) diff --git a/include/view/viewer.h b/include/view/viewer.h index f50bc40..c9e5f32 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -30,6 +30,7 @@ #define PART_VIEWER_PAGE "part.viewer_page" #define PART_VIEWER_PROGRESS "part.viewer_progress" #define PART_VIEWER_TOTAL "part.viewer_total" +#define PART_VIEWER_FAVORITE "part.viewer_favorite" /* signal */ #define SIG_SET_PLAY "set,play,icon" @@ -38,7 +39,7 @@ #define SIG_BTN_CALLBACK "btn,callback" /* images */ -#define IMAGE_VIEWER_FAVORITE "ic_title_favorite.png" +#define IMAGE_VIEWER_FAVORITE IMAGEDIR"/ic_title_favorite.png" #define IMAGE_VIEWER_PREV_FOCUS "btn_view_contr_previous_foc.png" #define IMAGE_VIEWER_PREV_NORMAL "btn_view_contr_previous_nor.png" diff --git a/res/edc/view/viewer.edc b/res/edc/view/viewer.edc index 84cb95a..e3c6573 100644 --- a/res/edc/view/viewer.edc +++ b/res/edc/view/viewer.edc @@ -16,9 +16,6 @@ group { name: GRP_VIEWER_VIEW; - images { - image: IMAGE_VIEWER_FAVORITE COMP; - } parts { part { name: "bg"; @@ -187,7 +184,8 @@ group { } } part { - name: "favorite_icon"; + name: PART_VIEWER_FAVORITE; + type: SWALLOW; scale: 1; description { state: "default" 0.0; @@ -200,10 +198,6 @@ group { to: "padding_right"; relative: 0.0 0.5; } - /* It will be modified to SWALLOW area */ - image { - normal: IMAGE_VIEWER_FAVORITE; - } fixed: 1 1; align: 1.0 0.5; } diff --git a/res/edc/images/ic_title_favorite.png b/res/images/ic_title_favorite.png similarity index 100% rename from res/edc/images/ic_title_favorite.png rename to res/images/ic_title_favorite.png diff --git a/src/view/viewer.c b/src/view/viewer.c index 656ae4d..4202bac 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -18,18 +18,377 @@ #include #include #include +#include +#include +#include #include "define.h" +#include "util/controller.h" + +#define STYLE_VIEWER_BTN "viewer_btn" +#define PART_VIEWER_BTN "control_btn" + +#define VIDEO_COPYRIGHT "Unknown" + +enum { + VIEWER_MOVIE, + VIEWER_PHOTO, + VIEWER_VIDEO, + VIEWER_MAX +}; + +struct _viewer { + struct controller *ctl[VIEWER_MAX]; + int cur; +}; + +struct _playlist { + Eina_List *list; + int cur; +}; struct _priv { Evas_Object *win; Evas_Object *base; + + struct _viewer viewer; + struct _playlist playlist; +}; + +struct _btn_info { + const char *name; + int loc; +}; + +static struct _btn_info btn_movie[] = { + { + .name = "prev", + .loc = 0, + }, + { + .name = "rew", + .loc = 1, + }, + { + .name = "play", + .loc = 2, + }, + { + .name = "ff", + .loc = 3, + }, + { + .name = "next", + .loc = 4, + }, +}; + +static struct _btn_info btn_photo[] = { + { + .name = "prev_photo", + .loc = 0, + }, + { + .name = "next_photo", + .loc = 4, + }, +}; + +static struct _btn_info btn_video[] = { + { + .name = "prev", + .loc = 0, + }, + { + .name = "rew", + .loc = 1, + }, + { + .name = "play", + .loc = 2, + }, + { + .name = "ff", + .loc = 3, + }, + { + .name = "next", + .loc = 4, + }, +}; + +struct _viewer_info { + struct _btn_info *btns; + int btn_count; + int focus_loc; +}; + +static struct _viewer_info viewer_info[] = { + { + .btns = btn_movie, + .btn_count = 5, + .focus_loc = 2, + }, + { + .btns = btn_photo, + .btn_count = 2, + .focus_loc = 1, + }, + { + .btns = btn_video, + .btn_count = 5, + .focus_loc = 4, + }, }; +/* FIXME: test function */ +static bool _media(media_info_h media_h, void *dt) +{ + struct _priv *priv; + app_media *am; + + priv = dt; + + am = app_media_create(media_h); + + priv->playlist.list = eina_list_append(priv->playlist.list, am); + + return true; +} + +static void _media_test(struct _priv *priv, int mode) +{ + char *path = "/home/owner/content/Videos/Xmen-Days_of_Future_Past.mp4"; + filter_h filter; + char buf[1024]; + int r; + + r = media_filter_create(&filter); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("Media Filter Creation Failed"); + return; + } + + if (mode) + snprintf(buf, sizeof(buf), "MEDIA_PATH = \"%s\"", path); + else + snprintf(buf, sizeof(buf), "MEDIA_TYPE=0 OR MEDIA_TYPE=1"); + + r = media_filter_set_condition(filter, buf, + MEDIA_CONTENT_COLLATE_DEFAULT); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("Fail to set filter condition"); + media_filter_destroy(filter); + return; + } + + media_content_connect(); + + r = media_info_foreach_media_from_db(filter, _media, priv); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("MEDIA CONTENT ERROR: %d", r); + media_filter_destroy(filter); + media_content_disconnect(); + return; + } + + media_filter_destroy(filter); + media_content_disconnect(); +} +/* FIXME: test function end */ + +/* + * NOTE: Workaround + * we assumed that if video content have the copyright then it's a movie. + */ +static inline bool _check_movie_type(app_media_info *mi) +{ + return strcmp(mi->video->copyright, VIDEO_COPYRIGHT); +} + +static void _get_timestr(char *str, int size, unsigned int ms) +{ + int sec; + + sec = ms / 1000; + + snprintf(str, size, "%02d:%02d:%02d", + sec / 3600, (sec % 3600) / 60, sec % 60); +} + +static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) +{ + char buf[32] = {0,}; + struct tm tm; + + if (id == VIEWER_MOVIE) { + elm_object_part_text_set(priv->base, + PART_VIEWER_TITLE, mi->title); + } else { + localtime_r(&mi->modified_time, &tm); + strftime(buf, sizeof(buf), "%a, %d %b", &tm); + + elm_object_part_text_set(priv->base, PART_VIEWER_DATE, buf); + + snprintf(buf, sizeof(buf), "%d / %d", priv->playlist.cur + 1, + eina_list_count(priv->playlist.list)); + elm_object_part_text_set(priv->base, PART_VIEWER_PAGE, buf); + } +} + +static void _draw_time_info(struct _priv *priv, int id, app_media_info *mi) +{ + char progress[32] = {0,}; + char duration[32] = {0,}; + char total[32] = {0,}; + + if (id != VIEWER_PHOTO) { + _get_timestr(progress, sizeof(progress), mi->video->position); + _get_timestr(duration, sizeof(duration), mi->video->duration); + snprintf(total, sizeof(total), "/ %s", duration); + } + + elm_object_part_text_set(priv->base, PART_VIEWER_PROGRESS, progress); + elm_object_part_text_set(priv->base, PART_VIEWER_TOTAL, total); +} + +static void _draw_favorite_icon(struct _priv *priv, int id, app_media_info *mi) +{ + Evas_Object *img; + + if (!mi->favorite) + return; + + img = elm_image_add(priv->base); + if (!img) + return; + + elm_image_file_set(img, IMAGE_VIEWER_FAVORITE, NULL); + + evas_object_show(img); + elm_object_part_content_set(priv->base, PART_VIEWER_FAVORITE, img); +} + +static bool _viewer_show(struct _priv *priv, int cur) +{ + struct _viewer_info *info; + struct controller *ctl; + int id; + app_media *am; + app_media_info *mi; + + am = eina_list_nth(priv->playlist.list, cur); + if (!am) { + _ERR("failed to get app_media"); + return false; + } + + priv->playlist.cur = cur; + + mi = app_media_get_info(am); + if (!mi) { + _ERR("failed to getting media info"); + return false; + } + + switch (mi->media_type) { + case MEDIA_CONTENT_TYPE_IMAGE: + id = VIEWER_PHOTO; + break; + case MEDIA_CONTENT_TYPE_VIDEO: + if (_check_movie_type(mi)) + id = VIEWER_MOVIE; + else + id = VIEWER_VIDEO; + break; + default: + return false; + } + + info = &viewer_info[id]; + ctl = priv->viewer.ctl[id]; + priv->viewer.cur = id; + + ctl->ops->show(ctl->handle); + ctl->ops->focus(ctl->handle, info->focus_loc, true); + + _draw_title_bar(priv, id, mi); + _draw_time_info(priv, id, mi); + _draw_favorite_icon(priv, id, mi); + + return true; +} + +static void _viewer_hide(struct _priv *priv) +{ + struct controller *ctl; + + ctl = priv->viewer.ctl[priv->viewer.cur]; + ctl->ops->hide(ctl->handle); + + elm_object_part_content_unset(priv->base, PART_VIEWER_FAVORITE); +} + +static bool _viewer_add(struct _priv *priv, int id) +{ + struct _viewer_info *info; + struct controller *ctl; + int i; + + info = &viewer_info[id]; + + ctl = controller_create(priv->base); + if (!ctl) { + _ERR("failed to create controller"); + return false; + } + + for (i = 0; i < info->btn_count; i++) { + ctl->ops->add_control(ctl->handle, + info->btns[i].name, info->btns[i].loc, + STYLE_VIEWER_BTN, PART_VIEWER_BTN); + } + + priv->viewer.ctl[id] = ctl; + + return true; +} + +static void _viewer_delete(struct _priv *priv) +{ + struct controller *ctl; + int i; + + for (i = 0; i < VIEWER_MAX; i++) { + ctl = priv->viewer.ctl[i]; + if (ctl) + controller_destroy(ctl->handle); + } +} + +static bool _ui_init(struct _priv *priv) +{ + bool r; + int i; + + for (i = 0; i < VIEWER_MAX; i++) { + r = _viewer_add(priv, i); + if (!r) + goto err; + } + + return true; + +err: + _viewer_delete(priv); + return false; +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; Evas_Object *base; + bool r; if (!win) { _ERR("failed to get win object"); @@ -58,6 +417,18 @@ static Evas_Object *_create(Evas_Object *win, void *data) priv->win = win; priv->base = base; + priv->playlist.list = NULL; + priv->playlist.cur = 0; + + r = _ui_init(priv); + if (!r) { + _ERR("failed to init UI"); + return NULL; + } + + /* FIXME: test code */ + _media_test(priv, 0); + viewmgr_set_view_data(VIEW_VIEWER, priv); return base; @@ -74,6 +445,9 @@ static void _show(void *view_data) priv = view_data; + /* FIXME: test code */ + _viewer_show(priv, 1); + evas_object_show(priv->base); } @@ -88,12 +462,15 @@ static void _hide(void *view_data) priv = view_data; + _viewer_hide(priv); + evas_object_hide(priv->base); } static void _destroy(void *view_data) { struct _priv *priv; + app_media *am; if (!view_data) { _ERR("failed to get view data"); @@ -102,6 +479,11 @@ static void _destroy(void *view_data) priv = view_data; + _viewer_delete(priv); + + EINA_LIST_FREE(priv->playlist.list, am) + app_media_destroy(am); + evas_object_del(priv->base); free(priv); -- 2.7.4