[PATCH] Add option to enable postproc in qt4 intf.

Antoine Cellerier dionoea at videolan.org
Fri Sep 19 01:24:42 CEST 2008


---
 modules/gui/qt4/menus.cpp |   46 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 5867653..29e3e4f 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -208,12 +208,10 @@ static int VideoAutoMenuBuilder( vlc_object_t *p_object,
             vlc_object_t *p_pp = (vlc_object_t *)
                                  vlc_object_find_name( p_dec, "postproc",
                                                        FIND_CHILD );
+            p_object = p_pp;
+            PUSH_VAR( "postproc-q" );
             if( p_pp )
-            {
-                p_object = p_pp;
-                PUSH_VAR( "postproc-q" );
                 vlc_object_release( p_pp );
-            }
 
             vlc_object_release( p_dec );
         }
@@ -1059,7 +1057,21 @@ void QVLCMenu::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
         DeleteNonStaticEntries( action->menu() );
 
     if( !p_object )
+    {
+        if( !strcmp( psz_var, "postproc-q" ) )
+        {
+            /* FIXME: This is ugly as hell */
+            vlc_object_t *p_vout = ( vlc_object_t* )( vlc_object_find( p_intf,
+                                        VLC_OBJECT_VOUT, FIND_ANYWHERE ) );
+            if( p_vout )
+            {
+                CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
+                                  0, val, 0 );
+                vlc_object_release( p_vout );
+            }
+        }
         return;
+    }
 
     /* Check the type of the object variable */
     if( !strcmp( psz_var, "audio-es" )
@@ -1262,7 +1274,7 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
     }
 
     action->setToolTip( help );
-    action->setEnabled( i_object_id != 0 );
+    action->setEnabled( i_object_id != 0 || !strcmp( psz_var, "postproc-q" ) );
 
     if( i_item_type == ITEM_CHECK )
     {
@@ -1289,7 +1301,29 @@ void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
 {
     MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
     vlc_object_t *p_object = ( vlc_object_t * )vlc_object_get( p_intf->p_libvlc, itemData->i_object_id );
-    if( p_object == NULL ) return;
+    if( p_object == NULL )
+    {
+        if( !strcmp( itemData->psz_var, "postproc-q" ) )
+        {
+            /* FIXME: This is ugly as hell, part 2 */
+            vlc_object_t *p_vout = ( vlc_object_t* )( vlc_object_find( p_intf,
+                                        VLC_OBJECT_VOUT, FIND_ANYWHERE ) );
+            if( p_vout )
+            {
+                char *psz_filters = var_GetString( p_vout, "video-filter" );
+                char *psz_new_filters;
+                if( asprintf( &psz_new_filters, "postproc:%s", psz_filters )
+                    >= 0 )
+                {
+                    var_SetString( p_vout, "video-filter", psz_new_filters );
+                    free( psz_new_filters );
+                }
+                free( psz_filters );
+                vlc_object_release( p_vout );
+            }
+        }
+        return;
+    }
 
     var_Set( p_object, itemData->psz_var, itemData->val );
     vlc_object_release( p_object );
-- 
1.5.6.5


--azLHFNyN32YCQGCU--


More information about the vlc-devel mailing list