[vlc-commits] qt: fix QString::split warnings when Qt 5.14 is used

Fatih Uzunoglu git at videolan.org
Wed Feb 17 09:31:48 UTC 2021


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Feb 12 00:23:34 2021 +0300| [ecebe9fc1db5c9952e64a1d8b31ac5026a096ac0] | committer: Pierre Lamot

qt: fix QString::split warnings when Qt 5.14 is used

>From Qt 5.14.0, Qt::SplitBehavior enum is available and QString::split function causes warning when QString::SplitBehavior enum is used.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ecebe9fc1db5c9952e64a1d8b31ac5026a096ac0
---

 .../gui/qt/dialogs/extended/extended_panels.cpp    | 33 +++++++++++++++++++---
 .../qt/dialogs/preferences/simple_preferences.cpp  |  9 +++++-
 modules/gui/qt/dialogs/vlm/vlm.cpp                 | 17 +++++++++--
 modules/gui/qt/player/playercontrolbarmodel.cpp    | 18 ++++++++++--
 4 files changed, 67 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt/dialogs/extended/extended_panels.cpp b/modules/gui/qt/dialogs/extended/extended_panels.cpp
index 9b0c111986..97c464676b 100644
--- a/modules/gui/qt/dialogs/extended/extended_panels.cpp
+++ b/modules/gui/qt/dialogs/extended/extended_panels.cpp
@@ -59,7 +59,14 @@
 
 static bool filterIsPresent( const QString &filters, const QString &filter )
 {
-    QStringList list = filters.split( ':', QString::SplitBehavior::SkipEmptyParts );
+    QStringList list = filters.split( ':',
+                                      #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                        Qt::SkipEmptyParts
+                                      #else
+                                        QString::SkipEmptyParts
+                                      #endif
+                                    );
+
     foreach( const QString &filterCmp, list )
     {
         if( filterCmp.compare( filter ) == 0 )
@@ -294,7 +301,13 @@ static QString ChangeFiltersString( struct intf_thread_t *p_intf, const char *ps
     char* psz_chain = var_GetString( p_intf, psz_filter_type );
 
     QString const chain = QString( psz_chain ? psz_chain : "" );
-    QStringList list = chain.split( ':', QString::SplitBehavior::SkipEmptyParts );
+    QStringList list = chain.split( ':',
+                                    #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                        Qt::SkipEmptyParts
+                                    #else
+                                        QString::SkipEmptyParts
+                                    #endif
+                                  );
 
     if( b_add && std::find(list.begin(), list.end(), psz_name) == list.end() )
         list << psz_name;
@@ -988,7 +1001,13 @@ QStringList EqualizerSliderData::getBandsFromAout() const
             char *psz_bands = var_GetString( p_aout.get(), qtu(p_data->name) );
             if ( psz_bands )
             {
-                bands = QString( psz_bands ).split( " ", QString::SkipEmptyParts );
+                bands = QString( psz_bands ).split( " ",
+                                                    #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                                        Qt::SkipEmptyParts
+                                                    #else
+                                                        QString::SkipEmptyParts
+                                                    #endif
+                                                  );
                 free( psz_bands );
             }
         }
@@ -1003,7 +1022,13 @@ QStringList EqualizerSliderData::getBandsFromAout() const
     char *psz_bands = config_GetPsz( qtu(p_data->name) );
     if ( psz_bands )
     {
-        bands = QString( psz_bands ).split( " ", QString::SkipEmptyParts );
+        bands = QString( psz_bands ).split( " ",
+                                            #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                                Qt::SkipEmptyParts
+                                            #else
+                                                QString::SkipEmptyParts
+                                            #endif
+                                          );
         free( psz_bands );
     }
 
diff --git a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
index 26a9ead2a2..d03381992b 100644
--- a/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
+++ b/modules/gui/qt/dialogs/preferences/simple_preferences.cpp
@@ -592,7 +592,14 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                      setEnabled( bool ) );
 
             char* psz = config_GetPsz( "audio-filter" );
-            qs_filter = qfu( psz ).split( ':', QString::SkipEmptyParts );
+            qs_filter = qfu( psz ).split( ':',
+                                          #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                              Qt::SkipEmptyParts
+                                          #else
+                                              QString::SkipEmptyParts
+                                          #endif
+                                        );
+
             free( psz );
 
             bool b_enabled = ( qs_filter.contains( "normvol" ) );
diff --git a/modules/gui/qt/dialogs/vlm/vlm.cpp b/modules/gui/qt/dialogs/vlm/vlm.cpp
index 2b21d52f91..8e41b88b36 100644
--- a/modules/gui/qt/dialogs/vlm/vlm.cpp
+++ b/modules/gui/qt/dialogs/vlm/vlm.cpp
@@ -641,7 +641,14 @@ void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
         vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
         vlm_MessageDelete( message );
 
-        QStringList options = inputOptions.split( " :", QString::SkipEmptyParts );
+        QStringList options = inputOptions.split( " :",
+                                                  #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                                      Qt::SkipEmptyParts
+                                                  #else
+                                                      QString::SkipEmptyParts
+                                                  #endif
+                                                );
+
         for( int i = 0; i < options.count(); i++ )
         {
             command = "setup \"" + name + "\" option \"" + options[i].trimmed() + "\"";
@@ -732,7 +739,13 @@ void VLMWrapper::EditSchedule( const QString& name, const QString& input,
         vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
         vlm_MessageDelete( message );
 
-        QStringList options = inputOptions.split( " :", QString::SkipEmptyParts );
+        QStringList options = inputOptions.split( " :",
+                                                  #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                                      Qt::SkipEmptyParts
+                                                  #else
+                                                      QString::SkipEmptyParts
+                                                  #endif
+                                                );
         for( int i = 0; i < options.count(); i++ )
         {
             command = "setup \"" + name + "\" option \"" + options[i].trimmed() + "\"";
diff --git a/modules/gui/qt/player/playercontrolbarmodel.cpp b/modules/gui/qt/player/playercontrolbarmodel.cpp
index 479ef42eaa..28ed1ed1a6 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.cpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.cpp
@@ -146,9 +146,21 @@ void PlayerControlBarModel::parseDefault(const QVector<PlayerControlBarModel::Ic
 
 void PlayerControlBarModel::parseAndAdd(const QString &config)
 {
-    beginInsertRows(QModelIndex(),rowCount(),rowCount()+config.split(";", QString::SkipEmptyParts).length() - 1);
-
-    for (const QString& iconPropertyTxt : config.split( ";", QString::SkipEmptyParts ) )
+    beginInsertRows(QModelIndex(),rowCount(),rowCount()+config.split(";",
+                                                                     #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                                                         Qt::SkipEmptyParts
+                                                                     #else
+                                                                         QString::SkipEmptyParts
+                                                                     #endif
+                                                                     ).length() - 1);
+
+    for (const QString& iconPropertyTxt : config.split( ";",
+                                                    #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+                                                        Qt::SkipEmptyParts
+                                                    #else
+                                                        QString::SkipEmptyParts
+                                                    #endif
+                                                    ) )
     {
         QStringList list2 = iconPropertyTxt.trimmed().split( "-" );
 



More information about the vlc-commits mailing list