[vlc-commits] Qt: fix the postprocessing menu

Jean-Baptiste Kempf git at videolan.org
Fri Aug 15 09:56:41 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Aug 15 09:26:25 2014 +0200| [d65b41f4da915e148a42b5699962947134fcc7dd] | committer: Jean-Baptiste Kempf

Qt: fix the postprocessing menu

Close #11613

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

 modules/gui/qt4/menus.cpp |   35 +++++++++++++++++++++++++++++++++--
 modules/gui/qt4/menus.hpp |    3 +++
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index a29333b..4bd45b3 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -50,6 +50,7 @@
 #include "util/qmenuview.hpp"                     /* Simple Playlist menu */
 #include "components/playlist/playlist_model.hpp" /* PLModel getter */
 #include "components/playlist/standardpanel.hpp"  /* PLView getter */
+#include "components/extended_panels.hpp"
 
 #include <QMenu>
 #include <QMenuBar>
@@ -83,6 +84,7 @@ static QActionGroup *currentGroup;
 
 QMenu *VLCMenuBar::recentsMenu = NULL;
 QMenu *VLCMenuBar::audioDeviceMenu = NULL;
+QMenu *VLCMenuBar::ppMenu = NULL;
 
 /**
  * @brief Add static entries to DP in menus
@@ -247,7 +249,8 @@ static int VideoAutoMenuBuilder( playlist_t *pl, input_thread_t *p_input,
     PUSH_VAR( "crop" );
     PUSH_VAR( "deinterlace" );
     PUSH_VAR( "deinterlace-mode" );
-    PUSH_VAR( "postprocess" );
+
+    VLCMenuBar::ppMenu->setEnabled( p_object != NULL );
 
     if( p_object )
         vlc_object_release( p_object );
@@ -684,7 +687,8 @@ QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current )
         /* Rendering modifiers */
         addActionWithSubmenu( current, "deinterlace", qtr( "&Deinterlace" ) );
         addActionWithSubmenu( current, "deinterlace-mode", qtr( "&Deinterlace mode" ) );
-        addActionWithSubmenu( current, "postprocess", qtr( "&Post processing" ) );
+        ppMenu = PPMenu( p_intf );
+        current->addMenu( ppMenu );
 
         current->addSeparator();
         /* Other actions */
@@ -1656,3 +1660,30 @@ void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
         }
     }
 }
+
+QMenu *VLCMenuBar::PPMenu( intf_thread_t *p_intf )
+{
+    int i_q = ExtVideo::getPostprocessing( p_intf );
+
+    QMenu *submenu = new QMenu( "&Post processing" );
+
+    QActionGroup *actionGroup = new QActionGroup(submenu);
+    QAction *action;
+
+#define ADD_PP_ACTION( text, value ) \
+    action = new QAction( qtr(text), submenu ); \
+    action->setData( value ); \
+    action->setCheckable(true); \
+    if( value == i_q ) action->setChecked( true ); \
+    submenu->addAction( action ); \
+    actionGroup->addAction( action );
+
+    ADD_PP_ACTION( "Disable", -1 );
+    submenu->addSeparator();
+    ADD_PP_ACTION( "Lowest",  1 );
+    ADD_PP_ACTION( "Middle",  3 );
+    ADD_PP_ACTION( "Highest", 6 );
+
+    CONNECT( actionGroup, triggered( QAction *), ActionsManager::getInstance( p_intf ), PPaction( QAction * ) );
+    return submenu;
+}
diff --git a/modules/gui/qt4/menus.hpp b/modules/gui/qt4/menus.hpp
index b02e939..649e57e 100644
--- a/modules/gui/qt4/menus.hpp
+++ b/modules/gui/qt4/menus.hpp
@@ -99,6 +99,8 @@ public:
     };
     Q_DECLARE_FLAGS(actionflags, actionflag)
 
+    static QMenu *ppMenu;
+
 private:
     /* All main Menus */
     static QMenu *FileMenu( intf_thread_t *, QWidget *, MainInterface * mi = NULL );
@@ -133,6 +135,7 @@ private:
     }
 
     static QMenu *HelpMenu( QWidget * );
+    static QMenu *PPMenu( intf_thread_t *p_intf );
 
     /* Popups Menus */
     static void PopupMenuStaticEntries( QMenu *menu );



More information about the vlc-commits mailing list