diff options
author | Minkyu Kang <mk7.kang@samsung.com> | 2015-06-15 15:55:41 +0900 |
---|---|---|
committer | Minkyu Kang <mk7.kang@samsung.com> | 2015-06-15 17:19:23 +0900 |
commit | 8f7338ece6e88479981cf7dc82c80b8a2567b11d (patch) | |
tree | deabb504fd7260eb319efbca04fa5e036b094f95 | |
parent | 342fcad5a96d5152126a1b89627d91268c693d5b (diff) | |
download | air_mediahub-8f7338ece6e88479981cf7dc82c80b8a2567b11d.tar.gz air_mediahub-8f7338ece6e88479981cf7dc82c80b8a2567b11d.tar.bz2 air_mediahub-8f7338ece6e88479981cf7dc82c80b8a2567b11d.zip |
add viewer view
Change-Id: I9ce1ea071af506ea608b420048480dfc2ed2ce73
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | include/define.h | 42 | ||||
-rw-r--r-- | include/layout.h (renamed from include/layout/menu_layout.h) | 7 | ||||
-rw-r--r-- | include/layout/menu.h (renamed from include/common/define.h) | 12 | ||||
-rw-r--r-- | include/view.h (renamed from include/view/movie_view.h) | 10 | ||||
-rw-r--r-- | include/view/movie.h | 24 | ||||
-rw-r--r-- | include/view/viewer.h | 31 | ||||
-rw-r--r-- | res/edc/mediahub.edc | 3 | ||||
-rw-r--r-- | res/edc/view/viewer.edc | 291 | ||||
-rw-r--r-- | src/layout/menu_layout.c | 1 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/view/movie_view.c | 3 | ||||
-rw-r--r-- | src/view/viewer.c | 121 |
13 files changed, 531 insertions, 23 deletions
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 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 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 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 <layoutmgr.h> #include "define.h" -#include "menu_layout.h" struct _priv { Evas_Object *base; @@ -20,7 +20,7 @@ #include <viewmgr.h> #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 <layoutmgr.h> #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 <Elementary.h> +#include <app_debug.h> +#include <viewmgr.h> +#include <layoutmgr.h> + +#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; +} |