fix qt5 build

This commit is contained in:
Martin Rotter 2023-03-29 09:20:31 +02:00
parent 8a4ac8f09f
commit b91db35eb5
3 changed files with 22 additions and 1 deletions

View File

@ -157,7 +157,12 @@ void FeedDownloader::updateFeeds(const QList<Feed*>& feeds) {
return updateThreadedFeed(fd);
};
m_watcherLookup.setFuture(QtConcurrent::mapped(qApp->workHorsePool(), m_feeds, func));
m_watcherLookup.setFuture(QtConcurrent::mapped(
#if QT_VERSION_MAJOR > 5
qApp->workHorsePool(),
#endif
m_feeds,
func));
}
}

View File

@ -967,6 +967,14 @@ void Application::setupWorkHorsePool() {
// NOTE: Do not expire threads so that their IDs are not reused.
// This fixes cross-thread QSqlDatabase access.
m_workHorsePool->setExpiryTimeout(-1);
#if QT_VERSION_MAJOR == 5
// NOTE: Qt 5 sadly does not allow to specify custom thread pool for
// QtConcurrent::mapped() method, so we have to use global thread pool
// there.
QThreadPool::globalInstance()->setMaxThreadCount(m_workHorsePool->maxThreadCount());
QThreadPool::globalInstance()->setExpiryTimeout(m_workHorsePool->expiryTimeout());
#endif
}
void Application::onAdBlockFailure() {

View File

@ -380,7 +380,11 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
return produceFeed(lookup);
};
#if QT_VERSION_MAJOR == 5
QFuture<bool> fut = QtConcurrent::mapped(m_lookup, func);
#else
QFuture<bool> fut = QtConcurrent::mapped(qApp->workHorsePool(), m_lookup, func);
#endif
m_watcherLookup.setFuture(fut);
@ -445,7 +449,11 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data,
return produceFeed(lookup);
};
#if QT_VERSION_MAJOR == 5
QFuture<bool> fut = QtConcurrent::mapped(m_lookup, func);
#else
QFuture<bool> fut = QtConcurrent::mapped(qApp->workHorsePool(), m_lookup, func);
#endif
m_watcherLookup.setFuture(fut);