forked from enlightenment/efl
efl_ui/image: implement efl.player::autoplay for image widgets
this just calls efl.player::playing_set any time autoplay is true and the internal image object is preloaded ref T8589 Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11306
This commit is contained in:
parent
849b37d641
commit
c18327d5df
|
@ -153,7 +153,7 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|||
|
||||
if (file && eina_str_has_extension(file, ".gif")
|
||||
&& efl_playable_get(ph))
|
||||
efl_player_playing_set(ph, EINA_TRUE);
|
||||
efl_player_autoplay_set(ph, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -834,7 +834,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
if (efl_playable_get(zoomable))
|
||||
{
|
||||
printf("animation is available for this image.\n");
|
||||
efl_player_playing_set(zoomable, EINA_TRUE);
|
||||
efl_player_autoplay_set(zoomable, EINA_TRUE);
|
||||
}
|
||||
|
||||
rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win,
|
||||
|
|
|
@ -103,7 +103,11 @@ _on_image_preloaded(void *data,
|
|||
if (sd->show) evas_object_show(obj);
|
||||
_prev_img_del(sd);
|
||||
err = evas_object_image_load_error_get(obj);
|
||||
if (!err) evas_object_smart_callback_call(sd->self, SIG_LOAD_READY, NULL);
|
||||
if (!err)
|
||||
{
|
||||
evas_object_smart_callback_call(sd->self, SIG_LOAD_READY, NULL);
|
||||
if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
|
||||
}
|
||||
else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL);
|
||||
}
|
||||
|
||||
|
@ -436,7 +440,11 @@ _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread)
|
|||
ok = !_efl_ui_image_smart_internal_file_set(sd->self, sd);
|
||||
}
|
||||
}
|
||||
if (ok) evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL);
|
||||
if (ok)
|
||||
{
|
||||
evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL);
|
||||
if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
|
||||
}
|
||||
else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -528,6 +536,7 @@ _efl_ui_image_edje_file_set(Evas_Object *obj)
|
|||
}
|
||||
else
|
||||
return _efl_ui_image_async_file_set(obj, sd);
|
||||
if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
|
||||
|
||||
/* FIXME: do i want to update icon on file change ? */
|
||||
efl_canvas_group_change(obj);
|
||||
|
@ -1036,7 +1045,10 @@ _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd)
|
|||
}
|
||||
|
||||
if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED)
|
||||
_prev_img_del(sd);
|
||||
{
|
||||
_prev_img_del(sd);
|
||||
if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_hide(sd->img);
|
||||
|
@ -1808,6 +1820,29 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd)
|
|||
return _efl_ui_image_animated_get_internal(obj, sd);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool autoplay)
|
||||
{
|
||||
autoplay = !!autoplay;
|
||||
if (sd->autoplay == autoplay) return;
|
||||
sd->autoplay = autoplay;
|
||||
if (sd->img && (!sd->edje))
|
||||
{
|
||||
/* filter cases where we aren't going to immediately start playing */
|
||||
if (!autoplay) return;
|
||||
if ((sd->preload_status != EFL_UI_IMAGE_PRELOADED) &&
|
||||
(sd->preload_status != EFL_UI_IMAGE_PRELOAD_DISABLED))
|
||||
return;
|
||||
}
|
||||
efl_player_playing_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_image_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
|
||||
{
|
||||
return sd->autoplay;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double factor)
|
||||
{
|
||||
|
@ -2427,7 +2462,10 @@ elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char
|
|||
(sd->img, (void *)img, size, (char *)format, (char *)key);
|
||||
|
||||
if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED)
|
||||
_prev_img_del(sd);
|
||||
{
|
||||
_prev_img_del(sd);
|
||||
if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sd->preload_status = EFL_UI_IMAGE_PRELOADING;
|
||||
|
|
|
@ -103,7 +103,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.
|
|||
Efl.Player.playback_position { get; set; }
|
||||
Efl.Player.playback_progress { get; set; }
|
||||
Efl.Player.playback_speed { get; set; }
|
||||
@empty Efl.Player.autoplay { set; get; }
|
||||
Efl.Player.autoplay { set; get; }
|
||||
@empty Efl.Player.playback_loop { set; get; }
|
||||
Efl.Layout.Signal.signal_emit;
|
||||
Efl.Layout.Signal.message_send;
|
||||
|
|
|
@ -728,6 +728,7 @@ _main_img_preloaded_cb(void *data,
|
|||
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
||||
evas_object_show(sd->img);
|
||||
sd->main_load_pending = 0;
|
||||
if (sd->autoplay) efl_player_playing_set(obj, EINA_TRUE);
|
||||
g = _grid_create(obj);
|
||||
if (g)
|
||||
{
|
||||
|
@ -3098,6 +3099,28 @@ _efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomab
|
|||
return _efl_ui_image_zoomable_animated_get_internal(obj, sd);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_zoomable_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool autoplay)
|
||||
{
|
||||
autoplay = !!autoplay;
|
||||
if (sd->autoplay == autoplay) return;
|
||||
sd->autoplay = autoplay;
|
||||
if (!sd->edje)
|
||||
{
|
||||
/* filter cases where we aren't going to immediately start playing */
|
||||
if (!autoplay) return;
|
||||
if (sd->preload_num)
|
||||
return;
|
||||
}
|
||||
efl_player_playing_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_image_zoomable_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
|
||||
{
|
||||
return sd->autoplay;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom
|
|||
Efl.Player.playback_position { get; set; }
|
||||
Efl.Player.playback_progress { get; set; }
|
||||
Efl.Player.playback_speed { get; set; }
|
||||
@empty Efl.Player.autoplay { set; get; }
|
||||
Efl.Player.autoplay { set; get; }
|
||||
@empty Efl.Player.playback_loop { set; get; }
|
||||
Efl.Ui.Zoom.zoom_animation { set; get; }
|
||||
Efl.Ui.Zoom.zoom_level { set; get; }
|
||||
|
|
|
@ -142,6 +142,7 @@ struct _Efl_Ui_Image_Zoomable_Data
|
|||
Eina_Bool paused : 1;
|
||||
Eina_Bool orientation_changed : 1;
|
||||
Eina_Bool anim : 1;
|
||||
Eina_Bool autoplay : 1;
|
||||
Eina_Bool freeze_want : 1;
|
||||
Eina_Bool show_item: 1;
|
||||
};
|
||||
|
|
|
@ -97,6 +97,7 @@ struct _Efl_Ui_Image_Data
|
|||
Eina_Bool edit : 1;
|
||||
Eina_Bool edje : 1;
|
||||
Eina_Bool anim : 1;
|
||||
Eina_Bool autoplay : 1;
|
||||
Eina_Bool paused : 1;
|
||||
Eina_Bool async_enable : 1;
|
||||
Eina_Bool scale_up : 1;
|
||||
|
|
Loading…
Reference in New Issue