[vlc-commits] qt: PlayerControlBarModel load model when context is available

Pierre Lamot git at videolan.org
Thu Aug 29 10:45:12 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Aug 27 17:39:08 2019 +0200| [d39750e55f9ebe17073fbccbaf1cc85d16404d22] | committer: Jean-Baptiste Kempf

qt: PlayerControlBarModel load model when context is available

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

 modules/gui/qt/components/playercontrolbarmodel.cpp | 10 +++++-----
 modules/gui/qt/components/playercontrolbarmodel.hpp |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt/components/playercontrolbarmodel.cpp b/modules/gui/qt/components/playercontrolbarmodel.cpp
index 0781e44d86..1f5e3b4686 100644
--- a/modules/gui/qt/components/playercontrolbarmodel.cpp
+++ b/modules/gui/qt/components/playercontrolbarmodel.cpp
@@ -180,12 +180,10 @@ void PlayerControlBarModel::setMainCtx(QmlMainContext* ctx)
     if(ctx == nullptr && m_mainCtx == ctx)
         return;
     m_mainCtx = ctx;
+    p_intf = m_mainCtx->getIntf();
+    assert(p_intf != nullptr);
+    reloadModel();
     emit ctxChanged(ctx);
-    intf_thread_t *temp_intf = m_mainCtx->getIntf();
-    if(temp_intf != nullptr && temp_intf != p_intf)
-        p_intf = temp_intf;
-    else
-        return;
 }
 
 void PlayerControlBarModel::setConfigName(QString name)
@@ -197,6 +195,8 @@ void PlayerControlBarModel::setConfigName(QString name)
         defaultConfig = MAIN_TB1_DEFAULT;
     else
         defaultConfig = MINI_TB_DEFAULT;
+    if  (m_mainCtx)
+        reloadModel();
     emit configNameChanged(name);
 }
 
diff --git a/modules/gui/qt/components/playercontrolbarmodel.hpp b/modules/gui/qt/components/playercontrolbarmodel.hpp
index ed4bda5083..b8fe81f5c2 100644
--- a/modules/gui/qt/components/playercontrolbarmodel.hpp
+++ b/modules/gui/qt/components/playercontrolbarmodel.hpp
@@ -110,7 +110,7 @@ signals:
     void configNameChanged(QString);
 
 protected:
-    intf_thread_t       *p_intf;
+    intf_thread_t       *p_intf  = nullptr;
 
 private:
     QVector<IconToolButton> mButtons;
@@ -123,7 +123,7 @@ private:
     void addProfiles();
     void loadConfig();
 
-    QmlMainContext* m_mainCtx;
+    QmlMainContext* m_mainCtx = nullptr;
 
 public slots:
     Q_INVOKABLE void insert(int index, QVariantMap bdata);



More information about the vlc-commits mailing list