Add slideshow to ephoto.. It uses elm_slideshow, and this is likely temporary, because in the f uture I am going to do some more extensive slideshow stuff. I'm not happy with this, it seems pretty slow on transitions(I'll take a look at speeding things up), but it will do for now.
SVN revision: 50569
This commit is contained in:
parent
7f75caca3a
commit
82f69119b6
|
@ -10,6 +10,7 @@ ephoto_SOURCES = \
|
|||
ephoto.h \
|
||||
ephoto_flow_browser.c \
|
||||
ephoto_main.c \
|
||||
ephoto_slideshow.c \
|
||||
ephoto_thumb_browser.c
|
||||
|
||||
ephoto_CFLAGS = @EVAS_CFLAGS@ @EDJE_CFLAGS@ @EINA_CFLAGS@ @EFREET_MIME_CFLAGS@ @ETHUMB_CFLAGS@ @ELEMENTARY_CFLAGS@ @EIO_CFLAGS@ -Wall -g
|
||||
|
|
|
@ -31,6 +31,12 @@ void ephoto_show_flow_browser(const char *current_image);
|
|||
void ephoto_hide_flow_browser(void);
|
||||
void ephoto_delete_flow_browser(void);
|
||||
|
||||
/*Ephoto Slideshow*/
|
||||
void ephoto_create_slideshow(void);
|
||||
void ephoto_show_slideshow(int view, const char *current_image);
|
||||
void ephoto_hide_slideshow(void);
|
||||
void ephoto_delete_slideshow(void);
|
||||
|
||||
/*Ephoto Thumb Browser*/
|
||||
void ephoto_create_thumb_browser(const char *directory);
|
||||
void ephoto_show_thumb_browser(void);
|
||||
|
@ -46,6 +52,7 @@ struct _Ephoto
|
|||
Evas_Object *bg;
|
||||
Evas_Object *box;
|
||||
Evas_Object *flow_browser;
|
||||
Evas_Object *slideshow;
|
||||
Evas_Object *thumb_browser;
|
||||
Eina_List *images;
|
||||
};
|
||||
|
|
|
@ -6,11 +6,13 @@ static void _ephoto_go_first(void *data, Evas_Object *obj, void *event_info);
|
|||
static void _ephoto_go_last(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
||||
/*Inline variables*/
|
||||
static Eina_List *iter;
|
||||
static Evas_Object *image, *image2, *toolbar;
|
||||
static const char *cur_image;
|
||||
|
||||
static const char *toolbar_items[] = {
|
||||
"First",
|
||||
|
@ -71,7 +73,7 @@ ephoto_create_flow_browser(void)
|
|||
|
||||
o = elm_icon_add(em->win);
|
||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||
elm_toolbar_item_add(toolbar, o, "Slideshow", NULL, NULL);
|
||||
elm_toolbar_item_add(toolbar, o, "Slideshow", _ephoto_go_slideshow, NULL);
|
||||
}
|
||||
|
||||
/*Show the flow browser*/
|
||||
|
@ -82,6 +84,8 @@ ephoto_show_flow_browser(const char *current_image)
|
|||
Elm_Toolbar_Item *o;
|
||||
int i;
|
||||
|
||||
cur_image = current_image;
|
||||
|
||||
evas_object_event_callback_add(em->flow_browser, EVAS_CALLBACK_KEY_UP,
|
||||
_ephoto_key_pressed, NULL);
|
||||
|
||||
|
@ -208,6 +212,7 @@ _ephoto_go_first(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_box_pack_end(em->flow_browser, image);
|
||||
evas_object_show(image);
|
||||
}
|
||||
cur_image = eina_list_data_get(iter);
|
||||
|
||||
elm_box_pack_end(em->flow_browser, toolbar);
|
||||
|
||||
|
@ -241,6 +246,7 @@ _ephoto_go_last(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_box_pack_end(em->flow_browser, image);
|
||||
evas_object_show(image);
|
||||
}
|
||||
cur_image = eina_list_data_get(iter);
|
||||
|
||||
elm_box_pack_end(em->flow_browser, toolbar);
|
||||
|
||||
|
@ -276,6 +282,7 @@ _ephoto_go_next(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_box_pack_end(em->flow_browser, image);
|
||||
evas_object_show(image);
|
||||
}
|
||||
cur_image = eina_list_data_get(iter);
|
||||
|
||||
elm_box_pack_end(em->flow_browser, toolbar);
|
||||
|
||||
|
@ -311,9 +318,19 @@ _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_box_pack_end(em->flow_browser, image);
|
||||
evas_object_show(image);
|
||||
}
|
||||
cur_image = eina_list_data_get(iter);
|
||||
|
||||
elm_box_pack_end(em->flow_browser, toolbar);
|
||||
|
||||
elm_toolbar_item_unselect_all(toolbar);
|
||||
}
|
||||
|
||||
/*Go to the slideshow*/
|
||||
static void
|
||||
_ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
ephoto_hide_flow_browser();
|
||||
ephoto_show_slideshow(1, cur_image);
|
||||
elm_toolbar_item_unselect_all(toolbar);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
#include "ephoto.h"
|
||||
|
||||
static Evas_Object *_ephoto_get_image(void *data, Evas_Object *obj);
|
||||
static void _ephoto_end_slideshow(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
||||
static Elm_Slideshow_Item_Class itc;
|
||||
static int return_view;
|
||||
static const char *cur_image;
|
||||
|
||||
/*Create the slideshow*/
|
||||
void
|
||||
ephoto_create_slideshow(void)
|
||||
{
|
||||
em->slideshow = elm_slideshow_add(em->win);
|
||||
elm_slideshow_loop_set(em->slideshow, EINA_TRUE);
|
||||
elm_slideshow_layout_set(em->slideshow, "fullscreen");
|
||||
elm_slideshow_transition_set(em->slideshow, "fade");
|
||||
evas_object_size_hint_weight_set(em->slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(em->slideshow, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_event_callback_add(em->slideshow, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_ephoto_end_slideshow, NULL);
|
||||
}
|
||||
|
||||
/*Start and show the slideshow*/
|
||||
void
|
||||
ephoto_show_slideshow(int view, const char *current_image)
|
||||
{
|
||||
Eina_List *l = NULL, *iter = NULL;
|
||||
const char *image;
|
||||
int x, y, w, h;
|
||||
|
||||
ephoto_create_slideshow();
|
||||
|
||||
return_view = view;
|
||||
cur_image = current_image;
|
||||
|
||||
evas_object_geometry_get(em->box, &x, &y, &w, &h);
|
||||
evas_object_resize(em->slideshow, w, h);
|
||||
evas_object_move(em->slideshow, 0, 0);
|
||||
|
||||
itc.func.get = _ephoto_get_image;
|
||||
itc.func.del = NULL;
|
||||
|
||||
l = em->images;
|
||||
EINA_LIST_FOREACH(l, iter, image)
|
||||
{
|
||||
elm_slideshow_item_add(em->slideshow, &itc, image);
|
||||
}
|
||||
evas_object_show(em->slideshow);
|
||||
elm_win_resize_object_add(em->win, em->slideshow);
|
||||
elm_slideshow_timeout_set(em->slideshow, 4);
|
||||
}
|
||||
|
||||
/*Hide the slideshow object*/
|
||||
void
|
||||
ephoto_hide_slideshow(void)
|
||||
{
|
||||
ephoto_delete_slideshow();
|
||||
if (return_view == 0)
|
||||
ephoto_show_thumb_browser();
|
||||
else
|
||||
ephoto_show_flow_browser(cur_image);
|
||||
}
|
||||
|
||||
/*Delete the slideshow object*/
|
||||
void
|
||||
ephoto_delete_slideshow(void)
|
||||
{
|
||||
evas_object_del(em->slideshow);
|
||||
}
|
||||
|
||||
/*Get the image for the slideshow*/
|
||||
static Evas_Object *
|
||||
_ephoto_get_image(void *data, Evas_Object *obj)
|
||||
{
|
||||
char *file;
|
||||
Evas_Object *image;
|
||||
|
||||
file = data;
|
||||
|
||||
image = elm_photo_add(obj);
|
||||
elm_photo_file_set(image, file);
|
||||
elm_photo_fill_inside_set(image, EINA_TRUE);
|
||||
elm_object_style_set(image, "shadow");
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/*End the slideshow*/
|
||||
static void
|
||||
_ephoto_end_slideshow(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
ephoto_hide_slideshow();
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ static void _ephoto_thumb_clicked_job(void *data);
|
|||
static void _ephoto_thumb_clicked(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_view_large(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_change_directory(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
/*Inline Variables*/
|
||||
static Elm_Gengrid_Item_Class eg;
|
||||
|
@ -72,7 +73,7 @@ ephoto_create_thumb_browser(const char *directory)
|
|||
|
||||
o = elm_icon_add(em->win);
|
||||
elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL);
|
||||
elm_toolbar_item_add(toolbar, o, "Play Slideshow", NULL, NULL);
|
||||
elm_toolbar_item_add(toolbar, o, "Play Slideshow", _ephoto_view_slideshow, NULL);
|
||||
|
||||
em->thumb_browser = elm_gengrid_add(em->win);
|
||||
elm_gengrid_align_set(em->thumb_browser, 0.5, 0.6);
|
||||
|
@ -372,7 +373,7 @@ _ephoto_thumb_clicked(void *data, Evas_Object *obj, void *event_info)
|
|||
ecore_job_add(_ephoto_thumb_clicked_job, etd->file);
|
||||
}
|
||||
|
||||
/*File Selector is show*/
|
||||
/*File Selector is shown*/
|
||||
static void
|
||||
_ephoto_fileselector_shown(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -464,3 +465,11 @@ _ephoto_change_directory(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_show(win);
|
||||
}
|
||||
|
||||
/*Show slideshow*/
|
||||
static void
|
||||
_ephoto_view_slideshow(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
ephoto_hide_thumb_browser();
|
||||
ephoto_show_slideshow(0, NULL);
|
||||
elm_toolbar_item_unselect_all(toolbar);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue