]> git.sesse.net Git - vlc/commitdiff
Qt: really fix #2619 and the Playback menus
authorJean-Philippe Andre <jpeg@via.ecp.fr>
Sun, 5 Apr 2009 09:16:05 +0000 (17:16 +0800)
committerJean-Philippe Andre <jpeg@via.ecp.fr>
Sun, 5 Apr 2009 09:19:26 +0000 (17:19 +0800)
Never disable Stop
Disable stop when no input
Populate Bookmarks

modules/gui/qt4/menus.cpp

index 3c22ae5f8ddf77914e098f5d08d511dbeea14a8e..020bab45dfd780ebed138e27b5ef3775310c2d6a 100644 (file)
@@ -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();
 }