From bbda9033aa0630afbff8d6ed50fa9684537528c6 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 14 Nov 2015 09:13:13 +0900 Subject: [PATCH] rage - yet more browser mode related improvements make video hide on stop so when browser i sback there isnt a dead video in the background make poster mode explicit so timeline thumbs work again add spacing between browser item and make label multi-line ... --- data/themes/default.edc | 81 +++++++++++++++++++++++++++++++++-------- src/bin/browser.c | 5 ++- src/bin/key.c | 1 + src/bin/thumb.c | 6 ++- src/bin/videothumb.c | 29 +++++++++++---- src/bin/videothumb.h | 1 + src/bin/win.c | 7 ++-- src/bin/win.h | 2 +- src/bin/winvid.c | 6 ++- 9 files changed, 106 insertions(+), 32 deletions(-) diff --git a/data/themes/default.edc b/data/themes/default.edc index 534b182..22ede4c 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -236,6 +236,13 @@ collections { part { name: "rage.content"; type: SWALLOW; description { state: "default" 0.0; + visible: 0; + } + description { state: "novideo" 0.0; + visible: 0; + } + description { state: "video" 0.0; + visible: 1; } } @@ -452,6 +459,15 @@ collections { target: "speaker_clip"; target: "shadow"; target: "statusloc"; + target: "rage.content"; + } + program { + signal: "state,default"; source: "rage"; + action: STATE_SET "default" 0.0; + target: "speaker_clip"; + target: "shadow"; + target: "statusloc"; + target: "rage.content"; } program { signal: "state,video"; source: "rage"; @@ -459,6 +475,7 @@ collections { target: "speaker_clip"; target: "shadow"; target: "statusloc"; + target: "rage.content"; } program { signal: "state,novideo"; source: "rage"; @@ -2126,7 +2143,7 @@ collections { rel2.offset: -1 40; rel2.relative: 1.0 0.0; color: 255 255 255 255; - text { font: "Sans:style=Bold"; size: 20; + text { font: "Sans:style=Bold"; size: 40; align: 0.0 0.0; min: 0 1; elipsis: 0; @@ -2146,9 +2163,14 @@ collections { group { name: "rage/browser/item"; images.image: "win_shadow.png" COMP; - images.image: "win_glow.png" COMP; images.image: "dimmer.png" COMP; + styles { + style { name: "browser_item_label"; + base: "font=Sans font_size=20 color=#ffffffff wrap=mixed ellipsis=1.0"; + } + } + parts { part { name: "shadow"; mouse_events: 0; description { state: "default" 0.0; @@ -2170,22 +2192,20 @@ collections { rel2.to: "clip"; } } - part { name: "glow"; mouse_events: 0; + part { name: "glow"; type: RECT; mouse_events: 0; description { state: "default" 0.0; - image.normal: "win_glow.png"; - image.border: 9 9 9 9; - image.middle: 0; rel1.to: "clip"; - rel1.offset: -5 -5; rel2.to: "clip"; - rel2.offset: 4 4; - fill.smooth: 0; - color: 255 255 255 0; + color: 51 153 255 0; visible: 0; } description { state: "selected" 0.0; inherit: "default" 0.0; - color: 255 255 255 255; + rel1.to: "p1"; + rel1.relative: 0.75 0.75; + rel2.to: "p2"; + rel2.relative: 0.25 0.25; + color: 51 153 255 255; visible: 1; } } @@ -2194,18 +2214,45 @@ collections { action: STATE_SET "selected" 0.0; transition: SINUSOIDAL 0.1; target: "glow"; + target: "clip"; } program { signal: "rage,state,unselected"; source: "rage"; action: STATE_SET "default" 0.0; transition: SINUSOIDAL 0.3; target: "glow"; + target: "clip"; } + part { name: "p1"; type: SPACER; + scale: 1; + description { state: "default" 0.0; + rel2.relative: 0.0 0.0; + align: 0.0 0.0; + min: 16 16; + fixed: 1 1; + } + } + part { name: "p2"; type: SPACER; + scale: 1; + description { state: "default" 0.0; + rel1.relative: 1.0 1.0; + align: 1.0 1.0; + min: 16 16; + fixed: 1 1; + } + } part { name: "clip"; type: RECT; description { state: "default" 0.0; - rel1.offset: 4 4; - rel2.offset: -5 -5; + rel1.to: "p1"; + rel1.relative: 1.0 1.0; + rel2.to: "p2"; + rel2.relative: 0.0 0.0; + color: 192 192 192 255; + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; } } part { name: "rage.content"; type: SWALLOW; @@ -2224,15 +2271,19 @@ collections { rel2.to: "clip"; } } - part { name: "rage.title"; type: TEXT; mouse_events: 0; + part { name: "rage.title"; type: TEXTBLOCK; mouse_events: 0; + clip_to: "clip"; scale: 1; description { state: "default" 0.0; fixed: 1 1; align: 0.0 1.0; rel1.offset: 8 8; + rel1.to: "clip"; rel2.offset: -9 -9; + rel2.to: "clip"; color: 255 255 255 255; - text { font: "Sans"; size: 12; + text { font: "Sans"; size: 20; + style: "browser_item_label"; align: 0.0 1.0; min: 0 1; elipsis: 0; diff --git a/src/bin/browser.c b/src/bin/browser.c index 07a2c79..6a91c36 100644 --- a/src/bin/browser.c +++ b/src/bin/browser.c @@ -58,8 +58,8 @@ _item_size_get(Evas_Object *win, Evas_Coord *w, Evas_Coord *h) elm_coords_finger_size_adjust(1, &sz, 1, &sz); evas_object_geometry_get(win, NULL, NULL, w, h); - *w = *w / 8; - *h = *h / 3; + *w = (double)(*w) / 5.0; + *h = (double)(*h) / 1.5; if (*w < sz) *w = sz; if (*h < sz) *h = sz; } @@ -266,6 +266,7 @@ _entry_files_pop(Evas_Object *win, Entry *entry) elm_layout_signal_callback_add(o, "rage,selected", "rage", _cb_file_selected, win); o = videothumb_add(win); + videothumb_poster_mode_set(o, EINA_TRUE); evas_object_smart_callback_add(o, "data", _cb_vidthumb_data, base); evas_object_data_set(o, "entry", entry); evas_object_data_set(o, "file", file); diff --git a/src/bin/key.c b/src/bin/key.c index cb835cd..1a3d1b2 100644 --- a/src/bin/key.c +++ b/src/bin/key.c @@ -113,6 +113,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev) { video_stop(inf->vid); elm_layout_signal_emit(inf->lay, "action,stop", "rage"); + elm_layout_signal_emit(inf->lay, "state,default", "rage"); if (inf->browse_mode) browser_show(win); } else if (!strcmp(ev->keyname, "c")) diff --git a/src/bin/thumb.c b/src/bin/thumb.c index 0009e1f..41ea0a2 100644 --- a/src/bin/thumb.c +++ b/src/bin/thumb.c @@ -11,6 +11,7 @@ static Ecore_Timer *vid_timeout = NULL; static Eina_Bool is_audio = EINA_FALSE; static Eina_Bool is_movie = EINA_FALSE; static int iw, ih, incr = 0; +static Eina_Bool poster = 0; static unsigned char sum[20]; static const char *file = NULL; @@ -53,7 +54,7 @@ _cb_loaded(void *data, Evas_Object *obj, void *info EINA_UNUSED) _cb_fetched, (void *)file); return; } - else + else if (poster) { double len = emotion_object_play_length_get(obj); double ratio = emotion_object_ratio_get(obj); @@ -149,7 +150,7 @@ _cb_timeout(void *data EINA_UNUSED) EAPI_MAIN int elm_main(int argc, char **argv) { - if (argc < 3) exit(1); + if (argc < 4) exit(1); elm_need_efreet(); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); @@ -171,6 +172,7 @@ elm_main(int argc, char **argv) vid = emotion_object_add(evas_object_evas_get(win)); file = argv[1]; incr = atoi(argv[2]); + poster = atoi(argv[3]); const char *extn = strchr(file, '.'); if (extn) diff --git a/src/bin/videothumb.c b/src/bin/videothumb.c index 06db837..6a16e09 100644 --- a/src/bin/videothumb.c +++ b/src/bin/videothumb.c @@ -21,6 +21,7 @@ struct _Videothumb int iw, ih; Evas_Coord w, h; Eina_Bool seen : 1; + Eina_Bool poster_mode : 1; }; static Evas_Smart *_smart = NULL; @@ -142,8 +143,9 @@ _videothumb_launch_do(Evas_Object *obj) sd->exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _cb_thumb_exe, obj); snprintf(buf, sizeof(buf), - "%s/rage/utils/rage_thumb %s 10000 >& /dev/null", - libdir, s); + "%s/rage/utils/rage_thumb %s 10000 %i >& /dev/null", + libdir, s, sd->poster_mode ? 1 : 0); + printf("RUN: %s\n", buf); sd->thumb_exe = ecore_exe_pipe_run(buf, ECORE_EXE_TERM_WITH_PARENT | ECORE_EXE_NOT_LEADER, @@ -243,15 +245,18 @@ _videothumb_image_load(Evas_Object *obj) if (!sd->file) return; sd->o_img2 = evas_object_image_filled_add(evas_object_evas_get(obj)); evas_object_smart_member_add(sd->o_img2, obj); - artfile = albumart_file_get(sd->realpath); - if (artfile) + if (sd->poster_mode) { - if (ecore_file_exists(artfile)) + artfile = albumart_file_get(sd->realpath); + if (artfile) { - sd->realfile = eina_stringshare_add(artfile); - found = EINA_TRUE; + if (ecore_file_exists(artfile)) + { + sd->realfile = eina_stringshare_add(artfile); + found = EINA_TRUE; + } + free(artfile); } - free(artfile); } if (!found) { @@ -485,6 +490,14 @@ videothumb_add(Evas_Object *parent) return obj; } +void +videothumb_poster_mode_set(Evas_Object *obj, Eina_Bool poster_mode) +{ + Videothumb *sd = evas_object_smart_data_get(obj); + if (!sd) return; + sd->poster_mode = poster_mode; +} + void videothumb_file_set(Evas_Object *obj, const char *file, double pos) { diff --git a/src/bin/videothumb.h b/src/bin/videothumb.h index ab5c703..b6f4f9e 100644 --- a/src/bin/videothumb.h +++ b/src/bin/videothumb.h @@ -2,6 +2,7 @@ #define _VIDEOTHUMB_H__ 1 Evas_Object *videothumb_add(Evas_Object *parent); +void videothumb_poster_mode_set(Evas_Object *obj, Eina_Bool poster_mode); void videothumb_file_set(Evas_Object *obj, const char *file, double pos); void videothumb_autocycle_set(Evas_Object *obj, Eina_Bool enabled); void videothumb_size_get(Evas_Object *obj, int *w, int *h); diff --git a/src/bin/win.c b/src/bin/win.c index fe34ecb..399141d 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -250,26 +250,27 @@ win_video_restart(Evas_Object *win) _restart_vid(win, inf->lay, inf->vid, vid->file, vid->sub); } -void +Eina_Bool win_video_next(Evas_Object *win) { Inf *inf = evas_object_data_get(win, "inf"); Eina_List *l; Winvid_Entry *vid; - if (!inf->file_list) return; + if (!inf->file_list) return EINA_FALSE; if (!inf->file_cur) l = inf->file_list; else l = inf->file_cur->next; if (!l) { if (inf->browse_mode) browser_show(win); else elm_exit(); - return; + return EINA_FALSE; } inf->file_cur = l; vid = l->data; _restart_vid(win, inf->lay, inf->vid, vid->file, vid->sub); win_list_sel_update(win); + return EINA_TRUE; } void diff --git a/src/bin/win.h b/src/bin/win.h index 16a26b6..1d542fa 100644 --- a/src/bin/win.h +++ b/src/bin/win.h @@ -35,7 +35,7 @@ void win_do_next(Evas_Object *win); // lower level controls void win_video_restart(Evas_Object *win); -void win_video_next(Evas_Object *win); +Eina_Bool win_video_next(Evas_Object *win); void win_video_prev(Evas_Object *win); void win_video_first(Evas_Object *win); void win_video_last(Evas_Object *win); diff --git a/src/bin/winvid.c b/src/bin/winvid.c index 8e98a0d..2bec061 100644 --- a/src/bin/winvid.c +++ b/src/bin/winvid.c @@ -25,7 +25,10 @@ _cb_stop_next(void *data) { Inf *inf = evas_object_data_get(data, "inf"); inf->next_job = NULL; - win_video_next(data); + if (!win_video_next(data)) + { + elm_layout_signal_emit(inf->lay, "state,default", "rage"); + } } static void @@ -39,6 +42,7 @@ _cb_stop(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) } else { + elm_layout_signal_emit(inf->lay, "state,default", "rage"); if (inf->browse_mode) browser_show(data); else elm_exit(); }