aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help/helpmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/help/helpmanager.cpp')
-rw-r--r--src/plugins/help/helpmanager.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp
index 09fdc041fe..d4c5243e2f 100644
--- a/src/plugins/help/helpmanager.cpp
+++ b/src/plugins/help/helpmanager.cpp
@@ -43,10 +43,15 @@
#include <QHelpEngineCore>
#include <QMutexLocker>
+
+#ifndef HELP_NEW_FILTER_ENGINE
#include <QSqlDatabase>
#include <QSqlDriver>
#include <QSqlError>
#include <QSqlQuery>
+#else
+#include <QtHelp/QHelpLink>
+#endif
using namespace Core;
@@ -84,6 +89,8 @@ struct HelpManagerPrivate
static HelpManager *m_instance = nullptr;
static HelpManagerPrivate *d = nullptr;
+#ifndef HELP_NEW_FILTER_ENGINE
+
// -- DbCleaner
struct DbCleaner
@@ -93,6 +100,8 @@ struct DbCleaner
QString name;
};
+#endif
+
// -- HelpManager
HelpManager::HelpManager(QObject *parent) :
@@ -225,20 +234,36 @@ QSet<QString> HelpManager::userDocumentationPaths()
}
// This should go into Qt 4.8 once we start using it for Qt Creator
-QMap<QString, QUrl> HelpManager::linksForKeyword(const QString &key)
+QMultiMap<QString, QUrl> HelpManager::linksForKeyword(const QString &key)
{
QTC_ASSERT(!d->m_needsSetup, return {});
if (key.isEmpty())
return {};
+#ifndef HELP_NEW_FILTER_ENGINE
return d->m_helpEngine->linksForKeyword(key);
+#else
+ QMultiMap<QString, QUrl> links;
+ const QList<QHelpLink> docs = d->m_helpEngine->documentsForKeyword(key, QString());
+ for (const auto &doc : docs)
+ links.insert(doc.title, doc.url);
+ return links;
+#endif
}
-QMap<QString, QUrl> HelpManager::linksForIdentifier(const QString &id)
+QMultiMap<QString, QUrl> HelpManager::linksForIdentifier(const QString &id)
{
QTC_ASSERT(!d->m_needsSetup, return {});
if (id.isEmpty())
return {};
+#ifndef HELP_NEW_FILTER_ENGINE
return d->m_helpEngine->linksForIdentifier(id);
+#else
+ QMultiMap<QString, QUrl> links;
+ const QList<QHelpLink> docs = d->m_helpEngine->documentsForIdentifier(id, QString());
+ for (const auto &doc : docs)
+ links.insert(doc.title, doc.url);
+ return links;
+#endif
}
QUrl HelpManager::findFile(const QUrl &url)
@@ -292,6 +317,8 @@ QVariant HelpManager::customValue(const QString &key, const QVariant &value)
return d->m_helpEngine->customValue(key, value);
}
+#ifndef HELP_NEW_FILTER_ENGINE
+
HelpManager::Filters HelpManager::filters()
{
QTC_ASSERT(!d->m_needsSetup, return {});
@@ -358,6 +385,8 @@ void HelpManager::addUserDefinedFilter(const QString &filter, const QStringList
emit m_instance->collectionFileChanged();
}
+#endif
+
void HelpManager::aboutToShutdown()
{
if (d && d->m_registerFuture.isRunning()) {
@@ -378,6 +407,9 @@ void HelpManager::setupHelpManager()
// create the help engine
d->m_helpEngine = new QHelpEngineCore(collectionFilePath(), m_instance);
+#ifdef HELP_NEW_FILTER_ENGINE
+ d->m_helpEngine->setUsesFilterEngine(true);
+#endif
d->m_helpEngine->setupData();
for (const QString &filePath : d->documentationFromInstaller())