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