summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/util/listmgr.h22
-rw-r--r--res/edc/widgets/button.edc38
-rw-r--r--src/layout/gallery.c25
-rw-r--r--src/layout/movie.c176
-rw-r--r--src/util/listmgr.c115
5 files changed, 333 insertions, 43 deletions
diff --git a/include/util/listmgr.h b/include/util/listmgr.h
index ad0a8ce..121c97e 100644
--- a/include/util/listmgr.h
+++ b/include/util/listmgr.h
@@ -19,6 +19,19 @@
struct listmgr;
+struct play_info_ops {
+ bool (*draw)(void *data, Evas_Object *base);
+ bool (*update)(void *data, Evas_Object *base);
+ void *ops_data;
+};
+
+struct grid_ops {
+ struct grid_class *gclass;
+
+ void (*selected_cb)(void *data, Elm_Object_Item *it);
+ void *ops_data;
+};
+
struct listmgr_data {
int grid_item_x;
int grid_item_y;
@@ -26,16 +39,15 @@ struct listmgr_data {
int box_padding;
- struct grid_class *gclass;
-
- void (*grid_selected_cb)(void *data, Elm_Object_Item *it);
- void *cb_data;
+ struct play_info_ops *pops;
+ struct grid_ops *gops;
};
struct listmgr *listmgr_create(Evas_Object *base, void *data);
void listmgr_destroy(struct listmgr *listmgr);
bool listmgr_draw_list_area(struct listmgr *lmgr);
-bool listmgr_update_list_area(struct listmgr *lmgr, Eina_List *list);
+bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list);
+bool listmgr_update_play_info(struct listmgr *lmgr, app_media_info *info);
#endif /* __AIR_MEDIAHUB_LISTMGR_H__ */
diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc
index e35692a..ea45e4b 100644
--- a/res/edc/widgets/button.edc
+++ b/res/edc/widgets/button.edc
@@ -606,8 +606,6 @@ group {
description {
state: "default" 0.0;
min: 740 614;
- fixed: 1 1;
- visible: 0;
}
}
part {
@@ -1004,6 +1002,16 @@ group {
min: 100 20;
align: 0.0 0.0;
fixed: 1 1;
+ map {
+ perspective_on: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
+
}
}
part {
@@ -1025,6 +1033,15 @@ group {
min: 100 20;
align: 1.0 0.0;
fixed: 1 1;
+ map {
+ perspective_on: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
}
}
part {
@@ -1057,6 +1074,15 @@ group {
min: 0 30;
align: 0.5 0.0;
fixed: 0 1;
+ map {
+ perspective_on: 1;
+ perspective: "map";
+ }
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ map.on: 1;
}
}
part {
@@ -1065,7 +1091,7 @@ group {
scale: 1;
description {
state: "default" 0.0;
- visible: 0;
+ color: 0 0 0 0;
}
}
}
@@ -1087,6 +1113,9 @@ group {
name: "focus,in,anim";
action: STATE_SET "selected" 0.0;
target: PART_RECENT_CONTENT_THUMBNAIL;
+ target: PART_RECENT_CONTENT_PROGRESS;
+ target: PART_RECENT_CONTENT_TOTAL;
+ target: PART_RECENT_CONTENT_SLIDER;
target: "default_image";
target: "part_focus1";
target: "part_focus2";
@@ -1124,6 +1153,9 @@ group {
name: "focus,out,anim,2";
action: STATE_SET "default" 0.0;
target: PART_RECENT_CONTENT_THUMBNAIL;
+ target: PART_RECENT_CONTENT_PROGRESS;
+ target: PART_RECENT_CONTENT_TOTAL;
+ target: PART_RECENT_CONTENT_SLIDER;
target: "default_image";
target: "part_focus1";
target: "part_focus2";
diff --git a/src/layout/gallery.c b/src/layout/gallery.c
index 61607c2..673a280 100644
--- a/src/layout/gallery.c
+++ b/src/layout/gallery.c
@@ -128,24 +128,32 @@ static void _grid_selected_cb(void *data, Elm_Object_Item *it)
static struct listmgr_data *_create_listmgr_data(struct _priv *priv)
{
struct listmgr_data *data;
+ struct grid_ops *gops;
data = calloc(1, sizeof(*data));
- if (!data) {
- _ERR("failed to allocate listmgr data");
- return NULL;
- }
+ if (!data)
+ goto err;
data->grid_item_x = GRID_ITEM_X;
data->grid_item_y = GRID_ITEM_Y;
data->grid_num_item = GRID_NUM_ITEM;
data->box_padding = BOX_PADDING;
- data->gclass = &_gclass;
+ gops = calloc(1, sizeof(*gops));
+ if (!gops)
+ goto err;
+
+ gops->gclass = &_gclass;
+ gops->selected_cb = _grid_selected_cb;
+ gops->ops_data = priv;
- data->grid_selected_cb = _grid_selected_cb;
- data->cb_data = priv;
+ data->gops = gops;
return data;
+
+err:
+ _ERR("failed to allocate memory");
+ return NULL;
}
static void _update_list_area(struct _priv *priv)
@@ -162,7 +170,7 @@ static void _update_list_area(struct _priv *priv)
return;
}
- if (!listmgr_update_list_area(priv->listmgr, list))
+ if (!listmgr_update_content_list(priv->listmgr, list))
_ERR("failed to update list area");
priv->media_list = list;
@@ -265,6 +273,7 @@ static void _destroy(void *layout_data)
mediadata_destroy(priv->md);
listmgr_destroy(priv->listmgr);
+ free(priv->ldata->gops);
free(priv->ldata);
evas_object_del(priv->layout);
diff --git a/src/layout/movie.c b/src/layout/movie.c
index a3fa193..31b18ca 100644
--- a/src/layout/movie.c
+++ b/src/layout/movie.c
@@ -26,11 +26,13 @@
#include "view.h"
#include "data/mediadata.h"
#include "util/listmgr.h"
+#include "util/progressbar.h"
#include "util/util.h"
#define LIST_MEDIA_COND "media_type=1 AND copyright NOT LIKE \"Unknown\""
#define TEXT_NOCONTENT "No Movies"
+#define TEXT_RECENTLY_WATCHED "Recently watched"
#define GRID_ITEM_X 404
#define GRID_ITEM_Y 320
@@ -50,7 +52,11 @@ struct _priv {
struct mediadata *md;
+ struct progressbar *prog;
+
Eina_List *media_list;
+
+ app_media_info *recent_info;
};
static char *_grid_text_get(void *data, Evas_Object *obj, const char *part)
@@ -115,6 +121,132 @@ static struct grid_class _gclass = {
.content_get = _grid_content_get
};
+static bool _update_recent(void *data, Evas_Object *base)
+{
+ Evas_Object *recent, *image;
+ app_media_info *info;
+ struct _priv *priv;
+ char buf[32];
+
+ if (!data || !base) {
+ _ERR("invalid argument");
+ return false;
+ }
+
+ priv = data;
+
+ recent = elm_object_part_content_get(base, PART_ITEM_CONTENT);
+ if (!recent) {
+ _ERR("failed to get recent content part");
+ return false;
+ }
+
+ image = elm_object_part_content_get(recent,
+ PART_RECENT_CONTENT_THUMBNAIL);
+ if (!image) {
+ _ERR("failed to get image object");
+ return false;
+ }
+
+ info = priv->recent_info;
+
+ elm_image_file_set(image, info->thumbnail_path, NULL);
+ elm_image_aspect_fixed_set(image, EINA_FALSE);
+
+ elm_object_part_text_set(recent, PART_RECENT_CONTENT_TITLE,
+ info->title);
+
+ util_time_string(buf, sizeof(buf), info->played_time);
+ elm_object_part_text_set(recent, PART_RECENT_CONTENT_DATE, buf);
+
+ progressbar_reset(priv->prog, info->video->position,
+ info->video->duration);
+
+ progressbar_show(priv->prog);
+
+ return true;
+}
+
+static bool _draw_recent_title(Evas_Object *base)
+{
+ Evas_Object *btn;
+
+ btn = elm_button_add(base);
+ if (!btn) {
+ _ERR("failed to create button object");
+ return false;
+ }
+
+ elm_object_style_set(btn, STYLE_BTN_INDEX);
+ elm_object_text_set(btn, TEXT_RECENTLY_WATCHED);
+
+ elm_object_part_content_set(base, PART_ITEM_TITLE, btn);
+
+ return true;
+}
+
+static bool _draw_recent_content(struct _priv *priv, Evas_Object *base)
+{
+ Evas_Object *btn, *image;
+ struct progressbar *prog;
+
+ btn = elm_button_add(base);
+ if (!btn) {
+ _ERR("failed to create button object");
+ return false;
+ }
+
+ elm_object_style_set(btn, STYLE_BTN_RECENT_CONTENT);
+
+ image = elm_image_add(btn);
+ if (!image) {
+ _ERR("failed to create image object");
+ return false;
+ }
+
+ elm_object_part_content_set(btn, PART_RECENT_CONTENT_THUMBNAIL, image);
+
+ elm_object_part_content_set(base, PART_ITEM_CONTENT, btn);
+
+ prog = progressbar_create(btn, STYLE_BASE_PROGRESS);
+ if (!prog) {
+ _ERR("failed to create progressbar");
+ return false;
+ }
+
+ progressbar_set_parts(prog, PART_RECENT_CONTENT_SLIDER,
+ PART_RECENT_CONTENT_TOTAL,
+ PART_RECENT_CONTENT_PROGRESS, "");
+
+ priv->prog = prog;
+
+ return true;
+}
+
+static bool _draw_recent(void *data, Evas_Object *base)
+{
+ struct _priv *priv;
+
+ if (!data || !base) {
+ _ERR("invalid argument");
+ return false;
+ }
+
+ priv = data;
+
+ if (!_draw_recent_title(base)) {
+ _ERR("failed to draw recent title");
+ return false;
+ }
+
+ if (!_draw_recent_content(priv, base)) {
+ _ERR("failed to draw recent content");
+ return false;
+ }
+
+ return true;
+}
+
static void _grid_selected_cb(void *data, Elm_Object_Item *it)
{
app_media *am;
@@ -144,27 +276,45 @@ static void _grid_selected_cb(void *data, Elm_Object_Item *it)
static struct listmgr_data *_create_listmgr_data(struct _priv *priv)
{
struct listmgr_data *data;
+ struct play_info_ops *pops;
+ struct grid_ops *gops;
data = calloc(1, sizeof(*data));
- if (!data) {
- _ERR("failed to allocate listmgr data");
- return NULL;
- }
+ if (!data)
+ goto err;
data->grid_item_x = GRID_ITEM_X;
data->grid_item_y = GRID_ITEM_Y;
data->grid_num_item = GRID_NUM_ITEM;
data->box_padding = BOX_PADDING;
- data->gclass = &_gclass;
+ pops = calloc(1, sizeof(*pops));
+ if (!pops)
+ goto err;
+
+ pops->draw = _draw_recent;
+ pops->update = _update_recent;
+ pops->ops_data = priv;
+
+ gops = calloc(1, sizeof(*gops));
+ if (!gops)
+ goto err;
+
+ gops->gclass = &_gclass;
+ gops->selected_cb = _grid_selected_cb;
+ gops->ops_data = priv;
- data->grid_selected_cb = _grid_selected_cb;
- data->cb_data = priv;
+ data->pops = pops;
+ data->gops = gops;
return data;
+
+err:
+ _ERR("failed to allocate memory");
+ return NULL;
}
-static void _update_list_area(struct _priv *priv)
+static void _update_content_list(struct _priv *priv)
{
Eina_List *list;
@@ -178,8 +328,10 @@ static void _update_list_area(struct _priv *priv)
return;
}
- if (!listmgr_update_list_area(priv->listmgr, list))
+ if (!listmgr_update_content_list(priv->listmgr, list)) {
_ERR("failed to update list area");
+ return;
+ }
priv->media_list = list;
}
@@ -277,10 +429,14 @@ static void _destroy(void *layout_data)
priv = layout_data;
+ progressbar_destroy(priv->prog);
+
mediadata_free_list(priv->media_list);
mediadata_destroy(priv->md);
listmgr_destroy(priv->listmgr);
+ free(priv->ldata->pops);
+ free(priv->ldata->gops);
free(priv->ldata);
evas_object_del(priv->layout);
@@ -330,7 +486,7 @@ static void _update(void *layout_data, int update_type, void *data)
priv = layout_data;
- _update_list_area(priv);
+ _update_content_list(priv);
}
static layout_class _lclass = {
diff --git a/src/util/listmgr.c b/src/util/listmgr.c
index c45b6ec..652e00c 100644
--- a/src/util/listmgr.c
+++ b/src/util/listmgr.c
@@ -15,7 +15,9 @@
*/
#include <Elementary.h>
+#include <media_content.h>
#include <app_debug.h>
+#include <app_media.h>
#include <gridmgr.h>
#include <inputmgr.h>
@@ -24,12 +26,19 @@
#include "util/listmgr.h"
#include "util/util.h"
+enum _object_type {
+ LISTMGR_GRID = 0,
+};
+
struct listmgr {
Evas_Object *base;
Evas_Object *box;
+ Evas_Object *play_info;
struct gridmgr *gmgr;
struct listmgr_data *data;
+
+ Eina_Bool show_play_info;
};
void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
@@ -40,34 +49,37 @@ void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
if (!obj || !ev)
return;
- it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
- ev->cur.canvas.y, NULL, NULL);
+ switch (id) {
+ case LISTMGR_GRID:
+ it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
- if (!it)
- return;
+ if (!it)
+ return;
- if (elm_object_item_focus_get(it))
- return;
+ if (!elm_object_item_focus_get(it))
+ elm_object_item_focus_set(it, EINA_TRUE);
- elm_object_item_focus_set(it, EINA_TRUE);
+ break;
+ default:
+ break;
+ }
}
void _grid_selected_cb(void *data, Elm_Object_Item *it,
const char *emission, const char *source)
{
struct listmgr *lmgr;
- struct listmgr_data *ldata;
+ struct grid_ops *gops;
if (!data || !it)
return;
lmgr = data;
- ldata = lmgr->data;
+ gops = lmgr->data->gops;
- if (ldata->grid_selected_cb)
- ldata->grid_selected_cb(ldata->cb_data, it);
-
- elm_gengrid_item_selected_set(it, EINA_FALSE);
+ if (gops->selected_cb)
+ gops->selected_cb(gops->ops_data, it);
}
void _grid_realized_cb(int id, void *data, Evas_Object *obj,
@@ -90,7 +102,7 @@ void _grid_unrealized_cb(int id, void *data, Evas_Object *obj,
SIG_SOURCE_EDC, _grid_selected_cb);
}
-static input_handler grid_handler = {
+static input_handler _grid_handler = {
.mouse_move = _mouse_move_cb,
.realized = _grid_realized_cb,
.unrealized = _grid_unrealized_cb
@@ -107,6 +119,32 @@ static int _get_grid_size(int count, int num_item)
return size;
}
+static bool _draw_play_info(struct listmgr *lmgr)
+{
+ Evas_Object *ly;
+ struct play_info_ops *pops;
+
+ ly = elm_layout_add(lmgr->box);
+ if (!ly) {
+ _ERR("failed to create layout object");
+ return false;
+ }
+
+ elm_layout_file_set(ly, EDJEFILE, GRP_LIST_ITEM);
+
+ pops = lmgr->data->pops;
+
+ if (!pops->draw(pops->ops_data, ly)) {
+ _ERR("failed to draw play info item");
+ evas_object_del(ly);
+ return false;
+ }
+
+ lmgr->play_info = ly;
+
+ return true;
+}
+
static Evas_Object *_draw_list_item(struct listmgr *lmgr, struct group_info *gi)
{
Evas_Object *ly, *btn, *grid;
@@ -140,7 +178,7 @@ static Evas_Object *_draw_list_item(struct listmgr *lmgr, struct group_info *gi)
return NULL;
}
- if (!gridmgr_add_grid(lmgr->gmgr, gi->name, grid, data->gclass)) {
+ if (!gridmgr_add_grid(lmgr->gmgr, gi->name, grid, data->gops->gclass)) {
_ERR("failed to add grid");
evas_object_del(ly);
return NULL;
@@ -151,7 +189,7 @@ static Evas_Object *_draw_list_item(struct listmgr *lmgr, struct group_info *gi)
evas_object_size_hint_min_set(grid, size * data->grid_item_x,
data->grid_num_item * data->grid_item_y);
- inputmgr_add_callback(grid, 0, &grid_handler, lmgr);
+ inputmgr_add_callback(grid, LISTMGR_GRID, &_grid_handler, lmgr);
elm_object_part_content_set(ly, PART_ITEM_TITLE, btn);
elm_object_part_content_set(ly, PART_ITEM_CONTENT, grid);
@@ -159,7 +197,7 @@ static Evas_Object *_draw_list_item(struct listmgr *lmgr, struct group_info *gi)
return ly;
}
-bool listmgr_update_list_area(struct listmgr *lmgr, Eina_List *list)
+bool listmgr_update_content_list(struct listmgr *lmgr, Eina_List *list)
{
Evas_Object *ly;
Eina_List *l;
@@ -190,6 +228,40 @@ bool listmgr_update_list_area(struct listmgr *lmgr, Eina_List *list)
return true;
}
+bool listmgr_update_play_info(struct listmgr *lmgr, app_media_info *info)
+{
+ struct play_info_ops *pops;
+
+ if (!lmgr) {
+ _ERR("invalid argument");
+ return false;
+ }
+
+ if (!info) {
+ if (lmgr->show_play_info) {
+ elm_box_unpack(lmgr->box, lmgr->play_info);
+ evas_object_hide(lmgr->play_info);
+ lmgr->show_play_info = EINA_FALSE;
+ }
+ return true;
+ }
+
+ pops = lmgr->data->pops;
+
+ if (!pops->update(pops->ops_data, lmgr->play_info)) {
+ _ERR("failed to update play info");
+ return false;
+ }
+
+ if (!lmgr->show_play_info) {
+ elm_box_pack_start(lmgr->box, lmgr->play_info);
+ evas_object_show(lmgr->play_info);
+ lmgr->show_play_info = EINA_TRUE;
+ }
+
+ return true;
+}
+
bool listmgr_draw_list_area(struct listmgr *lmgr)
{
Evas_Object *scr, *box;
@@ -221,6 +293,14 @@ bool listmgr_draw_list_area(struct listmgr *lmgr)
lmgr->box = box;
+ if (lmgr->data->pops) {
+ if (!_draw_play_info(lmgr)) {
+ _ERR("failed to draw play info");
+ evas_object_del(scr);
+ return false;
+ }
+ }
+
return true;
}
@@ -250,6 +330,7 @@ struct listmgr *listmgr_create(Evas_Object *base, void *data)
lmgr->base = base;
lmgr->gmgr = gmgr;
lmgr->data = (struct listmgr_data *)data;
+ lmgr->show_play_info = EINA_FALSE;
return lmgr;
}