forked from qt-creator/qt-creator
Help: Get rid of special CentralWidget class for help mode viewer
Change-Id: Id733eb0449cdaed5901e4144089c8adaaf07d7a9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -4,7 +4,6 @@ add_qtc_plugin(Help
|
|||||||
PLUGIN_DEPENDS Core ProjectExplorer
|
PLUGIN_DEPENDS Core ProjectExplorer
|
||||||
PLUGIN_RECOMMENDS TextEditor
|
PLUGIN_RECOMMENDS TextEditor
|
||||||
SOURCES
|
SOURCES
|
||||||
centralwidget.cpp centralwidget.h
|
|
||||||
docsettingspage.cpp docsettingspage.h docsettingspage.ui
|
docsettingspage.cpp docsettingspage.h docsettingspage.ui
|
||||||
filtersettingspage.cpp filtersettingspage.h filtersettingspage.ui
|
filtersettingspage.cpp filtersettingspage.h filtersettingspage.ui
|
||||||
generalsettingspage.cpp generalsettingspage.h generalsettingspage.ui
|
generalsettingspage.cpp generalsettingspage.h generalsettingspage.ui
|
||||||
|
@@ -1,69 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
|
|
||||||
#include "helpviewer.h"
|
|
||||||
#include "localhelpmanager.h"
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
using namespace Help::Internal;
|
|
||||||
|
|
||||||
static CentralWidget *gStaticCentralWidget = nullptr;
|
|
||||||
|
|
||||||
// -- CentralWidget
|
|
||||||
|
|
||||||
CentralWidget::CentralWidget(const Core::Context &context, QWidget *parent)
|
|
||||||
: HelpWidget(context, HelpWidget::ModeWidget, parent)
|
|
||||||
{
|
|
||||||
QTC_CHECK(!gStaticCentralWidget);
|
|
||||||
gStaticCentralWidget = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
CentralWidget::~CentralWidget()
|
|
||||||
{
|
|
||||||
// TODO: this shouldn't be done here
|
|
||||||
QList<qreal> zoomFactors;
|
|
||||||
QStringList currentPages;
|
|
||||||
for (int i = 0; i < viewerCount(); ++i) {
|
|
||||||
const HelpViewer * const viewer = viewerAt(i);
|
|
||||||
const QUrl &source = viewer->source();
|
|
||||||
if (source.isValid()) {
|
|
||||||
currentPages.append(source.toString());
|
|
||||||
zoomFactors.append(viewer->scale());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalHelpManager::setLastShownPages(currentPages);
|
|
||||||
LocalHelpManager::setLastShownPagesZoom(zoomFactors);
|
|
||||||
LocalHelpManager::setLastSelectedTab(currentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
CentralWidget *CentralWidget::instance()
|
|
||||||
{
|
|
||||||
Q_ASSERT(gStaticCentralWidget);
|
|
||||||
return gStaticCentralWidget;
|
|
||||||
}
|
|
@@ -1,47 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "helpwidget.h"
|
|
||||||
|
|
||||||
#include <coreplugin/find/ifindsupport.h>
|
|
||||||
|
|
||||||
namespace Help {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CentralWidget : public HelpWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CentralWidget(const Core::Context &context, QWidget *parent = nullptr);
|
|
||||||
~CentralWidget() override;
|
|
||||||
|
|
||||||
static CentralWidget *instance();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Help
|
|
@@ -25,9 +25,10 @@
|
|||||||
|
|
||||||
#include "generalsettingspage.h"
|
#include "generalsettingspage.h"
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
#include "helpconstants.h"
|
#include "helpconstants.h"
|
||||||
|
#include "helpplugin.h"
|
||||||
#include "helpviewer.h"
|
#include "helpviewer.h"
|
||||||
|
#include "helpwidget.h"
|
||||||
#include "localhelpmanager.h"
|
#include "localhelpmanager.h"
|
||||||
#include "xbelsupport.h"
|
#include "xbelsupport.h"
|
||||||
|
|
||||||
@@ -105,10 +106,12 @@ QWidget *GeneralSettingsPage::widget()
|
|||||||
this, &GeneralSettingsPage::setCurrentPage);
|
this, &GeneralSettingsPage::setCurrentPage);
|
||||||
connect(m_ui->blankPageButton, &QPushButton::clicked,
|
connect(m_ui->blankPageButton, &QPushButton::clicked,
|
||||||
this, &GeneralSettingsPage::setBlankPage);
|
this, &GeneralSettingsPage::setBlankPage);
|
||||||
connect(m_ui->defaultPageButton, &QPushButton::clicked,
|
connect(m_ui->defaultPageButton,
|
||||||
this, &GeneralSettingsPage::setDefaultPage);
|
&QPushButton::clicked,
|
||||||
|
this,
|
||||||
|
&GeneralSettingsPage::setDefaultPage);
|
||||||
|
|
||||||
HelpViewer *viewer = CentralWidget::instance()->currentViewer();
|
HelpViewer *viewer = HelpPlugin::modeHelpWidget()->currentViewer();
|
||||||
if (!viewer)
|
if (!viewer)
|
||||||
m_ui->currentPageButton->setEnabled(false);
|
m_ui->currentPageButton->setEnabled(false);
|
||||||
|
|
||||||
@@ -191,7 +194,7 @@ void GeneralSettingsPage::apply()
|
|||||||
|
|
||||||
void GeneralSettingsPage::setCurrentPage()
|
void GeneralSettingsPage::setCurrentPage()
|
||||||
{
|
{
|
||||||
HelpViewer *viewer = CentralWidget::instance()->currentViewer();
|
HelpViewer *viewer = HelpPlugin::modeHelpWidget()->currentViewer();
|
||||||
if (viewer)
|
if (viewer)
|
||||||
m_ui->homePageLineEdit->setText(viewer->source().toString());
|
m_ui->homePageLineEdit->setText(viewer->source().toString());
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,6 @@ DEFINES += \
|
|||||||
HELP_LIBRARY
|
HELP_LIBRARY
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
centralwidget.h \
|
|
||||||
docsettingspage.h \
|
docsettingspage.h \
|
||||||
filtersettingspage.h \
|
filtersettingspage.h \
|
||||||
generalsettingspage.h \
|
generalsettingspage.h \
|
||||||
@@ -32,7 +31,6 @@ HEADERS += \
|
|||||||
helpwidget.h
|
helpwidget.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
centralwidget.cpp \
|
|
||||||
docsettingspage.cpp \
|
docsettingspage.cpp \
|
||||||
filtersettingspage.cpp \
|
filtersettingspage.cpp \
|
||||||
generalsettingspage.cpp \
|
generalsettingspage.cpp \
|
||||||
|
@@ -28,7 +28,6 @@ QtcPlugin {
|
|||||||
Group {
|
Group {
|
||||||
name: "Sources"
|
name: "Sources"
|
||||||
files: [
|
files: [
|
||||||
"centralwidget.cpp", "centralwidget.h",
|
|
||||||
"docsettingspage.cpp", "docsettingspage.h", "docsettingspage.ui",
|
"docsettingspage.cpp", "docsettingspage.h", "docsettingspage.ui",
|
||||||
"filtersettingspage.cpp", "filtersettingspage.h", "filtersettingspage.ui",
|
"filtersettingspage.cpp", "filtersettingspage.h", "filtersettingspage.ui",
|
||||||
"generalsettingspage.cpp", "generalsettingspage.h", "generalsettingspage.ui",
|
"generalsettingspage.cpp", "generalsettingspage.h", "generalsettingspage.ui",
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
|
|
||||||
#include <coreplugin/find/ifindsupport.h>
|
#include <coreplugin/find/ifindsupport.h>
|
||||||
|
|
||||||
namespace Help {
|
namespace Help {
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "helpindexfilter.h"
|
#include "helpindexfilter.h"
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
#include "helpicons.h"
|
#include "helpicons.h"
|
||||||
#include "helpmanager.h"
|
#include "helpmanager.h"
|
||||||
#include "topicchooser.h"
|
#include "topicchooser.h"
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#include "helpplugin.h"
|
#include "helpplugin.h"
|
||||||
|
|
||||||
#include "bookmarkmanager.h"
|
#include "bookmarkmanager.h"
|
||||||
#include "centralwidget.h"
|
|
||||||
#include "docsettingspage.h"
|
#include "docsettingspage.h"
|
||||||
#include "filtersettingspage.h"
|
#include "filtersettingspage.h"
|
||||||
#include "generalsettingspage.h"
|
#include "generalsettingspage.h"
|
||||||
@@ -37,11 +36,12 @@
|
|||||||
#include "helpmanager.h"
|
#include "helpmanager.h"
|
||||||
#include "helpmode.h"
|
#include "helpmode.h"
|
||||||
#include "helpviewer.h"
|
#include "helpviewer.h"
|
||||||
|
#include "helpwidget.h"
|
||||||
#include "localhelpmanager.h"
|
#include "localhelpmanager.h"
|
||||||
#include "openpagesmanager.h"
|
#include "openpagesmanager.h"
|
||||||
#include "remotehelpfilter.h"
|
#include "remotehelpfilter.h"
|
||||||
#include "searchwidget.h"
|
|
||||||
#include "searchtaskhandler.h"
|
#include "searchtaskhandler.h"
|
||||||
|
#include "searchwidget.h"
|
||||||
#include "topicchooser.h"
|
#include "topicchooser.h"
|
||||||
|
|
||||||
#include <bookmarkmanager.h>
|
#include <bookmarkmanager.h>
|
||||||
@@ -118,7 +118,6 @@ public:
|
|||||||
|
|
||||||
void saveExternalWindowSettings();
|
void saveExternalWindowSettings();
|
||||||
void showLinksInCurrentViewer(const QMap<QString, QUrl> &links, const QString &key);
|
void showLinksInCurrentViewer(const QMap<QString, QUrl> &links, const QString &key);
|
||||||
void slotHideRightPane();
|
|
||||||
|
|
||||||
void updateSideBarSource(const QUrl &newUrl);
|
void updateSideBarSource(const QUrl &newUrl);
|
||||||
|
|
||||||
@@ -144,8 +143,10 @@ public:
|
|||||||
void doSetupIfNeeded();
|
void doSetupIfNeeded();
|
||||||
|
|
||||||
HelpMode m_mode;
|
HelpMode m_mode;
|
||||||
CentralWidget *m_centralWidget = nullptr;
|
HelpWidget *m_centralWidget = nullptr;
|
||||||
HelpWidget *m_rightPaneSideBarWidget = nullptr;
|
HelpWidget *m_rightPaneSideBarWidget = nullptr;
|
||||||
|
QPointer<HelpWidget> m_externalWindow;
|
||||||
|
QRect m_externalWindowState;
|
||||||
|
|
||||||
DocSettingsPage m_docSettingsPage;
|
DocSettingsPage m_docSettingsPage;
|
||||||
FilterSettingsPage m_filterSettingsPage;
|
FilterSettingsPage m_filterSettingsPage;
|
||||||
@@ -155,9 +156,6 @@ public:
|
|||||||
bool m_setupNeeded = true;
|
bool m_setupNeeded = true;
|
||||||
LocalHelpManager m_localHelpManager;
|
LocalHelpManager m_localHelpManager;
|
||||||
|
|
||||||
QPointer<HelpWidget> m_externalWindow;
|
|
||||||
QRect m_externalWindowState;
|
|
||||||
|
|
||||||
HelpIndexFilter helpIndexFilter;
|
HelpIndexFilter helpIndexFilter;
|
||||||
RemoteHelpFilter remoteHelpFilter;
|
RemoteHelpFilter remoteHelpFilter;
|
||||||
};
|
};
|
||||||
@@ -209,16 +207,9 @@ HelpPluginPrivate::HelpPluginPrivate()
|
|||||||
QCoreApplication::installTranslator(qhelptr);
|
QCoreApplication::installTranslator(qhelptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_centralWidget = new CentralWidget(Context("Help.CentralHelpWidget"));
|
m_centralWidget = createHelpWidget(Context("Help.CentralHelpWidget"), HelpWidget::ModeWidget);
|
||||||
connect(m_centralWidget, &HelpWidget::sourceChanged,
|
connect(m_centralWidget, &HelpWidget::sourceChanged,
|
||||||
this, &HelpPluginPrivate::updateSideBarSource);
|
this, &HelpPluginPrivate::updateSideBarSource);
|
||||||
connect(m_centralWidget,
|
|
||||||
&CentralWidget::closeButtonClicked,
|
|
||||||
m_centralWidget->openPagesManager(),
|
|
||||||
&OpenPagesManager::closeCurrentPage);
|
|
||||||
|
|
||||||
connect(LocalHelpManager::instance(), &LocalHelpManager::returnOnCloseChanged,
|
|
||||||
m_centralWidget, &CentralWidget::updateCloseButton);
|
|
||||||
connect(HelpManager::instance(), &HelpManager::helpRequested,
|
connect(HelpManager::instance(), &HelpManager::helpRequested,
|
||||||
this, &HelpPluginPrivate::showHelpUrl);
|
this, &HelpPluginPrivate::showHelpUrl);
|
||||||
connect(&m_searchTaskHandler, &SearchTaskHandler::search,
|
connect(&m_searchTaskHandler, &SearchTaskHandler::search,
|
||||||
@@ -406,14 +397,19 @@ HelpWidget *HelpPluginPrivate::createHelpWidget(const Context &context, HelpWidg
|
|||||||
connect(widget, &HelpWidget::openHelpMode, this, [this](const QUrl &url) {
|
connect(widget, &HelpWidget::openHelpMode, this, [this](const QUrl &url) {
|
||||||
showHelpUrl(url, Core::HelpManager::HelpModeAlways);
|
showHelpUrl(url, Core::HelpManager::HelpModeAlways);
|
||||||
});
|
});
|
||||||
connect(widget, &HelpWidget::closeButtonClicked, this, &HelpPluginPrivate::slotHideRightPane);
|
connect(LocalHelpManager::instance(),
|
||||||
|
&LocalHelpManager::returnOnCloseChanged,
|
||||||
|
widget,
|
||||||
|
&HelpWidget::updateCloseButton);
|
||||||
|
connect(widget, &HelpWidget::closeButtonClicked, this, [this, widget] {
|
||||||
|
if (widget->viewerCount() == 1 && LocalHelpManager::returnOnClose())
|
||||||
|
ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||||
|
if (widget->widgetStyle() == HelpWidget::SideBarWidget)
|
||||||
|
RightPaneWidget::instance()->setShown(false);
|
||||||
|
});
|
||||||
connect(widget, &HelpWidget::aboutToClose,
|
connect(widget, &HelpWidget::aboutToClose,
|
||||||
this, &HelpPluginPrivate::saveExternalWindowSettings);
|
this, &HelpPluginPrivate::saveExternalWindowSettings);
|
||||||
|
|
||||||
// force setup, as we might have never switched to full help mode
|
|
||||||
// thus the help engine might still run without collection file setup
|
|
||||||
LocalHelpManager::setupGuiHelpEngine();
|
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,6 +466,11 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
|
|||||||
return viewer;
|
return viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HelpWidget *HelpPlugin::modeHelpWidget()
|
||||||
|
{
|
||||||
|
return dd->m_centralWidget;
|
||||||
|
}
|
||||||
|
|
||||||
void HelpPluginPrivate::showLinksInCurrentViewer(const QMap<QString, QUrl> &links, const QString &key)
|
void HelpPluginPrivate::showLinksInCurrentViewer(const QMap<QString, QUrl> &links, const QString &key)
|
||||||
{
|
{
|
||||||
if (links.size() < 1)
|
if (links.size() < 1)
|
||||||
@@ -478,11 +479,6 @@ void HelpPluginPrivate::showLinksInCurrentViewer(const QMap<QString, QUrl> &link
|
|||||||
widget->showLinks(links, key);
|
widget->showLinks(links, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPluginPrivate::slotHideRightPane()
|
|
||||||
{
|
|
||||||
RightPaneWidget::instance()->setShown(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HelpPluginPrivate::modeChanged(Core::Id mode, Core::Id old)
|
void HelpPluginPrivate::modeChanged(Core::Id mode, Core::Id old)
|
||||||
{
|
{
|
||||||
Q_UNUSED(old)
|
Q_UNUSED(old)
|
||||||
@@ -556,6 +552,9 @@ HelpViewer *HelpPluginPrivate::viewerForHelpViewerLocation(
|
|||||||
actualLocation = canShowHelpSideBySide() ? Core::HelpManager::SideBySideAlways
|
actualLocation = canShowHelpSideBySide() ? Core::HelpManager::SideBySideAlways
|
||||||
: Core::HelpManager::HelpModeAlways;
|
: Core::HelpManager::HelpModeAlways;
|
||||||
|
|
||||||
|
// force setup, as we might have never switched to full help mode
|
||||||
|
// thus the help engine might still run without collection file setup
|
||||||
|
LocalHelpManager::setupGuiHelpEngine();
|
||||||
if (actualLocation == Core::HelpManager::ExternalHelpAlways)
|
if (actualLocation == Core::HelpManager::ExternalHelpAlways)
|
||||||
return externalHelpViewer();
|
return externalHelpViewer();
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ QT_END_NAMESPACE
|
|||||||
namespace Help {
|
namespace Help {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class HelpWidget;
|
||||||
class HelpViewer;
|
class HelpViewer;
|
||||||
|
|
||||||
class HelpPlugin : public ExtensionSystem::IPlugin
|
class HelpPlugin : public ExtensionSystem::IPlugin
|
||||||
@@ -48,6 +49,7 @@ public:
|
|||||||
|
|
||||||
static void showHelpUrl(const QUrl &url, Core::HelpManager::HelpViewerLocation location);
|
static void showHelpUrl(const QUrl &url, Core::HelpManager::HelpViewerLocation location);
|
||||||
static HelpViewer *createHelpViewer(qreal zoom);
|
static HelpViewer *createHelpViewer(qreal zoom);
|
||||||
|
static HelpWidget *modeHelpWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||||
|
@@ -332,6 +332,10 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
|||||||
: Utils::Icons::CLOSE_SPLIT_RIGHT;
|
: Utils::Icons::CLOSE_SPLIT_RIGHT;
|
||||||
m_closeAction = new QAction(icon.icon(), QString(), toolBar);
|
m_closeAction = new QAction(icon.icon(), QString(), toolBar);
|
||||||
connect(m_closeAction, &QAction::triggered, this, &HelpWidget::closeButtonClicked);
|
connect(m_closeAction, &QAction::triggered, this, &HelpWidget::closeButtonClicked);
|
||||||
|
connect(m_closeAction, &QAction::triggered, this, [this] {
|
||||||
|
if (viewerCount() > 1)
|
||||||
|
closeCurrentPage();
|
||||||
|
});
|
||||||
button = new QToolButton;
|
button = new QToolButton;
|
||||||
button->setDefaultAction(m_closeAction);
|
button->setDefaultAction(m_closeAction);
|
||||||
layout->addWidget(button);
|
layout->addWidget(button);
|
||||||
@@ -354,6 +358,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
|||||||
|
|
||||||
HelpWidget::~HelpWidget()
|
HelpWidget::~HelpWidget()
|
||||||
{
|
{
|
||||||
|
saveState();
|
||||||
if (m_sideBar) {
|
if (m_sideBar) {
|
||||||
m_sideBar->saveSettings(Core::ICore::settings(), sideBarSettingsKey());
|
m_sideBar->saveSettings(Core::ICore::settings(), sideBarSettingsKey());
|
||||||
Core::ActionManager::unregisterAction(m_contentsAction, Constants::HELP_CONTENTS);
|
Core::ActionManager::unregisterAction(m_contentsAction, Constants::HELP_CONTENTS);
|
||||||
@@ -388,6 +393,11 @@ QAbstractItemModel *HelpWidget::model()
|
|||||||
return &m_model;
|
return &m_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HelpWidget::WidgetStyle HelpWidget::widgetStyle() const
|
||||||
|
{
|
||||||
|
return m_style;
|
||||||
|
}
|
||||||
|
|
||||||
void HelpWidget::addSideBar()
|
void HelpWidget::addSideBar()
|
||||||
{
|
{
|
||||||
QMap<QString, Core::Command *> shortcutMap;
|
QMap<QString, Core::Command *> shortcutMap;
|
||||||
@@ -705,6 +715,32 @@ void HelpWidget::helpModeButtonClicked()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HelpWidget::closeCurrentPage()
|
||||||
|
{
|
||||||
|
removeViewerAt(currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void HelpWidget::saveState() const
|
||||||
|
{
|
||||||
|
// TODO generalize
|
||||||
|
if (m_style == ModeWidget) {
|
||||||
|
QList<qreal> zoomFactors;
|
||||||
|
QStringList currentPages;
|
||||||
|
for (int i = 0; i < viewerCount(); ++i) {
|
||||||
|
const HelpViewer *const viewer = viewerAt(i);
|
||||||
|
const QUrl &source = viewer->source();
|
||||||
|
if (source.isValid()) {
|
||||||
|
currentPages.append(source.toString());
|
||||||
|
zoomFactors.append(viewer->scale());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalHelpManager::setLastShownPages(currentPages);
|
||||||
|
LocalHelpManager::setLastShownPagesZoom(zoomFactors);
|
||||||
|
LocalHelpManager::setLastSelectedTab(currentIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HelpWidget::updateCloseButton()
|
void HelpWidget::updateCloseButton()
|
||||||
{
|
{
|
||||||
if (m_style == ModeWidget) {
|
if (m_style == ModeWidget) {
|
||||||
|
@@ -81,6 +81,7 @@ public:
|
|||||||
~HelpWidget() override;
|
~HelpWidget() override;
|
||||||
|
|
||||||
QAbstractItemModel *model();
|
QAbstractItemModel *model();
|
||||||
|
WidgetStyle widgetStyle() const;
|
||||||
|
|
||||||
HelpViewer *currentViewer() const;
|
HelpViewer *currentViewer() const;
|
||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
@@ -122,6 +123,8 @@ private:
|
|||||||
void updateForwardMenu();
|
void updateForwardMenu();
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void helpModeButtonClicked();
|
void helpModeButtonClicked();
|
||||||
|
void closeCurrentPage();
|
||||||
|
void saveState() const;
|
||||||
|
|
||||||
void goHome();
|
void goHome();
|
||||||
void addBookmark();
|
void addBookmark();
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
#include "helpviewer.h"
|
#include "helpviewer.h"
|
||||||
#include "openpagesmanager.h"
|
#include "openpagesmanager.h"
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "openpagesswitcher.h"
|
#include "openpagesswitcher.h"
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
#include "openpageswidget.h"
|
#include "openpageswidget.h"
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "centralwidget.h"
|
|
||||||
#include "helpviewer.h"
|
#include "helpviewer.h"
|
||||||
#include "openpagesmanager.h"
|
#include "openpagesmanager.h"
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "contentwindow.h"
|
#include "contentwindow.h"
|
||||||
|
|
||||||
#include <centralwidget.h>
|
|
||||||
#include <helpviewer.h>
|
#include <helpviewer.h>
|
||||||
#include <localhelpmanager.h>
|
#include <localhelpmanager.h>
|
||||||
#include <openpagesmanager.h>
|
#include <openpagesmanager.h>
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "topicchooser.h"
|
#include "topicchooser.h"
|
||||||
|
|
||||||
#include <centralwidget.h>
|
|
||||||
#include <helpviewer.h>
|
#include <helpviewer.h>
|
||||||
#include <localhelpmanager.h>
|
#include <localhelpmanager.h>
|
||||||
#include <openpagesmanager.h>
|
#include <openpagesmanager.h>
|
||||||
|
Reference in New Issue
Block a user