[vlc-devel] [PATCH 06/11] qt: duplicate video filters options in the playlist

Thomas Guillem thomas at gllm.fr
Mon May 29 18:53:00 CEST 2017


Since we don't want to always save options anymore, we need a parent object to
store options that won't be destroyed (in contrary to the vout that can be
restarted/destroyed).

Ref #6873
---
 modules/gui/qt/components/extended_panels.cpp | 74 +++++++++++----------------
 1 file changed, 30 insertions(+), 44 deletions(-)

diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index 5decd6f88e..ffbb6abb11 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -418,39 +418,25 @@ void ExtVideo::setWidgetValue( QObject *widget )
     QString option = OptionFromWidgetName( widget );
     //std::cout << "Option name: " << option.toStdString() << std::endl;
 
-    vlc_object_t *p_obj = ( vlc_object_t * )
-        vlc_object_find_name( p_intf->obj.libvlc, qtu( module ) );
-    int i_type;
     vlc_value_t val;
-
-    if( !p_obj )
+    int i_type = config_GetType( p_intf, qtu( option ) ) & VLC_VAR_CLASS;
+    switch( i_type )
     {
-#if 0
-        msg_Dbg( p_intf,
-                 "Module instance %s not found, looking in config values.",
-                 qtu( module ) );
-#endif
-        i_type = config_GetType( p_intf, qtu( option ) ) & VLC_VAR_CLASS;
-        switch( i_type )
-        {
-            case VLC_VAR_INTEGER:
-            case VLC_VAR_BOOL:
-                val.i_int = config_GetInt( p_intf, qtu( option ) );
-                break;
-            case VLC_VAR_FLOAT:
-                val.f_float = config_GetFloat( p_intf, qtu( option ) );
-                break;
-            case VLC_VAR_STRING:
-                val.psz_string = config_GetPsz( p_intf, qtu( option ) );
-                break;
-        }
-    }
-    else
-    {
-        i_type = var_Type( p_obj, qtu( option ) ) & VLC_VAR_CLASS;
-        var_Get( p_obj, qtu( option ), &val );
-        vlc_object_release( p_obj );
+        case VLC_VAR_INTEGER:
+        case VLC_VAR_BOOL:
+        case VLC_VAR_FLOAT:
+        case VLC_VAR_STRING:
+            break;
+        default:
+            msg_Err( p_intf,
+                     "Module %s's %s variable is of an unsupported type ( %d )",
+                     qtu( module ), qtu( option ), i_type );
+            return;
     }
+    if( var_Create( THEPL, qtu( option ), i_type | VLC_VAR_DOINHERIT ) )
+        return;
+    if( var_GetChecked( THEPL, qtu( option ), i_type, &val ) )
+        return;
 
     /* Try to cast to all the widgets we're likely to encounter. Only
      * one of the casts is expected to work. */
@@ -494,13 +480,6 @@ void ExtVideo::setWidgetValue( QObject *widget )
         else msg_Warn( p_intf, "Could not find the correct String widget" );
         free( val.psz_string );
     }
-    else
-        if( p_obj )
-            msg_Err( p_intf,
-                     "Module %s's %s variable is of an unsupported type ( %d )",
-                     qtu( module ),
-                     qtu( option ),
-                     i_type );
 }
 
 void ExtVideo::setFilterOption( struct intf_thread_t *p_intf, const char *psz_module, const char *psz_option,
@@ -519,24 +498,30 @@ void ExtVideo::setFilterOption( struct intf_thread_t *p_intf, const char *psz_mo
         i_type = config_GetType( p_intf, psz_option );
 
     i_type &= VLC_VAR_CLASS;
-    if( i_type == VLC_VAR_INTEGER || i_type == VLC_VAR_BOOL )
+    if( i_type == VLC_VAR_INTEGER )
     {
         if( i_int == -1 )
             msg_Warn( p_intf, "Could not find the correct Integer widget" );
         config_PutInt( p_intf, psz_option, i_int );
+        var_SetInteger( THEPL, psz_option, i_int );
         if( b_is_command )
-        {
-            if( i_type == VLC_VAR_INTEGER )
-                var_SetInteger( p_vout, psz_option, i_int );
-            else
-                var_SetBool( p_vout, psz_option, i_int );
-        }
+            var_SetInteger( p_vout, psz_option, i_int );
+    }
+    else if( i_type == VLC_VAR_BOOL )
+    {
+        if( i_int == -1 )
+            msg_Warn( p_intf, "Could not find the correct Bool widget" );
+        config_PutInt( p_intf, psz_option, i_int );
+        var_SetBool( THEPL, psz_option, i_int );
+        if( b_is_command )
+            var_SetBool( p_vout, psz_option, i_int );
     }
     else if( i_type == VLC_VAR_FLOAT )
     {
         if( f_float == -1 )
             msg_Warn( p_intf, "Could not find the correct Float widget" );
         config_PutFloat( p_intf, psz_option, f_float );
+        var_SetFloat( THEPL, psz_option, f_float );
         if( b_is_command )
             var_SetFloat( p_vout, psz_option, f_float );
     }
@@ -545,6 +530,7 @@ void ExtVideo::setFilterOption( struct intf_thread_t *p_intf, const char *psz_mo
         if( val.isNull() )
             msg_Warn( p_intf, "Could not find the correct String widget" );
         config_PutPsz( p_intf, psz_option, qtu( val ) );
+        var_SetString( THEPL, psz_option, qtu( val ) );
         if( b_is_command )
             var_SetString( p_vout, psz_option, qtu( val ) );
     }
-- 
2.11.0



More information about the vlc-devel mailing list