[vlc-devel] [PATCH 10/17] qt: add first_symbol model roles in album model

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


---
 modules/gui/qt/medialibrary/mlalbummodel.cpp | 8 +++++++-
 modules/gui/qt/medialibrary/mlalbummodel.hpp | 5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/medialibrary/mlalbummodel.cpp b/modules/gui/qt/medialibrary/mlalbummodel.cpp
index 0d4b438284..b4a62b9de0 100644
--- a/modules/gui/qt/medialibrary/mlalbummodel.cpp
+++ b/modules/gui/qt/medialibrary/mlalbummodel.cpp
@@ -59,6 +59,10 @@ QVariant MLAlbumModel::data(const QModelIndex &index, int role) const
         return QVariant::fromValue( ml_item->getNbTracks() );
     case ALBUM_DURATION:
         return QVariant::fromValue( ml_item->getDuration() );
+    case ALBUM_TITLE_FIRST_SYMBOL:
+        return QVariant::fromValue( getFirstSymbol( ml_item->getTitle() ) );
+    case ALBUM_MAIN_ARTIST_FIRST_SYMBOL:
+        return QVariant::fromValue( getFirstSymbol( ml_item->getArtist() ) );
     default:
         return QVariant();
     }
@@ -74,7 +78,9 @@ QHash<int, QByteArray> MLAlbumModel::roleNames() const
         {ALBUM_COVER, "cover"},
         {ALBUM_MAIN_ARTIST, "main_artist"},
         {ALBUM_NB_TRACKS, "nb_tracks"},
-        {ALBUM_DURATION, "duration"}
+        {ALBUM_DURATION, "duration"},
+        {ALBUM_TITLE_FIRST_SYMBOL, "title_first_symbol"},
+        {ALBUM_MAIN_ARTIST_FIRST_SYMBOL, "main_artist_first_symbol"}
     };
 }
 
diff --git a/modules/gui/qt/medialibrary/mlalbummodel.hpp b/modules/gui/qt/medialibrary/mlalbummodel.hpp
index 6b5dcfc145..f531851d00 100644
--- a/modules/gui/qt/medialibrary/mlalbummodel.hpp
+++ b/modules/gui/qt/medialibrary/mlalbummodel.hpp
@@ -42,7 +42,10 @@ public:
         ALBUM_COVER,
         ALBUM_MAIN_ARTIST,
         ALBUM_NB_TRACKS,
-        ALBUM_DURATION
+        ALBUM_DURATION,
+
+        ALBUM_TITLE_FIRST_SYMBOL,
+        ALBUM_MAIN_ARTIST_FIRST_SYMBOL
     };
     Q_ENUM(Roles)
 
-- 
2.25.1



More information about the vlc-devel mailing list