forked from qt-creator/qt-creator
Core: Merge Find and Locator into Core plugin
Change-Id: I7053310272235d854c9f409670ff52a10a7add8b Reviewed-by: Christian Kandeler <christian.kandeler@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -152,7 +152,7 @@ void CentralWidget::setCurrentPage(HelpViewer *page)
|
||||
m_stackedWidget->setCurrentWidget(page);
|
||||
}
|
||||
|
||||
bool CentralWidget::find(const QString &txt, Find::FindFlags flags,
|
||||
bool CentralWidget::find(const QString &txt, Core::FindFlags flags,
|
||||
bool incremental, bool *wrapped)
|
||||
{
|
||||
return currentHelpViewer()->findText(txt, flags, incremental, false, wrapped);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef CENTRALWIDGET_H
|
||||
#define CENTRALWIDGET_H
|
||||
|
||||
#include <find/ifindsupport.h>
|
||||
#include <coreplugin/find/ifindsupport.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
int currentIndex() const;
|
||||
void setCurrentPage(HelpViewer *page);
|
||||
|
||||
bool find(const QString &txt, Find::FindFlags findFlags,
|
||||
bool find(const QString &txt, Core::FindFlags findFlags,
|
||||
bool incremental, bool *wrapped = 0);
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -12,8 +12,6 @@ QtcPlugin {
|
||||
}
|
||||
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "Find" }
|
||||
Depends { name: "Locator" }
|
||||
Depends { name: "app_version_header" }
|
||||
|
||||
cpp.defines: base.concat(["QT_CLUCENE_SUPPORT"])
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
QTC_PLUGIN_NAME = Help
|
||||
QTC_PLUGIN_DEPENDS += \
|
||||
coreplugin \
|
||||
find \
|
||||
locator
|
||||
coreplugin
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Help::Internal;
|
||||
|
||||
HelpFindSupport::HelpFindSupport(CentralWidget *centralWidget)
|
||||
@@ -43,9 +44,9 @@ HelpFindSupport::~HelpFindSupport()
|
||||
{
|
||||
}
|
||||
|
||||
Find::FindFlags HelpFindSupport::supportedFindFlags() const
|
||||
Core::FindFlags HelpFindSupport::supportedFindFlags() const
|
||||
{
|
||||
return Find::FindBackward | Find::FindCaseSensitively;
|
||||
return FindBackward | FindCaseSensitively;
|
||||
}
|
||||
|
||||
QString HelpFindSupport::currentFindString() const
|
||||
@@ -62,20 +63,20 @@ QString HelpFindSupport::completedFindString() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
Find::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt,
|
||||
Find::FindFlags findFlags)
|
||||
Core::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt,
|
||||
Core::FindFlags findFlags)
|
||||
{
|
||||
findFlags &= ~Find::FindBackward;
|
||||
findFlags &= ~FindBackward;
|
||||
return find(txt, findFlags, true) ? Found : NotFound;
|
||||
}
|
||||
|
||||
Find::IFindSupport::Result HelpFindSupport::findStep(const QString &txt,
|
||||
Find::FindFlags findFlags)
|
||||
Core::IFindSupport::Result HelpFindSupport::findStep(const QString &txt,
|
||||
Core::FindFlags findFlags)
|
||||
{
|
||||
return find(txt, findFlags, false) ? Found : NotFound;
|
||||
}
|
||||
|
||||
bool HelpFindSupport::find(const QString &txt, Find::FindFlags findFlags, bool incremental)
|
||||
bool HelpFindSupport::find(const QString &txt, Core::FindFlags findFlags, bool incremental)
|
||||
{
|
||||
QTC_ASSERT(m_centralWidget, return false);
|
||||
bool wrapped = false;
|
||||
@@ -92,9 +93,9 @@ HelpViewerFindSupport::HelpViewerFindSupport(HelpViewer *viewer)
|
||||
{
|
||||
}
|
||||
|
||||
Find::FindFlags HelpViewerFindSupport::supportedFindFlags() const
|
||||
Core::FindFlags HelpViewerFindSupport::supportedFindFlags() const
|
||||
{
|
||||
return Find::FindBackward | Find::FindCaseSensitively;
|
||||
return FindBackward | FindCaseSensitively;
|
||||
}
|
||||
|
||||
QString HelpViewerFindSupport::currentFindString() const
|
||||
@@ -103,23 +104,23 @@ QString HelpViewerFindSupport::currentFindString() const
|
||||
return m_viewer->selectedText();
|
||||
}
|
||||
|
||||
Find::IFindSupport::Result HelpViewerFindSupport::findIncremental(const QString &txt,
|
||||
Find::FindFlags findFlags)
|
||||
Core::IFindSupport::Result HelpViewerFindSupport::findIncremental(const QString &txt,
|
||||
Core::FindFlags findFlags)
|
||||
{
|
||||
QTC_ASSERT(m_viewer, return NotFound);
|
||||
findFlags &= ~Find::FindBackward;
|
||||
findFlags &= ~FindBackward;
|
||||
return find(txt, findFlags, true) ? Found : NotFound;
|
||||
}
|
||||
|
||||
Find::IFindSupport::Result HelpViewerFindSupport::findStep(const QString &txt,
|
||||
Find::FindFlags findFlags)
|
||||
Core::IFindSupport::Result HelpViewerFindSupport::findStep(const QString &txt,
|
||||
Core::FindFlags findFlags)
|
||||
{
|
||||
QTC_ASSERT(m_viewer, return NotFound);
|
||||
return find(txt, findFlags, false) ? Found : NotFound;
|
||||
}
|
||||
|
||||
bool HelpViewerFindSupport::find(const QString &txt,
|
||||
Find::FindFlags findFlags, bool incremental)
|
||||
Core::FindFlags findFlags, bool incremental)
|
||||
{
|
||||
QTC_ASSERT(m_viewer, return false);
|
||||
bool wrapped = false;
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
|
||||
#include "centralwidget.h"
|
||||
|
||||
#include <find/ifindsupport.h>
|
||||
#include <coreplugin/find/ifindsupport.h>
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class HelpViewer;
|
||||
|
||||
class HelpFindSupport : public Find::IFindSupport
|
||||
class HelpFindSupport : public Core::IFindSupport
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -48,40 +48,40 @@ public:
|
||||
~HelpFindSupport();
|
||||
|
||||
bool supportsReplace() const { return false; }
|
||||
Find::FindFlags supportedFindFlags() const;
|
||||
Core::FindFlags supportedFindFlags() const;
|
||||
|
||||
void resetIncrementalSearch() {}
|
||||
void clearResults() {}
|
||||
QString currentFindString() const;
|
||||
QString completedFindString() const;
|
||||
|
||||
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
||||
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
||||
Result findIncremental(const QString &txt, Core::FindFlags findFlags);
|
||||
Result findStep(const QString &txt, Core::FindFlags findFlags);
|
||||
|
||||
private:
|
||||
bool find(const QString &ttf, Find::FindFlags findFlags, bool incremental);
|
||||
bool find(const QString &ttf, Core::FindFlags findFlags, bool incremental);
|
||||
|
||||
CentralWidget *m_centralWidget;
|
||||
};
|
||||
|
||||
class HelpViewerFindSupport : public Find::IFindSupport
|
||||
class HelpViewerFindSupport : public Core::IFindSupport
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelpViewerFindSupport(HelpViewer *viewer);
|
||||
|
||||
bool supportsReplace() const { return false; }
|
||||
Find::FindFlags supportedFindFlags() const;
|
||||
Core::FindFlags supportedFindFlags() const;
|
||||
void resetIncrementalSearch() {}
|
||||
void clearResults() {}
|
||||
QString currentFindString() const;
|
||||
QString completedFindString() const { return QString(); }
|
||||
|
||||
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
||||
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
||||
Result findIncremental(const QString &txt, Core::FindFlags findFlags);
|
||||
Result findStep(const QString &txt, Core::FindFlags findFlags);
|
||||
|
||||
private:
|
||||
bool find(const QString &ttf, Find::FindFlags findFlags, bool incremental);
|
||||
bool find(const QString &ttf, Core::FindFlags findFlags, bool incremental);
|
||||
HelpViewer *m_viewer;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
using namespace Locator;
|
||||
using namespace Core;
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
@@ -59,7 +59,7 @@ HelpIndexFilter::~HelpIndexFilter()
|
||||
{
|
||||
}
|
||||
|
||||
QList<FilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
||||
QList<LocatorFilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry)
|
||||
{
|
||||
QStringList keywords;
|
||||
if (entry.length() < 2)
|
||||
@@ -67,17 +67,17 @@ QList<FilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<Locator::FilterE
|
||||
else
|
||||
keywords = Core::HelpManager::findKeywords(entry, caseSensitivity(entry));
|
||||
|
||||
QList<FilterEntry> entries;
|
||||
QList<LocatorFilterEntry> entries;
|
||||
foreach (const QString &keyword, keywords) {
|
||||
if (future.isCanceled())
|
||||
break;
|
||||
entries.append(FilterEntry(this, keyword, QVariant(), m_icon));
|
||||
entries.append(LocatorFilterEntry(this, keyword, QVariant(), m_icon));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
void HelpIndexFilter::accept(FilterEntry selection) const
|
||||
void HelpIndexFilter::accept(LocatorFilterEntry selection) const
|
||||
{
|
||||
const QString &key = selection.displayName;
|
||||
const QMap<QString, QUrl> &links = Core::HelpManager::linksForKeyword(key);
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
#ifndef HELPINDEXFILTER_H
|
||||
#define HELPINDEXFILTER_H
|
||||
|
||||
#include <locator/ilocatorfilter.h>
|
||||
#include <coreplugin/locator/ilocatorfilter.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class HelpIndexFilter : public Locator::ILocatorFilter
|
||||
class HelpIndexFilter : public Core::ILocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
~HelpIndexFilter();
|
||||
|
||||
// ILocatorFilter
|
||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||
void accept(Locator::FilterEntry selection) const;
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry);
|
||||
void accept(Core::LocatorFilterEntry selection) const;
|
||||
void refresh(QFutureInterface<void> &future);
|
||||
|
||||
signals:
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#include <coreplugin/rightpane.h>
|
||||
#include <coreplugin/sidebar.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <find/findplugin.h>
|
||||
#include <coreplugin/find/findplugin.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/styledbar.h>
|
||||
@@ -1227,8 +1227,8 @@ void HelpPlugin::slotReportBug()
|
||||
|
||||
void HelpPlugin::openFindToolBar()
|
||||
{
|
||||
if (Find::FindPlugin::instance())
|
||||
Find::FindPlugin::instance()->openFindToolBar(Find::FindPlugin::FindForwardDirection);
|
||||
if (FindPlugin::instance())
|
||||
FindPlugin::instance()->openFindToolBar(FindPlugin::FindForwardDirection);
|
||||
}
|
||||
|
||||
void HelpPlugin::onSideBarVisibilityChanged()
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef HELPVIEWER_H
|
||||
#define HELPVIEWER_H
|
||||
|
||||
#include <find/ifindsupport.h>
|
||||
#include <coreplugin/find/ifindsupport.h>
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <QString>
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
bool isForwardAvailable() const;
|
||||
bool isBackwardAvailable() const;
|
||||
|
||||
bool findText(const QString &text, Find::FindFlags flags,
|
||||
bool findText(const QString &text, Core::FindFlags flags,
|
||||
bool incremental, bool fromSearch, bool *wrapped = 0);
|
||||
|
||||
static bool isLocalUrl(const QUrl &url);
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
#include <QHelpEngine>
|
||||
|
||||
using namespace Find;
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
@@ -194,7 +193,7 @@ bool HelpViewer::isBackwardAvailable() const
|
||||
return QTextBrowser::isBackwardAvailable();
|
||||
}
|
||||
|
||||
bool HelpViewer::findText(const QString &text, Find::FindFlags flags,
|
||||
bool HelpViewer::findText(const QString &text, Core::FindFlags flags,
|
||||
bool incremental, bool fromSearch, bool *wrapped)
|
||||
{
|
||||
if (wrapped)
|
||||
@@ -208,10 +207,10 @@ bool HelpViewer::findText(const QString &text, Find::FindFlags flags,
|
||||
if (incremental)
|
||||
cursor.setPosition(position);
|
||||
|
||||
QTextDocument::FindFlags f = Find::textDocumentFlagsForFindFlags(flags);
|
||||
QTextDocument::FindFlags f = Core::textDocumentFlagsForFindFlags(flags);
|
||||
QTextCursor found = doc->find(text, cursor, f);
|
||||
if (found.isNull()) {
|
||||
if ((flags & Find::FindBackward) == 0)
|
||||
if ((flags & Core::FindBackward) == 0)
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
else
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace Find;
|
||||
using namespace Core;
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
@@ -412,7 +412,7 @@ bool HelpViewer::isBackwardAvailable() const
|
||||
return pageAction(QWebPage::Back)->isEnabled();
|
||||
}
|
||||
|
||||
bool HelpViewer::findText(const QString &text, Find::FindFlags flags,
|
||||
bool HelpViewer::findText(const QString &text, Core::FindFlags flags,
|
||||
bool incremental, bool fromSearch, bool *wrapped)
|
||||
{
|
||||
Q_UNUSED(incremental);
|
||||
@@ -420,9 +420,9 @@ bool HelpViewer::findText(const QString &text, Find::FindFlags flags,
|
||||
if (wrapped)
|
||||
*wrapped = false;
|
||||
QWebPage::FindFlags options;
|
||||
if (flags & Find::FindBackward)
|
||||
if (flags & Core::FindBackward)
|
||||
options |= QWebPage::FindBackward;
|
||||
if (flags & Find::FindCaseSensitively)
|
||||
if (flags & Core::FindCaseSensitively)
|
||||
options |= QWebPage::FindCaseSensitively;
|
||||
|
||||
bool found = QWebView::findText(text, options);
|
||||
|
||||
@@ -96,20 +96,20 @@ RemoteHelpFilter::~RemoteHelpFilter()
|
||||
{
|
||||
}
|
||||
|
||||
QList<Locator::FilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &pattern)
|
||||
QList<Core::LocatorFilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &pattern)
|
||||
{
|
||||
QList<Locator::FilterEntry> entries;
|
||||
QList<Core::LocatorFilterEntry> entries;
|
||||
foreach (const QString &url, m_remoteUrls) {
|
||||
if (future.isCanceled())
|
||||
break;
|
||||
|
||||
entries.append(Locator::FilterEntry(this, url.arg(pattern), QVariant(),
|
||||
entries.append(Core::LocatorFilterEntry(this, url.arg(pattern), QVariant(),
|
||||
m_icon));
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
void RemoteHelpFilter::accept(Locator::FilterEntry selection) const
|
||||
void RemoteHelpFilter::accept(Core::LocatorFilterEntry selection) const
|
||||
{
|
||||
const QString &url = selection.displayName;
|
||||
if (!url.isEmpty())
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
|
||||
#include "ui_remotehelpfilter.h"
|
||||
|
||||
#include <locator/ilocatorfilter.h>
|
||||
#include <coreplugin/locator/ilocatorfilter.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class RemoteHelpFilter : public Locator::ILocatorFilter
|
||||
class RemoteHelpFilter : public Core::ILocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
~RemoteHelpFilter();
|
||||
|
||||
// ILocatorFilter
|
||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||
void accept(Locator::FilterEntry selection) const;
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry);
|
||||
void accept(Core::LocatorFilterEntry selection) const;
|
||||
void refresh(QFutureInterface<void> &future);
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
|
||||
Reference in New Issue
Block a user