Commit 9be6878a authored by Damien Fouilleul's avatar Damien Fouilleul

- Qt4: fix popup menu

parent 31439d7a
......@@ -105,7 +105,7 @@ void DialogsProvider::customEvent( QEvent *event )
extendedDialog(); break;
/* We might want to make it better with custom functions */
case INTF_DIALOG_POPUPMENU:
QVLCMenu::PopupMenu( p_intf ); break;
QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_AUDIOPOPUPMENU:
QVLCMenu::AudioPopupMenu( p_intf ); break;
case INTF_DIALOG_VIDEOPOPUPMENU:
......
......@@ -504,48 +504,60 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
p_intf->p_sys->p_popup_menu = NULL;
}
void QVLCMenu::PopupMenu( intf_thread_t *p_intf )
void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
{
POPUP_BOILERPLATE;
if( p_input )
if( show )
{
vlc_object_yield( p_input );
InputAutoMenuBuilder( VLC_OBJECT(p_input), objects, varnames );
/* Video menu */
PUSH_SEPARATOR;
varnames.push_back( "video-es" );
objects.push_back( p_input->i_object_id );
varnames.push_back( "spu-es" );
objects.push_back( p_input->i_object_id );
vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{
VideoAutoMenuBuilder( p_vout, objects, varnames );
vlc_object_release( p_vout );
}
/* Audio menu */
PUSH_SEPARATOR
varnames.push_back( "audio-es" );
objects.push_back( p_input->i_object_id );
vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
{
AudioAutoMenuBuilder( p_aout, objects, varnames );
vlc_object_release( p_aout );
}
// create a popup if there is none
if( ! p_intf->p_sys->p_popup_menu )
{
POPUP_BOILERPLATE;
if( p_input )
{
vlc_object_yield( p_input );
InputAutoMenuBuilder( VLC_OBJECT(p_input), objects, varnames );
/* Video menu */
PUSH_SEPARATOR;
varnames.push_back( "video-es" );
objects.push_back( p_input->i_object_id );
varnames.push_back( "spu-es" );
objects.push_back( p_input->i_object_id );
vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{
VideoAutoMenuBuilder( p_vout, objects, varnames );
vlc_object_release( p_vout );
}
/* Audio menu */
PUSH_SEPARATOR
varnames.push_back( "audio-es" );
objects.push_back( p_input->i_object_id );
vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
{
AudioAutoMenuBuilder( p_aout, objects, varnames );
vlc_object_release( p_aout );
}
}
QMenu *menu = new QMenu();
Populate( p_intf, menu, varnames, objects );
menu->addSeparator();
POPUP_STATIC_ENTRIES;
p_intf->p_sys->p_popup_menu = menu;
}
p_intf->p_sys->p_popup_menu->popup( QCursor::pos() );
}
else
{
// destroy popup if there is one
delete p_intf->p_sys->p_popup_menu;
p_intf->p_sys->p_popup_menu = NULL;
}
QMenu *menu = new QMenu();
Populate( p_intf, menu, varnames, objects );
menu->addSeparator();
POPUP_STATIC_ENTRIES;
p_intf->p_sys->p_popup_menu = menu;
menu->popup( QCursor::pos() );
p_intf->p_sys->p_popup_menu = NULL;
}
#undef PUSH_VAR
......
......@@ -79,7 +79,7 @@ public:
static void AudioPopupMenu( intf_thread_t * );
static void VideoPopupMenu( intf_thread_t * );
static void MiscPopupMenu( intf_thread_t * );
static void PopupMenu( intf_thread_t * );
static void PopupMenu( intf_thread_t *, bool );
static void DoAction( intf_thread_t *, QObject * );
private:
......
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