[vlc-devel] [PATCH 09/17] qt: move getFirstSymbol to MlBaseModel

Prince Gupta guptaprince8832 at gmail.com
Fri Jun 19 16:06:22 CEST 2020


---
 modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp | 8 --------
 modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp | 2 --
 modules/gui/qt/medialibrary/mlbasemodel.cpp       | 8 ++++++++
 modules/gui/qt/medialibrary/mlbasemodel.hpp       | 1 +
 modules/gui/qt/medialibrary/mlvideomodel.cpp      | 8 --------
 modules/gui/qt/medialibrary/mlvideomodel.hpp      | 1 -
 6 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp b/modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp
index 0d6819ea34..a57628c28f 100644
--- a/modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp
+++ b/modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp
@@ -195,11 +195,3 @@ void MLAlbumTrackModel::onVlcMlEvent(const vlc_ml_event_t* event)
     }
     MLBaseModel::onVlcMlEvent( event );
 }
-
-QString MLAlbumTrackModel::getFirstSymbol( const QString& str )
-{
-    QString ret("#");
-    if ( str.length() > 0 && str[0].isLetter() )
-        ret = str[0].toUpper();
-    return ret;
-}
diff --git a/modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp b/modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp
index bae6f42db9..4314ff229a 100644
--- a/modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp
+++ b/modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp
@@ -49,7 +49,5 @@ private:
     virtual void onVlcMlEvent( const vlc_ml_event_t* event ) override;
 
     static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria;
-
-    static QString getFirstSymbol( const QString& str );
 };
 #endif // MLTRACKMODEL_HPP
diff --git a/modules/gui/qt/medialibrary/mlbasemodel.cpp b/modules/gui/qt/medialibrary/mlbasemodel.cpp
index db56ced9d2..285397c0c9 100644
--- a/modules/gui/qt/medialibrary/mlbasemodel.cpp
+++ b/modules/gui/qt/medialibrary/mlbasemodel.cpp
@@ -92,6 +92,14 @@ void MLBaseModel::onVlcMlEvent(const vlc_ml_event_t* event)
     }
 }
 
+QString MLBaseModel::getFirstSymbol(QString str)
+{
+    QString ret("#");
+    if ( str.length() > 0 && str[0].isLetter() )
+        ret = str[0].toUpper();
+    return ret;
+}
+
 void MLBaseModel::onVlcMlEvent(void* data, const vlc_ml_event_t* event)
 {
     auto self = static_cast<MLBaseModel*>(data);
diff --git a/modules/gui/qt/medialibrary/mlbasemodel.hpp b/modules/gui/qt/medialibrary/mlbasemodel.hpp
index 1909094939..bbedc6c26e 100644
--- a/modules/gui/qt/medialibrary/mlbasemodel.hpp
+++ b/modules/gui/qt/medialibrary/mlbasemodel.hpp
@@ -75,6 +75,7 @@ private:
 protected:
     virtual void clear() = 0;
     virtual vlc_ml_sorting_criteria_t roleToCriteria(int role) const = 0;
+    static QString getFirstSymbol(QString str);
     virtual vlc_ml_sorting_criteria_t nameToCriteria(QByteArray) const {
         return VLC_ML_SORTING_DEFAULT;
     }
diff --git a/modules/gui/qt/medialibrary/mlvideomodel.cpp b/modules/gui/qt/medialibrary/mlvideomodel.cpp
index a46444e340..7115d90db2 100644
--- a/modules/gui/qt/medialibrary/mlvideomodel.cpp
+++ b/modules/gui/qt/medialibrary/mlvideomodel.cpp
@@ -177,11 +177,3 @@ void MLVideoModel::thumbnailUpdated(int idx)
 {
     emit dataChanged(index(idx), index(idx), {VIDEO_THUMBNAIL});
 }
-
-QString MLVideoModel::getFirstSymbol( const QString& str )
-{
-    QString ret("#");
-    if ( str.length() > 0 && str[0].isLetter() )
-        ret = str[0].toUpper();
-    return ret;
-}
diff --git a/modules/gui/qt/medialibrary/mlvideomodel.hpp b/modules/gui/qt/medialibrary/mlvideomodel.hpp
index ecde78171c..83cc0ab241 100644
--- a/modules/gui/qt/medialibrary/mlvideomodel.hpp
+++ b/modules/gui/qt/medialibrary/mlvideomodel.hpp
@@ -51,7 +51,6 @@ private:
     virtual void thumbnailUpdated( int ) override;
 
     static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria;
-    static QString getFirstSymbol( const QString& str );
     QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override;
 };
 
-- 
2.25.1



More information about the vlc-devel mailing list