Qt: fix the postprocessing menu
authorJean-Baptiste Kempf <jb@videolan.org>
Fri, 15 Aug 2014 07:26:25 +0000 (09:26 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 15 Aug 2014 07:55:19 +0000 (09:55 +0200)
Close #11613

modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp

index a29333b..4bd45b3 100644 (file)
@@ -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;
+}
index b02e939..649e57e 100644 (file)
@@ -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 );