vlc | branch: master | Thomas Guillem <[email protected]> | Tue May 23 19:37:52 2017 +0200| [6a3d27909c35b5734afb45ae4409d092c967c723] | committer: Thomas Guillem
qt: refactor ChangeVFiltersString Ref #6873 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a3d27909c35b5734afb45ae4409d092c967c723 --- modules/gui/qt/components/extended_panels.cpp | 53 ++++++++++++++++++--------- modules/gui/qt/components/extended_panels.hpp | 2 + 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp index d5b9f2cedf..55620f9ce9 100644 --- a/modules/gui/qt/components/extended_panels.cpp +++ b/modules/gui/qt/components/extended_panels.cpp @@ -301,19 +301,10 @@ static QString ChangeFiltersString( struct intf_thread_t *p_intf, const char *ps return list.join( ":" ); } -static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ) +static void UpdateVFiltersString( struct intf_thread_t *p_intf, + const char *psz_filter_type, const char *value ) { - const char *psz_filter_type = GetVFilterType( p_intf, psz_name ); - - if( psz_filter_type == NULL ) - return; - - QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); - - /* Vout is not kept, so put that in the config */ - config_PutPsz( p_intf, psz_filter_type, qtu( result ) ); - - var_SetString( THEPL, psz_filter_type, qtu( result ) ); + var_SetString( THEPL, psz_filter_type, value ); /* Try to set non splitter filters on the fly */ if( strcmp( psz_filter_type, "video-splitter" ) ) @@ -321,12 +312,25 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_ QVector<vout_thread_t*> p_vouts = THEMIM->getVouts(); foreach( vout_thread_t *p_vout, p_vouts ) { - var_SetString( p_vout, psz_filter_type, qtu( result ) ); + var_SetString( p_vout, psz_filter_type, value ); vlc_object_release( p_vout ); } } } +void ExtVideo::changeVFiltersString( const char *psz_name, bool b_add ) +{ + const char *psz_filter_type = GetVFilterType( p_intf, psz_name ); + if( psz_filter_type == NULL ) + return; + + QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); + + config_PutPsz( p_intf, psz_filter_type, qtu( result ) ); + + UpdateVFiltersString( p_intf, psz_filter_type, qtu( result ) ); +} + void ExtVideo::updateFilters() { QString module = ModuleFromWidgetName( sender() ); @@ -334,7 +338,7 @@ void ExtVideo::updateFilters() QCheckBox *checkbox = qobject_cast<QCheckBox*>( sender() ); QGroupBox *groupbox = qobject_cast<QGroupBox*>( sender() ); - ChangeVFiltersString( p_intf, qtu( module ), + changeVFiltersString( qtu( module ), checkbox ? checkbox->isChecked() : groupbox->isChecked() ); } @@ -559,8 +563,8 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option, msg_Warn( p_intf, "Module %s's %s variable isn't a command. Brute-restarting the filter.", psz_module, psz_option ); - ChangeVFiltersString( p_intf, psz_module, false ); - ChangeVFiltersString( p_intf, psz_module, true ); + changeVFiltersString( psz_module, false ); + changeVFiltersString( psz_module, true ); } foreach( vout_thread_t *p_vout, p_vouts ) @@ -1516,7 +1520,7 @@ void SyncControls::adjustSubsDuration( double f_factor ) if( THEMIM->getInput() && b_userAction ) { subsdelaySetFactor( f_factor ); - ChangeVFiltersString( p_intf, "subsdelay", f_factor > 0 ); + changeVFiltersString( "subsdelay", f_factor > 0 ); } } @@ -1549,7 +1553,7 @@ void SyncControls::initSubsDuration() void SyncControls::subsdelayClean() { /* Remove subsdelay filter */ - ChangeVFiltersString( p_intf, "subsdelay", false ); + changeVFiltersString( "subsdelay", false ); } void SyncControls::subsdelaySetFactor( double f_factor ) @@ -1566,6 +1570,19 @@ void SyncControls::subsdelaySetFactor( double f_factor ) } } +void SyncControls::changeVFiltersString( const char *psz_name, bool b_add ) +{ + const char *psz_filter_type = GetVFilterType( p_intf, psz_name ); + if( psz_filter_type == NULL ) + return; + + QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); + + config_PutPsz( p_intf, psz_filter_type, qtu( result ) ); + + UpdateVFiltersString( p_intf, psz_filter_type, qtu( result ) ); +} + /********************************************************************** * Video filters / Adjust diff --git a/modules/gui/qt/components/extended_panels.hpp b/modules/gui/qt/components/extended_panels.hpp index 1f6a1869d3..872b872f1d 100644 --- a/modules/gui/qt/components/extended_panels.hpp +++ b/modules/gui/qt/components/extended_panels.hpp @@ -56,6 +56,7 @@ private: void clean(); void setFilterOption( const char *psz_module, const char *psz_option, int, double, const char * ); + void changeVFiltersString( const char *psz_name, bool b_add ); private slots: void updateFilters(); @@ -246,6 +247,7 @@ private: void initSubsDuration(); void subsdelayClean(); void subsdelaySetFactor( double ); + void changeVFiltersString( const char *psz_name, bool b_add ); public slots: void update(); private slots: _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
