From 2d0e1cfb080f110be766c0dba1340364dc664dd4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Sun, 5 Apr 2009 17:16:05 +0800 Subject: [PATCH] Qt: really fix #2619 and the Playback menus Never disable Stop Disable stop when no input Populate Bookmarks --- modules/gui/qt4/menus.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 3c22ae5f8d..020bab45df 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -111,12 +111,12 @@ void addDPStaticEntry( QMenu *menu, /*** * Same for MIM ***/ -void addMIMStaticEntry( intf_thread_t *p_intf, - QMenu *menu, - const QString text, - const char *icon, - const char *member, - bool bStatic = false ) +QAction* addMIMStaticEntry( intf_thread_t *p_intf, + QMenu *menu, + const QString text, + const char *icon, + const char *member, + bool bStatic = false ) { QAction *action; if( strlen( icon ) > 0 ) @@ -129,6 +129,7 @@ void addMIMStaticEntry( intf_thread_t *p_intf, action = menu->addAction( text, THEMIM, member ); } action->setData( bStatic ? STATIC_ENTRY : ENTRY_ALWAYS_ENABLED ); + return action; } /** @@ -608,7 +609,8 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) PopupMenuPlaylistControlEntries( menu, p_intf ); PopupMenuControlEntries( menu, p_intf ); - return menu; + EnableStaticEntries( menu, ( THEMIM->getInput() != NULL ) ); + return RebuildNavigMenu( p_intf, menu ); } QMenu *QVLCMenu::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu ) @@ -781,15 +783,19 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ) void QVLCMenu::PopupMenuPlaylistControlEntries( QMenu *menu, intf_thread_t *p_intf ) { - addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ), ":/stop", SLOT( stop() ), - true ); + bool bEnable = THEMIM->getInput() != NULL; + QAction *action = + addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ), ":/stop", + SLOT( stop() ), true ); + /* Disable Stop in the right-click popup menu */ + if( !bEnable ) + action->setEnabled( false ); /* Next / Previous */ - bool bEnable = THEMIM->getInput() != NULL; addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ), - ":/previous", SLOT( prev() ), true ); + ":/previous", SLOT( prev() ) ); addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ), - ":/next", SLOT( next() ), true ); + ":/next", SLOT( next() ) ); menu->addSeparator(); } -- 2.39.2