summaryrefslogtreecommitdiffstats
path: root/src/assistant/help/qhelpengine.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2017-08-25 17:02:29 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2018-04-23 14:14:34 +0000
commit829f9dec6bff57e8b3f1afdc982778a9d573174f (patch)
tree908d7930a11e24b621074ace5b3509a63a61d4f6 /src/assistant/help/qhelpengine.cpp
parent58bf8789242b0775d491c8969abae8f42f2bc32d (diff)
Store the copy of the index inside the help collection file
This avoids having to open all .qch files at startup, which is slow and can lead to contention on open file handles. This change is backward compatible. The old help lib won't use the new tables. The new help lib will generate the new tables on first run or regenerate them when it detects they are not anymore in sync. Store also the timestamp info about the qch files and compare it upon every startup. If it doesn't match then new tables' data is regenerated. The case when running new Creator, then running old Creator and reconfiguring doc set and then running new Creator again should work properly. Task-number: QTCREATORBUG-18242 Change-Id: I7f656935ae2383b866b27e256eec23dab588efc5 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/assistant/help/qhelpengine.cpp')
-rw-r--r--src/assistant/help/qhelpengine.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/assistant/help/qhelpengine.cpp b/src/assistant/help/qhelpengine.cpp
index 41ded85ee..966c33354 100644
--- a/src/assistant/help/qhelpengine.cpp
+++ b/src/assistant/help/qhelpengine.cpp
@@ -48,6 +48,7 @@
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QPluginLoader>
+#include <QtCore/QTimer>
#include <QtWidgets/QApplication>
#include <QtSql/QSqlQuery>
@@ -64,15 +65,26 @@ void QHelpEnginePrivate::init(const QString &collectionFile,
indexModel = new QHelpIndexModel(this);
connect(helpEngineCore, &QHelpEngineCore::setupFinished,
- this, &QHelpEnginePrivate::applyCurrentFilter);
+ this, &QHelpEnginePrivate::scheduleApplyCurrentFilter);
connect(helpEngineCore, &QHelpEngineCore::currentFilterChanged,
- this, &QHelpEnginePrivate::applyCurrentFilter);
+ this, &QHelpEnginePrivate::scheduleApplyCurrentFilter);
}
-void QHelpEnginePrivate::applyCurrentFilter()
+void QHelpEnginePrivate::scheduleApplyCurrentFilter()
{
if (!error.isEmpty())
return;
+
+ if (m_isApplyCurrentFilterScheduled)
+ return;
+
+ m_isApplyCurrentFilterScheduled = true;
+ QTimer::singleShot(0, this, &QHelpEnginePrivate::applyCurrentFilter);
+}
+
+void QHelpEnginePrivate::applyCurrentFilter()
+{
+ m_isApplyCurrentFilterScheduled = false;
contentModel->createContents(currentFilter);
indexModel->createIndex(currentFilter);
}