[vlc-devel] [PATCH 4/7] playlist_controller: Add a playlistInitialized signal
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Mon Jan 6 13:38:47 CET 2020
---
modules/gui/qt/playlist/playlist_controller.cpp | 9 +++++++++
modules/gui/qt/playlist/playlist_controller.hpp | 2 ++
2 files changed, 11 insertions(+)
diff --git a/modules/gui/qt/playlist/playlist_controller.cpp b/modules/gui/qt/playlist/playlist_controller.cpp
index 43ad90e5a5..3bbebe3b89 100644
--- a/modules/gui/qt/playlist/playlist_controller.cpp
+++ b/modules/gui/qt/playlist/playlist_controller.cpp
@@ -608,6 +608,15 @@ void PlaylistControllerModel::setPlaylistPtr(vlc_playlist_t* newPlaylist)
PlaylistLocker locker(newPlaylist);
d->m_playlist = newPlaylist;
d->m_listener = vlc_playlist_AddListener(d->m_playlist, &playlist_callbacks, d, true);
+ /*
+ * Queue a playlistInitialized to be sent after the initial state callbacks
+ * vlc_playlist_AddListener will synchronously call each callback in
+ * playlist_callbacks, which will in turn queue an async call on the Qt
+ * main thread
+ */
+ d->callAsync([=](){
+ emit playlistInitialized();
+ });
}
emit playlistPtrChanged( PlaylistPtr(newPlaylist) );
}
diff --git a/modules/gui/qt/playlist/playlist_controller.hpp b/modules/gui/qt/playlist/playlist_controller.hpp
index 4c7eb8b670..238a26df8a 100644
--- a/modules/gui/qt/playlist/playlist_controller.hpp
+++ b/modules/gui/qt/playlist/playlist_controller.hpp
@@ -156,6 +156,8 @@ signals:
void itemsRemoved(size_t index, size_t count);
void itemsUpdated(size_t index, QVector<PlaylistItem>);
+ void playlistInitialized();
+
private:
Q_DECLARE_PRIVATE(PlaylistControllerModel)
QScopedPointer<PlaylistControllerModelPrivate> d_ptr;
--
2.20.1
More information about the vlc-devel
mailing list