HelpManager: Cache the registered documentation namespaces

Querying the namespaces is expensive as it involves a complicated SQL
query. We shouldn't do this if we don't need to. In this case we only
need the initial list. After that, we know if we add something to it.

Change-Id: I0c45ae6d39da686fa29a968d815dac3d68890208
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Ulf Hermann
2018-02-15 13:26:41 +01:00
parent 324de13b4e
commit 45744fa725

View File

@@ -129,12 +129,14 @@ void HelpManager::registerDocumentation(const QStringList &files)
}
bool docsChanged = false;
QStringList nameSpaces = d->m_helpEngine->registeredDocumentations();
for (const QString &file : files) {
const QString &nameSpace = d->m_helpEngine->namespaceName(file);
if (nameSpace.isEmpty())
continue;
if (!d->m_helpEngine->registeredDocumentations().contains(nameSpace)) {
if (!nameSpaces.contains(nameSpace)) {
if (d->m_helpEngine->registerDocumentation(file)) {
nameSpaces.append(nameSpace);
docsChanged = true;
} else {
qWarning() << "Error registering namespace '" << nameSpace