forked from enlightenment/rage
add vidual video list selector
this allows you to see the video playlisty live, select items from it, scroll around and have full live paying previews in the list
This commit is contained in:
parent
571be6a89a
commit
06cfbb082c
|
@ -240,6 +240,35 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
part { name: "rage.list"; type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
rel1.relative: 1.0 0.0;
|
||||||
|
fixed: 1 1;
|
||||||
|
}
|
||||||
|
description { state: "visible" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
align: 1.0 0.5;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "list,state,visible"; source: "rage";
|
||||||
|
action: STATE_SET "visible" 0.0;
|
||||||
|
transition: DECELERATE 0.3;
|
||||||
|
target: "rage.list";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "list,state,hidden"; source: "rage";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
transition: ACCELERATE 0.5;
|
||||||
|
target: "rage.list";
|
||||||
|
after: "list_hidden";
|
||||||
|
}
|
||||||
|
program { name: "list_hidden";
|
||||||
|
action: SIGNAL_EMIT "list,state,hidden,finished" "rage";
|
||||||
|
}
|
||||||
|
|
||||||
part { name: "poscover"; mouse_events: 0;
|
part { name: "poscover"; mouse_events: 0;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
|
@ -1060,6 +1089,27 @@ collections {
|
||||||
target: "posclip";
|
target: "posclip";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
part { name: "listevent"; type: RECT; repeat_events: 1;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 0 0 0 0;
|
||||||
|
rel1.relative: 0.8 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "listevent2"; type: RECT; repeat_events: 1;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 0 0 0 0;
|
||||||
|
rel2.relative: 0.2 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "mouse,in"; source: "listevent";
|
||||||
|
action: SIGNAL_EMIT "list,show" "rage";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "mouse,in"; source: "listevent2";
|
||||||
|
action: SIGNAL_EMIT "list,hide" "rage";
|
||||||
|
}
|
||||||
|
|
||||||
program {
|
program {
|
||||||
signal: "action,newvid"; source: "rage";
|
signal: "action,newvid"; source: "rage";
|
||||||
action: SIGNAL_EMIT "mouse,move" "event";
|
action: SIGNAL_EMIT "mouse,move" "event";
|
||||||
|
@ -1090,4 +1140,111 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group { name: "rage/list/item";
|
||||||
|
images.image: "win_shadow.png" COMP;
|
||||||
|
images.image: "win_glow.png" COMP;
|
||||||
|
|
||||||
|
parts {
|
||||||
|
part { name: "shadow"; mouse_events: 0;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
fixed: 1 1;
|
||||||
|
rel1.to: "clip";
|
||||||
|
rel2.to: "clip";
|
||||||
|
image.normal: "win_shadow.png";
|
||||||
|
image.border: 14 14 14 14;
|
||||||
|
image.middle: 0;
|
||||||
|
rel1.offset: -7 -3;
|
||||||
|
rel2.offset: 6 11;
|
||||||
|
fill.smooth: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "base"; type: RECT; mouse_events: 0;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 32 32 32 255;
|
||||||
|
rel1.to: "clip";
|
||||||
|
rel2.to: "clip";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "glow"; 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;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
|
description { state: "selected" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "rage,state,selected"; source: "rage";
|
||||||
|
action: STATE_SET "selected" 0.0;
|
||||||
|
transition: SINUSOIDAL 0.1;
|
||||||
|
target: "glow";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "rage,state,unselected"; source: "rage";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
transition: SINUSOIDAL 0.3;
|
||||||
|
target: "glow";
|
||||||
|
}
|
||||||
|
|
||||||
|
part { name: "clip"; type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
rel1.offset: 4 4;
|
||||||
|
rel2.offset: -5 -5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "rage.sizer"; type: SWALLOW;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
min: 16 16;
|
||||||
|
rel1.to: "clip";
|
||||||
|
rel2.to: "clip";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "rage.content"; type: SWALLOW;
|
||||||
|
clip_to: "clip";
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
rel1.to: "clip";
|
||||||
|
rel2.to: "clip";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "rage.title"; type: TEXT; mouse_events: 0;
|
||||||
|
effect: GLOW;
|
||||||
|
scale: 1;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
fixed: 1 1;
|
||||||
|
align: 0.0 1.0;
|
||||||
|
rel1.offset: 4 4;
|
||||||
|
rel2.offset: -5 -5;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
color2: 51 153 255 128;
|
||||||
|
color3: 51 153 255 20;
|
||||||
|
text { font: "Sans"; size: 8;
|
||||||
|
align: 0.0 1.0;
|
||||||
|
min: 0 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "event"; type: RECT;
|
||||||
|
ignore_flags: ON_HOLD;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 0 0 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
signal: "mouse,clicked,1"; source: "event";
|
||||||
|
action: SIGNAL_EMIT "rage,selected" "rage";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,6 @@ icon_spanner2.png \
|
||||||
icon_volume2.png \
|
icon_volume2.png \
|
||||||
pos_indicator_big.png \
|
pos_indicator_big.png \
|
||||||
bevel_dark_out.png \
|
bevel_dark_out.png \
|
||||||
bg_bevel.png
|
bg_bevel.png \
|
||||||
|
win_glow.png \
|
||||||
|
win_shadow.png
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 604 B |
Binary file not shown.
After Width: | Height: | Size: 501 B |
|
@ -17,4 +17,5 @@ key.c key.h \
|
||||||
main.c main.h \
|
main.c main.h \
|
||||||
video.c video.h \
|
video.c video.h \
|
||||||
winvid.c winvid.h \
|
winvid.c winvid.h \
|
||||||
win.c win.h
|
win.c win.h \
|
||||||
|
winlist.c winlist.h
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
|
#include "winlist.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_drag(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
_cb_drag(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||||
|
@ -45,6 +46,18 @@ _cb_options(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *em
|
||||||
// win_do_options(data);
|
// win_do_options(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_list_show(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||||
|
{
|
||||||
|
win_list_show(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_list_hide(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||||
|
{
|
||||||
|
win_list_hide(data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_time_print(double t, double max, int size, char *buf, Eina_Bool subsec)
|
_time_print(double t, double max, int size, char *buf, Eina_Bool subsec)
|
||||||
{
|
{
|
||||||
|
@ -107,6 +120,10 @@ controls_init(Evas_Object *win, Evas_Object *lay)
|
||||||
_cb_pos_pause, win);
|
_cb_pos_pause, win);
|
||||||
elm_layout_signal_callback_add(lay, "pos,action,options", "rage",
|
elm_layout_signal_callback_add(lay, "pos,action,options", "rage",
|
||||||
_cb_options, win);
|
_cb_options, win);
|
||||||
|
elm_layout_signal_callback_add(lay, "list,show", "rage",
|
||||||
|
_cb_list_show, win);
|
||||||
|
elm_layout_signal_callback_add(lay, "list,hide", "rage",
|
||||||
|
_cb_list_hide, win);
|
||||||
sz = 0;
|
sz = 0;
|
||||||
elm_coords_finger_size_adjust(1, &sz, 1, &sz);
|
elm_coords_finger_size_adjust(1, &sz, 1, &sz);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
#include "winlist.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
|
key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
|
||||||
|
@ -164,6 +165,10 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
|
||||||
video_ratio_size_get(inf->vid, &w, &h);
|
video_ratio_size_get(inf->vid, &w, &h);
|
||||||
if ((w > 1) && (h > 1)) evas_object_resize(win, w, h);
|
if ((w > 1) && (h > 1)) evas_object_resize(win, w, h);
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(ev->keyname, "backslash"))
|
||||||
|
{
|
||||||
|
win_list_toggle(win);
|
||||||
|
}
|
||||||
else if (!strcmp(ev->keyname, "y"))
|
else if (!strcmp(ev->keyname, "y"))
|
||||||
{
|
{
|
||||||
video_lowquality_set(inf->vid, !video_lowquality_get(inf->vid));
|
video_lowquality_set(inf->vid, !video_lowquality_get(inf->vid));
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "winvid.h"
|
#include "winvid.h"
|
||||||
|
#include "winlist.h"
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_cb_show_timeout(void *data)
|
_cb_show_timeout(void *data)
|
||||||
|
@ -14,6 +15,12 @@ _cb_show_timeout(void *data)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_resize(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
win_list_size_update(obj);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI_MAIN int
|
EAPI_MAIN int
|
||||||
elm_main(int argc, char **argv)
|
elm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +51,7 @@ elm_main(int argc, char **argv)
|
||||||
elm_theme_overlay_add(NULL, buf);
|
elm_theme_overlay_add(NULL, buf);
|
||||||
|
|
||||||
win = win_add();
|
win = win_add();
|
||||||
|
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _cb_resize, NULL);
|
||||||
evas_object_resize(win, 320, 200);
|
evas_object_resize(win, 320, 200);
|
||||||
|
|
||||||
win_video_init(win);
|
win_video_init(win);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "winvid.h"
|
#include "winvid.h"
|
||||||
|
#include "winlist.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "dnd.h"
|
#include "dnd.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
@ -142,6 +143,13 @@ _restart_vid(Evas_Object *win, Evas_Object *lay, Evas_Object *vid, const char *f
|
||||||
win_title_update(win);
|
win_title_update(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_video_restart(Evas_Object *win)
|
||||||
|
{
|
||||||
|
Inf *inf = evas_object_data_get(win, "inf");
|
||||||
|
_restart_vid(win, inf->lay, inf->vid, inf->file_cur->data);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_video_next(Evas_Object *win)
|
win_video_next(Evas_Object *win)
|
||||||
{
|
{
|
||||||
|
@ -158,6 +166,7 @@ win_video_next(Evas_Object *win)
|
||||||
}
|
}
|
||||||
inf->file_cur = l;
|
inf->file_cur = l;
|
||||||
_restart_vid(win, inf->lay, inf->vid, l->data);
|
_restart_vid(win, inf->lay, inf->vid, l->data);
|
||||||
|
win_list_sel_update(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -172,6 +181,7 @@ win_video_prev(Evas_Object *win)
|
||||||
if (!l) return;
|
if (!l) return;
|
||||||
inf->file_cur = l;
|
inf->file_cur = l;
|
||||||
_restart_vid(win, inf->lay, inf->vid, l->data);
|
_restart_vid(win, inf->lay, inf->vid, l->data);
|
||||||
|
win_list_sel_update(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -184,6 +194,7 @@ win_video_first(Evas_Object *win)
|
||||||
l = inf->file_list;
|
l = inf->file_list;
|
||||||
inf->file_cur = l;
|
inf->file_cur = l;
|
||||||
_restart_vid(win, inf->lay, inf->vid, l->data);
|
_restart_vid(win, inf->lay, inf->vid, l->data);
|
||||||
|
win_list_sel_update(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -197,6 +208,7 @@ win_video_last(Evas_Object *win)
|
||||||
if (!l) return;
|
if (!l) return;
|
||||||
inf->file_cur = l;
|
inf->file_cur = l;
|
||||||
_restart_vid(win, inf->lay, inf->vid, l->data);
|
_restart_vid(win, inf->lay, inf->vid, l->data);
|
||||||
|
win_list_sel_update(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
|
|
|
@ -31,6 +31,7 @@ void win_do_prev(Evas_Object *win);
|
||||||
void win_do_next(Evas_Object *win);
|
void win_do_next(Evas_Object *win);
|
||||||
|
|
||||||
// lower level controls
|
// lower level controls
|
||||||
|
void win_video_restart(Evas_Object *win);
|
||||||
void win_video_next(Evas_Object *win);
|
void win_video_next(Evas_Object *win);
|
||||||
void win_video_prev(Evas_Object *win);
|
void win_video_prev(Evas_Object *win);
|
||||||
void win_video_first(Evas_Object *win);
|
void win_video_first(Evas_Object *win);
|
||||||
|
|
|
@ -0,0 +1,334 @@
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "main.h"
|
||||||
|
#include "win.h"
|
||||||
|
#include "winvid.h"
|
||||||
|
#include "winlist.h"
|
||||||
|
#include "video.h"
|
||||||
|
|
||||||
|
static Evas_Object *tb = NULL;
|
||||||
|
static Evas_Object *mb, *sc, *rc, *bx;
|
||||||
|
static Ecore_Timer *bring_timer = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ready(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
int w = 1, h = 1;
|
||||||
|
|
||||||
|
if (evas_object_data_get(obj, "ready")) return;
|
||||||
|
evas_object_data_set(obj, "ready", obj);
|
||||||
|
video_position_set(obj, video_length_get(obj) / 2.0);
|
||||||
|
video_ratio_size_get(obj, &w, &h);
|
||||||
|
evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_NEITHER, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_bring(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Coord x, y, w, h, px, py;
|
||||||
|
|
||||||
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||||
|
evas_object_geometry_get(bx, &px, &py, NULL, NULL);
|
||||||
|
elm_scroller_region_bring_in(sc, x - px, y - py, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_cb_bring_in(void *data)
|
||||||
|
{
|
||||||
|
_bring(data);
|
||||||
|
bring_timer = NULL;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_opened(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_ready(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_length(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_ready(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_cb_pos_eval(void *data)
|
||||||
|
{
|
||||||
|
Evas_Object *obj = data;
|
||||||
|
Evas_Coord x, y, w, h, vx, vy, vw, vh;
|
||||||
|
|
||||||
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||||
|
evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
|
||||||
|
if (ELM_RECTS_INTERSECT(x, y, w, h, vx, vy, vw, vh))
|
||||||
|
{
|
||||||
|
if (!evas_object_data_get(obj, "active"))
|
||||||
|
{
|
||||||
|
const char *f;
|
||||||
|
|
||||||
|
f = evas_object_data_get(obj, "file");
|
||||||
|
video_play_set(obj, EINA_TRUE);
|
||||||
|
video_loop_set(obj, EINA_TRUE);
|
||||||
|
video_file_set(obj, f);
|
||||||
|
evas_object_data_set(obj, "active", obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (evas_object_data_get(obj, "active"))
|
||||||
|
{
|
||||||
|
video_play_set(obj, EINA_FALSE);
|
||||||
|
video_file_set(obj, NULL);
|
||||||
|
video_position_set(obj, 0.0);
|
||||||
|
evas_object_data_del(obj, "active");
|
||||||
|
evas_object_data_del(obj, "ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evas_object_data_del(obj, "timer");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_vid_move(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Ecore_Timer *tim = evas_object_data_get(obj, "timer");
|
||||||
|
if (tim) ecore_timer_del(tim);
|
||||||
|
tim = ecore_timer_add(0.1, _cb_pos_eval, obj);
|
||||||
|
evas_object_data_set(obj, "timer", tim);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_vid_resize(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Ecore_Timer *tim = evas_object_data_get(obj, "timer");
|
||||||
|
if (tim) ecore_timer_del(tim);
|
||||||
|
tim = ecore_timer_add(0.1, _cb_pos_eval, obj);
|
||||||
|
evas_object_data_set(obj, "timer", tim);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_vid_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Ecore_Timer *tim = evas_object_data_get(obj, "timer");
|
||||||
|
if (tim) ecore_timer_del(tim);
|
||||||
|
evas_object_data_del(obj, "timer");
|
||||||
|
if (bring_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(bring_timer);
|
||||||
|
bring_timer = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_sel(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Eina_List *items = elm_box_children_get(bx);
|
||||||
|
Eina_List *l;
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(items, l, o)
|
||||||
|
{
|
||||||
|
if (evas_object_data_get(o, "selected"))
|
||||||
|
{
|
||||||
|
evas_object_data_del(o, "selected");
|
||||||
|
elm_layout_signal_emit(o, "rage,state,unselected", "rage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elm_layout_signal_emit(obj, "rage,state,selected", "rage");
|
||||||
|
evas_object_data_set(obj, "selected", obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_selected(void *data, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||||
|
{
|
||||||
|
if (evas_object_data_get(obj, "selected")) return;
|
||||||
|
_sel(obj);
|
||||||
|
win_video_goto(data, evas_object_data_get(obj, "list"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_fill_box(Evas_Object *win)
|
||||||
|
{
|
||||||
|
Inf *inf = evas_object_data_get(win, "inf");
|
||||||
|
Eina_List *l;
|
||||||
|
const char *f, *s;
|
||||||
|
Evas_Object *o, *base, *rect;
|
||||||
|
char buf[4096];
|
||||||
|
Evas_Coord w, h, sz = 0;
|
||||||
|
|
||||||
|
elm_coords_finger_size_adjust(1, &sz, 1, &sz);
|
||||||
|
evas_object_geometry_get(win, NULL, NULL, &w, &h);
|
||||||
|
w = w / 8;
|
||||||
|
h = h / 8;
|
||||||
|
if (w < sz) w = sz;
|
||||||
|
if (h < sz) h = sz;
|
||||||
|
EINA_LIST_FOREACH(inf->file_list, l, f)
|
||||||
|
{
|
||||||
|
base = o = elm_layout_add(win);
|
||||||
|
elm_object_focus_allow_set(o, EINA_FALSE);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/themes/default.edj", elm_app_data_dir_get());
|
||||||
|
elm_layout_file_set(o, buf, "rage/list/item");
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, -1.0, 0.5);
|
||||||
|
elm_layout_signal_callback_add(o, "rage,selected", "rage", _cb_selected, win);
|
||||||
|
evas_object_data_set(o, "list", l);
|
||||||
|
|
||||||
|
s = ecore_file_file_get(f);
|
||||||
|
if ((s) && (s[0] != 0))
|
||||||
|
elm_object_part_text_set(o, "rage.title", s);
|
||||||
|
else
|
||||||
|
elm_object_part_text_set(o, "rage.title", f);
|
||||||
|
|
||||||
|
rect = o = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_color_set(rect, 0, 0, 0, 0);
|
||||||
|
elm_object_part_content_set(base, "rage.sizer", o);
|
||||||
|
evas_object_data_set(base, "sizer", o);
|
||||||
|
evas_object_size_hint_min_set(o, w, h);
|
||||||
|
|
||||||
|
o = video_add(win);
|
||||||
|
evas_object_data_set(o, "base", base);
|
||||||
|
evas_object_data_set(base, "video", o);
|
||||||
|
video_mute_set(o, EINA_TRUE);
|
||||||
|
video_fill_set(o, EINA_TRUE);
|
||||||
|
video_lowquality_set(o, EINA_TRUE);
|
||||||
|
evas_object_smart_callback_add(o, "opened", _cb_opened, win);
|
||||||
|
evas_object_smart_callback_add(o, "length", _cb_length, win);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _cb_vid_move, win);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _cb_vid_resize, win);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _cb_vid_del, win);
|
||||||
|
|
||||||
|
evas_object_data_set(o, "file", f);
|
||||||
|
elm_object_part_content_set(base, "rage.content", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
elm_box_pack_end(bx, base);
|
||||||
|
evas_object_show(base);
|
||||||
|
|
||||||
|
if (l == inf->file_cur)
|
||||||
|
{
|
||||||
|
evas_object_data_set(base, "selected", base);
|
||||||
|
elm_layout_signal_emit(base, "rage,state,selected", "rage");
|
||||||
|
if (bring_timer) ecore_timer_del(bring_timer);
|
||||||
|
bring_timer = ecore_timer_add(0.3, _cb_bring_in, base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_list_show(Evas_Object *win)
|
||||||
|
{
|
||||||
|
Inf *inf = evas_object_data_get(win, "inf");
|
||||||
|
|
||||||
|
if (tb) return;
|
||||||
|
tb = elm_table_add(win);
|
||||||
|
evas_object_show(tb);
|
||||||
|
|
||||||
|
rc = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_size_hint_weight_set(rc, 1.0, 1.0);
|
||||||
|
evas_object_color_set(rc, 0, 0, 0, 0);
|
||||||
|
elm_table_pack(tb, rc, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
mb = elm_mapbuf_add(win);
|
||||||
|
elm_object_focus_allow_set(mb, EINA_FALSE);
|
||||||
|
evas_object_size_hint_weight_set(mb, 1.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(mb, -1.0, -1.0);
|
||||||
|
elm_mapbuf_alpha_set(mb, EINA_TRUE);
|
||||||
|
// elm_mapbuf_enabled_set(mb, EINA_TRUE);
|
||||||
|
elm_table_pack(tb, mb, 0, 0, 1, 1);
|
||||||
|
evas_object_show(mb);
|
||||||
|
|
||||||
|
sc = elm_scroller_add(win);
|
||||||
|
elm_object_focus_allow_set(sc, EINA_FALSE);
|
||||||
|
evas_object_size_hint_weight_set(sc, 1.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(sc, -1.0, -1.0);
|
||||||
|
elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
|
||||||
|
elm_object_content_set(mb, sc);
|
||||||
|
evas_object_show(sc);
|
||||||
|
|
||||||
|
bx = elm_box_add(win);
|
||||||
|
elm_object_focus_allow_set(bx, EINA_FALSE);
|
||||||
|
evas_object_size_hint_weight_set(bx, 1.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(bx, -1.0, 0.0);
|
||||||
|
elm_box_homogeneous_set(bx, EINA_TRUE);
|
||||||
|
|
||||||
|
_fill_box(win);
|
||||||
|
|
||||||
|
elm_object_content_set(sc, bx);
|
||||||
|
evas_object_show(bx);
|
||||||
|
|
||||||
|
elm_object_part_content_set(inf->lay, "rage.list", tb);
|
||||||
|
|
||||||
|
elm_layout_signal_emit(inf->lay, "list,state,visible", "rage");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_hidden(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||||
|
{
|
||||||
|
elm_layout_signal_callback_del(obj, "list,state,hidden,finished", "rage",
|
||||||
|
_cb_hidden);
|
||||||
|
evas_object_del(tb);
|
||||||
|
tb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_list_hide(Evas_Object *win)
|
||||||
|
{
|
||||||
|
Inf *inf = evas_object_data_get(win, "inf");
|
||||||
|
|
||||||
|
if (!tb) return;
|
||||||
|
if (bring_timer) ecore_timer_del(bring_timer);
|
||||||
|
bring_timer = NULL;
|
||||||
|
elm_layout_signal_callback_add(inf->lay, "list,state,hidden,finished", "rage",
|
||||||
|
_cb_hidden, win);
|
||||||
|
elm_layout_signal_emit(inf->lay, "list,state,hidden", "rage");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_list_toggle(Evas_Object *win)
|
||||||
|
{
|
||||||
|
if (tb) win_list_hide(win);
|
||||||
|
else win_list_show(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_list_sel_update(Evas_Object *win)
|
||||||
|
{
|
||||||
|
if (!tb) return;
|
||||||
|
Inf *inf = evas_object_data_get(win, "inf");
|
||||||
|
Eina_List *items = elm_box_children_get(bx);
|
||||||
|
Eina_List *l;
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(items, l, o)
|
||||||
|
{
|
||||||
|
if (inf->file_cur == evas_object_data_get(o, "list"))
|
||||||
|
{
|
||||||
|
if (evas_object_data_get(o, "selected")) return;
|
||||||
|
_sel(o);
|
||||||
|
_bring(o);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_list_size_update(Evas_Object *win)
|
||||||
|
{
|
||||||
|
if (!tb) return;
|
||||||
|
Eina_List *items = elm_box_children_get(bx);
|
||||||
|
Eina_List *l;
|
||||||
|
Evas_Object *o;
|
||||||
|
Evas_Coord w, h, sz = 0;
|
||||||
|
|
||||||
|
elm_coords_finger_size_adjust(1, &sz, 1, &sz);
|
||||||
|
evas_object_geometry_get(win, NULL, NULL, &w, &h);
|
||||||
|
w = w / 8;
|
||||||
|
h = h / 8;
|
||||||
|
if (w < sz) w = sz;
|
||||||
|
if (h < sz) h = sz;
|
||||||
|
EINA_LIST_FOREACH(items, l, o)
|
||||||
|
{
|
||||||
|
Evas_Object *sizer = evas_object_data_get(o, "sizer");
|
||||||
|
evas_object_size_hint_min_set(sizer, w, h);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _WINLIST_H__
|
||||||
|
#define _WINLIST_H__ 1
|
||||||
|
|
||||||
|
void win_list_show(Evas_Object *win);
|
||||||
|
void win_list_hide(Evas_Object *win);
|
||||||
|
void win_list_toggle(Evas_Object *win);
|
||||||
|
void win_list_sel_update(Evas_Object *win);
|
||||||
|
void win_list_size_update(Evas_Object *win);
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,6 +2,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "winlist.h"
|
||||||
#include "winvid.h"
|
#include "winvid.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -159,3 +160,13 @@ win_video_insert(Evas_Object *win, const char *file)
|
||||||
(inf->file_list, eina_stringshare_add(file), inf->file_cur);
|
(inf->file_list, eina_stringshare_add(file), inf->file_cur);
|
||||||
evas_object_data_set(win, "file_list", inf->file_list);
|
evas_object_data_set(win, "file_list", inf->file_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_video_goto(Evas_Object *win, Eina_List *l)
|
||||||
|
{
|
||||||
|
Inf *inf = evas_object_data_get(win, "inf");
|
||||||
|
|
||||||
|
inf->file_cur = l;
|
||||||
|
win_video_restart(win);
|
||||||
|
win_list_sel_update(win);
|
||||||
|
}
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
void win_video_init(Evas_Object *win);
|
void win_video_init(Evas_Object *win);
|
||||||
void win_video_file_list_set(Evas_Object *win, Eina_List *list);
|
void win_video_file_list_set(Evas_Object *win, Eina_List *list);
|
||||||
void win_video_insert(Evas_Object *win, const char *file);
|
void win_video_insert(Evas_Object *win, const char *file);
|
||||||
|
void win_video_goto(Evas_Object *win, Eina_List *l);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue