From 0beb9086d3d5e08bd618129af8ff7842a11f5fb1 Mon Sep 17 00:00:00 2001 From: Hyojung Jo Date: Wed, 30 Sep 2015 18:04:14 +0900 Subject: [PATCH] Channel layout: Added progressbar and progressbar style Change-Id: I11c7b8bd51467db8ac12b55da57f0f6cdd44d968 Signed-off-by: Hyojung Jo --- include/define.h | 7 +++--- include/utils.h | 2 ++ res/layout/channel.edc | 15 ++++++++----- res/settings-theme.edc | 1 + res/widget/progressbar.edc | 55 +++++++++++++++++++++++++++++++++++++++++++++ src/common/utils.c | 25 +++++++++++++++++++++ src/layout/layout_channel.c | 15 ++++++++++--- 7 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 res/widget/progressbar.edc diff --git a/include/define.h b/include/define.h index f9fdc3c..89f6419 100644 --- a/include/define.h +++ b/include/define.h @@ -48,12 +48,13 @@ /* Style */ #define STYLE_MENU_BTN "style.menu.button" #define STYLE_BASE_BTN "style.base.button" +#define STYLE_SEARCH_PB "style.search.progressbar" /* Signal */ #define SIG_FOCUSED "elm,action,focus" #define SIG_UNFOCUSED "elm,action,unfocus" #define SIG_SELECTED "selected" -#define SIG_GUIDE "signal.guide" +#define SIG_SEARCH_INIT "signal.search.init" #define SIG_SEARCHING "signal.searching" #define SIG_SEARCH_COMPLETE "signal.search.complete" @@ -78,9 +79,9 @@ /* String for channel layout */ #define STR_CHANNEL_TITLE "Auto Program" -#define STR_SEARCH_GUIDE1 "Connect TV cable to antenna / cable input socket
"\ +#define STR_SEARCH_INIT1 "Connect TV cable to antenna / cable input socket
"\ "behind the TV to start tuning.
You can search all available channels." -#define STR_SEARCH_GUIDE2 "Press start to search and store channels." +#define STR_SEARCH_INIT2 "Press start to search and store channels." #define STR_SEARCHING1 "Auto Program is finding channels for you.
"\ "To skip current step, Press stop." #define STR_SEARCHING2 "%d Ch found" diff --git a/include/utils.h b/include/utils.h index 2208189..400ded6 100644 --- a/include/utils.h +++ b/include/utils.h @@ -23,5 +23,7 @@ Evas_Object *utils_add_box(Evas_Object *parent, const char *part, Eina_Bool horizontal, int pad_h, int pad_v); Evas_Object *utils_add_button(Evas_Object *parent, const char *part, const char *style, const char *text); +Evas_Object *utils_add_progressbar(Evas_Object *parent, const char *part, + const char *style); #endif /* __AIR_SETTINGS_UTILS_H__ */ diff --git a/res/layout/channel.edc b/res/layout/channel.edc index 50418d8..83b3f93 100644 --- a/res/layout/channel.edc +++ b/res/layout/channel.edc @@ -162,14 +162,17 @@ group { scale, 1; description { state, "default" 0.0; - min, 0 4; - rel1.to, "padding.progressbar"; + min, 568 4; + rel1 { + to, "padding.progressbar"; + relative, 0.5 0.0; + } rel2 { to, "padding.progressbar"; - relative, 1.0 0.0; + relative, 0.5 0.0; } align, 0.5 1.0; - fixed, 0 1; + fixed, 1 1; visible, 0; } description { @@ -247,8 +250,8 @@ group { programs { program { - name, SIG_GUIDE; - signal, SIG_GUIDE; + name, SIG_SEARCH_INIT; + signal, SIG_SEARCH_INIT; source, SRC_ELM; action, STATE_SET "default" 0.0; target, PART_SUBTEXT1; diff --git a/res/settings-theme.edc b/res/settings-theme.edc index f486272..c3edd6b 100644 --- a/res/settings-theme.edc +++ b/res/settings-theme.edc @@ -18,4 +18,5 @@ collections { #include "widget/button.edc" + #include "widget/progressbar.edc" } diff --git a/res/widget/progressbar.edc b/res/widget/progressbar.edc new file mode 100644 index 0000000..a83209e --- /dev/null +++ b/res/widget/progressbar.edc @@ -0,0 +1,55 @@ +group { + name, "elm/progressbar/horizontal/style.search.progressbar"; + parts { + part { + name, "bg"; + type, RECT; + mouse_events, 0; + scale, 1; + description { + state, "default" 0.0; + color, 206 206 206 255; + } + } + + part { + name, "elm.cur.progressbar"; + mouse_events, 0; + scale, 1; + dragable { + confine, "bg"; + x, 1 1 1; + y, 0 0 0; + } + description { + state, "default" 0.0; + min, 0 4; + fixed, 0 1; + visible, 0; + rel1 { + to, "bg"; + relative, 0.0 0.0; + } + rel2.to, "bg"; + } + } + + part { + name, "elm.progress.progressbar"; + type, RECT; + mouse_events, 0; + scale, 1; + description { + state, "default" 0.0; + min, 0 0; + fixed, 1 0; + rel1.to, "bg"; + rel2 { + to_y, "bg"; + to_x, "elm.cur.progressbar"; + } + color, 64 136 211 255; + } + } + } +} diff --git a/src/common/utils.c b/src/common/utils.c index 5a66ce2..a5c109f 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -102,3 +102,28 @@ Evas_Object *utils_add_button(Evas_Object *parent, const char *part, return btn; } + +Evas_Object *utils_add_progressbar(Evas_Object *parent, const char *part, + const char *style) +{ + Evas_Object *pb; + + if (!parent) { + _ERR("Invalid argument."); + return NULL; + } + + pb = elm_progressbar_add(parent); + if (!pb) { + _ERR("elm_progressbar_add failed."); + return NULL; + } + + if (part) + elm_object_part_content_set(parent, part, pb); + + if (style) + elm_object_style_set(pb, style); + + return pb; +} diff --git a/src/layout/layout_channel.c b/src/layout/layout_channel.c index 5e4a4b7..f19c353 100644 --- a/src/layout/layout_channel.c +++ b/src/layout/layout_channel.c @@ -35,6 +35,7 @@ struct _priv { Evas_Object *base; Evas_Object *ly; Evas_Object *btn; + Evas_Object *pb; enum search_state cur_state; layoutmgr *lmgr; }; @@ -90,8 +91,8 @@ static void _channel_search_stop(struct _priv *priv) static void _channel_search_init(struct _priv *priv) { - _update_layout_text(priv, SIG_GUIDE, STR_SEARCH_GUIDE1, - STR_SEARCH_GUIDE2, STR_START); + _update_layout_text(priv, SIG_SEARCH_INIT, STR_SEARCH_INIT1, + STR_SEARCH_INIT2, STR_START); priv->cur_state = STATE_INIT; } @@ -142,7 +143,7 @@ static input_handler _input_handler = { static bool _create(layoutmgr *lmgr, void *data) { struct _priv *priv; - Evas_Object *base, *ly, *btn; + Evas_Object *base, *ly, *btn, *pb; if (!lmgr) { _ERR("Invalid argument."); @@ -170,6 +171,13 @@ static bool _create(layoutmgr *lmgr, void *data) return false; } + pb = utils_add_progressbar(ly, PART_PROGRESSBAR, STYLE_SEARCH_PB); + if (!pb) { + _ERR("Addprogress bar failed."); + evas_object_del(ly); + return false; + } + priv = calloc(1, sizeof(*priv)); if (!priv) { _ERR("Calloc failed."); @@ -181,6 +189,7 @@ static bool _create(layoutmgr *lmgr, void *data) priv->base = base; priv->ly = ly; priv->btn = btn; + priv->pb = pb; inputmgr_add_callback(btn, 0, &_input_handler, priv); layoutmgr_set_layout_data(lmgr, LAYOUT_ID_CHANNEL, priv); -- 2.7.4