From 8c86faef56056db0b76672496f2b95b7768b9995 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Mon, 8 Jun 2015 21:55:46 +0900 Subject: [PATCH 2/7] 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 3/7] 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 4/7] 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 5/7] 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 6/7] 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 7/7] 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