summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-06-29 15:51:13 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-06-29 15:56:34 +0900
commitd52f95790faec075078afa7418c7e01f83f425f5 (patch)
tree74cf36054003d5baa6d178d4244f08ef62f82f4d
parent8c596d6cee9099df0fe6c78d106672ebc71042cf (diff)
downloadair_livetv-d52f95790faec075078afa7418c7e01f83f425f5.tar.gz
air_livetv-d52f95790faec075078afa7418c7e01f83f425f5.tar.bz2
air_livetv-d52f95790faec075078afa7418c7e01f83f425f5.zip
Initifal commit
Change-Id: I4dd1bf891eff98d34f577d6384cc3c401733a220 Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r--CMakeLists.txt74
-rw-r--r--data/CMakeLists.txt32
-rw-r--r--data/live-tv-theme.edc20
-rw-r--r--data/live-tv.edc33
-rw-r--r--include/define.h24
-rw-r--r--include/main_view.h22
-rw-r--r--org.tizen.live-tv.pngbin0 -> 38658 bytes
-rw-r--r--org.tizen.live-tv.xml.in10
-rw-r--r--packaging/org.tizen.live-tv.spec54
-rw-r--r--src/main.c143
-rw-r--r--src/main_view.c118
11 files changed, 530 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..bf712d2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,74 @@
+# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT("live-tv" C)
+
+IF(NOT DEFINED PACKAGE_NAME)
+ SET(PACKAGE_NAME "org.tizen.${PROJECT_NAME}")
+ENDIF(NOT DEFINED PACKAGE_NAME)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+IF(NOT DEFINED BINDIR)
+ SET(BINDIR "${PREFIX}/bin")
+ENDIF(NOT DEFINED BINDIR)
+IF(NOT DEFINED RESDIR)
+ SET(RESDIR "${PREFIX}/res")
+ENDIF(NOT DEFINED RESDIR)
+IF(NOT DEFINED IMAGEDIR)
+ SET(IMAGEDIR "${PREFIX}/res/images")
+ENDIF(NOT DEFINED IMAGEDIR)
+IF(NOT DEFINED EDJEDIR)
+ SET(EDJEDIR "${PREFIX}/res/edje")
+ENDIF(NOT DEFINED EDJEDIR)
+IF(NOT DEFINED MANIFESTDIR)
+ SET(MANIFESTDIR "/usr/share/packages")
+ENDIF(NOT DEFINED MANIFESTDIR)
+
+SET(SRCS src/main.c
+ src/main_view.c)
+
+SET(TARGET_EDJ "${PROJECT_NAME}.edj")
+SET(THEME_EDJ "${PROJECT_NAME}-theme.edj")
+
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
+ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
+ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"")
+ADD_DEFINITIONS("-DTHEMEFILE=\"${EDJEDIR}/${THEME_EDJ}\"")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(PKGS REQUIRED
+ elementary
+ ecore
+ edje
+ capi-appfw-application
+ app-utils)
+
+FOREACH(flag ${PKGS_CFLAGS})
+ SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLGAS}")
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
+CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR})
+
+ADD_SUBDIRECTORY(data)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..c2bb8f9
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ADD_CUSTOM_TARGET(${TARGET_EDJ}
+ COMMAND edje_cc -id images
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc
+ ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR})
+
+ADD_CUSTOM_TARGET(${THEME_EDJ}
+ COMMAND edje_cc -id images -sd sounds
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+ ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${THEME_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ} DESTINATION ${EDJEDIR})
diff --git a/data/live-tv-theme.edc b/data/live-tv-theme.edc
new file mode 100644
index 0000000..52e787d
--- /dev/null
+++ b/data/live-tv-theme.edc
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../include/define.h"
+
+collections {
+}
diff --git a/data/live-tv.edc b/data/live-tv.edc
new file mode 100644
index 0000000..a1cfbd7
--- /dev/null
+++ b/data/live-tv.edc
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../include/define.h"
+
+collections {
+ group {
+ name: GRP_MAIN_VIEW;
+ parts {
+ part {
+ name, PART_CONTENT;
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ }
+ }
+ }
+ }
+}
diff --git a/include/define.h b/include/define.h
new file mode 100644
index 0000000..42bb0dd
--- /dev/null
+++ b/include/define.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LIVETV_DEFINE_H__
+#define __LIVETV_DEFINE_H__
+
+#define VIEW_MAIN "VIEW_MAIN"
+#define GRP_MAIN_VIEW "grp.main.view"
+#define PART_CONTENT "part.content"
+
+#endif /* __LIVETV_DEFINE_H__*/
diff --git a/include/main_view.h b/include/main_view.h
new file mode 100644
index 0000000..6beb35d
--- /dev/null
+++ b/include/main_view.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LIVETV_MAIN_VIEW_H__
+#define __LIVETV_MAIN_VIEW_H__
+
+view_class *view_main_get_vclass(void);
+
+#endif /* __LIVETV_MAIN_VIEW_H__*/
diff --git a/org.tizen.live-tv.png b/org.tizen.live-tv.png
new file mode 100644
index 0000000..affa436
--- /dev/null
+++ b/org.tizen.live-tv.png
Binary files differ
diff --git a/org.tizen.live-tv.xml.in b/org.tizen.live-tv.xml.in
new file mode 100644
index 0000000..ae0c390
--- /dev/null
+++ b/org.tizen.live-tv.xml.in
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" version="@VERSION@" install-location="internal-only">
+ <label>Live TV</label>
+ <author email="jw0227.shin@samsung.com" href="www.samsung.com">Jinwoo Shin</author>
+ <description>Live TV application for Tizen TV</description>
+ <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <label>Live TV</label>
+ <icon>@DESKTOP_ICON@</icon>
+ </ui-application>
+</manifest>
diff --git a/packaging/org.tizen.live-tv.spec b/packaging/org.tizen.live-tv.spec
new file mode 100644
index 0000000..2b9626e
--- /dev/null
+++ b/packaging/org.tizen.live-tv.spec
@@ -0,0 +1,54 @@
+Name: org.tizen.live-tv
+Summary: Live TV application for Tizen TV
+Version: 0.1
+Release: 1
+Group: Applications
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(edje)
+BuildRequires: pkgconfig(app-utils)
+BuildRequires: gettext-devel
+BuildRequires: edje-bin
+
+%define _pkgdir %{_prefix}/apps/%{name}
+%define _bindir %{_pkgdir}/bin
+%define _resdir %{_pkgdir}/res
+%define _datadir %{_pkgdir}/data
+%define _edjedir %{_resdir}/edje
+%define _manifestdir %{_datarootdir}/packages
+
+%description
+Live TV application for Tizen TV.
+
+%prep
+%setup -q
+
+%build
+cmake \
+ -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \
+ -DPACKAGE_NAME=%{name} \
+ -DBINDIR=%{_bindir} \
+ -DEDJEDIR=%{_edjedir} \
+ -DMANIFESTDIR=%{_manifestdir} \
+ -DVERSION=%{version}
+
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+install --directory %{buildroot}/%{_datadir}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_resdir}/*
+%{_datadir}
+%{_manifestdir}/%{name}.xml
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..14c9672
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <app.h>
+#include <Elementary.h>
+#include <viewmgr.h>
+#include <app_debug.h>
+
+#include "define.h"
+#include "main_view.h"
+
+SET_TAG(PACKAGE)
+
+struct _appdata {
+ const char *name;
+ Evas_Object *win;
+};
+
+static Evas_Object *_add_win(const char *name)
+{
+ Evas_Object *win;
+
+ win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (!win) {
+ _ERR("failed to create win");
+ return NULL;
+ }
+ elm_win_alpha_set(win, EINA_FALSE);
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+ elm_win_focus_highlight_style_set(win, "invisible");
+
+ evas_object_show(win);
+
+ return win;
+}
+
+static void _pause(void *data)
+{
+}
+
+static void _resume(void *data)
+{
+}
+
+static bool _create(void *data)
+{
+ struct _appdata *ad;
+ Evas_Object *win;
+
+ if (!data) {
+ _ERR("failed to get data");
+ return false;
+ }
+
+ ad = data;
+
+ elm_theme_overlay_add(NULL, THEMEFILE);
+
+ win = _add_win(ad->name);
+ if (!win) {
+ _ERR("failed to create win object");
+ return false;
+ }
+
+ if (!viewmgr_create(win)) {
+ _ERR("failed to initialize viewmgr");
+ evas_object_del(win);
+ return false;
+ }
+
+ viewmgr_add_view(view_main_get_vclass(), NULL);
+
+ ad->win = win;
+
+ return true;
+}
+
+static void _terminate(void *data)
+{
+ struct _appdata *ad;
+
+ if (!data) {
+ _ERR("failed to get data");
+ return;
+ }
+
+ ad = data;
+
+ viewmgr_remove_view(VIEW_MAIN);
+ viewmgr_destroy();
+
+ if (ad->win) {
+ evas_object_del(ad->win);
+ ad->win = NULL;
+ }
+}
+
+static void _control(app_control_h control, void *data)
+{
+ struct _appdata *ad;
+
+ if (!data) {
+ _ERR("failed to get data");
+ return;
+ }
+
+ ad = data;
+
+ if (ad->win)
+ elm_win_activate(ad->win);
+
+ viewmgr_push_view(VIEW_MAIN);
+}
+
+int main(int argc, char *argv[])
+{
+ struct _appdata ad;
+ ui_app_lifecycle_callback_s cbs = {
+ .create = _create,
+ .terminate = _terminate,
+ .pause = _pause,
+ .resume = _resume,
+ .app_control = _control,
+ };
+
+ memset(&ad, 0x00, sizeof(ad));
+ ad.name = PACKAGE;
+
+ return ui_app_main(argc, argv, &cbs, &ad);
+}
diff --git a/src/main_view.c b/src/main_view.c
new file mode 100644
index 0000000..a159cdf
--- /dev/null
+++ b/src/main_view.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <viewmgr.h>
+#include <inputmgr.h>
+#include <app_debug.h>
+
+#include "define.h"
+#include "main_view.h"
+
+struct _priv {
+ Evas_Object *base;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv;
+ Evas_Object *base;
+
+ if (!win) {
+ _ERR("failed to get win object");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(*priv));
+ if (!priv) {
+ _ERR("failed to allocate priv");
+ return NULL;
+ }
+
+ base = elm_layout_add(win);
+ if (!base) {
+ _ERR("failed to create base object");
+ free(priv);
+ return NULL;
+ }
+ elm_layout_file_set(base, EDJEFILE, GRP_MAIN_VIEW);
+
+ evas_object_size_hint_weight_set(base,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, base);
+
+ priv->base = base;
+ viewmgr_set_view_data(VIEW_MAIN, priv);
+
+ return base;
+}
+
+static void _show(void *view_data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = (struct _priv *) view_data;
+
+ evas_object_show(priv->base);
+}
+
+static void _hide(void *view_data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = (struct _priv *) view_data;
+
+ evas_object_hide(priv->base);
+}
+
+static void _destroy(void *view_data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = (struct _priv *) view_data;
+
+ evas_object_del(priv->base);
+
+ free(priv);
+}
+
+static view_class vclass = {
+ .view_id = VIEW_MAIN,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy,
+};
+
+view_class *view_main_get_vclass(void)
+{
+ return &vclass;
+}