[vlc-devel] [PATCHv2 07/18] qt: fix filter list false positives

Thomas Guillem thomas at gllm.fr
Tue May 30 18:40:57 CEST 2017


---
 modules/gui/qt/components/extended_panels.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index de070d3625..6ce2eaa081 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -53,6 +53,17 @@
 #include <vlc_modules.h>
 #include <vlc_plugin.h>
 
+static bool filterIsPresent( const QString &filters, const QString &filter )
+{
+    QStringList list = filters.split( ':', QString::SplitBehavior::SkipEmptyParts );
+    foreach( const QString &filterCmp, list )
+    {
+        if( filterCmp.compare( filter ) == 0 )
+            return true;
+    }
+    return false;
+}
+
 static const char* GetVFilterType( struct intf_thread_t *p_intf, const char *psz_name )
 {
     module_t *p_obj = module_find( psz_name );
@@ -964,7 +975,7 @@ void AudioFilterControlWidget::build()
     else
         psz_af = config_GetPsz( p_intf, "audio-filter" );
 
-    if( psz_af && strstr( psz_af, qtu(name) ) != NULL )
+    if( psz_af && filterIsPresent( qfu(psz_af), name ) )
         slidersBox->setChecked( true );
     else
         slidersBox->setChecked( false );
@@ -1209,7 +1220,7 @@ void Equalizer::build()
     CONNECT( ui.enableCheck, toggled(bool), ui.preampValue, setEnabled(bool) );
     CONNECT( ui.enableCheck, toggled(bool), ui.preampLabel, setEnabled(bool) );
 
-    if( psz_af && strstr( psz_af, qtu(name) ) != NULL )
+    if( psz_af && filterIsPresent( qfu(psz_af), name ) )
         ui.enableCheck->setChecked( true );
     else
         ui.enableCheck->setChecked( false );
-- 
2.11.0



More information about the vlc-devel mailing list