forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.4'
Change-Id: I35ba4cc7f7052699c3006545514c866be3cb5fdd
This commit is contained in:
@@ -231,7 +231,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
connect(remoteHelpFilter, SIGNAL(linkActivated(QUrl)), this,
|
||||
SLOT(showLinkInHelpMode(QUrl)));
|
||||
|
||||
QDesktopServices::setUrlHandler(QLatin1String("qthelp"), this, "handleHelpRequest");
|
||||
QDesktopServices::setUrlHandler(QLatin1String("qthelp"), HelpManager::instance(), "handleHelpRequest");
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
|
||||
this, SLOT(modeChanged(Core::IMode*,Core::IMode*)));
|
||||
|
||||
@@ -367,24 +367,37 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
|
||||
factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); });
|
||||
|
||||
ViewerFactory factory;
|
||||
// TODO: Visual Studio < 2013 has a bug in std::function's operator bool, which in this case
|
||||
// leads to succeeding boolean checks on factory which should not succeed.
|
||||
// So we may not check against "if (!factory)"
|
||||
bool factoryFound = false;
|
||||
|
||||
// check requested backend
|
||||
const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND"));
|
||||
if (!backend.isEmpty()) {
|
||||
factory = factories.value(backend);
|
||||
if (!factory)
|
||||
if (!factories.contains(backend)) {
|
||||
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
|
||||
} else {
|
||||
factory = factories.value(backend);
|
||||
factoryFound = true;
|
||||
}
|
||||
}
|
||||
// default setting
|
||||
#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT
|
||||
if (!factory)
|
||||
if (!factoryFound && factories.contains(QLatin1String("native"))) {
|
||||
factory = factories.value(QLatin1String("native"));
|
||||
factoryFound = true;
|
||||
}
|
||||
#endif
|
||||
if (!factory)
|
||||
if (!factoryFound && factories.contains(QLatin1String("qtwebkit"))) {
|
||||
factory = factories.value(QLatin1String("qtwebkit"));
|
||||
if (!factory)
|
||||
factoryFound = true;
|
||||
}
|
||||
if (!factoryFound && factories.contains(QLatin1String("textbrowser"))) {
|
||||
factory = factories.value(QLatin1String("textbrowser"));
|
||||
|
||||
QTC_ASSERT(factory, return 0);
|
||||
factoryFound = true;
|
||||
}
|
||||
QTC_ASSERT(factoryFound, return 0);
|
||||
HelpViewer *viewer = factory();
|
||||
|
||||
// initialize font
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/styledbar.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHelpEngine>
|
||||
#include <QHelpSearchEngine>
|
||||
@@ -131,15 +132,18 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
||||
}
|
||||
if (style != SideBarWidget) {
|
||||
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
|
||||
tr(Core::Constants::TR_SHOW_SIDEBAR), toolBar);
|
||||
QCoreApplication::translate("Core", Core::Constants::TR_SHOW_SIDEBAR),
|
||||
toolBar);
|
||||
m_toggleSideBarAction->setCheckable(true);
|
||||
m_toggleSideBarAction->setChecked(false);
|
||||
cmd = Core::ActionManager::registerAction(m_toggleSideBarAction,
|
||||
Core::Constants::TOGGLE_SIDEBAR, context);
|
||||
connect(m_toggleSideBarAction, &QAction::toggled, m_toggleSideBarAction,
|
||||
[this](bool checked) {
|
||||
m_toggleSideBarAction->setText(checked ? tr(Core::Constants::TR_HIDE_SIDEBAR)
|
||||
: tr(Core::Constants::TR_SHOW_SIDEBAR));
|
||||
m_toggleSideBarAction->setText(
|
||||
QCoreApplication::translate("Core",
|
||||
checked ? Core::Constants::TR_HIDE_SIDEBAR
|
||||
: Core::Constants::TR_SHOW_SIDEBAR));
|
||||
});
|
||||
addSideBar();
|
||||
m_toggleSideBarAction->setChecked(m_sideBar->isVisibleTo(this));
|
||||
|
||||
@@ -294,11 +294,6 @@ void QtWebKitHelpWidget::scaleDown()
|
||||
setZoomFactor(qMax(qreal(0.0), zoomFactor() - qreal(0.1)));
|
||||
}
|
||||
|
||||
void QtWebKitHelpWidget::setOpenInNewPageActionVisible(bool visible)
|
||||
{
|
||||
m_openInNewPageActionVisible = visible;
|
||||
}
|
||||
|
||||
// -- public slots
|
||||
|
||||
void QtWebKitHelpWidget::copy()
|
||||
@@ -567,7 +562,7 @@ void QtWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
|
||||
|
||||
void QtWebKitHelpViewer::setOpenInNewPageActionVisible(bool visible)
|
||||
{
|
||||
m_webView->setOpenInNewPageActionVisible(visible);
|
||||
m_webView->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(visible);
|
||||
}
|
||||
|
||||
bool QtWebKitHelpViewer::findText(const QString &text, FindFlags flags,
|
||||
|
||||
@@ -110,8 +110,6 @@ public:
|
||||
void scaleUp();
|
||||
void scaleDown();
|
||||
|
||||
void setOpenInNewPageActionVisible(bool visible);
|
||||
|
||||
public slots:
|
||||
void copy();
|
||||
|
||||
@@ -134,7 +132,6 @@ private:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
QtWebKitHelpViewer *m_parent;
|
||||
bool m_openInNewPageActionVisible;
|
||||
};
|
||||
|
||||
class HelpPage : public QWebPage
|
||||
|
||||
Reference in New Issue
Block a user