forked from qt-creator/qt-creator
CMake: Make use of CMake-provided .qch files
* Have UI to select a .qch file location in CMake Tool setup * Auto-detect CMake's .qch file in its default location (relative to the cmake executable) * Register the .qch files with the HelpManager Task-number: QTCREATORBUG-21338 Change-Id: I4057eec42c39535012d9f0daf788fc62ef20d544 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "cmaketoolsettingsaccessor.h"
|
||||
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/pointeralgorithm.h>
|
||||
@@ -105,6 +106,8 @@ bool CMakeToolManager::registerCMakeTool(std::unique_ptr<CMakeTool> &&tool)
|
||||
|
||||
ensureDefaultCMakeToolIsValid();
|
||||
|
||||
updateDocumentation();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -112,9 +115,10 @@ void CMakeToolManager::deregisterCMakeTool(const Id &id)
|
||||
{
|
||||
auto toRemove = Utils::take(d->m_cmakeTools, Utils::equal(&CMakeTool::id, id));
|
||||
if (toRemove.has_value()) {
|
||||
|
||||
ensureDefaultCMakeToolIsValid();
|
||||
|
||||
updateDocumentation();
|
||||
|
||||
emit m_instance->cmakeRemoved(id);
|
||||
}
|
||||
}
|
||||
@@ -152,9 +156,22 @@ void CMakeToolManager::restoreCMakeTools()
|
||||
d->m_cmakeTools = std::move(tools.cmakeTools);
|
||||
setDefaultCMakeTool(tools.defaultToolId);
|
||||
|
||||
updateDocumentation();
|
||||
|
||||
emit m_instance->cmakeToolsLoaded();
|
||||
}
|
||||
|
||||
void CMakeToolManager::updateDocumentation()
|
||||
{
|
||||
const QList<CMakeTool *> tools = cmakeTools();
|
||||
QStringList docs;
|
||||
for (const auto tool : tools) {
|
||||
if (!tool->qchFilePath().isEmpty())
|
||||
docs.append(tool->qchFilePath().toString());
|
||||
}
|
||||
Core::HelpManager::registerDocumentation(docs);
|
||||
}
|
||||
|
||||
void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool)
|
||||
{
|
||||
if (!tool || !Utils::contains(d->m_cmakeTools, tool))
|
||||
|
||||
Reference in New Issue
Block a user