forked from qt-creator/qt-creator
Help: Simplify and unify code
The help widget doesn't need to resolve the external help viewer instance manually, we have an entrypoint for that already. Change-Id: I6875c434428baac3f1883813207cf318d7d3dc09 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -133,7 +133,7 @@ public:
|
||||
void setupHelpEngineIfNeeded();
|
||||
|
||||
void highlightSearchTermsInContextHelp();
|
||||
void handleHelpRequest(const QUrl &url, Core::HelpManager::HelpViewerLocation location);
|
||||
void showHelpUrl(const QUrl &url, Core::HelpManager::HelpViewerLocation location);
|
||||
|
||||
void slotSystemInformation();
|
||||
|
||||
@@ -190,6 +190,11 @@ HelpPlugin::~HelpPlugin()
|
||||
m_helpManager = nullptr;
|
||||
}
|
||||
|
||||
void HelpPlugin::showHelpUrl(const QUrl &url, Core::HelpManager::HelpViewerLocation location)
|
||||
{
|
||||
dd->showHelpUrl(url, location);
|
||||
}
|
||||
|
||||
bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
@@ -225,7 +230,7 @@ HelpPluginPrivate::HelpPluginPrivate()
|
||||
connect(LocalHelpManager::instance(), &LocalHelpManager::returnOnCloseChanged,
|
||||
m_centralWidget, &CentralWidget::updateCloseButton);
|
||||
connect(HelpManager::instance(), &HelpManager::helpRequested,
|
||||
this, &HelpPluginPrivate::handleHelpRequest);
|
||||
this, &HelpPluginPrivate::showHelpUrl);
|
||||
connect(&m_searchTaskHandler, &SearchTaskHandler::search,
|
||||
this, &QDesktopServices::openUrl);
|
||||
|
||||
@@ -585,11 +590,6 @@ HelpWidget *HelpPluginPrivate::helpWidgetForWindow(QWidget *window)
|
||||
return m_centralWidget;
|
||||
}
|
||||
|
||||
HelpViewer *HelpPlugin::viewerForHelpViewerLocation(Core::HelpManager::HelpViewerLocation location)
|
||||
{
|
||||
return dd->viewerForHelpViewerLocation(location);
|
||||
}
|
||||
|
||||
HelpViewer *HelpPluginPrivate::viewerForHelpViewerLocation(
|
||||
Core::HelpManager::HelpViewerLocation location)
|
||||
{
|
||||
@@ -613,11 +613,6 @@ HelpViewer *HelpPluginPrivate::viewerForHelpViewerLocation(
|
||||
return helpModeHelpViewer();
|
||||
}
|
||||
|
||||
void HelpPlugin::showInHelpViewer(const QUrl &url, HelpViewer *viewer)
|
||||
{
|
||||
dd->showInHelpViewer(url, viewer);
|
||||
}
|
||||
|
||||
void HelpPluginPrivate::showInHelpViewer(const QUrl &url, HelpViewer *viewer)
|
||||
{
|
||||
QTC_ASSERT(viewer, return);
|
||||
@@ -726,8 +721,7 @@ void HelpPluginPrivate::highlightSearchTermsInContextHelp()
|
||||
m_contextHelpHighlightId.clear();
|
||||
}
|
||||
|
||||
void HelpPluginPrivate::handleHelpRequest(const QUrl &url,
|
||||
Core::HelpManager::HelpViewerLocation location)
|
||||
void HelpPluginPrivate::showHelpUrl(const QUrl &url, Core::HelpManager::HelpViewerLocation location)
|
||||
{
|
||||
static const QString qtcreatorUnversionedID = "org.qt-project.qtcreator";
|
||||
if (url.host() == qtcreatorUnversionedID) {
|
||||
@@ -735,7 +729,7 @@ void HelpPluginPrivate::handleHelpRequest(const QUrl &url,
|
||||
QUrl versioned = url;
|
||||
versioned.setHost(qtcreatorUnversionedID + "."
|
||||
+ QString::fromLatin1(Core::Constants::IDE_VERSION_LONG).remove('.'));
|
||||
handleHelpRequest(versioned, location);
|
||||
showHelpUrl(versioned, location);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -46,8 +46,7 @@ public:
|
||||
HelpPlugin();
|
||||
~HelpPlugin() final;
|
||||
|
||||
static HelpViewer *viewerForHelpViewerLocation(Core::HelpManager::HelpViewerLocation location);
|
||||
static void showInHelpViewer(const QUrl &url, HelpViewer *viewer);
|
||||
static void showHelpUrl(const QUrl &url, Core::HelpManager::HelpViewerLocation location);
|
||||
static HelpViewer *createHelpViewer(qreal zoom);
|
||||
|
||||
private:
|
||||
|
@@ -69,8 +69,7 @@ namespace Internal {
|
||||
|
||||
static void openUrlInWindow(const QUrl &url)
|
||||
{
|
||||
HelpViewer *viewer = HelpPlugin::viewerForHelpViewerLocation(Core::HelpManager::ExternalHelpAlways);
|
||||
HelpPlugin::showInHelpViewer(url, viewer);
|
||||
HelpPlugin::showHelpUrl(url, Core::HelpManager::ExternalHelpAlways);
|
||||
}
|
||||
|
||||
static bool isBookmarkable(const QUrl &url)
|
||||
|
Reference in New Issue
Block a user