summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-10 11:05:35 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-20 15:57:44 +0100
commitc18327d5df1735b7d18f4d7194692079f3879c6c (patch)
tree427b9a43638f1d93e991a27013f5c1f18768f5d2
parent849b37d64128e9737721f4f1e9bc87dc5debd09b (diff)
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
-rw-r--r--src/bin/elementary/test_photocam.c4
-rw-r--r--src/lib/elementary/efl_ui_image.c46
-rw-r--r--src/lib/elementary/efl_ui_image.eo2
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c23
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.eo2
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable_private.h1
-rw-r--r--src/lib/elementary/efl_ui_widget_image.h1
7 files changed, 71 insertions, 8 deletions
diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c
index de7b827a84..9f357d9ef0 100644
--- a/src/bin/elementary/test_photocam.c
+++ b/src/bin/elementary/test_photocam.c
@@ -153,7 +153,7 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
153 153
154 if (file && eina_str_has_extension(file, ".gif") 154 if (file && eina_str_has_extension(file, ".gif")
155 && efl_playable_get(ph)) 155 && efl_playable_get(ph))
156 efl_player_playing_set(ph, EINA_TRUE); 156 efl_player_autoplay_set(ph, EINA_TRUE);
157} 157}
158 158
159static void 159static void
@@ -834,7 +834,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
834 if (efl_playable_get(zoomable)) 834 if (efl_playable_get(zoomable))
835 { 835 {
836 printf("animation is available for this image.\n"); 836 printf("animation is available for this image.\n");
837 efl_player_playing_set(zoomable, EINA_TRUE); 837 efl_player_autoplay_set(zoomable, EINA_TRUE);
838 } 838 }
839 839
840 rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win, 840 rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win,
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 2684b0f364..c1e0eb80f2 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -103,7 +103,11 @@ _on_image_preloaded(void *data,
103 if (sd->show) evas_object_show(obj); 103 if (sd->show) evas_object_show(obj);
104 _prev_img_del(sd); 104 _prev_img_del(sd);
105 err = evas_object_image_load_error_get(obj); 105 err = evas_object_image_load_error_get(obj);
106 if (!err) evas_object_smart_callback_call(sd->self, SIG_LOAD_READY, NULL); 106 if (!err)
107 {
108 evas_object_smart_callback_call(sd->self, SIG_LOAD_READY, NULL);
109 if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
110 }
107 else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL); 111 else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL);
108} 112}
109 113
@@ -436,7 +440,11 @@ _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread)
436 ok = !_efl_ui_image_smart_internal_file_set(sd->self, sd); 440 ok = !_efl_ui_image_smart_internal_file_set(sd->self, sd);
437 } 441 }
438 } 442 }
439 if (ok) evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL); 443 if (ok)
444 {
445 evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL);
446 if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
447 }
440 else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL); 448 else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL);
441 } 449 }
442 } 450 }
@@ -528,6 +536,7 @@ _efl_ui_image_edje_file_set(Evas_Object *obj)
528 } 536 }
529 else 537 else
530 return _efl_ui_image_async_file_set(obj, sd); 538 return _efl_ui_image_async_file_set(obj, sd);
539 if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
531 540
532 /* FIXME: do i want to update icon on file change ? */ 541 /* FIXME: do i want to update icon on file change ? */
533 efl_canvas_group_change(obj); 542 efl_canvas_group_change(obj);
@@ -1036,7 +1045,10 @@ _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd)
1036 } 1045 }
1037 1046
1038 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) 1047 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED)
1039 _prev_img_del(sd); 1048 {
1049 _prev_img_del(sd);
1050 if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
1051 }
1040 else 1052 else
1041 { 1053 {
1042 evas_object_hide(sd->img); 1054 evas_object_hide(sd->img);
@@ -1809,6 +1821,29 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd)
1809} 1821}
1810 1822
1811EOLIAN static void 1823EOLIAN static void
1824_efl_ui_image_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool autoplay)
1825{
1826 autoplay = !!autoplay;
1827 if (sd->autoplay == autoplay) return;
1828 sd->autoplay = autoplay;
1829 if (sd->img && (!sd->edje))
1830 {
1831 /* filter cases where we aren't going to immediately start playing */
1832 if (!autoplay) return;
1833 if ((sd->preload_status != EFL_UI_IMAGE_PRELOADED) &&
1834 (sd->preload_status != EFL_UI_IMAGE_PRELOAD_DISABLED))
1835 return;
1836 }
1837 efl_player_playing_set(obj, EINA_TRUE);
1838}
1839
1840EOLIAN static Eina_Bool
1841_efl_ui_image_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
1842{
1843 return sd->autoplay;
1844}
1845
1846EOLIAN static void
1812_efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double factor) 1847_efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double factor)
1813{ 1848{
1814 EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0); 1849 EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0);
@@ -2427,7 +2462,10 @@ elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char
2427 (sd->img, (void *)img, size, (char *)format, (char *)key); 2462 (sd->img, (void *)img, size, (char *)format, (char *)key);
2428 2463
2429 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) 2464 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED)
2430 _prev_img_del(sd); 2465 {
2466 _prev_img_del(sd);
2467 if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE);
2468 }
2431 else 2469 else
2432 { 2470 {
2433 sd->preload_status = EFL_UI_IMAGE_PRELOADING; 2471 sd->preload_status = EFL_UI_IMAGE_PRELOADING;
diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo
index 3bba17ed4b..392251e4de 100644
--- a/src/lib/elementary/efl_ui_image.eo
+++ b/src/lib/elementary/efl_ui_image.eo
@@ -103,7 +103,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.
103 Efl.Player.playback_position { get; set; } 103 Efl.Player.playback_position { get; set; }
104 Efl.Player.playback_progress { get; set; } 104 Efl.Player.playback_progress { get; set; }
105 Efl.Player.playback_speed { get; set; } 105 Efl.Player.playback_speed { get; set; }
106 @empty Efl.Player.autoplay { set; get; } 106 Efl.Player.autoplay { set; get; }
107 @empty Efl.Player.playback_loop { set; get; } 107 @empty Efl.Player.playback_loop { set; get; }
108 Efl.Layout.Signal.signal_emit; 108 Efl.Layout.Signal.signal_emit;
109 Efl.Layout.Signal.message_send; 109 Efl.Layout.Signal.message_send;
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index 55c2daab41..8045ec6363 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -728,6 +728,7 @@ _main_img_preloaded_cb(void *data,
728 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); 728 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
729 evas_object_show(sd->img); 729 evas_object_show(sd->img);
730 sd->main_load_pending = 0; 730 sd->main_load_pending = 0;
731 if (sd->autoplay) efl_player_playing_set(obj, EINA_TRUE);
731 g = _grid_create(obj); 732 g = _grid_create(obj);
732 if (g) 733 if (g)
733 { 734 {
@@ -3098,6 +3099,28 @@ _efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomab
3098 return _efl_ui_image_zoomable_animated_get_internal(obj, sd); 3099 return _efl_ui_image_zoomable_animated_get_internal(obj, sd);
3099} 3100}
3100 3101
3102EOLIAN static void
3103_efl_ui_image_zoomable_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool autoplay)
3104{
3105 autoplay = !!autoplay;
3106 if (sd->autoplay == autoplay) return;
3107 sd->autoplay = autoplay;
3108 if (!sd->edje)
3109 {
3110 /* filter cases where we aren't going to immediately start playing */
3111 if (!autoplay) return;
3112 if (sd->preload_num)
3113 return;
3114 }
3115 efl_player_playing_set(obj, EINA_TRUE);
3116}
3117
3118EOLIAN static Eina_Bool
3119_efl_ui_image_zoomable_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
3120{
3121 return sd->autoplay;
3122}
3123
3101EOLIAN static Eina_Bool 3124EOLIAN static Eina_Bool
3102_efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) 3125_efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
3103{ 3126{
diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo
index 64dc7a57b7..0cbd8424d9 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.eo
+++ b/src/lib/elementary/efl_ui_image_zoomable.eo
@@ -52,7 +52,7 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom
52 Efl.Player.playback_position { get; set; } 52 Efl.Player.playback_position { get; set; }
53 Efl.Player.playback_progress { get; set; } 53 Efl.Player.playback_progress { get; set; }
54 Efl.Player.playback_speed { get; set; } 54 Efl.Player.playback_speed { get; set; }
55 @empty Efl.Player.autoplay { set; get; } 55 Efl.Player.autoplay { set; get; }
56 @empty Efl.Player.playback_loop { set; get; } 56 @empty Efl.Player.playback_loop { set; get; }
57 Efl.Ui.Zoom.zoom_animation { set; get; } 57 Efl.Ui.Zoom.zoom_animation { set; get; }
58 Efl.Ui.Zoom.zoom_level { set; get; } 58 Efl.Ui.Zoom.zoom_level { set; get; }
diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h
index e892c1f63c..c5435a27db 100644
--- a/src/lib/elementary/efl_ui_image_zoomable_private.h
+++ b/src/lib/elementary/efl_ui_image_zoomable_private.h
@@ -142,6 +142,7 @@ struct _Efl_Ui_Image_Zoomable_Data
142 Eina_Bool paused : 1; 142 Eina_Bool paused : 1;
143 Eina_Bool orientation_changed : 1; 143 Eina_Bool orientation_changed : 1;
144 Eina_Bool anim : 1; 144 Eina_Bool anim : 1;
145 Eina_Bool autoplay : 1;
145 Eina_Bool freeze_want : 1; 146 Eina_Bool freeze_want : 1;
146 Eina_Bool show_item: 1; 147 Eina_Bool show_item: 1;
147}; 148};
diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h
index de625b28b4..00716b18f1 100644
--- a/src/lib/elementary/efl_ui_widget_image.h
+++ b/src/lib/elementary/efl_ui_widget_image.h
@@ -97,6 +97,7 @@ struct _Efl_Ui_Image_Data
97 Eina_Bool edit : 1; 97 Eina_Bool edit : 1;
98 Eina_Bool edje : 1; 98 Eina_Bool edje : 1;
99 Eina_Bool anim : 1; 99 Eina_Bool anim : 1;
100 Eina_Bool autoplay : 1;
100 Eina_Bool paused : 1; 101 Eina_Bool paused : 1;
101 Eina_Bool async_enable : 1; 102 Eina_Bool async_enable : 1;
102 Eina_Bool scale_up : 1; 103 Eina_Bool scale_up : 1;