diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-07 03:05:32 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-07 03:05:32 +0100 |
commit | f57b06711a901cc9fbb71512e758719edf26e3cf (patch) | |
tree | f83a421d2226077c50a66ce234545c14cd575819 | |
parent | 5a2c52c212ebcc8de77bc9bc97812ebfa8925c94 (diff) | |
parent | 3cb8f05175090754815dae4fbd003549c2d792eb (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I8c0b6672cfb3b1dfec7ff8ced392e43518bdb162
-rw-r--r-- | .gitmodules | 1 | ||||
-rw-r--r-- | src/ivicore/qivipendingreply.cpp | 24 | ||||
-rw-r--r-- | src/plugins/ivimedia/media_qtro/mediaplayerbackend.cpp | 2 | ||||
-rw-r--r-- | src/tools/media-simulation-server/main.cpp | 4 | ||||
-rw-r--r-- | tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp | 36 |
5 files changed, 40 insertions, 27 deletions
diff --git a/.gitmodules b/.gitmodules index 25448fe..36ff789 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,6 @@ [submodule "src/3rdparty/qface"] path = src/3rdparty/qface url = ../qtivi-qface.git - branch = upstream/develop [submodule "src/3rdparty/taglib/taglib"] path = src/3rdparty/taglib/taglib url = ../qtivi-taglib.git diff --git a/src/ivicore/qivipendingreply.cpp b/src/ivicore/qivipendingreply.cpp index 2caa926..b0c6edd 100644 --- a/src/ivicore/qivipendingreply.cpp +++ b/src/ivicore/qivipendingreply.cpp @@ -73,13 +73,23 @@ void qiviRegisterPendingReplyBasicTypes() { if (once) return; - qRegisterMetaType<QIviPendingReplyBase>("QIviPendingReplyBase"); - QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QTIVI_ADD_STATIC_METATYPE) - QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QTIVI_ADD_STATIC_METATYPE) - QT_FOR_EACH_STATIC_CORE_POINTER(QTIVI_ADD_STATIC_METATYPE) - QT_FOR_EACH_STATIC_CORE_TEMPLATE(QTIVI_ADD_STATIC_METATYPE) - QT_FOR_EACH_STATIC_CORE_CLASS(QTIVI_ADD_STATIC_METATYPE) - QT_FOR_EACH_STATIC_ALIAS_TYPE(QTIVI_ADD_STATIC_METATYPE2) + // This function is registered as Q_COREAPP_STARTUP_FUNCTION, which makes sure + // it is run after the QCoreApplication constructor to ensure we can register + // types. + // In case the library is loaded at runtime (because of a qml plugin dependency), + // the init function would be registered and executed right away before the + // rest of the library is initialized (e.g. the QMetaObject of QIviPendingReplyBase). + // The singleshot timer makes sure the registration is done in the next event + // loop run, when everything is ready. + QMetaObject::invokeMethod(qApp, []() { + qRegisterMetaType<QIviPendingReplyBase>("QIviPendingReplyBase"); + QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QTIVI_ADD_STATIC_METATYPE) + QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QTIVI_ADD_STATIC_METATYPE) + QT_FOR_EACH_STATIC_CORE_POINTER(QTIVI_ADD_STATIC_METATYPE) + QT_FOR_EACH_STATIC_CORE_TEMPLATE(QTIVI_ADD_STATIC_METATYPE) + QT_FOR_EACH_STATIC_CORE_CLASS(QTIVI_ADD_STATIC_METATYPE) + QT_FOR_EACH_STATIC_ALIAS_TYPE(QTIVI_ADD_STATIC_METATYPE2) + }); once = true; } diff --git a/src/plugins/ivimedia/media_qtro/mediaplayerbackend.cpp b/src/plugins/ivimedia/media_qtro/mediaplayerbackend.cpp index 11f77e8..48b185b 100644 --- a/src/plugins/ivimedia/media_qtro/mediaplayerbackend.cpp +++ b/src/plugins/ivimedia/media_qtro/mediaplayerbackend.cpp @@ -68,7 +68,7 @@ void MediaPlayerBackend::initialize() emit playStateChanged(m_replica->playState()); emit positionChanged(m_replica->position()); emit durationChanged(m_replica->duration()); - emit currentTrackChanged(m_replica->currentTrack()); + emit currentTrackChanged(m_helper->fromRemoteObjectVariant(m_replica->currentTrack())); emit currentIndexChanged(m_replica->currentIndex()); emit volumeChanged(m_replica->volume()); emit mutedChanged(m_replica->muted()); diff --git a/src/tools/media-simulation-server/main.cpp b/src/tools/media-simulation-server/main.cpp index 7729d30..fa83a21 100644 --- a/src/tools/media-simulation-server/main.cpp +++ b/src/tools/media-simulation-server/main.cpp @@ -63,7 +63,9 @@ int main(int argc, char *argv[]) { #ifdef Q_OS_MACOS - //QtMultimedia doesn't work with a QCoreApplication on macos + // QtMultimedia doesn't work with a QCoreApplication on macos + // Use the env variable to prevent Qt from creating an app icon in the dock + qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "1"); QGuiApplication app(argc, argv); #else QCoreApplication app(argc, argv); diff --git a/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp b/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp index 9124827..5f0bb73 100644 --- a/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp +++ b/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp @@ -141,8 +141,10 @@ class tst_QIviPendingReply : public QObject private Q_SLOTS: void initTestCase(); - void testSuccess(); + // This needs to be the first test, as it tests calling a function which returns QIviPendingReply + // from QML and for this the basic types have to be registered before automatically. void testSuccess_qml(); + void testSuccess(); void testSuccessFromQml(); void testConversion_qml(); void testFailed(); @@ -202,22 +204,6 @@ template <typename T> void tst_QIviPendingReply::test_helper(const QIviPendingRe QCOMPARE(reply.value(), valueChangedSpy.at(0).at(0)); } -void tst_QIviPendingReply::testSuccess() -{ - TestObject testObject; - - test_helper<void>(testObject.test_void(), false); - test<int>(testObject.test_int(500), false, 500); - test<quint16>(testObject.test_quint16(1234), false, 1234); - test<float>(testObject.test_float(-1234.56), false, -1234.56); - test<QString>(testObject.test_QString("HELLO"), false, "HELLO"); - test<QVariant>(testObject.test_QVariant(QVariant("VARIANT")), false, QVariant("VARIANT")); - test<TestObject::TestEnum>(testObject.test_TestEnum(TestObject::Value_2), false, TestObject::Value_2); - test<TestObject::TestFlags>(testObject.test_TestFlags(TestObject::TestFlags(TestObject::TestFlag_2 | TestObject::TestFlag_1)), false, - TestObject::TestFlags(TestObject::TestFlag_2 | TestObject::TestFlag_1)); - test<TestGadget>(testObject.test_TestGadget(TestGadget("FOO", 5)), false, TestGadget("FOO", 5)); -} - template <typename T> void tst_QIviPendingReply::testQml(TestObject *testObject, const QByteArray qmlFunction, bool failed, T expectedResult) { QVariant result; @@ -333,6 +319,22 @@ void tst_QIviPendingReply::testSuccess_qml() testQml<TestGadget>(&testObject, "test_TestGadget(testObject.createGadget('FOO', 5))", false, TestGadget("FOO", 5)); } +void tst_QIviPendingReply::testSuccess() +{ + TestObject testObject; + + test_helper<void>(testObject.test_void(), false); + test<int>(testObject.test_int(500), false, 500); + test<quint16>(testObject.test_quint16(1234), false, 1234); + test<float>(testObject.test_float(-1234.56), false, -1234.56); + test<QString>(testObject.test_QString("HELLO"), false, "HELLO"); + test<QVariant>(testObject.test_QVariant(QVariant("VARIANT")), false, QVariant("VARIANT")); + test<TestObject::TestEnum>(testObject.test_TestEnum(TestObject::Value_2), false, TestObject::Value_2); + test<TestObject::TestFlags>(testObject.test_TestFlags(TestObject::TestFlags(TestObject::TestFlag_2 | TestObject::TestFlag_1)), false, + TestObject::TestFlags(TestObject::TestFlag_2 | TestObject::TestFlag_1)); + test<TestGadget>(testObject.test_TestGadget(TestGadget("FOO", 5)), false, TestGadget("FOO", 5)); +} + void tst_QIviPendingReply::testSuccessFromQml() { // Instead of using the PendingReply in QML and react on the result using then() |