Commit d9d82c67 authored by Luis de Bethencourt's avatar Luis de Bethencourt

ui: add fullscreen button

parent c6f69e3e
......@@ -4,6 +4,7 @@ icons_DATA = \
audio-stream-toggle.png \
audio-volume-high.svg \
audio-volume-low.svg \
fullscreen.svg \
media-actions-pause.svg \
media-actions-start.svg \
subtitles-active.svg \
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
<g id="Layer_2">
</g>
<path opacity="0.75" fill="#FFFFFF" enable-background="new " d="M17.605,1H2.395C0.991,1,0,1.956,0,3.4v13.203
c0,1.331,0.916,2.398,2.394,2.398h15.212c1.441,0,2.395-1.18,2.395-2.398V3.4C20.002,1.994,18.973,1,17.605,1z M7.085,15.17
l1.599,1.604c0.044,0.043,0.056,0.107,0.032,0.165c-0.023,0.057-0.078,0.095-0.141,0.095H2.989v-5.256
c0-0.062,0.037-0.115,0.094-0.14c0.057-0.023,0.121-0.011,0.164,0.032l1.399,1.401c0.078,0.077,0.205,0.077,0.281,0l3.536-3.573
l1.976,2.012L7.085,14.89C7.007,14.967,7.007,15.093,7.085,15.17z M16.963,8.691c0,0.062-0.037,0.118-0.094,0.142
s-0.123,0.011-0.166-0.033l-1.561-1.695c-0.078-0.077-0.205-0.077-0.281,0l-3.443,3.393L9.481,8.486l3.365-3.31
c0.078-0.077,0.078-0.202,0-0.281l-1.611-1.604c-0.043-0.043-0.057-0.107-0.031-0.165c0.023-0.057,0.08-0.094,0.141-0.094h5.621
v5.658H16.963z"/>
<path opacity="0.65" fill="#FFFFFF" enable-background="new " d="M17.602,1.002H2.4C0.993,1.002,0,1.954,0,3.398v1
c0-1.444,0.993-2.396,2.4-2.396h15.2c1.371,0,2.4,0.99,2.4,2.396v-1C20,1.992,18.971,1.002,17.602,1.002z"/>
<path opacity="0.25" enable-background="new " d="M17.586,19H2.416c-1.479,0-2.396-1.068-2.396-2.399v1
C0.02,18.933,0.936,20,2.416,20h15.17c1.441,0,2.396-1.181,2.396-2.399v-1C19.982,17.819,19.027,19,17.586,19z"/>
<path opacity="0.65" fill="#FFFFFF" enable-background="new " d="M2.975,18.034h5.598c0.062,0,0.117-0.037,0.141-0.095
c0.024-0.057,0.012-0.121-0.033-0.166l-0.739-0.739H2.975V18.034z"/>
<path opacity="0.65" fill="#FFFFFF" enable-background="new " d="M16.715,8.8L15.15,7.105c-0.078-0.077-0.205-0.077-0.281,0
l-3.449,3.393L9.975,9.001L9.479,9.487l1.941,2.011l3.449-3.393c0.076-0.077,0.203-0.077,0.281,0L16.715,9.8
c0.043,0.044,0.109,0.057,0.166,0.033s0.094-0.079,0.094-0.141v-1c0,0.062-0.037,0.117-0.094,0.141S16.758,8.844,16.715,8.8z"/>
<path opacity="0.65" fill="#FFFFFF" enable-background="new " d="M7.078,15.171l0.358,0.358l3.001-3.019l-0.494-0.503
l-2.865,2.883C7,14.968,7,15.094,7.078,15.171z"/>
</svg>
......@@ -32,6 +32,7 @@ ui->control_box (fixed alignment bin)
ui->audio_stream_toggle
]
ui->subtitle_toggle
ui->fullscreen_button
]
]
]
......
......@@ -237,7 +237,7 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
case CLUTTER_F:
case CLUTTER_F11:
{
// Fullscreen button
// Fullscreen keys
toggle_fullscreen (ui);
handled = TRUE;
......@@ -506,6 +506,10 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
show_controls (ui, FALSE);
}
} else if (actor == ui->fullscreen_button) {
// Fullscreen button
toggle_fullscreen (ui);
} else if (actor == ui->audio_stream_toggle) {
cycle_streams (ui->engine, STREAM_AUDIO);
......@@ -566,7 +570,7 @@ static void
load_controls (UserInterface * ui)
{
// Check icon files exist
gchar *icon_files[8];
gchar *icon_files[9];
gchar *duration_str = NULL;
gint c;
gfloat pos;
......@@ -588,6 +592,7 @@ load_controls (UserInterface * ui)
"audio-volume-low.svg", NULL);
ui->volume_high_png = g_build_filename (ui->data_dir,
"audio-volume-high.svg", NULL);
ui->fullscreen_svg = g_build_filename (ui->data_dir, "fullscreen.svg", NULL);
ui->subtitle_active_png = g_build_filename (ui->data_dir,
"subtitles-active.svg", NULL);
ui->subtitle_inactive_png = g_build_filename (ui->data_dir,
......@@ -601,12 +606,13 @@ load_controls (UserInterface * ui)
icon_files[1] = ui->pause_png;
icon_files[2] = ui->volume_low_png;
icon_files[3] = ui->volume_high_png;
icon_files[4] = ui->subtitle_active_png;
icon_files[5] = ui->subtitle_inactive_png;
icon_files[6] = ui->video_stream_toggle_png;
icon_files[7] = ui->audio_stream_toggle_png;
icon_files[4] = ui->fullscreen_svg;
icon_files[5] = ui->subtitle_active_png;
icon_files[6] = ui->subtitle_inactive_png;
icon_files[7] = ui->video_stream_toggle_png;
icon_files[8] = ui->audio_stream_toggle_png;
for (c = 0; c < 8; c++) {
for (c = 0; c < 9; c++) {
if (!g_file_test (icon_files[c], G_FILE_TEST_EXISTS)) {
g_print ("Icon file doesn't exist, are you sure you have "
" installed snappy correctly?\nThis file needed is: %s\n",
......@@ -862,6 +868,24 @@ load_controls (UserInterface * ui)
CLUTTER_BOX_ALIGNMENT_CENTER, /* x-align */
CLUTTER_BOX_ALIGNMENT_START); /* y-align */
// Controls fullscreen
ui->fullscreen_button = gtk_clutter_texture_new ();
gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE
(ui->fullscreen_button),
gdk_pixbuf_new_from_file (ui->fullscreen_svg, NULL), &error);
if (!ui->fullscreen_button && error)
g_debug ("Clutter error: %s", error->message);
if (error) {
g_error_free (error);
error = NULL;
}
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (ui->info_box_layout), ui->fullscreen_button, FALSE, /* expand */
FALSE, /* x-fill */
FALSE, /* y-fill */
CLUTTER_BOX_ALIGNMENT_CENTER, /* x-align */
CLUTTER_BOX_ALIGNMENT_START); /* y-align */
// Add Info Box to Main Box Layout
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (ui->main_box_layout), ui->info_box, FALSE, /* expand */
FALSE, /* x-fill */
FALSE, /* y-fill */
......@@ -1149,9 +1173,9 @@ update_controls_size (UserInterface * ui)
icon_size = ctl_height * PLAY_TOGGLE_RATIO;
if (ui->subtitles_available) {
control_box_width = ctl_width + (icon_size * 0.72f);
control_box_width = ctl_width + (icon_size * 2.0f);
} else {
control_box_width = ctl_width;
control_box_width = ctl_width + (icon_size);
}
control_box_height = ctl_height * 0.85;
......@@ -1196,7 +1220,8 @@ update_controls_size (UserInterface * ui)
icon_size = ctl_height * VOLUME_ICON_RATIO;
clutter_actor_set_size (ui->volume_low, icon_size, icon_size);
clutter_actor_set_size (ui->volume_high, icon_size * 1.2f, icon_size); /* originally 24x24 */
clutter_actor_set_size (ui->volume_high, icon_size * 1.2f, icon_size);
clutter_actor_set_size (ui->fullscreen_button, icon_size, icon_size);
clutter_actor_set_size (ui->subtitle_toggle, icon_size * 1.4f, icon_size);
clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (ui->middle_box_layout),
......
......@@ -88,6 +88,7 @@ struct _UserInterface
gchar *play_png, *pause_png;
gchar *segment_png;
gchar *volume_low_png, *volume_high_png;
gchar *fullscreen_svg;
gchar *subtitle_active_png, *subtitle_inactive_png;
gchar *video_stream_toggle_png, *audio_stream_toggle_png;
gchar *data_dir;
......@@ -108,6 +109,7 @@ struct _UserInterface
ClutterActor *control_pos;
ClutterActor *volume_box;
ClutterActor *volume_low, *volume_high;
ClutterActor *fullscreen_button;
ClutterActor *subtitle_toggle;
ClutterActor *video_stream_toggle, *audio_stream_toggle;
ClutterActor *vol_int, *vol_int_bg, *volume_point;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment