Commit a8c9c25d authored by Jean-Philippe Andre's avatar Jean-Philippe Andre

Fix #2765: DVD chapters navigation menu.

parent a0d23587
......@@ -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:
......
......@@ -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;
......
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