forked from qt-creator/qt-creator
Help: Remove some unnecessary direct accesses to central widget
Change-Id: I04046b792f5b5264534e2654db28fcb18638869b Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
This commit is contained in:
@@ -86,13 +86,10 @@ void HelpIndexFilter::accept(LocatorFilterEntry selection) const
|
||||
const QString &key = selection.displayName;
|
||||
const QMap<QString, QUrl> &links = Core::HelpManager::linksForKeyword(key);
|
||||
|
||||
if (links.size() == 1) {
|
||||
if (links.size() == 1)
|
||||
emit linkActivated(links.begin().value());
|
||||
} else if (!links.isEmpty()) {
|
||||
TopicChooser tc(CentralWidget::instance(), key, links);
|
||||
if (tc.exec() == QDialog::Accepted)
|
||||
emit linkActivated(tc.link());
|
||||
}
|
||||
else
|
||||
emit linksActivated(links, key);
|
||||
}
|
||||
|
||||
void HelpIndexFilter::refresh(QFutureInterface<void> &future)
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
|
||||
signals:
|
||||
void linkActivated(const QUrl &link) const;
|
||||
void linksActivated(const QMap<QString, QUrl> &links, const QString &key) const;
|
||||
|
||||
private:
|
||||
QIcon m_icon;
|
||||
|
||||
@@ -162,7 +162,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
connect(HelpManager::instance(), SIGNAL(helpRequested(QUrl,Core::HelpManager::HelpViewerLocation)),
|
||||
this, SLOT(handleHelpRequest(QUrl,Core::HelpManager::HelpViewerLocation)));
|
||||
connect(m_searchTaskHandler, SIGNAL(search(QUrl)), this,
|
||||
SLOT(switchToHelpMode(QUrl)));
|
||||
SLOT(showLinkInHelpMode(QUrl)));
|
||||
|
||||
connect(m_filterSettingsPage, SIGNAL(filtersChanged()), this,
|
||||
SLOT(setupHelpEngineIfNeeded()));
|
||||
@@ -223,15 +223,17 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
SLOT(gotoNextPage()));
|
||||
}
|
||||
|
||||
HelpIndexFilter *helpIndexFilter = new HelpIndexFilter();
|
||||
auto helpIndexFilter = new HelpIndexFilter();
|
||||
addAutoReleasedObject(helpIndexFilter);
|
||||
connect(helpIndexFilter, SIGNAL(linkActivated(QUrl)), this,
|
||||
SLOT(switchToHelpMode(QUrl)));
|
||||
connect(helpIndexFilter, &HelpIndexFilter::linkActivated,
|
||||
this, &HelpPlugin::showLinkInHelpMode);
|
||||
connect(helpIndexFilter, &HelpIndexFilter::linksActivated,
|
||||
this, &HelpPlugin::showLinksInHelpMode);
|
||||
|
||||
RemoteHelpFilter *remoteHelpFilter = new RemoteHelpFilter();
|
||||
addAutoReleasedObject(remoteHelpFilter);
|
||||
connect(remoteHelpFilter, SIGNAL(linkActivated(QUrl)), this,
|
||||
SLOT(switchToHelpMode(QUrl)));
|
||||
SLOT(showLinkInHelpMode(QUrl)));
|
||||
|
||||
QDesktopServices::setUrlHandler(QLatin1String("qthelp"), this, "handleHelpRequest");
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
|
||||
@@ -330,7 +332,7 @@ HelpWidget *HelpPlugin::createHelpWidget(const Context &context, HelpWidget::Wid
|
||||
connect(widget->currentViewer(), SIGNAL(loadFinished()),
|
||||
this, SLOT(highlightSearchTermsInContextHelp()));
|
||||
connect(widget, SIGNAL(openHelpMode(QUrl)),
|
||||
this, SLOT(switchToHelpMode(QUrl)));
|
||||
this, SLOT(showLinkInHelpMode(QUrl)));
|
||||
connect(widget, SIGNAL(closeButtonClicked()),
|
||||
this, SLOT(slotHideRightPane()));
|
||||
connect(widget, SIGNAL(aboutToClose()),
|
||||
@@ -410,7 +412,7 @@ void HelpPlugin::activateHelpMode()
|
||||
ModeManager::activateMode(Id(Constants::ID_MODE_HELP));
|
||||
}
|
||||
|
||||
void HelpPlugin::switchToHelpMode(const QUrl &source)
|
||||
void HelpPlugin::showLinkInHelpMode(const QUrl &source)
|
||||
{
|
||||
activateHelpMode();
|
||||
Core::ICore::raiseWindow(m_mode->widget());
|
||||
@@ -418,6 +420,13 @@ void HelpPlugin::switchToHelpMode(const QUrl &source)
|
||||
m_centralWidget->setFocus();
|
||||
}
|
||||
|
||||
void HelpPlugin::showLinksInHelpMode(const QMap<QString, QUrl> &links, const QString &key)
|
||||
{
|
||||
activateHelpMode();
|
||||
Core::ICore::raiseWindow(m_mode->widget());
|
||||
m_centralWidget->showTopicChooser(links, key);
|
||||
}
|
||||
|
||||
void HelpPlugin::slotHideRightPane()
|
||||
{
|
||||
RightPaneWidget::instance()->setShown(false);
|
||||
@@ -463,7 +472,7 @@ void HelpPlugin::fontChanged()
|
||||
: m_rightPaneSideBarWidget->currentViewer()->viewerFont();
|
||||
|
||||
m_rightPaneSideBarWidget->setViewerFont(font);
|
||||
CentralWidget::instance()->setViewerFont(font);
|
||||
m_centralWidget->setViewerFont(font);
|
||||
}
|
||||
|
||||
void HelpPlugin::setupHelpEngineIfNeeded()
|
||||
@@ -646,7 +655,7 @@ void HelpPlugin::handleHelpRequest(const QUrl &url, Core::HelpManager::HelpViewe
|
||||
|
||||
void HelpPlugin::slotOpenSupportPage()
|
||||
{
|
||||
switchToHelpMode(QUrl(QLatin1String("qthelp://org.qt-project.qtcreator/doc/technical-support.html")));
|
||||
showLinkInHelpMode(QUrl(QLatin1String("qthelp://org.qt-project.qtcreator/doc/technical-support.html")));
|
||||
}
|
||||
|
||||
void HelpPlugin::slotReportBug()
|
||||
|
||||
@@ -94,7 +94,8 @@ private slots:
|
||||
void activateContents();
|
||||
|
||||
void saveExternalWindowSettings();
|
||||
void switchToHelpMode(const QUrl &source);
|
||||
void showLinkInHelpMode(const QUrl &source);
|
||||
void showLinksInHelpMode(const QMap<QString, QUrl> &links, const QString &key);
|
||||
void slotHideRightPane();
|
||||
|
||||
void updateSideBarSource();
|
||||
|
||||
@@ -323,7 +323,7 @@ void TextBrowserHelpWidget::openLink(const QUrl &url, bool newPage)
|
||||
if (newPage)
|
||||
OpenPagesManager::instance().createPage(url);
|
||||
else
|
||||
CentralWidget::instance()->setSource(url);
|
||||
setSource(url);
|
||||
}
|
||||
|
||||
void TextBrowserHelpWidget::scaleUp()
|
||||
|
||||
Reference in New Issue
Block a user