forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user