Commit b36e6edb authored by Gildas Bazin's avatar Gildas Bazin

Make the maemo interface a bit more useable

parent c2704417
......@@ -103,6 +103,7 @@ Windows port:
Maemo port:
* Multiple improvements for N900 compliance and efficiency
* Support for HW accelerated video decoding on N900
* Improvements to the maemo interface
Misc:
* new sqlite module
......
This diff is collapsed.
......@@ -21,9 +21,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <hildon/hildon-program.h>
#include <hildon/hildon-seekbar.h>
#include <hildon/hildon-file-chooser-dialog.h>
#include <hildon/hildon-banner.h>
#include <vlc_playlist.h>
......@@ -32,19 +35,25 @@
struct intf_sys_t
{
vlc_thread_t thread;
playlist_t *p_playlist;
input_thread_t *p_input;
vlc_sem_t ready;
HildonWindow *p_main_window;
HildonSeekbar *p_seekbar;
GtkWidget *p_tabs;
GtkWidget *p_play_button;
GtkWidget *p_playlist_store;
GtkListStore *p_playlist_store;
GtkWidget *p_playlist_window;
int i_event;
vlc_spinlock_t event_lock;
GtkWidget *p_video_window;
vout_thread_t *p_vout;
uint32_t xid; /* X11 windows ID */
bool b_fullscreen;
GtkWidget *p_control_window;
};
/*****************************************************************************
* maemo_callbacks.c : Callbacks for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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.
*****************************************************************************/
* maemo_callbacks.c : Callbacks for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
*
* 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 <vlc_common.h>
#include "maemo.h"
#include "maemo_callbacks.h"
#include <gdk/gdkkeysyms.h>
#include <vlc_keys.h>
#ifdef HAVE_MAEMO
# include <hildon/hildon-file-chooser-dialog.h>
#endif
/*
* Function used to retrieve an intf_thread_t object from a GtkWidget
*/
......@@ -99,6 +107,22 @@ void next_cb( GtkButton *button, gpointer user_data )
playlist_Next( p_intf->p_sys->p_playlist );
}
void playlist_cb( GtkButton *button, gpointer user_data )
{
(void)user_data;
intf_thread_t *p_intf = get_intf_from_widget( GTK_WIDGET( button ) );
if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_playlist_window) )
{
gtk_widget_show_all( p_intf->p_sys->p_video_window );
gtk_widget_hide_all( p_intf->p_sys->p_playlist_window );
}
else
{
gtk_widget_hide_all( p_intf->p_sys->p_video_window );
gtk_widget_show_all( p_intf->p_sys->p_playlist_window );
}
}
void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll,
gdouble value, gpointer data )
{
......@@ -124,8 +148,6 @@ void pl_row_activated_cb( GtkTreeView *tree_view , GtkTreePath *path,
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 );
......@@ -140,8 +162,15 @@ void open_cb( GtkMenuItem *menuitem, gpointer user_data )
GtkWidget *dialog;
char *psz_filename = NULL;
#ifdef HAVE_MAEMO
dialog = hildon_file_chooser_dialog_new( GTK_WINDOW( p_intf->p_sys->p_main_window ),
GTK_FILE_CHOOSER_ACTION_OPEN );
#else
dialog = gtk_file_chooser_dialog_new( "Open File", GTK_WINDOW( p_intf->p_sys->p_main_window ),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL );
#endif
gtk_widget_show_all( GTK_WIDGET( dialog ) );
if( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_OK )
......@@ -217,22 +246,22 @@ void open_webcam_cb( GtkMenuItem *menuitem, gpointer user_data )
void snapshot_cb( GtkMenuItem *menuitem, gpointer user_data )
{
(void)menuitem;
intf_thread_t *p_intf = (intf_thread_t *)user_data;
input_thread_t *p_input = p_intf->p_sys->p_input;
vout_thread_t *p_vout = p_input ? input_GetVout( p_input ) : NULL;
(void)menuitem;
if( !p_intf->p_sys->p_vout )
if( !p_vout )
{
hildon_banner_show_information(
GTK_WIDGET( p_intf->p_sys->p_main_window ),
"gtk-dialog-error",
"There is no video" );
"gtk-dialog-error", "There is no video" );
return;
}
var_TriggerCallback( p_intf->p_sys->p_vout, "video-snapshot" );
var_TriggerCallback( p_vout, "video-snapshot" );
hildon_banner_show_information( GTK_WIDGET( p_intf->p_sys->p_main_window ),
NULL,
"Snapshot taken" );
NULL, "Snapshot taken" );
}
void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data )
......@@ -244,3 +273,105 @@ void dropframe_cb( GtkMenuItem *menuitem, gpointer user_data )
else
config_PutInt( p_intf, "ffmpeg-skip-frame", 0 );
}
static int keyModifiersToVLC( GdkEventKey *event )
{
int i_keyModifiers = 0;
if( event->state & GDK_SHIFT_MASK ) i_keyModifiers |= KEY_MODIFIER_SHIFT;
if( event->state & GDK_MOD1_MASK ) i_keyModifiers |= KEY_MODIFIER_ALT;
if( event->state & GDK_CONTROL_MASK ) i_keyModifiers |= KEY_MODIFIER_CTRL;
if( event->state & GDK_META_MASK ) i_keyModifiers |= KEY_MODIFIER_META;
return i_keyModifiers;
}
static int eventToVLCKey( GdkEventKey *event )
{
int i_vlck = 0;
switch( event->keyval )
{
case GDK_Left: i_vlck |= KEY_LEFT; break;
case GDK_Right: i_vlck |= KEY_RIGHT; break;
case GDK_Up: i_vlck |= KEY_UP; break;
case GDK_Down: i_vlck |= KEY_DOWN; break;
case GDK_Escape: i_vlck |= KEY_ESC; break;
case GDK_Return: i_vlck |= KEY_ENTER; break;
case GDK_F1: i_vlck |= KEY_F1; break;
case GDK_F2: i_vlck |= KEY_F2; break;
case GDK_F3: i_vlck |= KEY_F3; break;
case GDK_F4: i_vlck |= KEY_F4; break;
case GDK_F5: i_vlck |= KEY_F5; break;
case GDK_F6: i_vlck |= KEY_F6; break;
case GDK_F7: i_vlck |= KEY_F7; break;
case GDK_F8: i_vlck |= KEY_F8; break;
case GDK_F9: i_vlck |= KEY_F9; break;
case GDK_F10: i_vlck |= KEY_F10; break;
case GDK_F11: i_vlck |= KEY_F11; break;
case GDK_F12: i_vlck |= KEY_F12; break;
case GDK_Page_Up: i_vlck |= KEY_PAGEUP; break;
case GDK_Page_Down: i_vlck |= KEY_PAGEDOWN; break;
case GDK_Home: i_vlck |= KEY_HOME; break;
case GDK_End: i_vlck |= KEY_END; break;
case GDK_Insert: i_vlck |= KEY_INSERT; break;
case GDK_Delete: i_vlck |= KEY_DELETE; break;
#ifndef HAVE_MAEMO
case GDK_AudioLowerVolume: i_vlck |= KEY_VOLUME_DOWN; break;
case GDK_AudioRaiseVolume: i_vlck |= KEY_VOLUME_UP; break;
case GDK_AudioMute: i_vlck |= KEY_VOLUME_MUTE; break;
case GDK_AudioPlay: i_vlck |= KEY_MEDIA_PLAY_PAUSE; break;
case GDK_AudioStop: i_vlck |= KEY_MEDIA_STOP; break;
case GDK_AudioNext: i_vlck |= KEY_MEDIA_NEXT_TRACK; break;
case GDK_AudioPrev: i_vlck |= KEY_MEDIA_PREV_TRACK; break;
#endif
}
if( !i_vlck )
{
/* Force lowercase */
if( event->keyval >= GDK_A && event->keyval <= GDK_Z )
i_vlck = event->keyval + 32;
/* Rest of the ascii range */
else if( event->keyval >= GDK_space && event->keyval <= GDK_asciitilde )
i_vlck = event->keyval;
}
/* Handle modifiers */
i_vlck |= keyModifiersToVLC( event );
return i_vlck;
}
gboolean key_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
intf_thread_t *p_intf = (intf_thread_t *)user_data;
widget = widget; /* unused */
int i_vlck = eventToVLCKey( event );
if( i_vlck > 0 )
{
var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlck );
return TRUE;
}
return FALSE;
}
gboolean fullscreen_cb( gpointer user_data )
{
intf_thread_t *p_intf = (intf_thread_t *)user_data;
if(p_intf->p_sys->b_fullscreen)
{
gtk_widget_hide_all( GTK_WIDGET( p_intf->p_sys->p_control_window ) );
gtk_window_fullscreen( GTK_WINDOW(p_intf->p_sys->p_main_window) );
}
else
{
gtk_window_unfullscreen( GTK_WINDOW(p_intf->p_sys->p_main_window) );
gtk_widget_show_all( GTK_WIDGET( p_intf->p_sys->p_control_window ) );
}
return FALSE;
}
......@@ -34,6 +34,7 @@ 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 playlist_cb( GtkButton *button, gpointer user_data );
void seekbar_changed_cb( GtkRange *range, GtkScrollType scroll,
gdouble value, gpointer data );
......@@ -46,3 +47,6 @@ 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 );
gboolean key_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
gboolean fullscreen_cb(gpointer user_data);
/*****************************************************************************
* maemo_input.c : Input handling for the maemo plugin
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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.
*****************************************************************************/
* maemo_input.c : Input handling for the maemo plugin
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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"
......@@ -194,4 +194,3 @@ static int input_event_cb( vlc_object_t *p_this, const char *psz_var,
else
return interface_changed_cb( p_this, psz_var, oldval, newval, param );
}
/*****************************************************************************
* maemo_input.h : Input handling header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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.
*****************************************************************************/
* maemo_input.h : Input handling header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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 <gtk/gtk.h>
......
/*****************************************************************************
* maemo_interface.c : Interface creation of the maemo plugin
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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.
*****************************************************************************/
* maemo_interface.c : Interface creation of the maemo plugin
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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 <vlc_common.h>
......@@ -101,7 +101,7 @@ void create_playlist( intf_thread_t *p_intf )
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 );
p_intf->p_sys->p_playlist_store = playlist_store;
gtk_tree_view_set_model( GTK_TREE_VIEW( playlist ),
GTK_TREE_MODEL( playlist_store ) );
......@@ -117,11 +117,7 @@ void create_playlist( intf_thread_t *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 );
p_intf->p_sys->p_playlist_window = scroll;
g_signal_connect( playlist, "row-activated",
G_CALLBACK( pl_row_activated_cb ), NULL );
......
/*****************************************************************************
* maemo_interface.h : Interface creation header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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.
*****************************************************************************/
* maemo_interface.h : Interface creation header file for the maemo plugin.
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* 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 <gtk/gtk.h>
......
......@@ -308,11 +308,11 @@ DIST_maemo = \
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_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
share/maemo/playlist.png

1.56 KB | W: | H:

share/maemo/playlist.png

147 Bytes | W: | H:

share/maemo/playlist.png
share/maemo/playlist.png
share/maemo/playlist.png
share/maemo/playlist.png
  • 2-up
  • Swipe
  • Onion skin
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