vlc | branch: master | Benjamin Arnaud <benjamin.arn...@videolabs.io> | Tue Mar 30 12:54:47 2021 +0200| [e1b1737e47764282f9d16d4e0bce7df640c15aad] | committer: Pierre Lamot
qt/mlplaylistmodel: Add the 'thumbnailUpdated' function Signed-off-by: Pierre Lamot <pie...@videolabs.io> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e1b1737e47764282f9d16d4e0bce7df640c15aad --- modules/gui/qt/medialibrary/mlplaylistmodel.cpp | 36 ++++++++++++++----------- modules/gui/qt/medialibrary/mlplaylistmodel.hpp | 8 +++--- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/modules/gui/qt/medialibrary/mlplaylistmodel.cpp b/modules/gui/qt/medialibrary/mlplaylistmodel.cpp index 98f37e93ed..b312c8b39d 100644 --- a/modules/gui/qt/medialibrary/mlplaylistmodel.cpp +++ b/modules/gui/qt/medialibrary/mlplaylistmodel.cpp @@ -265,35 +265,41 @@ ListCacheLoader<std::unique_ptr<MLItem>> * MLPlaylistModel::createLoader() const } //------------------------------------------------------------------------------------------------- -// Private functions +// Protected MLBaseModel reimplementation +//------------------------------------------------------------------------------------------------- -QList<int> MLPlaylistModel::getRows(const QModelIndexList & indexes) const +void MLPlaylistModel::onVlcMlEvent(const MLEvent & event) /* override */ { - QList<int> rows; - - for (const QModelIndex & index : indexes) + if (event.i_type == VLC_ML_EVENT_PLAYLIST_UPDATED) { - rows.append(index.row()); + m_need_reset = true; + + // NOTE: Maybe we should call this from MLBaseModel ? + emit resetRequested(); } - return rows; + MLBaseModel::onVlcMlEvent(event); +} + +void MLPlaylistModel::thumbnailUpdated(int idx) /* override */ +{ + emit dataChanged(index(idx), index(idx), { MEDIA_THUMBNAIL }); } //------------------------------------------------------------------------------------------------- -// Private MLBaseModel reimplementation +// Private functions //------------------------------------------------------------------------------------------------- -void MLPlaylistModel::onVlcMlEvent(const MLEvent & event) /* override */ +QList<int> MLPlaylistModel::getRows(const QModelIndexList & indexes) const { - if (event.i_type == VLC_ML_EVENT_PLAYLIST_UPDATED) - { - m_need_reset = true; + QList<int> rows; - // NOTE: Maybe we should call this from MLBaseModel ? - emit resetRequested(); + for (const QModelIndex & index : indexes) + { + rows.append(index.row()); } - MLBaseModel::onVlcMlEvent(event); + return rows; } //================================================================================================= diff --git a/modules/gui/qt/medialibrary/mlplaylistmodel.hpp b/modules/gui/qt/medialibrary/mlplaylistmodel.hpp index ce3edb87b8..6bdd155a65 100644 --- a/modules/gui/qt/medialibrary/mlplaylistmodel.hpp +++ b/modules/gui/qt/medialibrary/mlplaylistmodel.hpp @@ -68,12 +68,14 @@ protected: // MLBaseModel implementation ListCacheLoader<std::unique_ptr<MLItem>> * createLoader() const override; +protected: // MLBaseModel reimplementation + void onVlcMlEvent(const MLEvent & event) override; + + void thumbnailUpdated(int idx) override; + private: // Functions QList<int> getRows(const QModelIndexList & indexes) const; -private: // MLBaseModel implementation - void onVlcMlEvent(const MLEvent & event) override; - private: struct Loader : public MLBaseModel::BaseLoader { _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits