[vlc-commits] Qt: Menus: make speed menu tearable.

Francois Cartegnie git at videolan.org
Mon Dec 5 22:08:55 CET 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Nov 26 18:14:43 2011 +0100| [88515f20012beb82028e1fd1fbf2f015d0042b23] | committer: Francois Cartegnie

Qt: Menus: make speed menu tearable.

Tuning playback speed is usually done through multiple actions (because
values are relative/increments). It is better to create a tear-off menu
from it. Especially true since status bar isn't enabled by default.

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

 modules/gui/qt4/menus.cpp |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index f85e515..8d8181c 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -797,11 +797,13 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
                                         bool b_normal )
 {
     QAction *action;
+    QMenu *rateMenu = new QMenu( "Sp&eed" );
+    rateMenu->setTearOffEnabled( true );
 
     if( b_normal )
     {
         /* Faster/Slower */
-        action = menu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
+        action = rateMenu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
                                   SLOT( faster() ) );
 #ifndef __APPLE__ /* No icons in menus in Mac */
         action->setIcon( QIcon( ":/toolbar/faster2") );
@@ -809,21 +811,21 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
         action->setData( STATIC_ENTRY );
     }
 
-    action = menu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
+    action = rateMenu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
                               SLOT( littlefaster() ) );
     action->setData( STATIC_ENTRY );
 
-    action = menu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(),
+    action = rateMenu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(),
                               SLOT( normalRate() ) );
     action->setData( STATIC_ENTRY );
 
-    action = menu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(),
+    action = rateMenu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(),
                               SLOT( littleslower() ) );
     action->setData( STATIC_ENTRY );
 
     if( b_normal )
     {
-        action = menu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
+        action = rateMenu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
                                   SLOT( slower() ) );
 #ifndef __APPLE__ /* No icons in menus in Mac */
         action->setIcon( QIcon( ":/toolbar/slower2") );
@@ -831,6 +833,9 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
         action->setData( STATIC_ENTRY );
     }
 
+    action = menu->addMenu( rateMenu );
+    action->setData( STATIC_ENTRY );
+
     menu->addSeparator();
 
     if( !b_normal ) return;



More information about the vlc-commits mailing list