Emotion test: New volume slider. More readable alpha text.

This commit is contained in:
Davide Andreoli 2014-02-16 15:32:59 +01:00
parent a1b8e38a5c
commit 2ed26fed59
2 changed files with 79 additions and 12 deletions

View File

@ -647,11 +647,13 @@ collections {
//
// need txt parts:
// "video_speed_txt"
// "video_volume_txt"
// "video_progress_txt"
//
// need dragables:
// "video_progress" horizontal
// "video_speed" vertical
// "video_volume" vertical
part { name: "video_swallow"; mouse_events: 0; type: SWALLOW;
description { state: "default" 0.0;
rel1 {
@ -735,24 +737,35 @@ collections {
part { name: "video_speed_txt"; type: TEXT; mouse_events: 0;
description { state: "default" 0.0;
rel1 {
to: "video_frame_bottom";
relative: 0.0 0.0;
offset: 0 8;
to: "video_frame_top";
}
rel2 {
to: "video_frame_bottom";
relative: 1.0 1.0;
offset: -1 -13;
to: "video_frame_top";
}
color: 0 0 0 255;
text {
text: "Video Speed";
font: "Sans";
size: 6;
size: 8;
align: 1.0 0.5;
};
}
}
part { name: "video_volume_txt"; type: TEXT; mouse_events: 0;
description { state: "default" 0.0;
rel1 {
to: "video_frame_top";
}
rel2 {
to: "video_frame_top";
}
color: 0 0 0 255;
text {
font: "Sans";
size: 8;
align: 0.0 0.5;
};
}
}
part { name: "video_progress_confine"; mouse_events: 0; type: RECT;
description { state: "default" 0.0;
fixed: 1 1;
@ -851,6 +864,43 @@ collections {
}
}
}
part { name: "video_volume_confine"; mouse_events: 0; type: RECT;
description { state: "default" 0.0;
rel1 {
to: "video_frame_left";
offset: 10 24;
}
rel2 {
to: "video_frame_left";
offset: 0 -48;
}
color: 0 0 0 0;
}
}
part { name: "video_volume"; mouse_events: 1;
dragable {
x: 0 0 0;
y: -1 1 0;
confine: "video_volume_confine";
}
description { state: "default" 0.0;
fixed: 1 1;
min: 24 24;
rel1 {
to: "video_volume_confine";
relative: 0.5 0.5;
offset: 0 0;
}
rel2 {
to: "video_volume_confine";
relative: 0.5 0.5;
offset: 0 0;
}
image {
normal: "knob.png";
}
}
}
part { name: "video_play"; mouse_events: 1;
description { state: "default" 0.0;
fixed: 1 1;
@ -969,6 +1019,7 @@ collections {
// "video_control" "stop"
// "drag" "video_progress"
// "drag" "video_speed"
// "drag" "video_volume"
//
// get signals:
// "video_state" "play"

View File

@ -511,10 +511,23 @@ video_obj_signal_speed_cb(void *data, Evas_Object *o, const char *emission EINA_
edje_object_part_drag_value_get(o, source, &x, &y);
spd = 255 * y;
evas_object_color_set(ov, spd, spd, spd, spd);
snprintf(buf, sizeof(buf), "%.0f", spd);
snprintf(buf, sizeof(buf), "alpha %.0f", spd);
edje_object_part_text_set(o, "video_speed_txt", buf);
}
static void
video_obj_signal_vol_cb(void *data, Evas_Object *o, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
Evas_Object *ov = data;
double vol;
char buf[256];
edje_object_part_drag_value_get(o, source, NULL, &vol);
emotion_object_audio_volume_set(ov, vol);
snprintf(buf, sizeof(buf), "vol %.2f", vol);
edje_object_part_text_set(o, "video_volume_txt", buf);
}
static void
video_obj_signal_frame_move_start_cb(void *data EINA_UNUSED, Evas_Object *o, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
@ -605,11 +618,10 @@ init_video_object(const char *module_filename, const char *filename)
return;
emotion_object_vis_set(o, vis);
if (!emotion_object_file_set(o, filename))
{
return;
}
emotion_object_last_position_load(o);
emotion_object_play_set(o, 1);
emotion_object_audio_volume_set(o, 0.5);
evas_object_move(o, 0, 0);
evas_object_resize(o, 320, 240);
emotion_object_smooth_scale_set(o, 1);
@ -659,6 +671,7 @@ init_video_object(const char *module_filename, const char *filename)
edje_object_signal_callback_add(oe, "video_control", "stop", video_obj_signal_stop_cb, o);
edje_object_signal_callback_add(oe, "drag", "video_progress", video_obj_signal_jump_cb, o);
edje_object_signal_callback_add(oe, "drag", "video_speed", video_obj_signal_speed_cb, o);
edje_object_signal_callback_add(oe, "drag", "video_volume", video_obj_signal_vol_cb, o);
edje_object_signal_callback_add(oe, "frame_move", "start", video_obj_signal_frame_move_start_cb, oe);
edje_object_signal_callback_add(oe, "frame_move", "stop", video_obj_signal_frame_move_stop_cb, oe);
@ -667,7 +680,10 @@ init_video_object(const char *module_filename, const char *filename)
edje_object_signal_callback_add(oe, "mouse,move", "*", video_obj_signal_frame_move_cb, oe);
edje_object_part_drag_value_set(oe, "video_speed", 0.0, 1.0);
edje_object_part_text_set(oe, "video_speed_txt", "255");
edje_object_part_text_set(oe, "video_speed_txt", "alpha 255");
edje_object_part_drag_value_set(oe, "video_volume", 0.0, 0.5);
edje_object_part_text_set(oe, "video_volume_txt", "vol 0.50");
edje_object_signal_emit(o, "video_state", "play");