#define POSITION_MARGIN 500
#define VIEWER_TIMEOUT 3.0
#define VIEWER_SEPARATOR "/ "
+#define SLIDE_SHOW_INTERVAL 3.0
#define VIDEO_COPYRIGHT "Unknown"
#define BTN_LOC_NONE -1
#define BTN_LOC_NEXT 4
#define BTN_LOC_ROTATE 5
#define BTN_LOC_ZOOM 6
+#define BTN_LOC_SLIDE 8
enum {
VIEWER_MOVIE,
int cur;
};
+struct _slideshow {
+ Ecore_Timer *timer;
+ bool enable;
+};
+
struct _priv {
Evas_Object *win;
Evas_Object *base;
struct timeout_handler *timeout;
struct playermgr *player;
struct progressbar *progress;
+ struct _slideshow slideshow;
bool bar_show;
};
.name = SRC_BTN_ZOOM,
.loc = BTN_LOC_ZOOM,
},
+ {
+ .name = SRC_BTN_SLIDE,
+ .loc = BTN_LOC_SLIDE,
+ },
};
static struct _btn_info btn_video[] = {
.name = SRC_BTN_GALLERY_NEXT,
.loc = BTN_LOC_NEXT,
},
+ {
+ .name = SRC_BTN_SLIDE,
+ .loc = BTN_LOC_SLIDE,
+ },
};
struct _viewer_info {
static void _callback_photo(void *data, const char *ev);
static void _callback_video(void *data, const char *ev);
+static void _slideshow_set(struct _priv *priv);
+static void _slideshow_enable(struct _priv *priv);
+static void _slideshow_disable(struct _priv *priv);
+
static struct _viewer_info viewer_info[] = {
{
.btns = btn_movie,
},
{
.btns = btn_photo,
- .btn_count = 4,
+ .btn_count = 5,
.focus_loc = BTN_LOC_NEXT,
.callback = _callback_photo,
},
{
.btns = btn_video,
- .btn_count = 3,
+ .btn_count = 4,
.focus_loc = BTN_LOC_NEXT,
.callback = _callback_video,
},
_player_play(priv);
return;
} else if (id == VIEWER_VIDEO) {
- _draw_thumbnail(priv, mi);
+ if (priv->slideshow.enable)
+ _player_play(priv);
+ else
+ _draw_thumbnail(priv, mi);
return;
+ } else if (id == VIEWER_PHOTO) {
+ if (priv->slideshow.enable)
+ _slideshow_set(priv);
}
if (!mi->file_path)
ctl = priv->viewer.ctl[id];
priv->viewer.cur = id;
- ctl->ops->show(ctl->handle);
+ if (!priv->slideshow.enable)
+ ctl->ops->show(ctl->handle);
loc = priv->viewer.foc;
if (loc == BTN_LOC_NONE) {
ctl->ops->disable(ctl->handle);
}
+static Eina_Bool _slideshow_next(void *data)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return ECORE_CALLBACK_CANCEL;
+
+ priv = data;
+
+ priv->slideshow.timer = NULL;
+
+ if (!priv->slideshow.enable)
+ return ECORE_CALLBACK_CANCEL;
+
+ _viewer_next(priv);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void _slideshow_set(struct _priv *priv)
+{
+ if (priv->slideshow.timer)
+ return;
+
+ priv->slideshow.timer = ecore_timer_add(SLIDE_SHOW_INTERVAL,
+ _slideshow_next, priv);
+}
+
+static void _slideshow_enable(struct _priv *priv)
+{
+ priv->slideshow.enable = true;
+}
+
+static void _slideshow_disable(struct _priv *priv)
+{
+ priv->slideshow.enable = false;
+
+ if (priv->slideshow.timer) {
+ ecore_timer_del(priv->slideshow.timer);
+ priv->slideshow.timer = NULL;
+ }
+}
+
static void _pop_view(struct _priv *priv)
{
struct view_update_data vdata;
_pop_view(priv);
} else if (priv->viewer.cur == VIEWER_VIDEO) {
_player_stop(priv);
- _viewer_show(priv);
- _show_bar(data);
+
+ if (priv->slideshow.enable)
+ _viewer_next(priv);
+ else
+ _viewer_show(priv);
}
}
_viewer_show(priv);
} else if (!strcmp(ev, SRC_BTN_ZOOM)) {
_set_image_zoom(priv);
+ } else if (!strcmp(ev, SRC_BTN_SLIDE)) {
+ _slideshow_enable(priv);
+ _hide_bar(priv);
+ _viewer_show(priv);
}
}
_viewer_next(priv);
} else if (!strcmp(ev, SRC_BTN_PLAY)) {
_player_play_pause(priv);
+ } else if (!strcmp(ev, SRC_BTN_SLIDE)) {
+ _slideshow_enable(priv);
+ _hide_bar(priv);
+ _viewer_show(priv);
}
}
ev = ei;
+ if (priv->slideshow.enable) {
+ if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
+ if (priv->viewer.cur == VIEWER_VIDEO)
+ _player_stop(priv);
+
+ _slideshow_disable(priv);
+ _viewer_show(priv);
+ _show_bar(priv);
+ }
+
+ return ECORE_CALLBACK_DONE;
+ }
+
if (!strcmp(ev->keyname, KEY_BACK) ||
!strcmp(ev->keyname, KEY_BACK_REMOTE)) {
if (priv->bar_show) {
_viewer_prev(priv);
}
}
+ } else {
+ if (priv->slideshow.enable)
+ return ECORE_CALLBACK_DONE;
}
_show_bar(data);
priv->playlist.cur = 0;
priv->viewer.foc = BTN_LOC_NONE;
+ _slideshow_disable(priv);
+
player = playermgr_create(win);
if (!player) {
_ERR("failed to create player");
priv = view_data;
+ _slideshow_disable(priv);
_viewer_hide(priv);
timeout_handler_enable(priv->timeout, false);
priv->playlist.list = vdata->list;
priv->playlist.cur = vdata->index;
priv->viewer.foc = BTN_LOC_NONE;
+ priv->slideshow.enable = false;
break;
default:
break;