[vlc-commits] Qt(dialog provider): rework the part of popupmenu specific to skins2

Erwan Tulou git at videolan.org
Sun Jul 13 13:56:38 CEST 2014


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Jul 12 14:00:13 2014 +0200| [13e72f28eef889309f828512aab70adf7aff29cd] | committer: Erwan Tulou

Qt(dialog provider): rework the part of popupmenu specific to skins2

  - make it a bit simpler to read
  - add a shortcut to "Open skin.."
    (Ctrl-Shift-S chosen instead of Ctrl-S, since the latter
    is already used elsewhere)
  - Reuse the full version of "Open Media" with all accelerators
    being displayed instead of the light version
  - add the Help menu

With this new enriched popupmenu, skins2 should now offer all major
vlc hotkeys, which users have been asking for repeatedly.

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

 modules/gui/qt4/menus.cpp |   66 +++++++++++++++++++++++++++------------------
 1 file changed, 40 insertions(+), 26 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 279ff0f..a29333b 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -1066,38 +1066,36 @@ QMenu* VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
         /*QMenu *tools =*/ ToolsMenu( p_intf, submenu );
         submenu->addSeparator();
 
+        if( mi )
+        {
+            QMenu *bar = menu; // Needed for next macro
+            BAR_DADD( ViewMenu( p_intf, NULL, mi ), qtr( "V&iew" ), 4 );
+        }
+
         /* In skins interface, append some items */
-        if( !mi )
+        if( p_intf->p_sys->b_isDialogProvider )
         {
+            vlc_object_t* p_object = p_intf->p_parent;
             submenu->setTitle( qtr( "Interface" ) );
-            if( p_intf->p_sys->b_isDialogProvider )
-            {
-                /* list of skins available */
-                vlc_object_t* p_object = p_intf->p_parent;
 
-                objects.clear(); varnames.clear();
-                objects.append( p_object );
-                varnames.append( "intf-skins" );
-                Populate( p_intf, submenu, varnames, objects );
+            /* Open skin dialog box */
+            objects.clear(); varnames.clear();
+            objects.append( p_object );
+            varnames.append( "intf-skins-interactive" );
+            Populate( p_intf, submenu, varnames, objects );
+            QAction* action = submenu->actions().back();
+            action->setShortcut( QKeySequence( "Ctrl+Shift+S" ));
 
-                objects.clear(); varnames.clear();
-                objects.append( p_object );
-                varnames.append( "intf-skins-interactive" );
-                Populate( p_intf, submenu, varnames, objects );
+            /* list of skins available */
+            objects.clear(); varnames.clear();
+            objects.append( p_object );
+            varnames.append( "intf-skins" );
+            Populate( p_intf, submenu, varnames, objects );
 
-                submenu->addSeparator();
+            submenu->addSeparator();
 
-                /* Extensions */
-                ExtensionsMenu( p_intf, submenu );
-
-            }
-            else
-                msg_Warn( p_intf, "could not find parent interface" );
-        }
-        else
-        {
-            QMenu *bar = menu; // Needed for next macro
-            BAR_DADD( ViewMenu( p_intf, NULL, mi ), qtr( "V&iew" ), 4 );
+            /* list of extensions */
+            ExtensionsMenu( p_intf, submenu );
         }
 
         menu->addMenu( submenu );
@@ -1113,7 +1111,23 @@ QMenu* VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
     menu->addMenu( plMenu );
 
     /* Static entries for ending, like open */
-    PopupMenuStaticEntries( menu );
+    if( p_intf->p_sys->b_isDialogProvider )
+    {
+        QMenu *openmenu = FileMenu( p_intf, menu );
+        openmenu->setTitle( qtr( "Open Media" ) );
+        menu->addMenu( openmenu );
+
+        menu->addSeparator();
+
+        QMenu *helpmenu = HelpMenu( menu );
+        helpmenu->setTitle( qtr( "Help" ) );
+        menu->addMenu( helpmenu );
+
+        addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/exit",
+                          SLOT( quit() ), "Ctrl+Q", QAction::QuitRole );
+    }
+    else
+        PopupMenuStaticEntries( menu );
 
     if( show )
         menu->popup( QCursor::pos() );



More information about the vlc-commits mailing list