summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-07-16 13:44:53 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-07-16 13:54:01 +0900
commit3df30c5812af648c8cf4c33f6009a925d8a60df6 (patch)
treea6ba375b6af0eb8f10d84e8f6a8d82d2a67ed994
parent5bd30ea364075b537e787115da47cd88f55873c2 (diff)
downloadair_livetv-3df30c5812af648c8cf4c33f6009a925d8a60df6.tar.gz
air_livetv-3df30c5812af648c8cf4c33f6009a925d8a60df6.tar.bz2
air_livetv-3df30c5812af648c8cf4c33f6009a925d8a60df6.zip
Add error view for no channel and no signal
Change-Id: I99d426fb19b72817e14b16e3d1f98491136b764b Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--data/live-tv.edc1
-rw-r--r--data/view/error.edc86
-rw-r--r--include/define.h5
-rw-r--r--include/strings.h4
-rw-r--r--include/view.h5
-rw-r--r--src/layout_channelinfo_search.c3
-rw-r--r--src/main.c2
-rw-r--r--src/view_channelnumber.c3
-rw-r--r--src/view_error.c140
10 files changed, 246 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b42838..34340b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ SET(SRCS src/main.c
src/layout_channelinfo_list.c
src/layout_channelinfo_search.c
src/view_channelnumber.c
+ src/view_error.c
src/util.c
src/tv_service.c)
diff --git a/data/live-tv.edc b/data/live-tv.edc
index 8a77133..2c43574 100644
--- a/data/live-tv.edc
+++ b/data/live-tv.edc
@@ -19,4 +19,5 @@
collections {
#include "view/channelinfo.edc"
#include "view/channelnumber.edc"
+ #include "view/error.edc"
}
diff --git a/data/view/error.edc b/data/view/error.edc
new file mode 100644
index 0000000..2d1b3e9
--- /dev/null
+++ b/data/view/error.edc
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http,//www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../include/define.h"
+
+group {
+ name, GRP_VIEW_ERROR;
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 244 244 244 255;
+ }
+ }
+ part {
+ name, "part.error";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.5 0.5;
+ rel2.relative, 0.5 0.5;
+ min, 0 82;
+ align, 0.5 0.5;
+ fixed, 0 1;
+ }
+
+ part {
+ name, PART_ERROR_TITLE;
+ type, TEXT;
+ scale, 1;
+ description {
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 0.0;
+ text {
+ font, FONT_LIGHT;
+ size, 28;
+ align, 0.5 0.5;
+ min, 1 0;
+ ellipsis, -1;
+ }
+ color, 103 103 103 255;
+ min, 0 36;
+ align, 0.5 0.0;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_ERROR_TEXT;
+ type, TEXT;
+ scale, 1;
+ description {
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 1.0;
+ text {
+ font, FONT_LIGHT;
+ size, 28;
+ align, 0.5 0.5;
+ min, 1 0;
+ ellipsis, -1;
+ }
+ color, 116 116 116 255;
+ min, 0 36;
+ align, 0.5 1.0;
+ fixed, 1 1;
+ }
+ }
+ }
+ }
+}
diff --git a/include/define.h b/include/define.h
index 79000c3..372275a 100644
--- a/include/define.h
+++ b/include/define.h
@@ -73,4 +73,9 @@
#define PART_CHANNELNUMBER_LIST "part.channelnumber.list"
#define GRP_CHANNELNUMBER_LIST_ITEM "grp.channelnumber.list.item"
+#define VIEW_ERROR "VIEW_ERROR"
+#define GRP_VIEW_ERROR "grp.view.error"
+#define PART_ERROR_TITLE "part.error.title"
+#define PART_ERROR_TEXT "part.error.text"
+
#endif /* __LIVETV_DEFINE_H__*/
diff --git a/include/strings.h b/include/strings.h
index cb65a19..486c0bd 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -20,5 +20,9 @@
#define STR_NOTITLE "No Information"
#define STR_NOTIME "No Data"
#define STR_CHANNEL_PREFIX "CH."
+#define STR_NOCHANNEL_TITLE "No Channel"
+#define STR_NOCHANNEL_TEXT "The channel is not found"
+#define STR_NOSIGNAL_TITLE "Weak or No Signal"
+#define STR_NOSIGNAL_TEXT "Check the antenna cable connection"
#endif /* __AIR_LIVETV_STRINGS_H__*/
diff --git a/include/view.h b/include/view.h
index 936f0fe..8e0fc8e 100644
--- a/include/view.h
+++ b/include/view.h
@@ -17,15 +17,20 @@
#ifndef __LIVETV_VIEW_H__
#define __LIVETV_VIEW_H__
+#include "tv.h"
+
enum _update_type {
UPDATE_TYPE_TIMER,
UPDATE_TYPE_INPUT_KEY_DOWN,
UPDATE_TYPE_INPUT_KEY_UP,
+ UPDATE_TYPE_NOCHANNEL,
+ UPDATE_TYPE_NOSIGNAL,
};
void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info);
view_class *view_channelnumber_get_vclass(void);
view_class *view_channelinfo_get_vclass(void);
+view_class *view_error_get_vclass(void);
#endif /* __LIVETV_VIEW_H__*/
diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c
index ef62aca..bdaabae 100644
--- a/src/layout_channelinfo_search.c
+++ b/src/layout_channelinfo_search.c
@@ -92,9 +92,8 @@ static void _release_channel_handler(Evas_Object *obj)
child = elm_box_children_get(obj);
- EINA_LIST_FOREACH(child, l, ly) {
+ EINA_LIST_FOREACH(child, l, ly)
inputmgr_remove_callback(ly, &channel_handler);
- }
if (child)
eina_list_free(child);
diff --git a/src/main.c b/src/main.c
index 9cdc317..c806937 100644
--- a/src/main.c
+++ b/src/main.c
@@ -229,6 +229,7 @@ static bool _create(void *data)
viewmgr_add_view(view_channelinfo_get_vclass(), NULL);
viewmgr_add_view(view_channelnumber_get_vclass(), NULL);
+ viewmgr_add_view(view_error_get_vclass(), NULL);
r = tv_create();
if (r < 0) {
@@ -269,6 +270,7 @@ static void _terminate(void *data)
viewmgr_remove_view(VIEW_CHANNELINFO);
viewmgr_remove_view(VIEW_CHANNELNUMBER);
+ viewmgr_remove_view(VIEW_ERROR);
viewmgr_destroy();
evas_object_del(ad->win);
diff --git a/src/view_channelnumber.c b/src/view_channelnumber.c
index f478b31..ada44ad 100644
--- a/src/view_channelnumber.c
+++ b/src/view_channelnumber.c
@@ -152,9 +152,8 @@ static void _release_channel_handler(Evas_Object *obj)
child = elm_box_children_get(obj);
- EINA_LIST_FOREACH(child, l, ly) {
+ EINA_LIST_FOREACH(child, l, ly)
inputmgr_remove_callback(ly, &channel_handler);
- }
if (child)
eina_list_free(child);
diff --git a/src/view_error.c b/src/view_error.c
new file mode 100644
index 0000000..2983c25
--- /dev/null
+++ b/src/view_error.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <viewmgr.h>
+#include <app_debug.h>
+
+#include "define.h"
+#include "view.h"
+
+struct _priv {
+ Evas_Object *base;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv;
+
+ if (!win) {
+ _ERR("failed to get win object");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(*priv));
+ if (!priv) {
+ _ERR("failed to allocate priv");
+ return NULL;
+ }
+
+ priv->base = elm_layout_add(win);
+ if (!priv->base) {
+ _ERR("failed to create base object");
+ free(priv);
+ return NULL;
+ }
+ elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_ERROR);
+
+ evas_object_size_hint_weight_set(priv->base,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, priv->base);
+
+ viewmgr_set_view_data(VIEW_ERROR, priv);
+
+ return priv->base;
+}
+
+static void _show(void *view_data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = view_data;
+
+ evas_object_show(priv->base);
+}
+
+static void _hide(void *view_data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = view_data;
+
+ evas_object_hide(priv->base);
+}
+
+static void _destroy(void *view_data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = view_data;
+
+ evas_object_del(priv->base);
+
+ free(priv);
+}
+
+static void _update(void *view_data, int type, void *data)
+{
+ struct _priv *priv;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = view_data;
+
+ if (type == UPDATE_TYPE_NOCHANNEL) {
+ elm_object_part_text_set(priv->base,
+ PART_ERROR_TITLE, STR_NOCHANNEL_TITLE);
+ elm_object_part_text_set(priv->base,
+ PART_ERROR_TEXT, STR_NOCHANNEL_TEXT);
+ } else if (type == UPDATE_TYPE_NOSIGNAL) {
+ elm_object_part_text_set(priv->base,
+ PART_ERROR_TITLE, STR_NOSIGNAL_TITLE);
+ elm_object_part_text_set(priv->base,
+ PART_ERROR_TEXT, STR_NOSIGNAL_TEXT);
+ }
+}
+
+static view_class vclass = {
+ .view_id = VIEW_ERROR,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy,
+ .update = _update,
+};
+
+view_class *view_error_get_vclass(void)
+{
+ return &vclass;
+}