[vlc-commits] Qt: rebuild correctly the playback menu
Jean-Baptiste Kempf
git at videolan.org
Sat Jan 14 07:11:00 CET 2012
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Jan 14 07:03:38 2012 +0100| [921a659cf599ac0afd943aeed0a4fc085cc4f24f] | committer: Jean-Baptiste Kempf
Qt: rebuild correctly the playback menu
And also, close #5522
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=921a659cf599ac0afd943aeed0a4fc085cc4f24f
---
modules/gui/qt4/menus.cpp | 22 +++++++++++++++++-----
modules/gui/qt4/menus.hpp | 2 +-
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 502a747..bd668af 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -700,15 +700,16 @@ QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
action->setData( "bookmark" );
menu->addSeparator();
- PopupMenuPlaylistControlEntries( menu, p_intf );
+
PopupMenuControlEntries( menu, p_intf );
EnableStaticEntries( menu, ( THEMIM->getInput() != NULL ) );
- return RebuildNavigMenu( p_intf, menu );
+ return RebuildNavigMenu( p_intf, menu, true );
}
-QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu )
+QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu, bool b_keep )
{
+
/* */
input_thread_t *p_object;
QVector<vlc_object_t *> objects;
@@ -719,14 +720,25 @@ QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu )
InputAutoMenuBuilder( p_object, objects, varnames );
- menu->addSeparator();
-
/* Title and so on */
PUSH_VAR( "prev-title" );
PUSH_VAR( "next-title" );
PUSH_VAR( "prev-chapter" );
PUSH_VAR( "next-chapter" );
+ /* Remove playback actions to recreate them */
+ if( !b_keep )
+ {
+ QList< QAction* > actions = menu->actions();
+ if( actions.count() > 4 )
+ for( int i = actions.count() - 1 ; i >= actions.count() - 1 - 4 ; --i )
+ delete actions[i];
+ }
+
+ PopupPlayEntries( menu, p_intf, p_object );
+ PopupMenuPlaylistControlEntries( menu, p_intf );
+
+ /* */
EnableStaticEntries( menu, (p_object != NULL ) );
return Populate( p_intf, menu, varnames, objects );
}
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index 20ad2a4..8ffa9a6 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -114,7 +114,7 @@ private:
static QMenu *NavigMenu( intf_thread_t *p_intf, QWidget *parent ) {
return NavigMenu( p_intf, new QMenu( parent ) );
}
- static QMenu *RebuildNavigMenu( intf_thread_t *, QMenu *);
+ static QMenu *RebuildNavigMenu( intf_thread_t *, QMenu *, bool b_keep = false );
static QMenu *VideoMenu( intf_thread_t *, QMenu *, bool b_subtitle = true );
static QMenu *VideoMenu( intf_thread_t *p_intf, QWidget *parent ) {
More information about the vlc-commits
mailing list