diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-06-17 16:46:48 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-06-18 11:18:53 +0200 |
commit | 46cdd910242f1ba155c66096d2ba11f7a61ec53d (patch) | |
tree | 5f163892de8bcb2c3038cfcb4b08b996b62e351a | |
parent | 2b0954ca7dfc96d672dcbe76ced283780db7d494 (diff) | |
download | qt-creator-46cdd910242f1ba155c66096d2ba11f7a61ec53d.tar.gz |
Help: Get rid of separate find support for central widget
There is no reason to not just add the support to the individual pages
when they are created.
Change-Id: I0e45577d054a420f406c44cdcbb4968ff05fcc7c
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
-rw-r--r-- | src/plugins/help/helpfindsupport.cpp | 53 | ||||
-rw-r--r-- | src/plugins/help/helpfindsupport.h | 25 | ||||
-rw-r--r-- | src/plugins/help/helpplugin.cpp | 14 |
3 files changed, 6 insertions, 86 deletions
diff --git a/src/plugins/help/helpfindsupport.cpp b/src/plugins/help/helpfindsupport.cpp index b971fb1d9f..5543df5d65 100644 --- a/src/plugins/help/helpfindsupport.cpp +++ b/src/plugins/help/helpfindsupport.cpp @@ -35,59 +35,6 @@ using namespace Core; using namespace Help::Internal; -HelpFindSupport::HelpFindSupport(CentralWidget *centralWidget) - : m_centralWidget(centralWidget) -{ -} - -HelpFindSupport::~HelpFindSupport() -{ -} - -Core::FindFlags HelpFindSupport::supportedFindFlags() const -{ - return FindBackward | FindCaseSensitively; -} - -QString HelpFindSupport::currentFindString() const -{ - QTC_ASSERT(m_centralWidget, return QString()); - HelpViewer *viewer = m_centralWidget->currentHelpViewer(); - if (!viewer) - return QString(); - return viewer->selectedText(); -} - -QString HelpFindSupport::completedFindString() const -{ - return QString(); -} - -Core::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt, - Core::FindFlags findFlags) -{ - findFlags &= ~FindBackward; - return find(txt, findFlags, true) ? Found : NotFound; -} - -Core::IFindSupport::Result HelpFindSupport::findStep(const QString &txt, - Core::FindFlags findFlags) -{ - return find(txt, findFlags, false) ? Found : NotFound; -} - -bool HelpFindSupport::find(const QString &txt, Core::FindFlags findFlags, bool incremental) -{ - QTC_ASSERT(m_centralWidget, return false); - bool wrapped = false; - bool found = m_centralWidget->find(txt, findFlags, incremental, &wrapped); - if (wrapped) - showWrapIndicator(m_centralWidget); - return found; -} - -// -- HelpViewerFindSupport - HelpViewerFindSupport::HelpViewerFindSupport(HelpViewer *viewer) : m_viewer(viewer) { diff --git a/src/plugins/help/helpfindsupport.h b/src/plugins/help/helpfindsupport.h index c67a0a18d9..3809fe4314 100644 --- a/src/plugins/help/helpfindsupport.h +++ b/src/plugins/help/helpfindsupport.h @@ -39,31 +39,6 @@ namespace Internal { class HelpViewer; -class HelpFindSupport : public Core::IFindSupport -{ - Q_OBJECT - -public: - HelpFindSupport(CentralWidget *centralWidget); - ~HelpFindSupport(); - - bool supportsReplace() const { return false; } - Core::FindFlags supportedFindFlags() const; - - void resetIncrementalSearch() {} - void clearResults() {} - QString currentFindString() const; - QString completedFindString() const; - - Result findIncremental(const QString &txt, Core::FindFlags findFlags); - Result findStep(const QString &txt, Core::FindFlags findFlags); - -private: - bool find(const QString &ttf, Core::FindFlags findFlags, bool incremental); - - CentralWidget *m_centralWidget; -}; - class HelpViewerFindSupport : public Core::IFindSupport { Q_OBJECT diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 39794f3f67..c61bd0fe0e 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -303,10 +303,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) SLOT(gotoNextPage())); } - Aggregation::Aggregate *agg = new Aggregation::Aggregate; - agg->add(m_centralWidget); - agg->add(new HelpFindSupport(m_centralWidget)); - QWidget *toolBarWidget = new QWidget; QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget); toolBarLayout->setMargin(0); @@ -571,10 +567,6 @@ void HelpPlugin::createRightPaneContextViewer() rightPaneLayout->addWidget(fth); m_rightPaneSideBarWidget->setFocusProxy(m_helpViewerForSideBar); - Aggregation::Aggregate *agg = new Aggregation::Aggregate(); - agg->add(m_helpViewerForSideBar); - agg->add(new HelpViewerFindSupport(m_helpViewerForSideBar)); - Context context(Constants::C_HELP_SIDEBAR); IContext *icontext = new IContext(this); icontext->setContext(context); @@ -663,6 +655,12 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom) QVariant fontSetting = LocalHelpManager::engineFontSettings(); if (fontSetting.isValid()) viewer->setViewerFont(fontSetting.value<QFont>()); + + // add find support + Aggregation::Aggregate *agg = new Aggregation::Aggregate(); + agg->add(viewer); + agg->add(new HelpViewerFindSupport(viewer)); + return viewer; } |