[vlc-commits] qt: add nbtracks property to artist model

Prince Gupta git at videolan.org
Mon Aug 10 12:09:25 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Jul 10 00:16:47 2020 +0530| [e66efd4e1bc6747e695b52fd26d01182270f9fa0] | committer: Pierre Lamot

qt: add nbtracks property to artist model

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

 modules/gui/qt/medialibrary/mlartist.cpp      | 2 ++
 modules/gui/qt/medialibrary/mlartistmodel.cpp | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/medialibrary/mlartist.cpp b/modules/gui/qt/medialibrary/mlartist.cpp
index 98a6b0b96b..e96c7b6993 100644
--- a/modules/gui/qt/medialibrary/mlartist.cpp
+++ b/modules/gui/qt/medialibrary/mlartist.cpp
@@ -26,6 +26,7 @@ MLArtist::MLArtist(const vlc_ml_artist_t* _data, QObject *_parent)
     , m_shortBio( QString::fromUtf8( _data->psz_shortbio ) )
     , m_cover   ( QString::fromUtf8( _data->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl ) )
     , m_nbAlbums( _data->i_nb_album )
+    , m_nbTracks( _data->i_nb_tracks )
 {
     assert( _data );
 }
@@ -37,6 +38,7 @@ MLArtist::MLArtist(const MLArtist &artist, QObject *_parent)
     , m_shortBio( artist.m_shortBio )
     , m_cover   ( artist.m_cover )
     , m_nbAlbums( artist.m_nbAlbums )
+    , m_nbTracks( artist.m_nbTracks )
 {
 
 }
diff --git a/modules/gui/qt/medialibrary/mlartistmodel.cpp b/modules/gui/qt/medialibrary/mlartistmodel.cpp
index c453b83701..ec87c17b0c 100644
--- a/modules/gui/qt/medialibrary/mlartistmodel.cpp
+++ b/modules/gui/qt/medialibrary/mlartistmodel.cpp
@@ -25,7 +25,8 @@ namespace {
         ARTIST_NAME,
         ARTIST_SHORT_BIO,
         ARTIST_COVER,
-        ARTIST_NB_ALBUMS
+        ARTIST_NB_ALBUMS,
+        ARTIST_NB_TRACKS
     };
 }
 
@@ -59,6 +60,8 @@ QVariant MLArtistModel::data(const QModelIndex &index, int role) const
         return QVariant::fromValue( ml_artist->getCover() );
     case ARTIST_NB_ALBUMS :
         return QVariant::fromValue( ml_artist->getNbAlbums() );
+    case ARTIST_NB_TRACKS :
+        return QVariant::fromValue( ml_artist->getNbTracks() );
     default :
         return QVariant();
     }
@@ -72,6 +75,7 @@ QHash<int, QByteArray> MLArtistModel::roleNames() const
         { ARTIST_SHORT_BIO, "short_bio" },
         { ARTIST_COVER, "cover" },
         { ARTIST_NB_ALBUMS, "nb_albums" },
+        { ARTIST_NB_TRACKS, "nb_tracks" }
     };
 }
 



More information about the vlc-commits mailing list