[vlc-commits] qt: add is_on_provider_list qproperty

Abel Tesfaye git at videolan.org
Wed Aug 21 15:08:59 CEST 2019


vlc | branch: master | Abel Tesfaye <Abeltesfaye45 at gmail.com> | Thu Aug 15 15:51:41 2019 +0300| [ad822d125b519966080ef396be46a06bbf58ef15] | committer: Jean-Baptiste Kempf

qt: add is_on_provider_list qproperty

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt/components/mediacenter/mlnetworkmodel.cpp | 8 ++++++++
 modules/gui/qt/components/mediacenter/mlnetworkmodel.hpp | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/modules/gui/qt/components/mediacenter/mlnetworkmodel.cpp b/modules/gui/qt/components/mediacenter/mlnetworkmodel.cpp
index 70edb5413f..c780e6637d 100644
--- a/modules/gui/qt/components/mediacenter/mlnetworkmodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlnetworkmodel.cpp
@@ -142,6 +142,12 @@ void MLNetworkModel::setTree(QVariant parentTree)
     }
     emit treeChanged();
 }
+void MLNetworkModel::setIsOnProviderList(bool b)
+{
+    m_isOnProviderList = b;
+
+    emit isOnProviderListChanged();
+}
 
 bool MLNetworkModel::initializeMediaSources()
 {
@@ -157,6 +163,7 @@ bool MLNetworkModel::initializeMediaSources()
     if ( m_treeItem.media == nullptr )
     {
         // If there's no target media, we're handling device discovery
+        setIsOnProviderList( true );
         auto provider = vlc_media_source_provider_Get( libvlc );
 
         using SourceMetaPtr = std::unique_ptr<vlc_media_source_meta_list_t,
@@ -184,6 +191,7 @@ bool MLNetworkModel::initializeMediaSources()
         return m_listeners.empty() == false;
     }
     // Otherwise, we're listing content from a device or folder
+    setIsOnProviderList( false );
     auto tree = m_treeItem.source->tree;
     std::unique_ptr<SourceListener> l{ new SourceListener( m_treeItem.source, this ) };
     if ( l->listener == nullptr )
diff --git a/modules/gui/qt/components/mediacenter/mlnetworkmodel.hpp b/modules/gui/qt/components/mediacenter/mlnetworkmodel.hpp
index d09b5b9ece..c41ae0ef0f 100644
--- a/modules/gui/qt/components/mediacenter/mlnetworkmodel.hpp
+++ b/modules/gui/qt/components/mediacenter/mlnetworkmodel.hpp
@@ -77,6 +77,7 @@ public:
 
     Q_PROPERTY(QmlMainContext* ctx READ getCtx WRITE setCtx NOTIFY ctxChanged)
     Q_PROPERTY(QVariant tree READ getTree WRITE setTree NOTIFY treeChanged)
+    Q_PROPERTY(bool is_on_provider_list READ getIsOnProviderList WRITE setIsOnProviderList NOTIFY isOnProviderListChanged)
 
     explicit MLNetworkModel(QObject* parent = nullptr);
     MLNetworkModel( QmlMainContext* ctx, QString parentMrl, QObject* parent = nullptr );
@@ -90,13 +91,16 @@ public:
 
     void setCtx(QmlMainContext* ctx);
     void setTree(QVariant tree);
+    void setIsOnProviderList(bool b);
 
     inline QmlMainContext* getCtx() { return m_ctx; }
     inline QVariant getTree() { return QVariant::fromValue( m_treeItem); }
+    inline bool getIsOnProviderList() { return m_isOnProviderList; }
 
 signals:
     void ctxChanged();
     void treeChanged();
+    void isOnProviderListChanged();
 
 private:
     struct Item
@@ -168,6 +172,7 @@ private:
     vlc_medialibrary_t* m_ml;
     bool m_hasTree = false;
     NetworkTreeItem m_treeItem;
+    bool m_isOnProviderList;
     std::vector<std::unique_ptr<SourceListener>> m_listeners;
 };
 



More information about the vlc-commits mailing list