From: Antoine Lejeune Date: Fri, 27 Jun 2008 16:55:15 +0000 (+0200) Subject: A new GUI for Maemo based on Hildon framework X-Git-Tag: 1.0.0-pre1~2173 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=374571ac06c8bfbf4816cf130637bd20f9c3baf9;p=vlc A new GUI for Maemo based on Hildon framework Signed-off-by: RĂ©mi Denis-Courmont --- diff --git a/Makefile.am b/Makefile.am index a93e38fb3b..eef7106fd4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -358,7 +358,7 @@ endif # Building aliases ############################################################################### -ALL_ALIASES = cvlc rvlc svlc wxvlc qvlc nvlc +ALL_ALIASES = cvlc rvlc svlc wxvlc qvlc nvlc mvlc bin_SCRIPTS = $(ALIASES) CLEANFILES += $(ALIASES) $(noinst_SCRIPTS) EXTRA_SCRIPTS = $(ALL_ALIASES) @@ -385,6 +385,9 @@ qvlc: make-alias nvlc: make-alias $(MKALIAS) ncurses +mvlc: make-alias + $(MKALIAS) maemo + if BUILD_VLC noinst_SCRIPTS += vlc$(EXEEXT) endif diff --git a/configure.ac b/configure.ac index 36ad4144ce..285d7ef94b 100644 --- a/configure.ac +++ b/configure.ac @@ -4848,6 +4848,28 @@ then fi AM_CONDITIONAL(BUILD_PDA, [test "${enable_pda}" = "yes"]) +dnl +dnl Maemo +dnl +AC_ARG_ENABLE(maemo, + [ --enable-maemo Internet tablets based on Maemo SDK (default disabled)]) +if test "${enable_maemo}" != "no" +then + PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [ + VLC_ADD_CFLAGS([maemo],[${HILDON_CFLAGS}]) + VLC_ADD_LIBS([maemo],[${HILDON_LIBS}]) + VLC_ADD_PLUGIN([maemo]) + AC_DEFINE([BUILD_MAEMO], 1, [Define if you're using Maemo interfaces]) + ALIASES="${ALIASES} mvlc" + ], [ + AS_IF([test "${enable_maemo}" = "yes"],[ + AC_MSG_ERROR([Hildon libraries not found]) + ]) + enable_maemo="no" + ]) +fi +AM_CONDITIONAL(BUILD_MAEMO, [test "${enable_maemo}" = "yes"]) + dnl dnl QT 4 dnl @@ -5796,6 +5818,7 @@ AC_CONFIG_FILES([ modules/gui/beos/Makefile modules/gui/pda/Makefile modules/gui/macosx/Makefile + modules/gui/maemo/Makefile modules/gui/minimal_macosx/Makefile modules/gui/qnx/Makefile modules/gui/qt4/Makefile diff --git a/modules/gui/Modules.am b/modules/gui/Modules.am index d8cf7d7d11..5d1015e288 100644 --- a/modules/gui/Modules.am +++ b/modules/gui/Modules.am @@ -1,4 +1,4 @@ -DIST_SUBDIRS = beos macosx minimal_macosx pda qnx qt4 skins2 wince +DIST_SUBDIRS = beos macosx maemo minimal_macosx pda qnx qt4 skins2 wince SUBDIRS = if HAVE_BEOS @@ -7,6 +7,9 @@ endif if HAVE_DARWIN SUBDIRS += macosx minimal_macosx endif +if BUILD_MAEMO +SUBDIRS += maemo +endif if BUILD_PDA SUBDIRS += pda endif diff --git a/modules/gui/maemo/Modules.am b/modules/gui/maemo/Modules.am new file mode 100644 index 0000000000..8a4cb70da2 --- /dev/null +++ b/modules/gui/maemo/Modules.am @@ -0,0 +1,8 @@ +SOURCES_maemo = maemo.c \ + maemo.h \ + maemo_callbacks.c \ + maemo_callbacks.h \ + maemo_input.c \ + maemo_input.h \ + maemo_interface.c \ + maemo_interface.h diff --git a/modules/gui/maemo/maemo.c b/modules/gui/maemo/maemo.c new file mode 100644 index 0000000000..adde4e119a --- /dev/null +++ b/modules/gui/maemo/maemo.c @@ -0,0 +1,378 @@ +/***************************************************************************** +* maemo.c : Maemo plugin for VLC +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "maemo.h" +#include "maemo_callbacks.h" +#include "maemo_input.h" +#include "maemo_interface.h" + +/***************************************************************************** + * Local prototypes. + *****************************************************************************/ +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); +static void Run ( intf_thread_t * ); +static gboolean should_die ( gpointer ); +static int OpenWindow ( vlc_object_t * ); +static void CloseWindow ( vlc_object_t * ); +static int ControlWindow ( vout_window_t *, int, va_list ); +static void* request_video ( intf_thread_t *, vout_thread_t * ); +static void release_video ( intf_thread_t * ); +static gboolean video_widget_ready ( gpointer data ); + +/***************************************************************************** +* Module descriptor +*****************************************************************************/ +vlc_module_begin(); + set_shortname( "Maemo" ); + set_description( N_("Maemo hildon interface") ); + set_category( CAT_INTERFACE ); + set_subcategory( SUBCAT_INTERFACE_MAIN ); + set_capability( "interface", 70 ); + set_callbacks( Open, Close ); + add_shortcut( "maemo" ); + + add_submodule(); + set_capability( "vout window", 50 ); + set_callbacks( OpenWindow, CloseWindow ); +vlc_module_end(); + +/***************************************************************************** + * Module callbacks + *****************************************************************************/ +static int Open( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + + /* Allocate instance and initialize some members */ + p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); + if( p_intf->p_sys == NULL ) + { + msg_Err( p_intf, "out of memory" ); + return VLC_ENOMEM; + } + + p_intf->pf_run = Run; + + p_intf->p_sys->p_playlist = pl_Hold( p_intf ); + p_intf->p_sys->p_input = NULL; + p_intf->p_sys->p_vout = NULL; + + p_intf->p_sys->p_main_window = NULL; + p_intf->p_sys->p_video_window = NULL; + + vlc_spin_init( &p_intf->p_sys->event_lock ); + vlc_mutex_init( &p_intf->p_sys->p_video_mutex ); + vlc_cond_init( &p_intf->p_sys->p_video_cond ); + + return VLC_SUCCESS; +} + +static void Close( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + + vlc_object_release( p_intf->p_sys->p_playlist ); + + vlc_spin_destroy( &p_intf->p_sys->event_lock ); + + /* Destroy structure */ + free( p_intf->p_sys ); +} + +/***************************************************************************** +* Initialize and launch the interface +*****************************************************************************/ +static void Run( intf_thread_t *p_intf ) +{ + char *p_args[] = { "", NULL }; + char **pp_args = p_args; + int i_args = 1; + + HildonProgram *program; + HildonWindow *window; + GtkWidget *main_vbox; + + GtkWidget *tabs; + GtkWidget *video; + GtkWidget *bottom_hbox; + GtkWidget *play_button; + GtkWidget *prev_button; + GtkWidget *next_button; + GtkWidget *stop_button; + GtkWidget *seekbar; + + gtk_init( &i_args, &pp_args ); + + program = HILDON_PROGRAM( hildon_program_get_instance() ); + g_set_application_name( "VLC Media Player" ); + + window = HILDON_WINDOW( hildon_window_new() ); + hildon_program_add_window( program, window ); + gtk_object_set_data( GTK_OBJECT( window ), + "p_intf", p_intf ); + p_intf->p_sys->p_main_window = window; + + // A little theming + char *psz_rc_file = NULL; + if( asprintf( &psz_rc_file, "%s/maemo/vlc_intf.rc", + config_GetDataDir() ) != -1 ) + { + gtk_rc_parse( psz_rc_file ); + free( psz_rc_file ); + } + + // We create the main vertical box + main_vbox = gtk_vbox_new( FALSE, 0 ); + gtk_container_add( GTK_CONTAINER( window ), main_vbox ); + + tabs = gtk_notebook_new(); + p_intf->p_sys->p_tabs = tabs; + gtk_notebook_set_tab_pos( GTK_NOTEBOOK( tabs ), GTK_POS_LEFT ); + gtk_notebook_set_show_border( GTK_NOTEBOOK( tabs ), FALSE ); + gtk_box_pack_start( GTK_BOX( main_vbox ), tabs, TRUE, TRUE, 0 ); + + // We put first the embedded video + video = gtk_event_box_new(); + gtk_notebook_append_page( GTK_NOTEBOOK( tabs ), + video, + gtk_image_new_from_stock( "vlc", + GTK_ICON_SIZE_DIALOG ) ); + gtk_notebook_set_tab_label_packing( GTK_NOTEBOOK( tabs ), + video, + FALSE, FALSE, 0 ); + create_playlist( p_intf ); + + // We put the horizontal box which contains all the buttons + bottom_hbox = gtk_hbox_new( FALSE, 0 ); + + // We create the buttons + play_button = gtk_button_new(); + gtk_button_set_image( GTK_BUTTON( play_button ), + gtk_image_new_from_stock( "vlc-play", GTK_ICON_SIZE_BUTTON ) ); + gtk_widget_set_size_request( play_button, 60, 60); + p_intf->p_sys->p_play_button = play_button; + stop_button = gtk_button_new(); + gtk_button_set_image( GTK_BUTTON( stop_button ), + gtk_image_new_from_stock( "vlc-stop", GTK_ICON_SIZE_BUTTON ) ); + prev_button = gtk_button_new(); + gtk_button_set_image( GTK_BUTTON( prev_button ), + gtk_image_new_from_stock( "vlc-previous", GTK_ICON_SIZE_BUTTON ) ); + next_button = gtk_button_new(); + gtk_button_set_image( GTK_BUTTON( next_button ), + gtk_image_new_from_stock( "vlc-next", GTK_ICON_SIZE_BUTTON ) ); + seekbar = hildon_seekbar_new(); + p_intf->p_sys->p_seekbar = HILDON_SEEKBAR( seekbar ); + + // We add them to the hbox + gtk_box_pack_start( GTK_BOX( bottom_hbox ), play_button, FALSE, FALSE, 5 ); + gtk_box_pack_start( GTK_BOX( bottom_hbox ), stop_button, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( bottom_hbox ), prev_button, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( bottom_hbox ), next_button, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( bottom_hbox ), seekbar , TRUE , TRUE , 5 ); + // We add the hbox to the main vbox + gtk_box_pack_start( GTK_BOX( main_vbox ), bottom_hbox, FALSE, FALSE, 0 ); + + g_signal_connect( window, "delete_event", + G_CALLBACK( delete_event_cb ), NULL ); + g_signal_connect( play_button, "clicked", G_CALLBACK( play_cb ), NULL ); + g_signal_connect( stop_button, "clicked", G_CALLBACK( stop_cb ), NULL ); + g_signal_connect( prev_button, "clicked", G_CALLBACK( prev_cb ), NULL ); + g_signal_connect( next_button, "clicked", G_CALLBACK( next_cb ), NULL ); + g_signal_connect( seekbar, "change-value", + G_CALLBACK( seekbar_changed_cb ), NULL ); + + gtk_widget_show_all( GTK_WIDGET( window ) ); + + create_menu( p_intf ); + + // Set callback with the vlc core + g_timeout_add( INTF_IDLE_SLEEP / 1000, process_events, p_intf ); + g_timeout_add( 150 /* miliseconds */, should_die, p_intf ); + var_AddCallback( p_intf->p_sys->p_playlist, "item-change", + item_changed_cb, p_intf ); + var_AddCallback( p_intf->p_sys->p_playlist, "playlist-current", + playlist_current_cb, p_intf ); + var_AddCallback( p_intf->p_sys->p_playlist, "activity", + activity_cb, p_intf ); + + // Look if the playlist is already started + item_changed_pl( p_intf ); + + // The embedded video is only ready after gtk_main and windows are shown + g_idle_add( video_widget_ready, video ); + + gtk_main(); + + delete_input( p_intf ); + var_DelCallback( p_intf->p_sys->p_playlist, "item-change", + item_changed_cb, p_intf ); + var_DelCallback( p_intf->p_sys->p_playlist, "playlist-current", + playlist_current_cb, p_intf ); + var_DelCallback( p_intf->p_sys->p_playlist, "activity", + activity_cb, p_intf ); + + // Asking the vout to close + vout_thread_t *p_vout = p_intf->p_sys->p_vout; + + if( p_vout ) + { + if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS ) + vout_Control( p_vout, VOUT_REPARENT, 0 ); + vlc_object_release( p_vout ); + } + + gtk_object_destroy( GTK_OBJECT( window ) ); +} + +static gboolean should_die( gpointer data ) +{ + intf_thread_t *p_intf = (intf_thread_t *)data; + if( !vlc_object_alive( p_intf ) ) + gtk_main_quit(); + return TRUE; +} + +/** +* Video output window provider +*/ +static int OpenWindow (vlc_object_t *obj) +{ + vout_window_t *wnd = (vout_window_t *)obj; + + /* TODO: should probably be in the libvlc core instead: */ + if (!config_GetInt (obj, "embedded-video")) + return VLC_EGENERIC; + + intf_thread_t *intf = (intf_thread_t *) + vlc_object_find_name (obj, "maemo", FIND_ANYWHERE); + if (intf == NULL) + { + msg_Err( obj, "Maemo interface not found" ); + return VLC_EGENERIC; /* Maemo not in use */ + } + assert (intf->i_object_type == VLC_OBJECT_INTF); + + wnd->handle = request_video( intf, wnd->vout ); + msg_Dbg( intf, "Using handle %p", wnd->handle ); + + wnd->control = ControlWindow; + wnd->p_private = intf; + + // Signaling that the window is not at the requested sizeof + int i_width, i_height, i_x_top, i_y_top, i_x, i_y; + gdk_drawable_get_size( GDK_DRAWABLE( intf->p_sys->p_video_window->window ), + &i_width, &i_height ); + gdk_window_get_position( GTK_WIDGET(intf->p_sys->p_main_window)->window, + &i_x_top, &i_y_top ); + gdk_window_get_position( intf->p_sys->p_video_window->window, &i_x, &i_y ); + + wnd->width = i_width; + wnd->height = i_height; + wnd->pos_x = i_x_top + i_x; + wnd->pos_y = i_y_top + i_y; + + return VLC_SUCCESS; +} + +static int ControlWindow (vout_window_t *wnd, int query, va_list args) +{ + (void)wnd; (void)query; (void)args; + return VLC_EGENERIC; +} + +static void CloseWindow (vlc_object_t *obj) +{ + intf_thread_t *intf = (intf_thread_t *)obj->p_private; + + release_video( intf ); + vlc_object_release (intf); +} + +static void *request_video( intf_thread_t *p_intf, vout_thread_t *p_nvout ) +{ + if( p_intf->p_sys->p_vout ) + { + msg_Dbg( p_intf, "Embedded video already in use" ); + return NULL; + } + + vlc_mutex_lock( &p_intf->p_sys->p_video_mutex ); + mutex_cleanup_push( &p_intf->p_sys->p_video_mutex ); + + // We wait until the p_video_window is set + while( p_intf->p_sys->p_video_window == NULL ) + vlc_cond_wait( &p_intf->p_sys->p_video_cond, + &p_intf->p_sys->p_video_mutex ); + + vlc_cleanup_run(); + + p_intf->p_sys->p_vout = p_nvout; + return ( void * )GDK_WINDOW_XID( p_intf->p_sys->p_video_window->window ); +} + +static void release_video( intf_thread_t *p_intf ) +{ + msg_Dbg( p_intf, "Releasing embedded video" ); + p_intf->p_sys->p_vout = NULL; +} + +static gboolean video_widget_ready( gpointer data ) +{ + intf_thread_t *p_intf = NULL; + GtkWidget *top_window = NULL; + GtkWidget *video = (GtkWidget *)data; + + top_window = gtk_widget_get_toplevel( GTK_WIDGET( video ) ); + p_intf = (intf_thread_t *)gtk_object_get_data( GTK_OBJECT( top_window ), + "p_intf" ); + p_intf->p_sys->p_video_window = video; + gtk_widget_grab_focus( video ); + + vlc_cond_signal( &p_intf->p_sys->p_video_cond ); + + // We rewind the input + if( p_intf->p_sys->p_input ) + { + input_Control( p_intf->p_sys->p_input, INPUT_SET_POSITION, 0.0 ); + } + + // We want it to be executed only one time + return FALSE; +} diff --git a/modules/gui/maemo/maemo.h b/modules/gui/maemo/maemo.h new file mode 100644 index 0000000000..011a81b9b4 --- /dev/null +++ b/modules/gui/maemo/maemo.h @@ -0,0 +1,52 @@ +/***************************************************************************** + * maemo.h: private Maemo Interface Description + ***************************************************************************** + * Copyright (C) 2008 the VideoLAN team + * $Id$ + * + * Authors: Antoine Lejeune + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include + +struct intf_sys_t +{ + playlist_t *p_playlist; + input_thread_t *p_input; + + HildonWindow *p_main_window; + HildonSeekbar *p_seekbar; + GtkWidget *p_tabs; + GtkWidget *p_play_button; + + GtkWidget *p_playlist_store; + + int i_event; + vlc_spinlock_t event_lock; + + GtkWidget *p_video_window; + vout_thread_t *p_vout; + vlc_cond_t p_video_cond; + vlc_mutex_t p_video_mutex; +}; diff --git a/modules/gui/maemo/maemo_callbacks.c b/modules/gui/maemo/maemo_callbacks.c new file mode 100644 index 0000000000..e89aa66be3 --- /dev/null +++ b/modules/gui/maemo/maemo_callbacks.c @@ -0,0 +1,249 @@ +/***************************************************************************** +* maemo_callbacks.c : Callbacks for the maemo plugin. +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#include + +#include "maemo.h" +#include "maemo_callbacks.h" + +/* + * Function used to retrieve an intf_thread_t object from a GtkWidget + */ +static intf_thread_t *get_intf_from_widget( GtkWidget *widget ) +{ + if( GTK_IS_MENU_ITEM( widget ) ) + { + /* Look for a GTK_MENU */ + while( widget->parent && !GTK_IS_MENU( widget ) ) + { + widget = widget->parent; + } + + widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) ); + } + widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) ); + return (intf_thread_t *)gtk_object_get_data( GTK_OBJECT( widget ), + "p_intf" ); +} + +gboolean delete_event_cb( GtkWidget *widget, + GdkEvent *event, + gpointer user_data ) +{ + (void)event; (void)user_data; + intf_thread_t *p_intf = get_intf_from_widget( widget ); + + vlc_mutex_lock( &p_intf->change_lock ); + vlc_object_kill( p_intf->p_libvlc ); + vlc_mutex_unlock( &p_intf->change_lock ); + + gtk_main_quit(); + + return TRUE; +} + +void play_cb( GtkButton *button, gpointer user_data ) +{ + (void)user_data; + intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); + + // If there is no input, we ask the playlist to play + if( p_intf->p_sys->p_input == NULL ) + { + playlist_Play( p_intf->p_sys->p_playlist ); + return; + } + + // If there is an input, we toggle its state + vlc_value_t state; + var_Get( p_intf->p_sys->p_input, "state", &state ); + state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S; + var_Set( p_intf->p_sys->p_input, "state", state ); +} + +void stop_cb( GtkButton *button, gpointer user_data ) +{ + (void)user_data; + intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); + playlist_Stop( p_intf->p_sys->p_playlist ); +} + +void prev_cb( GtkButton *button, gpointer user_data ) +{ + (void)user_data; + intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); + playlist_Prev( p_intf->p_sys->p_playlist ); +} + +void next_cb( GtkButton *button, gpointer user_data ) +{ + (void)user_data; + intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) ); + playlist_Next( p_intf->p_sys->p_playlist ); +} + +void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll, + gdouble value, gpointer data ) +{ + (void)scroll; (void)data; + intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( range ) ); + if( p_intf->p_sys->p_input ) + { + int i_length = hildon_seekbar_get_total_time( p_intf->p_sys->p_seekbar ); + var_SetFloat( p_intf->p_sys->p_input, "position", (float)(value/i_length) ); + } +} + +void pl_row_activated_cb( GtkTreeView *tree_view , GtkTreePath *path, + GtkTreeViewColumn *column, gpointer user_data ) +{ + (void)column; (void)user_data; + intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( tree_view ) ); + input_item_t *p_input; + GtkTreeModel *model = gtk_tree_view_get_model( tree_view ); + GtkTreeIter iter; + gchar *filename = NULL; + + gtk_tree_model_get_iter( model, &iter, path ); + gtk_tree_model_get( model, &iter, 0, &filename, -1 ); + + gtk_notebook_set_current_page( GTK_NOTEBOOK( p_intf->p_sys->p_tabs ), 0 ); + + p_input = input_item_New( p_intf, filename, NULL ); + playlist_AddInput( p_intf->p_sys->p_playlist, p_input, + PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true, false ); + vlc_gc_decref( p_input ); +} + +void open_cb( GtkMenuItem *menuitem, gpointer user_data ) +{ + (void)menuitem; + intf_thread_t *p_intf = (intf_thread_t *)user_data; + input_item_t *p_input; + GtkWidget *dialog; + char *psz_filename = NULL; + + dialog = hildon_file_chooser_dialog_new( GTK_WINDOW( p_intf->p_sys->p_main_window ), + GTK_FILE_CHOOSER_ACTION_OPEN ); + gtk_widget_show_all( GTK_WIDGET( dialog ) ); + + if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_OK ) + { + psz_filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); + } + else + { + gtk_widget_destroy( dialog ); + return; + } + + gtk_widget_destroy( dialog ); + + p_input = input_item_New( p_intf, psz_filename, NULL ); + playlist_AddInput( p_intf->p_sys->p_playlist, p_input, + PLAYLIST_APPEND | PLAYLIST_GO, + PLAYLIST_END, true, false ); + vlc_gc_decref( p_input ); +} + +void open_address_cb( GtkMenuItem *menuitem, gpointer user_data ) +{ + (void)menuitem; + intf_thread_t *p_intf = (intf_thread_t *)user_data; + input_item_t *p_input; + GtkWidget *dialog, *hbox, *label, *entry; + + dialog = gtk_dialog_new_with_buttons( "Open Address", + GTK_WINDOW( p_intf->p_sys->p_main_window ), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL ); + label = gtk_label_new( "Address :" ); + entry = gtk_entry_new(); + gtk_entry_set_width_chars( GTK_ENTRY( entry ), 30 ); + hbox = gtk_hbox_new( FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 ); + gtk_container_add( GTK_CONTAINER( GTK_DIALOG( dialog )->vbox ), hbox ); + + gtk_widget_show_all( dialog ); + if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_CANCEL ) + { + gtk_widget_destroy( dialog ); + return; + } + + p_input = input_item_New( p_intf, + gtk_entry_get_text( GTK_ENTRY( entry ) ), + NULL ); + playlist_AddInput( p_intf->p_sys->p_playlist, p_input, + PLAYLIST_APPEND | PLAYLIST_GO, + PLAYLIST_END, true, false ); + vlc_gc_decref( p_input ); + + gtk_widget_destroy( dialog ); +} + +void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data ) +{ + (void)menuitem; + intf_thread_t *p_intf = (intf_thread_t *)user_data; + input_item_t *p_input; + + p_input = input_item_New( p_intf, "v4l2://", NULL ); + playlist_AddInput( p_intf->p_sys->p_playlist, p_input, + PLAYLIST_APPEND | PLAYLIST_GO, + PLAYLIST_END, true, false ); + vlc_gc_decref( p_input ); +} + +void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data ) +{ + (void)menuitem; + intf_thread_t *p_intf = (intf_thread_t *)user_data; + + if( !p_intf->p_sys->p_vout ) + { + hildon_banner_show_information( + GTK_WIDGET( p_intf->p_sys->p_main_window ), + "gtk-dialog-error", + "There is no video" ); + return; + } + + vout_Control( p_intf->p_sys->p_vout, VOUT_SNAPSHOT ); + hildon_banner_show_information( GTK_WIDGET( p_intf->p_sys->p_main_window ), + NULL, + "Snapshot taken" ); +} + +void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data ) +{ + intf_thread_t *p_intf = (intf_thread_t *)user_data; + + if( gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM( menuitem ) ) ) + config_PutInt( p_intf, "ffmpeg-skip-frame", 1 ); + else + config_PutInt( p_intf, "ffmpeg-skip-frame", 0 ); +} diff --git a/modules/gui/maemo/maemo_callbacks.h b/modules/gui/maemo/maemo_callbacks.h new file mode 100644 index 0000000000..84e7550c99 --- /dev/null +++ b/modules/gui/maemo/maemo_callbacks.h @@ -0,0 +1,48 @@ +/***************************************************************************** +* maemo_callbacks.h : Callbacks header file for the maemo plugin. +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#include + +#include +#include + +gboolean delete_event_cb( GtkWidget *widget, + GdkEvent *event, + gpointer user_data ); + +void play_cb( GtkButton *button, gpointer user_data ); +void stop_cb( GtkButton *button, gpointer user_data ); +void prev_cb( GtkButton *button, gpointer user_data ); +void next_cb( GtkButton *button, gpointer user_data ); +void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll, + gdouble value, gpointer data ); + +void pl_row_activated_cb( GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *, + gpointer ); + +void open_cb( GtkMenuItem *menuitem, gpointer user_data ); +void open_address_cb( GtkMenuItem *menuitem, gpointer user_data ); +void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data ); + +void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data ); +void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data ); diff --git a/modules/gui/maemo/maemo_input.c b/modules/gui/maemo/maemo_input.c new file mode 100644 index 0000000000..d7ebf2988c --- /dev/null +++ b/modules/gui/maemo/maemo_input.c @@ -0,0 +1,189 @@ +/***************************************************************************** +* maemo_input.c : Input handling for the maemo plugin +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "maemo.h" +#include "maemo_input.h" + +gboolean process_events( gpointer data ) +{ + intf_thread_t *p_intf = (intf_thread_t *)data; + vlc_spin_lock( &p_intf->p_sys->event_lock ); + + int i_event = p_intf->p_sys->i_event; + p_intf->p_sys->i_event = 0; + + vlc_spin_unlock( &p_intf->p_sys->event_lock ); + if( i_event ) + { + if( i_event & EVENT_PLAYLIST_CURRENT ) + item_changed_pl( p_intf ); + if( i_event & EVENT_ACTIVITY ) + item_changed_pl( p_intf ); + if( i_event & EVENT_ITEM_CHANGED ) + item_changed( p_intf ); + if( i_event & EVENT_INTF_CHANGED ) + update_position( p_intf ); + } + + return TRUE; +} + +void set_input( intf_thread_t *p_intf, input_thread_t *p_input ) +{ + if( p_input && !( p_input->b_die || p_input->b_dead ) ) + { + p_intf->p_sys->p_input = p_input; + vlc_object_hold( p_input ); + var_AddCallback( p_input, "intf-change", interface_changed_cb, p_intf ); + var_AddCallback( p_input, "state", item_changed_cb, p_intf ); + + // "Activate" the seekbar + gtk_widget_set_sensitive( GTK_WIDGET( p_intf->p_sys->p_seekbar ), TRUE ); + } + else + p_intf->p_sys->p_input = NULL; +} + +void delete_input( intf_thread_t *p_intf ) +{ + if( p_intf->p_sys->p_input ) + { + var_DelCallback( p_intf->p_sys->p_input, "intf-change", + interface_changed_cb, p_intf ); + var_DelCallback( p_intf->p_sys->p_input, "state", + item_changed_cb, p_intf ); + vlc_object_release( p_intf->p_sys->p_input ); + p_intf->p_sys->p_input = NULL; + + // Reset the seekbar + hildon_seekbar_set_position( p_intf->p_sys->p_seekbar, 0 ); + gtk_widget_set_sensitive( GTK_WIDGET( p_intf->p_sys->p_seekbar ), FALSE ); + } +} + +void item_changed_pl( intf_thread_t *p_intf ) +{ + vlc_mutex_lock( &p_intf->change_lock ); + if( p_intf->p_sys->p_input && + ( p_intf->p_sys->p_input->b_dead || p_intf->p_sys->p_input->b_die ) ) + { + delete_input( p_intf ); + vlc_mutex_unlock( &p_intf->change_lock ); + return; + } + + if( !p_intf->p_sys->p_input ) + { + set_input( p_intf, playlist_CurrentInput( p_intf->p_sys->p_playlist ) ); + } + vlc_mutex_unlock( &p_intf->change_lock ); + return; +} + +int playlist_current_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ) +{ + (void)p_this; (void)psz_var; (void)oldval; (void)newval; + intf_thread_t *p_intf = (intf_thread_t *)param; + vlc_spin_lock( &p_intf->p_sys->event_lock ); + + p_intf->p_sys->i_event |= EVENT_PLAYLIST_CURRENT; + + vlc_spin_unlock( &p_intf->p_sys->event_lock ); + return VLC_SUCCESS; +} + +int activity_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ) +{ + (void)p_this; (void)psz_var; (void)oldval; (void)newval; + intf_thread_t *p_intf = (intf_thread_t *)param; + vlc_spin_lock( &p_intf->p_sys->event_lock ); + + p_intf->p_sys->i_event |= EVENT_ACTIVITY; + + vlc_spin_unlock( &p_intf->p_sys->event_lock ); + return VLC_SUCCESS; +} + +void item_changed( intf_thread_t *p_intf ) +{ + GtkButton *p_button = GTK_BUTTON( p_intf->p_sys->p_play_button ); + vlc_value_t state; + + if( !p_intf->p_sys->p_input ) + return; + + var_Get( p_intf->p_sys->p_input, "state", &state ); + + // We change the "play" button + if( state.i_int == PLAYING_S ) + gtk_button_set_image( p_button, gtk_image_new_from_stock( "vlc-pause", + GTK_ICON_SIZE_BUTTON ) ); + else + gtk_button_set_image( p_button, gtk_image_new_from_stock( "vlc-play", + GTK_ICON_SIZE_BUTTON ) ); +} + +int item_changed_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ) +{ + (void)p_this; (void)psz_var; (void)oldval; (void)newval; + intf_thread_t *p_intf = (intf_thread_t *)param; + vlc_spin_lock( &p_intf->p_sys->event_lock ); + + p_intf->p_sys->i_event |= EVENT_ITEM_CHANGED; + + vlc_spin_unlock( &p_intf->p_sys->event_lock ); + return VLC_SUCCESS; +} + +void update_position( intf_thread_t *p_intf ) +{ + if( p_intf->p_sys->p_input ) + { + hildon_seekbar_set_total_time( p_intf->p_sys->p_seekbar, + var_GetTime( p_intf->p_sys->p_input, "length" )/1000000 ); + hildon_seekbar_set_position( p_intf->p_sys->p_seekbar, + var_GetTime( p_intf->p_sys->p_input, "time" )/1000000 ); + } +} + +int interface_changed_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ) +{ + (void)p_this; (void)psz_var; (void)oldval; (void)newval; + intf_thread_t *p_intf = (intf_thread_t *)param; + vlc_spin_lock( &p_intf->p_sys->event_lock ); + + p_intf->p_sys->i_event |= EVENT_INTF_CHANGED; + + vlc_spin_unlock( &p_intf->p_sys->event_lock ); + return VLC_SUCCESS; +} diff --git a/modules/gui/maemo/maemo_input.h b/modules/gui/maemo/maemo_input.h new file mode 100644 index 0000000000..03eae50e5c --- /dev/null +++ b/modules/gui/maemo/maemo_input.h @@ -0,0 +1,52 @@ +/***************************************************************************** +* maemo_input.h : Input handling header file for the maemo plugin. +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#include + +#include +#include + +#define EVENT_ITEM_STATE_CHANGE (1<<0) +#define EVENT_PLAYLIST_CURRENT (1<<1) +#define EVENT_ACTIVITY (1<<2) +#define EVENT_ITEM_CHANGED (1<<3) +#define EVENT_INTF_CHANGED (1<<4) + +gboolean process_events( gpointer data ); + +void set_input( intf_thread_t *p_intf, input_thread_t *p_input ); +void delete_input( intf_thread_t *p_intf ); + +int playlist_current_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ); +int activity_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ); +void item_changed_pl( intf_thread_t *p_intf ); + +int item_changed_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ); +void item_changed( intf_thread_t *p_intf ); + +int interface_changed_cb( vlc_object_t *p_this, const char *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *param ); +void update_position( intf_thread_t *p_intf ); diff --git a/modules/gui/maemo/maemo_interface.c b/modules/gui/maemo/maemo_interface.c new file mode 100644 index 0000000000..16cf8f0927 --- /dev/null +++ b/modules/gui/maemo/maemo_interface.c @@ -0,0 +1,189 @@ +/***************************************************************************** +* maemo_interface.c : Interface creation of the maemo plugin +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#include + +#include + +#include "maemo.h" +#include "maemo_callbacks.h" +#include "maemo_interface.h" + +static void scan_maemo_for_media ( intf_thread_t *p_intf ); +static void find_media_in_dir ( const char *psz_dir, GList **pp_list ); + +static const char *ppsz_extensions[] = + { "aac", "flac", "m4a", "m4p", "mka", "mp1", "mp2", "mp3", + "ogg", "wav", "wma", "asf", "avi", "divx", "flv", "m1v", + "m2v", "m4v", "mkv", "mov", "mpeg", "mpeg1", "mpeg2", "mpeg4", + "mpg", "ogm", "wmv", NULL }; + +static const char *ppsz_media_dirs[] = + { "/media/mmc1", "/media/mmc2", "/home/user/MyDocs/.videos", NULL }; + +#define ADD_MENU_ITEM( label, callback ) \ + item = gtk_menu_item_new_with_label( label ); \ + gtk_menu_append( main_menu, item ); \ + g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( callback ), \ + p_intf ); +#define ADD_CHECK_MENU_ITEM( label, callback ) \ + item = gtk_check_menu_item_new_with_label( label ); \ + gtk_menu_append( main_menu, item ); \ + g_signal_connect( GTK_OBJECT( item ), "toggled", G_CALLBACK( callback ), \ + p_intf ); +#define ADD_SEPARATOR \ + item = gtk_separator_menu_item_new(); \ + gtk_menu_append( main_menu, item ); + +void create_menu( intf_thread_t *p_intf ) +{ + /* Needed variables */ + GtkWidget *main_menu; + GtkWidget *item; + int i_skip; + + /* Creating the main menu */ + main_menu = gtk_menu_new(); + + /* Getting ffmpeg-skip-frame value */ + i_skip = config_GetInt( p_intf, "ffmpeg-skip-frame" ); + + /* Filling the menu */ + ADD_MENU_ITEM( "Open", open_cb ); + ADD_MENU_ITEM( "Open Address", open_address_cb ); + ADD_MENU_ITEM( "Open Webcam", open_webcam_cb ); + ADD_SEPARATOR; + ADD_MENU_ITEM( "Take a snapshot", snapshot_cb ); + ADD_CHECK_MENU_ITEM( "Drop frames", dropframe_cb ); + if( i_skip ) + gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), true ); + ADD_SEPARATOR; + ADD_MENU_ITEM( "Close", delete_event_cb ); + + hildon_window_set_menu( HILDON_WINDOW( p_intf->p_sys->p_main_window ), + GTK_MENU( main_menu ) ); + + gtk_widget_show_all( main_menu ); +} + +#undef ADD_MENU +#undef ADD_CHECK_MENU_ITEM +#undef ADD_SEPARATOR + +void create_playlist( intf_thread_t *p_intf ) +{ + GtkWidget *playlist; + GtkWidget *scroll; + GtkListStore *playlist_store; + GtkTreeViewColumn *col; + GtkCellRenderer *renderer; + + playlist = gtk_tree_view_new(); + + playlist_store = gtk_list_store_new( 1, G_TYPE_STRING ); + p_intf->p_sys->p_playlist_store = GTK_WIDGET( playlist_store ); + + gtk_tree_view_set_model( GTK_TREE_VIEW( playlist ), + GTK_TREE_MODEL( playlist_store ) ); + + renderer = gtk_cell_renderer_text_new(); + col = gtk_tree_view_column_new_with_attributes( "File", renderer, + "text", 0, NULL ); + gtk_tree_view_append_column( GTK_TREE_VIEW( playlist ), col ); + + g_object_set( playlist, "headers-visible", TRUE, NULL ); + scan_maemo_for_media( p_intf ); + + scroll = gtk_scrolled_window_new( NULL, NULL ); + gtk_container_add( GTK_CONTAINER( scroll ), playlist ); + + gtk_notebook_append_page( GTK_NOTEBOOK( p_intf->p_sys->p_tabs ), scroll, + gtk_image_new_from_stock( "vlc-playlist", + GTK_ICON_SIZE_DIALOG ) ); + gtk_notebook_set_tab_label_packing( GTK_NOTEBOOK( p_intf->p_sys->p_tabs ), scroll, + FALSE, FALSE, GTK_PACK_START ); + + g_signal_connect( playlist, "row-activated", + G_CALLBACK( pl_row_activated_cb ), NULL ); +} + +static void scan_maemo_for_media( intf_thread_t *p_intf ) +{ + GtkListStore *playlist_store = GTK_LIST_STORE( p_intf->p_sys->p_playlist_store ); + GList *list = NULL; + GtkTreeIter iter; + + for( int i = 0; ppsz_media_dirs[i]; i++ ) + { + find_media_in_dir( ppsz_media_dirs[i], &list ); + msg_Dbg( p_intf, "Looking for media in %s", ppsz_media_dirs[i] ); + } + + list = g_list_first( list ); + while( list ) + { + msg_Dbg( p_intf, "Adding : %s", (char *)list->data ); + gtk_list_store_append( playlist_store, &iter ); + gtk_list_store_set( playlist_store, &iter, + 0, list->data, -1 ); + list = g_list_next( list ); + } +} + +static void find_media_in_dir( const char *psz_dir, GList **pp_list ) +{ + GDir *dir = NULL; + const gchar *psz_name; + char *psz_path; + + dir = g_dir_open( psz_dir, 0, NULL ); + if( !dir ) + return; + while( ( psz_name = g_dir_read_name( dir ) ) != NULL ) + { + psz_path = g_build_path( "/", psz_dir, psz_name, NULL ); + if( g_file_test( psz_path, G_FILE_TEST_IS_DIR ) && + !g_file_test( psz_path, G_FILE_TEST_IS_SYMLINK ) ) + find_media_in_dir( psz_path, pp_list ); + else + { + char *psz_ext = strrchr( psz_name, '.' ); + if( psz_ext ) + { + psz_ext++; + for( int i = 0; ppsz_extensions[i]; i++ ) + { + if( strcmp( psz_ext, ppsz_extensions[i] ) == 0 ) + { + *pp_list = g_list_append( *pp_list, g_strdup( psz_path ) ); + break; + } + } + } + } + g_free( psz_path ); + } + + g_dir_close( dir ); + return; +} diff --git a/modules/gui/maemo/maemo_interface.h b/modules/gui/maemo/maemo_interface.h new file mode 100644 index 0000000000..87b535e415 --- /dev/null +++ b/modules/gui/maemo/maemo_interface.h @@ -0,0 +1,30 @@ +/***************************************************************************** +* maemo_interface.h : Interface creation header file for the maemo plugin. +***************************************************************************** +* Copyright (C) 2008 the VideoLAN team +* $Id$ +* +* Authors: Antoine Lejeune +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +*****************************************************************************/ + +#include + +#include + +void create_menu( intf_thread_t *p_intf ); + +void create_playlist( intf_thread_t *p_intf ); diff --git a/share/Makefile.am b/share/Makefile.am index 1a9296af2f..3c1ffb766d 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -28,7 +28,8 @@ EXTRA_DIST = \ $(DIST_osdmenu_default) \ $(DIST_osdmenu_dvd) \ $(DIST_osdmenu_minimal) \ - $(DIST_mozilla) + $(DIST_mozilla) \ + $(DIST_maemo) if BUILD_SKINS nobase_pkgdata_DATA = skins2/default.vlt @@ -56,6 +57,9 @@ if BUILD_MOZILLA # TODO: move to the mozilla directory nobase_dist_pkgdata_DATA += $(DIST_mozilla) endif +if BUILD_MAEMO +nobase_dist_pkgdata_DATA += $(DIST_maemo) +endif DIST_rsrc = \ newres.h \ @@ -385,3 +389,27 @@ DIST_mozilla = \ mozilla/volume_max.xpm \ mozilla/volume_mute.xpm \ mozilla/volume_slider_bar.xpm + +DIST_maemo = \ + maemo/vlc_intf.rc \ + maemo/vlc_left_tab_active.png \ + maemo/vlc_left_tab_passive.png \ + maemo/playlist.png \ + maemo/play.png \ + maemo/pause.png \ + maemo/stop.png \ + maemo/previous.png \ + maemo/next.png \ + maemo/vlc32x32.png + +maemo_FILES = \ + ../modules/gui/qt4/pixmaps/play.png \ + ../modules/gui/qt4/pixmaps/pause.png \ + ../modules/gui/qt4/pixmaps/stop.png \ + ../modules/gui/qt4/pixmaps/previous.png \ + ../modules/gui/qt4/pixmaps/next.png \ + vlc32x32.png + +$(DIST_maemo): $(maemo_FILES) + mkdir -p maemo + cp -r $+ maemo diff --git a/share/maemo/playlist.png b/share/maemo/playlist.png new file mode 100644 index 0000000000..c6c703bab6 Binary files /dev/null and b/share/maemo/playlist.png differ diff --git a/share/maemo/vlc_intf.rc b/share/maemo/vlc_intf.rc new file mode 100644 index 0000000000..82228197ee --- /dev/null +++ b/share/maemo/vlc_intf.rc @@ -0,0 +1,42 @@ +style "videolan-notebook" +{ + GtkNotebook::inner_left_border = 0 + GtkNotebook::inner_right_border = 0 + GtkNotebook::tab-overlap = 0 + GtkNotebook::arrow-spacing = 6 + GtkNotebook::label-padding = 12 + GtkWidget::scroll-arrow-hlength = 20 + GtkWidget::scroll-arrow-vlength = 30 + + engine "sapwood" + { + image + { + function = EXTENSION + state = ACTIVE + file = "vlc_left_tab_passive.png" + border = { 12, 12, 12, 12 } + gap_side = RIGHT + } + image + { + function = EXTENSION + file = "vlc_left_tab_active.png" + border = { 12, 12, 12, 12 } + gap_side = RIGHT + } + } +} +class "GtkNotebook" style "videolan-notebook" + +style "videolan" +{ + stock["vlc-next"] = {{ "next.png" }} + stock["vlc-previous"] = {{ "previous.png" }} + stock["vlc-stop"] = {{ "stop.png" }} + stock["vlc-play"] = {{ "play.png" }} + stock["vlc-pause"] = {{ "pause.png" }} + stock["vlc-playlist"] = {{ "playlist.png" }} + stock["vlc"] = {{ "vlc32x32.png" }} +} +widget "*" style "videolan" diff --git a/share/maemo/vlc_left_tab_active.png b/share/maemo/vlc_left_tab_active.png new file mode 100644 index 0000000000..c7e7d691a6 Binary files /dev/null and b/share/maemo/vlc_left_tab_active.png differ diff --git a/share/maemo/vlc_left_tab_passive.png b/share/maemo/vlc_left_tab_passive.png new file mode 100644 index 0000000000..bc3dda7c2c Binary files /dev/null and b/share/maemo/vlc_left_tab_passive.png differ