[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: use isSignalConnected() instead of receivers() in ControlbarProfile

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Jul 11 20:31:25 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
ae6e0c7b by Fatih Uzunoglu at 2021-07-11T20:20:44+00:00
qt: use isSignalConnected() instead of receivers() in ControlbarProfile

With Qt 5.0, a new syntax for signal/slot handling was introduced. This
patch updates the related function call that tests if the signal is
connected to its Qt 5 way of doing.

- - - - -
b7b1fcf9 by Fatih Uzunoglu at 2021-07-11T20:20:44+00:00
qt: defer init reload() in ControlbarProfileModel

this change allows selectedProfileControlListChanged
signal to be emitted after the initial reload happens.

- - - - -
0df3d23f by Fatih Uzunoglu at 2021-07-11T20:20:44+00:00
qt: register ControlbarProfileModel as qml type

- - - - -
676666ab by Fatih Uzunoglu at 2021-07-11T20:20:44+00:00
qt: remove unneeded meta type registration

qmlRegisterUncreatableType already registers the type
to the meta object system.

- - - - -


3 changed files:

- modules/gui/qt/dialogs/toolbar/controlbar_profile.cpp
- modules/gui/qt/dialogs/toolbar/controlbar_profile_model.cpp
- modules/gui/qt/maininterface/mainui.cpp


Changes:

=====================================
modules/gui/qt/dialogs/toolbar/controlbar_profile.cpp
=====================================
@@ -17,6 +17,8 @@
  *****************************************************************************/
 #include "controlbar_profile.hpp"
 
+#include <QMetaMethod>
+
 #include "player/control_list_model.hpp"
 #include "player/player_controlbar_model.hpp"
 
@@ -198,7 +200,7 @@ void ControlbarProfile::generateLinearControlList()
         return;
 
     // Don't bother if there is no receiver (connection):
-    if (receivers(SIGNAL(controlListChanged (const QVector<int>&) )) <= 0)
+    if (! isSignalConnected(QMetaMethod::fromSignal(&ControlbarProfile::controlListChanged)) )
         return;
 
     QVector<int> linearControls;


=====================================
modules/gui/qt/dialogs/toolbar/controlbar_profile_model.cpp
=====================================
@@ -208,11 +208,14 @@ ControlbarProfileModel::ControlbarProfileModel(qt_intf_t *p_intf, QObject *paren
             insertDefaults();
     });
 
-    if (reload() == false)
-    {
-        // If initial reload fails, load the default profiles:
-        insertDefaults();
-    }
+    // defer initialization reload:
+    QMetaObject::invokeMethod(this, [this] () {
+        if (reload() == false)
+        {
+            // If initial reload fails, load the default profiles:
+            insertDefaults();
+        }
+    }, Qt::QueuedConnection);
 }
 
 void ControlbarProfileModel::insertDefaults()


=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -244,8 +244,7 @@ void MainUI::registerQMLTypes()
 
     qmlRegisterType<QmlEventFilter>( "org.videolan.vlc", 0, 1, "EventFilter" );
 
-    qRegisterMetaType<ControlbarProfile*>();
-    qRegisterMetaType<ControlbarProfileModel*>();
+    qmlRegisterUncreatableType<ControlbarProfileModel>("org.videolan.vlc", 0, 1, "ControlbarProfileModel", "");
     qmlRegisterUncreatableType<ControlbarProfile>("org.videolan.vlc", 0, 1, "ControlbarProfile", "");
     qmlRegisterUncreatableType<PlayerControlbarModel>("org.videolan.vlc", 0, 1, "PlayerControlbarModel", "");
     qmlRegisterUncreatableType<ControlListModel>( "org.videolan.vlc", 0, 1, "ControlListModel", "" );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7f6e6a7603402fcaf29a9570bbfca58026ef2ff7...676666ab37a38b4cd9b471430c7a51c0849f4184

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7f6e6a7603402fcaf29a9570bbfca58026ef2ff7...676666ab37a38b4cd9b471430c7a51c0849f4184
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list