[vlmc-devel] MediaLibraryModel: Expose media id

Yikai Lu git at videolan.org
Fri Aug 19 12:09:41 CEST 2016


vlmc | branch: medialibrary | Yikai Lu <luyikei.qmltu at gmail.com> | Fri Aug 19 00:37:52 2016 -0500| [6dcd16a42684e1e6cf0cd030e310147e1e9fd4c5] | committer: Hugo Beauzée-Luyssen

MediaLibraryModel: Expose media id

> https://code.videolan.org/videolan/vlmc/commit/6dcd16a42684e1e6cf0cd030e310147e1e9fd4c5
---

 src/Library/MediaLibraryModel.cpp | 5 ++++-
 src/Library/MediaLibraryModel.h   | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Library/MediaLibraryModel.cpp b/src/Library/MediaLibraryModel.cpp
index 8f07274..b319cb5 100644
--- a/src/Library/MediaLibraryModel.cpp
+++ b/src/Library/MediaLibraryModel.cpp
@@ -114,6 +114,8 @@ QVariant MediaLibraryModel::data( const QModelIndex &index, int role ) const
         return QVariant( QString::fromStdString( m->thumbnail() ) );
     case Roles::Duration:
         return QVariant::fromValue( m->duration() );
+    case Roles::Id:
+        return QVariant::fromValue( m->id() );
     case Qt::UserRole:
         return QVariant::fromValue( m );
     default:
@@ -129,7 +131,8 @@ MediaLibraryModel::roleNames() const
     return {
         { Roles::Title, "title" },
         { Roles::ThumbnailPath, "thumbnailPath" },
-        { Roles::Duration, "duration" }
+        { Roles::Duration, "duration" },
+        { Roles::Id, "id" }
     };
 }
 
diff --git a/src/Library/MediaLibraryModel.h b/src/Library/MediaLibraryModel.h
index d9be33b..0add020 100644
--- a/src/Library/MediaLibraryModel.h
+++ b/src/Library/MediaLibraryModel.h
@@ -41,6 +41,7 @@ public:
         Title = Qt::UserRole + 1,
         ThumbnailPath,
         Duration,
+        Id,
     };
 
     explicit MediaLibraryModel( medialibrary::IMediaLibrary& ml, medialibrary::IMedia::Type type,



More information about the Vlmc-devel mailing list