[vlc-devel] commit: Qt: really fix #2619 and the Playback menus (Jean-Philippe Andre )

git version control git at videolan.org
Sun Apr 5 11:19:24 CEST 2009


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Sun Apr  5 17:16:05 2009 +0800| [2d0e1cfb080f110be766c0dba1340364dc664dd4] | committer: Jean-Philippe Andre 

Qt: really fix #2619 and the Playback menus

Never disable Stop
Disable stop when no input
Populate Bookmarks

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2d0e1cfb080f110be766c0dba1340364dc664dd4
---

 modules/gui/qt4/menus.cpp |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 3c22ae5..020bab4 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();
 }
 




More information about the vlc-devel mailing list