forked from qt-creator/qt-creator
Compile fix in case of when HELP_NEW_FILTER_ENGINE is undefined
Amends 8d06e66c49
Change-Id: Ia7a81ed754c9f5cad9d9d51a89b9e1e1a7eddd03
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -89,12 +89,8 @@ void HelpIndexFilter::prepareSearch(const QString &entry)
|
|||||||
|
|
||||||
QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry)
|
QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry)
|
||||||
{
|
{
|
||||||
m_mutex.lock(); // guard m_needsUpdate
|
if (m_needsUpdate.exchange(false) || m_searchTermCache.size() < 2
|
||||||
bool forceUpdate = m_needsUpdate;
|
|| m_searchTermCache.isEmpty() || !entry.contains(m_searchTermCache)) {
|
||||||
m_mutex.unlock();
|
|
||||||
|
|
||||||
if (forceUpdate || m_searchTermCache.size() < 2 || m_searchTermCache.isEmpty()
|
|
||||||
|| !entry.contains(m_searchTermCache)) {
|
|
||||||
int limit = entry.size() < 2 ? 200 : INT_MAX;
|
int limit = entry.size() < 2 ? 200 : INT_MAX;
|
||||||
QSet<QString> results;
|
QSet<QString> results;
|
||||||
for (const QString &filePath : qAsConst(m_helpDatabases)) {
|
for (const QString &filePath : qAsConst(m_helpDatabases)) {
|
||||||
@@ -108,9 +104,6 @@ QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFi
|
|||||||
Q_ARG(int, limit));
|
Q_ARG(int, limit));
|
||||||
results.unite(result);
|
results.unite(result);
|
||||||
}
|
}
|
||||||
m_mutex.lock(); // guard m_needsUpdate
|
|
||||||
m_needsUpdate = false;
|
|
||||||
m_mutex.unlock();
|
|
||||||
m_keywordCache = results;
|
m_keywordCache = results;
|
||||||
m_searchTermCache = entry;
|
m_searchTermCache = entry;
|
||||||
}
|
}
|
||||||
@@ -174,11 +167,10 @@ bool HelpIndexFilter::updateCache(QFutureInterface<LocatorFilterEntry> &future,
|
|||||||
|
|
||||||
QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry)
|
QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry)
|
||||||
{
|
{
|
||||||
if (m_needsUpdate) {
|
if (m_needsUpdate.exchange(false)) {
|
||||||
QStringList indices;
|
QStringList indices;
|
||||||
QMetaObject::invokeMethod(this, [this] { return allIndices(); },
|
QMetaObject::invokeMethod(this, [this] { return allIndices(); },
|
||||||
Qt::BlockingQueuedConnection, &indices);
|
Qt::BlockingQueuedConnection, &indices);
|
||||||
m_needsUpdate = false;
|
|
||||||
m_allIndicesCache = indices;
|
m_allIndicesCache = indices;
|
||||||
// force updating the cache taking the m_allIndicesCache
|
// force updating the cache taking the m_allIndicesCache
|
||||||
m_lastIndicesCache = QStringList();
|
m_lastIndicesCache = QStringList();
|
||||||
|
Reference in New Issue
Block a user