Commit 72ad8daa authored by Laurent Montel's avatar Laurent Montel 😁

Port to new connect api

parent 6be470ca
......@@ -126,10 +126,18 @@ void CollectionScheduler::quit()
void CollectionScheduler::inhibit(bool inhibit)
{
if (inhibit) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
const bool success = QMetaObject::invokeMethod(mScheduler, &PauseableTimer::pause, Qt::QueuedConnection);
#else
const bool success = QMetaObject::invokeMethod(mScheduler, "pause", Qt::QueuedConnection);
#endif
Q_ASSERT(success); Q_UNUSED(success);
} else {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
const bool success = QMetaObject::invokeMethod(mScheduler, &PauseableTimer::resume, Qt::QueuedConnection);
#else
const bool success = QMetaObject::invokeMethod(mScheduler, "resume", Qt::QueuedConnection);
#endif
Q_ASSERT(success); Q_UNUSED(success);
}
}
......@@ -149,9 +157,13 @@ void CollectionScheduler::collectionAdded(qint64 collectionId)
Collection collection = Collection::retrieveById(collectionId);
DataStore::self()->activeCachePolicy(collection);
if (shouldScheduleCollection(collection)) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(this, [this, collection]() {scheduleCollection(collection);}, Qt::QueuedConnection);
#else
QMetaObject::invokeMethod(this, "scheduleCollection",
Qt::QueuedConnection,
Q_ARG(Collection, collection));
#endif
}
}
......
......@@ -229,7 +229,11 @@ void SearchManager::scheduleSearchUpdate()
// Reset if the timer is active (use QueuedConnection to invoke start() from
// the thread the QTimer lives in instead of caller's thread, otherwise crashes
// and weird things can happen.
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(mSearchUpdateTimer, QOverload<>::of(&QTimer::start), Qt::QueuedConnection);
#else
QMetaObject::invokeMethod(mSearchUpdateTimer, "start", Qt::QueuedConnection);
#endif
}
void SearchManager::searchUpdateTimeout()
......@@ -243,9 +247,13 @@ void SearchManager::searchUpdateTimeout()
void SearchManager::updateSearchAsync(const Collection &collection)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(this, [this, collection]() { updateSearchImpl(collection); }, Qt::QueuedConnection);
#else
QMetaObject::invokeMethod(this, "updateSearchImpl",
Qt::QueuedConnection,
Q_ARG(Collection, collection));
#endif
}
void SearchManager::updateSearch(const Collection &collection)
......@@ -259,11 +267,13 @@ void SearchManager::updateSearch(const Collection &collection)
}
mUpdatingCollections.insert(collection.id());
mLock.unlock();
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(this, [this, collection]() { updateSearchImpl(collection); }, Qt::BlockingQueuedConnection);
#else
QMetaObject::invokeMethod(this, "updateSearchImpl",
Qt::BlockingQueuedConnection,
Q_ARG(Collection, collection));
#endif
mLock.lock();
mUpdatingCollections.remove(collection.id());
mLock.unlock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment