diff --git a/src/base/asyncfilestorage.cpp b/src/base/asyncfilestorage.cpp index 1cc5d8d7e..eccd2b491 100644 --- a/src/base/asyncfilestorage.cpp +++ b/src/base/asyncfilestorage.cpp @@ -54,8 +54,13 @@ AsyncFileStorage::~AsyncFileStorage() void AsyncFileStorage::store(const QString &fileName, const QByteArray &data) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(this, [this, data, fileName]() { store_impl(fileName, data); } + , Qt::QueuedConnection); +#else QMetaObject::invokeMethod(this, "store_impl", Qt::QueuedConnection , Q_ARG(QString, fileName), Q_ARG(QByteArray, data)); +#endif } QDir AsyncFileStorage::storageDir() const diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 7f1292ef3..bdb8329dd 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -422,7 +422,11 @@ Session::Session(QObject *parent) m_nativeSession = new lt::session {pack, LTSessionFlags {0}}; m_nativeSession->set_alert_notify([this]() { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(this, &Session::readAlerts, Qt::QueuedConnection); +#else QMetaObject::invokeMethod(this, "readAlerts", Qt::QueuedConnection); +#endif }); configurePeerClasses(); @@ -2190,14 +2194,24 @@ void Session::saveTorrentsQueue() data += (hash.toLatin1() + '\n'); const QString filename = QLatin1String {"queue"}; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(m_resumeDataSavingManager + , [this, data, filename]() { m_resumeDataSavingManager->save(filename, data); }); +#else QMetaObject::invokeMethod(m_resumeDataSavingManager, "save" , Q_ARG(QString, filename), Q_ARG(QByteArray, data)); +#endif } void Session::removeTorrentsQueue() { const QString filename = QLatin1String {"queue"}; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(m_resumeDataSavingManager + , [this, filename]() { m_resumeDataSavingManager->remove(filename); }); +#else QMetaObject::invokeMethod(m_resumeDataSavingManager, "remove", Q_ARG(QString, filename)); +#endif } void Session::setDefaultSavePath(QString path) @@ -3471,8 +3485,13 @@ void Session::handleTorrentResumeDataReady(TorrentHandle *const torrent, const l lt::bencode(std::back_inserter(out), data); const QString filename = QString("%1.fastresume").arg(torrent->hash()); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(m_resumeDataSavingManager + , [this, filename, out]() { m_resumeDataSavingManager->save(filename, out); }); +#else QMetaObject::invokeMethod(m_resumeDataSavingManager, "save", Q_ARG(QString, filename), Q_ARG(QByteArray, out)); +#endif } void Session::handleTorrentResumeDataFailed(TorrentHandle *const torrent) @@ -3530,7 +3549,13 @@ void Session::initResumeFolder() void Session::configureDeferred() { if (!m_deferredConfigureScheduled) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(this + , static_cast(&Session::configure) + , Qt::QueuedConnection); +#else QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection); +#endif m_deferredConfigureScheduled = true; } } diff --git a/src/base/rss/private/rss_parser.cpp b/src/base/rss/private/rss_parser.cpp index d16b20f26..315440fbd 100644 --- a/src/base/rss/private/rss_parser.cpp +++ b/src/base/rss/private/rss_parser.cpp @@ -535,8 +535,13 @@ Parser::Parser(const QString lastBuildDate) void Parser::parse(const QByteArray &feedData) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + QMetaObject::invokeMethod(this, [this, feedData]() { parse_impl(feedData); } + , Qt::QueuedConnection); +#else QMetaObject::invokeMethod(this, "parse_impl", Qt::QueuedConnection , Q_ARG(QByteArray, feedData)); +#endif } // read and create items from a rss document