[vlc-devel] commit: Fix #2765: DVD chapters navigation menu. (Jean-Philippe Andre )
git version control
git at videolan.org
Tue Jun 9 17:00:03 CEST 2009
vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Wed Jun 3 01:42:36 2009 +0800| [a8c9c25d2c137daf94292dcbbf4e889c6de0d6e6] | committer: Jean-Philippe Andre
Fix #2765: DVD chapters navigation menu.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a8c9c25d2c137daf94292dcbbf4e889c6de0d6e6
---
modules/gui/qt4/menus.cpp | 16 +++++++++++++++-
src/input/var.c | 10 ++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 38b26bc..b5713e4 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -1257,6 +1257,19 @@ void QVLCMenu::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
#undef TEXT_OR_VAR
+/** HACK for the navigation submenu:
+ * "title %2i" variables take the value 0 if not set
+ */
+static bool CheckTitle( vlc_object_t *p_object, const char *psz_var )
+{
+ int i_title = 0;
+ if( sscanf( psz_var, "title %2i", &i_title ) <= 0 )
+ return true;
+
+ int i_current_title = var_GetInteger( p_object, "title" );
+ return ( i_title == i_current_title );
+}
+
int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
vlc_object_t *p_object, bool b_root )
@@ -1325,7 +1338,8 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
else menutext.sprintf( "%d", CURVAL.i_int );
CreateAndConnect( submenu, psz_var, menutext, "", ITEM_RADIO,
p_object, CURVAL, i_type,
- CURVAL.i_int == val.i_int );
+ ( CURVAL.i_int == val.i_int )
+ && CheckTitle( p_object, psz_var ) );
break;
case VLC_VAR_FLOAT:
diff --git a/src/input/var.c b/src/input/var.c
index 955ca8e..38aac2d 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -711,6 +711,16 @@ static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd,
else
{
input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval );
+ val.i_int = newval.i_int;
+ }
+
+ /* Actualize "title %2i" variable */
+ if( val.i_int >= 0 && val.i_int < count.i_int )
+ {
+ int i_title = var_GetInteger( p_input, "title" );
+ char psz_titlevar[10] = {0};
+ snprintf( psz_titlevar, 10, "title %2i", i_title );
+ var_Change( p_input, psz_titlevar, VLC_VAR_SETVALUE, &val, NULL );
}
return VLC_SUCCESS;
More information about the vlc-devel
mailing list