[vlc-commits] playlist_controller: Add a playlistInitialized signal

Hugo Beauzée-Luyssen git at videolan.org
Thu Jan 9 16:54:46 CET 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 19 11:11:11 2019 +0100| [a2504ab701e1bd8fdc3f9ee2ad54572b2bbc60a5] | committer: Hugo Beauzée-Luyssen

playlist_controller: Add a playlistInitialized signal

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

 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;



More information about the vlc-commits mailing list