diff --git a/modules/gui/qt/components/mediacenter/mlnetworkdevicemodel.hpp b/modules/gui/qt/components/mediacenter/mlnetworkdevicemodel.hpp index df142402c7c517b10d57522a373cd41ea76f44aa..7867da57bfc1e55a31d8080ebaae31f727b8becf 100644 --- a/modules/gui/qt/components/mediacenter/mlnetworkdevicemodel.hpp +++ b/modules/gui/qt/components/mediacenter/mlnetworkdevicemodel.hpp @@ -112,6 +112,7 @@ private: void onItemCleared( MediaSourcePtr mediaSource, input_item_node_t* node ) override; void onItemAdded( MediaSourcePtr mediaSource, input_item_node_t* parent, input_item_node_t *const children[], size_t count ) override; void onItemRemoved( MediaSourcePtr mediaSource, input_item_node_t *const children[], size_t count ) override; + inline void onItemPreparseEnded( MediaSourcePtr, input_item_node_t *, enum input_item_preparse_status ) override {} void refreshDeviceList(MediaSourcePtr mediaSource, input_item_node_t* const children[], size_t count , bool clear); diff --git a/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp b/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp index f1a15d020fbf6aa9ac70d9002d0d0ad3ede9dfb1..e8f86091877d0683ccfa44bc80786e208eaf0e35 100644 --- a/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp +++ b/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.cpp @@ -259,6 +259,9 @@ bool MLNetworkMediaModel::initializeMediaSources() vlc_media_tree_Preparse( tree, libvlc, m_treeItem.media.get() ); + m_parsingPending = true; + emit parsingPendingChanged(m_parsingPending); + m_listener = std::move( l ); return true; @@ -319,6 +322,14 @@ void MLNetworkMediaModel::onItemRemoved( MediaSourcePtr, } } +void MLNetworkMediaModel::onItemPreparseEnded(MediaSourcePtr mediaSource, input_item_node_t* node, enum input_item_preparse_status status) +{ + QMetaObject::invokeMethod(this, [this]() { + m_parsingPending = false; + emit parsingPendingChanged(false); + }); +} + void MLNetworkMediaModel::refreshMediaList( MediaSourcePtr mediaSource, input_item_node_t* const children[], size_t count, bool clear ) diff --git a/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.hpp b/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.hpp index c21f44577e94f5e4f3551d9c4fb69d4871725bd4..a1a323b8e2f2e133e448797e253ea5f4aae6cb64 100644 --- a/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.hpp +++ b/modules/gui/qt/components/mediacenter/mlnetworkmediamodel.hpp @@ -93,6 +93,7 @@ public: Q_PROPERTY(ItemType type READ getType NOTIFY typeChanged) Q_PROPERTY(bool indexed READ isIndexed WRITE setIndexed NOTIFY isIndexedChanged) Q_PROPERTY(bool canBeIndexed READ canBeIndexed NOTIFY canBeIndexedChanged) + Q_PROPERTY(bool parsingPending READ getParsingPending NOTIFY parsingPendingChanged) explicit MLNetworkMediaModel(QObject* parent = nullptr); @@ -117,6 +118,7 @@ public: inline ItemType getType() const { return m_type; } inline bool isIndexed() const { return m_indexed; } inline bool canBeIndexed() const { return m_canBeIndexed; } + inline bool getParsingPending() const { return m_parsingPending; } Q_INVOKABLE bool addToPlaylist( int index ); Q_INVOKABLE bool addToPlaylist(const QVariantList& itemIdList); @@ -129,6 +131,7 @@ signals: void typeChanged(); void isIndexedChanged(); void canBeIndexedChanged(); + void parsingPendingChanged(bool); void ctxChanged(); void treeChanged(); @@ -154,6 +157,7 @@ private: void onItemCleared( MediaSourcePtr mediaSource, input_item_node_t* node ) override; void onItemAdded( MediaSourcePtr mediaSource, input_item_node_t* parent, input_item_node_t *const children[], size_t count ) override; void onItemRemoved( MediaSourcePtr mediaSource, input_item_node_t *const children[], size_t count ) override; + void onItemPreparseEnded( MediaSourcePtr mediaSource, input_item_node_t* node, enum input_item_preparse_status status ) override; void refreshMediaList(MediaSourcePtr s, input_item_node_t* const children[], size_t count , bool clear); @@ -166,6 +170,7 @@ private: ItemType m_type = ItemType::TYPE_UNKNOWN; bool m_indexed = false; bool m_canBeIndexed = false; + bool m_parsingPending = false; std::vector<Item> m_items; diff --git a/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.cpp b/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.cpp index c7fcbb618d1271075f806a257b63dfad9317236d..7cedf90afa1217da1a2923de11b35b420dd0ac87 100644 --- a/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.cpp +++ b/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.cpp @@ -14,7 +14,8 @@ MLNetworkSourceListener::MLNetworkSourceListener(MediaSourcePtr s, SourceListene static const vlc_media_tree_callbacks cbs { &MLNetworkSourceListener::onItemCleared, &MLNetworkSourceListener::onItemAdded, - &MLNetworkSourceListener::onItemRemoved + &MLNetworkSourceListener::onItemRemoved, + &MLNetworkSourceListener::onItemPreparseEnded }; auto l = vlc_media_tree_AddListener( s->tree, &cbs, this, true ); if ( l == nullptr ) @@ -49,3 +50,9 @@ void MLNetworkSourceListener::onItemRemoved( vlc_media_tree_t *, input_item_node auto* self = static_cast<MLNetworkSourceListener*>( userdata ); self->cb->onItemRemoved( self->source, children, count ); } + +void MLNetworkSourceListener::onItemPreparseEnded(vlc_media_tree_t *, input_item_node_t * node, enum input_item_preparse_status status, void *userdata) +{ + auto* self = static_cast<MLNetworkSourceListener*>( userdata ); + self->cb->onItemPreparseEnded( self->source, node, status ); +} diff --git a/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.hpp b/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.hpp index 210b91d76ac1e55361ddb6c6dcafb2c47843b4a7..ca56d832b88e7c2adf808706576c1e83f9a769a2 100644 --- a/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.hpp +++ b/modules/gui/qt/components/mediacenter/mlnetworksourcelistener.hpp @@ -50,6 +50,7 @@ public: virtual void onItemCleared( MediaSourcePtr mediaSource, input_item_node_t* node ) = 0; virtual void onItemAdded( MediaSourcePtr mediaSource, input_item_node_t* parent, input_item_node_t *const children[], size_t count ) = 0; virtual void onItemRemoved( MediaSourcePtr mediaSource, input_item_node_t *const children[], size_t count ) = 0; + virtual void onItemPreparseEnded( MediaSourcePtr mediaSource, input_item_node_t* node, enum input_item_preparse_status status ) = 0; }; public: @@ -71,6 +72,10 @@ public: input_item_node_t *const children[], size_t count, void *userdata ); + static void onItemPreparseEnded( vlc_media_tree_t *tree, input_item_node_t *node, + enum input_item_preparse_status status, + void *userdata ); + MediaSourcePtr source; ListenerPtr listener = nullptr; SourceListenerCb *cb = nullptr;