diff options
author | hjk <[email protected]> | 2014-01-13 16:17:34 +0100 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2014-01-14 07:43:00 +0100 |
commit | 4d96fa7aba7be35800d61d8bed89d3f6c3ef9329 (patch) | |
tree | c9b102981cf81023e1488224a24758af18aa064e /src | |
parent | 8b854270a6c214479b2cdf302072a3e74fa854da (diff) |
Core: Merge Find and Locator into Core plugin
Change-Id: I7053310272235d854c9f409670ff52a10a7add8b
Reviewed-by: Christian Kandeler <[email protected]>
Reviewed-by: Orgad Shaneh <[email protected]>
Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src')
235 files changed, 1612 insertions, 1774 deletions
diff --git a/src/plugins/bazaar/bazaar.qbs b/src/plugins/bazaar/bazaar.qbs index 54cbc804f06..7ecf5b8b0ff 100644 --- a/src/plugins/bazaar/bazaar.qbs +++ b/src/plugins/bazaar/bazaar.qbs @@ -8,10 +8,7 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "VcsBase" } - Depends { name: "Locator" } - files: [ "annotationhighlighter.cpp", diff --git a/src/plugins/bazaar/bazaar_dependencies.pri b/src/plugins/bazaar/bazaar_dependencies.pri index a7c268a0d78..1009c58f690 100644 --- a/src/plugins/bazaar/bazaar_dependencies.pri +++ b/src/plugins/bazaar/bazaar_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Bazaar QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ texteditor \ coreplugin \ vcsbase diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp index cf79874a2fc..9479fb74969 100644 --- a/src/plugins/bazaar/bazaarplugin.cpp +++ b/src/plugins/bazaar/bazaarplugin.cpp @@ -48,8 +48,7 @@ #include <coreplugin/icore.h> #include <coreplugin/documentmanager.h> #include <coreplugin/editormanager/editormanager.h> - -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <utils/parameteraction.h> #include <utils/qtcassert.h> @@ -149,7 +148,7 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag addAutoReleasedObject(new CloneWizard); const QString prefix = QLatin1String("bzr"); - m_commandLocator = new Locator::CommandLocator("Bazaar", prefix, prefix); + m_commandLocator = new Core::CommandLocator("Bazaar", prefix, prefix); addAutoReleasedObject(m_commandLocator); createMenu(); diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h index 382ea438e4d..7a2ee3c1814 100644 --- a/src/plugins/bazaar/bazaarplugin.h +++ b/src/plugins/bazaar/bazaarplugin.h @@ -42,6 +42,7 @@ QT_END_NAMESPACE namespace Core { class ActionManager; class ActionContainer; +class CommandLocator; class Id; class IVersionControl; class IEditorFactory; @@ -56,10 +57,6 @@ namespace VcsBase { class VcsBaseSubmitEditor; } -namespace Locator { -class CommandLocator; -} - namespace Bazaar { namespace Internal { @@ -132,7 +129,7 @@ private: OptionsPage *m_optionsPage; BazaarClient *m_client; - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; Core::ActionContainer *m_bazaarContainer; QList<QAction *> m_repositoryActionList; diff --git a/src/plugins/bineditor/bineditor.qbs b/src/plugins/bineditor/bineditor.qbs index f18676ea80e..a63bcc183fb 100644 --- a/src/plugins/bineditor/bineditor.qbs +++ b/src/plugins/bineditor/bineditor.qbs @@ -8,7 +8,6 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } files: [ "bineditor.cpp", diff --git a/src/plugins/bineditor/bineditor_dependencies.pri b/src/plugins/bineditor/bineditor_dependencies.pri index cbc6861ca1f..825c980e927 100644 --- a/src/plugins/bineditor/bineditor_dependencies.pri +++ b/src/plugins/bineditor/bineditor_dependencies.pri @@ -2,6 +2,5 @@ QTC_PLUGIN_NAME = BinEditor QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - find \ texteditor \ coreplugin diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index f2f57d47fab..62a233706ee 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -53,18 +53,19 @@ #include <coreplugin/id.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/ieditor.h> +#include <coreplugin/find/ifindsupport.h> #include <coreplugin/idocument.h> #include <coreplugin/mimedatabase.h> #include <extensionsystem/pluginmanager.h> -#include <find/ifindsupport.h> #include <utils/reloadpromptutils.h> #include <utils/qtcassert.h> +using namespace Core; using namespace BINEditor; using namespace BINEditor::Internal; -class BinEditorFind : public Find::IFindSupport +class BinEditorFind : public Core::IFindSupport { Q_OBJECT @@ -80,9 +81,9 @@ public: QString currentFindString() const { return QString(); } QString completedFindString() const { return QString(); } - Find::FindFlags supportedFindFlags() const + Core::FindFlags supportedFindFlags() const { - return Find::FindBackward | Find::FindCaseSensitively; + return FindBackward | FindCaseSensitively; } void resetIncrementalSearch() @@ -91,9 +92,9 @@ public: m_incrementalWrappedState = false; } - virtual void highlightAll(const QString &txt, Find::FindFlags findFlags) + virtual void highlightAll(const QString &txt, Core::FindFlags findFlags) { - m_widget->highlightSearchResults(txt.toLatin1(), Find::textDocumentFlagsForFindFlags(findFlags)); + m_widget->highlightSearchResults(txt.toLatin1(), textDocumentFlagsForFindFlags(findFlags)); } void clearResults() @@ -101,7 +102,7 @@ public: m_widget->highlightSearchResults(QByteArray()); } - int find(const QByteArray &pattern, int pos, Find::FindFlags findFlags, bool *wrapped) + int find(const QByteArray &pattern, int pos, Core::FindFlags findFlags, bool *wrapped) { if (wrapped) *wrapped = false; @@ -110,10 +111,10 @@ public: return pos; } - int res = m_widget->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags)); + int res = m_widget->find(pattern, pos, textDocumentFlagsForFindFlags(findFlags)); if (res < 0) { - pos = (findFlags & Find::FindBackward) ? -1 : 0; - res = m_widget->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags)); + pos = (findFlags & FindBackward) ? -1 : 0; + res = m_widget->find(pattern, pos, textDocumentFlagsForFindFlags(findFlags)); if (res < 0) return res; if (wrapped) @@ -122,7 +123,7 @@ public: return res; } - Result findIncremental(const QString &txt, Find::FindFlags findFlags) { + Result findIncremental(const QString &txt, Core::FindFlags findFlags) { QByteArray pattern = txt.toLatin1(); if (pattern != m_lastPattern) resetIncrementalSearch(); // Because we don't search for nibbles. @@ -140,13 +141,13 @@ public: Result result; if (found >= 0) { result = Found; - m_widget->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); + m_widget->highlightSearchResults(pattern, textDocumentFlagsForFindFlags(findFlags)); m_contPos = -1; } else { if (found == -2) { result = NotYetFound; m_contPos += - findFlags & Find::FindBackward + findFlags & FindBackward ? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride; } else { result = NotFound; @@ -157,12 +158,12 @@ public: return result; } - Result findStep(const QString &txt, Find::FindFlags findFlags) { + Result findStep(const QString &txt, Core::FindFlags findFlags) { QByteArray pattern = txt.toLatin1(); bool wasReset = (m_incrementalStartPos < 0); if (m_contPos == -1) { m_contPos = m_widget->cursorPosition(); - if (findFlags & Find::FindBackward) + if (findFlags & FindBackward) m_contPos = m_widget->selectionStart()-1; } bool wrapped; @@ -175,10 +176,10 @@ public: m_incrementalStartPos = found; m_contPos = -1; if (wasReset) - m_widget->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); + m_widget->highlightSearchResults(pattern, textDocumentFlagsForFindFlags(findFlags)); } else if (found == -2) { result = NotYetFound; - m_contPos += findFlags & Find::FindBackward + m_contPos += findFlags & FindBackward ? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride; } else { result = NotFound; @@ -213,7 +214,7 @@ public: ~BinEditorDocument() {} QString mimeType() const { - return QLatin1String(Constants::C_BINEDITOR_MIMETYPE); + return QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE); } bool setContents(const QByteArray &contents) @@ -340,7 +341,7 @@ public: m_widget = widget; m_file = new BinEditorDocument(m_widget); m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); - m_context.add(Constants::C_BINEDITOR); + m_context.add(BINEditor::Constants::C_BINEDITOR); m_addressEdit = new QLineEdit; QRegExpValidator * const addressValidator = new QRegExpValidator(QRegExp(QLatin1String("[0-9a-fA-F]{1,16}")), diff --git a/src/plugins/bookmarks/bookmarks.qbs b/src/plugins/bookmarks/bookmarks.qbs index 4264356767f..b92b06d0724 100644 --- a/src/plugins/bookmarks/bookmarks.qbs +++ b/src/plugins/bookmarks/bookmarks.qbs @@ -9,8 +9,6 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "ProjectExplorer" } Depends { name: "TextEditor" } - Depends { name: "Find" } - Depends { name: "Locator" } files: [ "bookmark.cpp", diff --git a/src/plugins/clangcodemodel/clangsymbolsearcher.cpp b/src/plugins/clangcodemodel/clangsymbolsearcher.cpp index 5032439b889..d603a745f2e 100644 --- a/src/plugins/clangcodemodel/clangsymbolsearcher.cpp +++ b/src/plugins/clangcodemodel/clangsymbolsearcher.cpp @@ -68,7 +68,7 @@ void ClangSymbolSearcher::search(const QLinkedList<Symbol> &allSymbols) ? Qt::CaseSensitive : Qt::CaseInsensitive)); const int chunkSize = 10; - QVector<Find::SearchResultItem> resultItems; + QVector<Core::SearchResultItem> resultItems; resultItems.reserve(100); m_future->setProgressRange(0, allSymbols.size() % chunkSize); @@ -138,7 +138,7 @@ void ClangSymbolSearcher::search(const QLinkedList<Symbol> &allSymbols) info.line = s.m_location.line(); info.column = s.m_location.column() - 1; - Find::SearchResultItem item; + Core::SearchResultItem item; item.path << s.m_qualification; item.text = s.m_name; item.icon = info.icon; diff --git a/src/plugins/clangcodemodel/clangsymbolsearcher.h b/src/plugins/clangcodemodel/clangsymbolsearcher.h index d316133bb9c..ff59e211c43 100644 --- a/src/plugins/clangcodemodel/clangsymbolsearcher.h +++ b/src/plugins/clangcodemodel/clangsymbolsearcher.h @@ -47,7 +47,7 @@ class ClangSymbolSearcher: public CppTools::SymbolSearcher Q_OBJECT typedef CppTools::SymbolSearcher::Parameters Parameters; - typedef Find::SearchResultItem SearchResultItem; + typedef Core::SearchResultItem SearchResultItem; public: ClangSymbolSearcher(ClangIndexer *indexer, const Parameters ¶meters, QSet<QString> fileNames, QObject *parent = 0); diff --git a/src/plugins/clearcase/clearcase.qbs b/src/plugins/clearcase/clearcase.qbs index 72edcc26b88..8389ef56737 100644 --- a/src/plugins/clearcase/clearcase.qbs +++ b/src/plugins/clearcase/clearcase.qbs @@ -12,9 +12,7 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "TextEditor" } Depends { name: "ProjectExplorer" } - Depends { name: "Find" } Depends { name: "VcsBase" } - Depends { name: "Locator" } files: [ "activityselector.cpp", diff --git a/src/plugins/clearcase/clearcase_dependencies.pri b/src/plugins/clearcase/clearcase_dependencies.pri index 3b39e2730eb..52d7309af5c 100644 --- a/src/plugins/clearcase/clearcase_dependencies.pri +++ b/src/plugins/clearcase/clearcase_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = ClearCase QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ projectexplorer \ texteditor \ coreplugin \ diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index a625609e152..43ba106d254 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -52,7 +52,7 @@ #include <coreplugin/messagemanager.h> #include <coreplugin/mimedatabase.h> #include <coreplugin/progressmanager/progressmanager.h> -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/project.h> #include <projectexplorer/iprojectmanager.h> @@ -471,7 +471,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er const QString description = QLatin1String("ClearCase"); const QString prefix = QLatin1String("cc"); // register cc prefix in Locator - m_commandLocator = new Locator::CommandLocator("cc", description, prefix); + m_commandLocator = new Core::CommandLocator("cc", description, prefix); addAutoReleasedObject(m_commandLocator); //register actions diff --git a/src/plugins/clearcase/clearcaseplugin.h b/src/plugins/clearcase/clearcaseplugin.h index 3dcd4be5eaf..2b47de944f2 100644 --- a/src/plugins/clearcase/clearcaseplugin.h +++ b/src/plugins/clearcase/clearcaseplugin.h @@ -54,13 +54,13 @@ class QTextCodec; QT_END_NAMESPACE namespace Core { +class CommandLocator; class IVersionControl; class IEditor; } // namespace Core namespace Utils { class ParameterAction; } namespace VcsBase { class VcsBaseSubmitEditor; } -namespace Locator { class CommandLocator; } namespace ProjectExplorer { class Project; } namespace ClearCase { @@ -277,7 +277,7 @@ private: QString m_activity; QString m_diffPrefix; - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; Utils::ParameterAction *m_checkOutAction; Utils::ParameterAction *m_checkInCurrentAction; Utils::ParameterAction *m_undoCheckOutAction; diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index 39ac8bc91dd..6e498b317c7 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -64,17 +64,17 @@ CMakeLocatorFilter::~CMakeLocatorFilter() } -QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) +QList<Core::LocatorFilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) { Q_UNUSED(future) - QList<Locator::FilterEntry> result; + QList<Core::LocatorFilterEntry> result; foreach (Project *p, SessionManager::projects()) { CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p); if (cmakeProject) { foreach (const CMakeBuildTarget &ct, cmakeProject->buildTargets()) { if (ct.title.contains(entry)) { - Locator::FilterEntry entry(this, ct.title, cmakeProject->projectFilePath()); + Core::LocatorFilterEntry entry(this, ct.title, cmakeProject->projectFilePath()); entry.extraInfo = FileUtils::shortNativePath( FileName::fromString(cmakeProject->projectFilePath())); result.append(entry); @@ -86,7 +86,7 @@ QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Loca return result; } -void CMakeLocatorFilter::accept(Locator::FilterEntry selection) const +void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const { // Get the project containing the target selected CMakeProject *cmakeProject = 0; diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h index a2476d7a8ee..c50c52dcd26 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h @@ -30,14 +30,14 @@ #ifndef CMAKELOCATORFILTER_H #define CMAKELOCATORFILTER_H -#include <locator/ilocatorfilter.h> +#include <coreplugin/locator/ilocatorfilter.h> #include <QIcon> namespace CMakeProjectManager { namespace Internal { -class CMakeLocatorFilter : public Locator::ILocatorFilter +class CMakeLocatorFilter : public Core::ILocatorFilter { Q_OBJECT @@ -45,8 +45,8 @@ public: CMakeLocatorFilter(); ~CMakeLocatorFilter(); - 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); private slots: diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs index 42eafccae7a..9232f5d60af 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs @@ -9,7 +9,6 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "CppTools" } Depends { name: "CPlusPlus" } - Depends { name: "Locator" } Depends { name: "ProjectExplorer" } Depends { name: "TextEditor" } Depends { name: "QtSupport" } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager_dependencies.pri b/src/plugins/cmakeprojectmanager/cmakeprojectmanager_dependencies.pri index 7ae1e8c822c..25940e72600 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager_dependencies.pri +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager_dependencies.pri @@ -1,7 +1,6 @@ QTC_PLUGIN_NAME = CMakeProjectManager QTC_PLUGIN_DEPENDS += \ coreplugin \ - locator \ projectexplorer \ cpptools \ texteditor \ diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index c6869dd1756..e16a4e7f96a 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -35,8 +35,11 @@ #include "mimedatabase.h" #include "modemanager.h" #include "infobar.h" + #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/find/findplugin.h> +#include <coreplugin/locator/locatorplugin.h> #include <utils/savefile.h> @@ -51,10 +54,15 @@ CorePlugin::CorePlugin() : m_editMode(0), m_designMode(0) { qRegisterMetaType<Core::Id>(); m_mainWindow = new MainWindow; + m_findPlugin = new FindPlugin; + m_locatorPlugin = new LocatorPlugin; } CorePlugin::~CorePlugin() { + delete m_findPlugin; + delete m_locatorPlugin; + if (m_editMode) { removeObject(m_editMode); delete m_editMode; @@ -98,6 +106,9 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) // Make sure we respect the process's umask when creating new files Utils::SaveFile::initializeUmask(); + m_findPlugin->initialize(arguments, errorMessage); + m_locatorPlugin->initialize(this, arguments, errorMessage); + return success; } @@ -107,11 +118,14 @@ void CorePlugin::extensionsInitialized() if (m_designMode->designModeIsRequired()) addObject(m_designMode); m_mainWindow->extensionsInitialized(); + m_findPlugin->extensionsInitialized(); + m_locatorPlugin->extensionsInitialized(); } bool CorePlugin::delayedInitialize() { HelpManager::setupHelpManager(); + m_locatorPlugin->delayedInitialize(); return true; } diff --git a/src/plugins/coreplugin/coreplugin.h b/src/plugins/coreplugin/coreplugin.h index 9855c39ebaf..fd6d1ad6624 100644 --- a/src/plugins/coreplugin/coreplugin.h +++ b/src/plugins/coreplugin/coreplugin.h @@ -33,11 +33,15 @@ #include <extensionsystem/iplugin.h> namespace Core { + class DesignMode; +class FindPlugin; + namespace Internal { class EditMode; class MainWindow; +class LocatorPlugin; class CorePlugin : public ExtensionSystem::IPlugin { @@ -69,6 +73,8 @@ private: MainWindow *m_mainWindow; EditMode *m_editMode; DesignMode *m_designMode; + FindPlugin *m_findPlugin; + LocatorPlugin *m_locatorPlugin; }; } // namespace Internal diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index 10b4087a432..3b68f06f263 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -206,11 +206,14 @@ FORMS += dialogs/newdialog.ui \ mimetypesettingspage.ui \ mimetypemagicdialog.ui \ removefiledialog.ui \ - dialogs/addtovcsdialog.ui + dialogs/addtovcsdialog.ui RESOURCES += core.qrc \ fancyactionbar.qrc +include(find/find.pri) +include(locator/locator.pri) + win32 { SOURCES += progressmanager/progressmanager_win.cpp greaterThan(QT_MAJOR_VERSION, 4): QT += gui-private # Uses QPlatformNativeInterface. diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs index b7b6c93b38e..a18785cdd3a 100644 --- a/src/plugins/coreplugin/coreplugin.qbs +++ b/src/plugins/coreplugin/coreplugin.qbs @@ -1,4 +1,5 @@ import qbs.base 1.0 +import qbs.FileInfo import QtcPlugin QtcPlugin { @@ -183,6 +184,92 @@ QtcPlugin { files: [ "testdatadir.cpp", "testdatadir.h", + "locator/locatorfiltertest.cpp", + "locator/locatorfiltertest.h", + "locator/locator_test.cpp" + ] + + cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"']) + } + + Group { + name: "Find" + prefix: "find/" + files: [ + "basetextfind.cpp", + "basetextfind.h", + "currentdocumentfind.cpp", + "currentdocumentfind.h", + "find.qrc", + "finddialog.ui", + "findplugin.cpp", + "findplugin.h", + "findtoolbar.cpp", + "findtoolbar.h", + "findtoolwindow.cpp", + "findtoolwindow.h", + "findwidget.ui", + "ifindfilter.cpp", + "ifindfilter.h", + "ifindsupport.cpp", + "ifindsupport.h", + "searchresultcolor.h", + "searchresulttreeitemdelegate.cpp", + "searchresulttreeitemdelegate.h", + "searchresulttreeitemroles.h", + "searchresulttreeitems.cpp", + "searchresulttreeitems.h", + "searchresulttreemodel.cpp", + "searchresulttreemodel.h", + "searchresulttreeview.cpp", + "searchresulttreeview.h", + "searchresultwidget.cpp", + "searchresultwidget.h", + "searchresultwindow.cpp", + "searchresultwindow.h", + "textfindconstants.h", + "treeviewfind.cpp", + "treeviewfind.h", + ] + } + + Group { + name: "Locator" + prefix: "locator/" + files: [ + "basefilefilter.cpp", + "basefilefilter.h", + "commandlocator.cpp", + "commandlocator.h", + "directoryfilter.cpp", + "directoryfilter.h", + "directoryfilter.ui", + "executefilter.cpp", + "executefilter.h", + "filesystemfilter.cpp", + "filesystemfilter.h", + "filesystemfilter.ui", + "ilocatorfilter.cpp", + "ilocatorfilter.h", + "locator.qrc", + "locatorconstants.h", + "locatorfiltersfilter.cpp", + "locatorfiltersfilter.h", + "locatormanager.cpp", + "locatormanager.h", + "locatorplugin.cpp", + "locatorplugin.h", + "locatorsearchutils.cpp", + "locatorsearchutils.h", + "locatorwidget.cpp", + "locatorwidget.h", + "opendocumentsfilter.cpp", + "opendocumentsfilter.h", + "settingspage.cpp", + "settingspage.h", + "settingspage.ui", + "images/locator.png", + "images/reload.png", ] } diff --git a/src/plugins/find/basetextfind.cpp b/src/plugins/coreplugin/find/basetextfind.cpp index 7fa257cfa4b..70fdef51bd5 100644 --- a/src/plugins/find/basetextfind.cpp +++ b/src/plugins/coreplugin/find/basetextfind.cpp @@ -38,7 +38,7 @@ #include <QPlainTextEdit> #include <QTextCursor> -namespace Find { +namespace Core { struct BaseTextFindPrivate { @@ -424,4 +424,4 @@ void BaseTextFind::clearFindScope() d->m_findScopeVerticalBlockSelectionLastColumn); } -} // namespace Find +} // namespace Core diff --git a/src/plugins/find/basetextfind.h b/src/plugins/coreplugin/find/basetextfind.h index b5769223020..1d1d54d9ef1 100644 --- a/src/plugins/find/basetextfind.h +++ b/src/plugins/coreplugin/find/basetextfind.h @@ -30,7 +30,6 @@ #ifndef BASETEXTFIND_H #define BASETEXTFIND_H -#include "find_global.h" #include "ifindsupport.h" QT_BEGIN_NAMESPACE @@ -39,10 +38,10 @@ class QTextEdit; class QTextCursor; QT_END_NAMESPACE -namespace Find { +namespace Core { struct BaseTextFindPrivate; -class FIND_EXPORT BaseTextFind : public IFindSupport +class CORE_EXPORT BaseTextFind : public IFindSupport { Q_OBJECT @@ -68,7 +67,7 @@ public: void clearFindScope(); signals: - void highlightAll(const QString &txt, Find::FindFlags findFlags); + void highlightAll(const QString &txt, Core::FindFlags findFlags); void findScopeChanged(const QTextCursor &start, const QTextCursor &end, int verticalBlockSelectionFirstColumn, int verticalBlockSelectionLastColumn); @@ -87,6 +86,6 @@ private: BaseTextFindPrivate *d; }; -} // namespace Find +} // namespace Core #endif // BASETEXTFIND_H diff --git a/src/plugins/find/currentdocumentfind.cpp b/src/plugins/coreplugin/find/currentdocumentfind.cpp index 48723e15351..854a391003b 100644 --- a/src/plugins/find/currentdocumentfind.cpp +++ b/src/plugins/coreplugin/find/currentdocumentfind.cpp @@ -38,8 +38,8 @@ #include <QWidget> using namespace Core; -using namespace Find; -using namespace Find::Internal; +using namespace Core; +using namespace Core::Internal; CurrentDocumentFind::CurrentDocumentFind() : m_currentFind(0) diff --git a/src/plugins/find/currentdocumentfind.h b/src/plugins/coreplugin/find/currentdocumentfind.h index 2c79ab36aef..2b428e05839 100644 --- a/src/plugins/find/currentdocumentfind.h +++ b/src/plugins/coreplugin/find/currentdocumentfind.h @@ -34,7 +34,7 @@ #include <QPointer> -namespace Find { +namespace Core { namespace Internal { class CurrentDocumentFind : public QObject @@ -88,6 +88,6 @@ private: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // CURRENTDOCUMENTFIND_H diff --git a/src/plugins/coreplugin/find/find.pri b/src/plugins/coreplugin/find/find.pri new file mode 100644 index 00000000000..c7e8c836bc9 --- /dev/null +++ b/src/plugins/coreplugin/find/find.pri @@ -0,0 +1,42 @@ +HEADERS += \ + $$PWD/findtoolwindow.h \ + $$PWD/textfindconstants.h \ + $$PWD/ifindsupport.h \ + $$PWD/ifindfilter.h \ + $$PWD/currentdocumentfind.h \ + $$PWD/basetextfind.h \ + $$PWD/findtoolbar.h \ + $$PWD/findplugin.h \ + $$PWD/searchresultcolor.h \ + $$PWD/searchresulttreeitemdelegate.h \ + $$PWD/searchresulttreeitemroles.h \ + $$PWD/searchresulttreeitems.h \ + $$PWD/searchresulttreemodel.h \ + $$PWD/searchresulttreeview.h \ + $$PWD/searchresultwindow.h \ + $$PWD/searchresultwidget.h \ + $$PWD/treeviewfind.h + +SOURCES += \ + $$PWD/findtoolwindow.cpp \ + $$PWD/currentdocumentfind.cpp \ + $$PWD/basetextfind.cpp \ + $$PWD/findtoolbar.cpp \ + $$PWD/findplugin.cpp \ + $$PWD/searchresulttreeitemdelegate.cpp \ + $$PWD/searchresulttreeitems.cpp \ + $$PWD/searchresulttreemodel.cpp \ + $$PWD/searchresulttreeview.cpp \ + $$PWD/searchresultwindow.cpp \ + $$PWD/ifindfilter.cpp \ + $$PWD/ifindsupport.cpp \ + $$PWD/searchresultwidget.cpp \ + $$PWD/treeviewfind.cpp + +FORMS += \ + $$PWD/findwidget.ui \ + $$PWD/finddialog.ui + +RESOURCES += \ + $$PWD/find.qrc + diff --git a/src/plugins/find/find.qrc b/src/plugins/coreplugin/find/find.qrc index 0c4e1281012..0c4e1281012 100644 --- a/src/plugins/find/find.qrc +++ b/src/plugins/coreplugin/find/find.qrc diff --git a/src/plugins/find/finddialog.ui b/src/plugins/coreplugin/find/finddialog.ui index c7eddf9dadc..19d41c938cf 100644 --- a/src/plugins/find/finddialog.ui +++ b/src/plugins/coreplugin/find/finddialog.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Find::Internal::FindDialog</class> - <widget class="QWidget" name="Find::Internal::FindDialog"> + <class>Core::Internal::FindDialog</class> + <widget class="QWidget" name="Core::Internal::FindDialog"> <property name="geometry"> <rect> <x>0</x> diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp new file mode 100644 index 00000000000..ebb9f4b1835 --- /dev/null +++ b/src/plugins/coreplugin/find/findplugin.cpp @@ -0,0 +1,394 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "findplugin.h" + +#include "currentdocumentfind.h" +#include "findtoolbar.h" +#include "findtoolwindow.h" +#include "searchresultwindow.h" +#include "ifindfilter.h" + +#include <coreplugin/actionmanager/actionmanager.h> +#include <coreplugin/actionmanager/actioncontainer.h> +#include <coreplugin/coreconstants.h> +#include <coreplugin/icore.h> +#include <coreplugin/id.h> +#include <coreplugin/coreplugin.h> + +#include <extensionsystem/pluginmanager.h> + +#include <utils/qtcassert.h> + +#include <QMenu> +#include <QStringListModel> +#include <QAction> + +#include <QtPlugin> +#include <QSettings> + +/*! + \namespace Core::Internal + \internal +*/ +/*! + \namespace Core::Internal::ItemDataRoles + \internal +*/ + +Q_DECLARE_METATYPE(Core::IFindFilter*) + +namespace { + const int MAX_COMPLETIONS = 50; +} + +namespace Core { + +class FindPluginPrivate { +public: + explicit FindPluginPrivate(FindPlugin *q); + + //variables + static FindPlugin *m_instance; + + QHash<IFindFilter *, QAction *> m_filterActions; + + Internal::CurrentDocumentFind *m_currentDocumentFind; + Internal::FindToolBar *m_findToolBar; + Internal::FindToolWindow *m_findDialog; + SearchResultWindow *m_searchResultWindow; + FindFlags m_findFlags; + QStringListModel *m_findCompletionModel; + QStringListModel *m_replaceCompletionModel; + QStringList m_findCompletions; + QStringList m_replaceCompletions; + QAction *m_openFindDialog; +}; + +FindPluginPrivate::FindPluginPrivate(FindPlugin *q) : + m_currentDocumentFind(0), m_findToolBar(0), m_findDialog(0), + m_findCompletionModel(new QStringListModel(q)), + m_replaceCompletionModel(new QStringListModel(q)) +{ +} + +FindPlugin *FindPluginPrivate::m_instance = 0; + +FindPlugin::FindPlugin() : d(new FindPluginPrivate(this)) +{ + QTC_ASSERT(!FindPluginPrivate::m_instance, return); + FindPluginPrivate::m_instance = this; +} + +FindPlugin::~FindPlugin() +{ + FindPluginPrivate::m_instance = 0; + delete d->m_currentDocumentFind; + delete d->m_findToolBar; + delete d->m_findDialog; + ExtensionSystem::PluginManager::removeObject(d->m_searchResultWindow); + delete d->m_searchResultWindow; + delete d; +} + +FindPlugin *FindPlugin::instance() +{ + return FindPluginPrivate::m_instance; +} + +void FindPlugin::initialize(const QStringList &, QString *) +{ + setupMenu(); + + d->m_currentDocumentFind = new Internal::CurrentDocumentFind; + + d->m_findToolBar = new Internal::FindToolBar(this, d->m_currentDocumentFind); + d->m_findDialog = new Internal::FindToolWindow(this); + d->m_searchResultWindow = new SearchResultWindow(d->m_findDialog); + ExtensionSystem::PluginManager::addObject(d->m_searchResultWindow); +} + +void FindPlugin::extensionsInitialized() +{ + setupFilterMenuItems(); + readSettings(); +} + +void FindPlugin::aboutToShutdown() +{ + d->m_findToolBar->setVisible(false); + d->m_findToolBar->setParent(0); + d->m_currentDocumentFind->removeConnections(); + writeSettings(); +} + +void FindPlugin::filterChanged() +{ + IFindFilter *changedFilter = qobject_cast<IFindFilter *>(sender()); + QAction *action = d->m_filterActions.value(changedFilter); + QTC_ASSERT(changedFilter, return); + QTC_ASSERT(action, return); + action->setEnabled(changedFilter->isEnabled()); + bool haveEnabledFilters = false; + foreach (const IFindFilter *filter, d->m_filterActions.keys()) { + if (filter->isEnabled()) { + haveEnabledFilters = true; + break; + } + } + d->m_openFindDialog->setEnabled(haveEnabledFilters); +} + +void FindPlugin::openFindFilter() +{ + QAction *action = qobject_cast<QAction*>(sender()); + QTC_ASSERT(action, return); + IFindFilter *filter = action->data().value<IFindFilter *>(); + openFindDialog(filter); +} + +void FindPlugin::openFindDialog(IFindFilter *filter) +{ + if (d->m_currentDocumentFind->candidateIsEnabled()) + d->m_currentDocumentFind->acceptCandidate(); + const QString currentFindString = + d->m_currentDocumentFind->isEnabled() ? + d->m_currentDocumentFind->currentFindString() : QString(); + if (!currentFindString.isEmpty()) + d->m_findDialog->setFindText(currentFindString); + d->m_findDialog->setCurrentFilter(filter); + SearchResultWindow::instance()->openNewSearchPanel(); +} + +void FindPlugin::setupMenu() +{ + Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); + Core::ActionContainer *mfind = Core::ActionManager::createMenu(Constants::M_FIND); + medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); + mfind->menu()->setTitle(tr("&Find/Replace")); + mfind->appendGroup(Constants::G_FIND_CURRENTDOCUMENT); + mfind->appendGroup(Constants::G_FIND_FILTERS); + mfind->appendGroup(Constants::G_FIND_FLAGS); + mfind->appendGroup(Constants::G_FIND_ACTIONS); + Core::Context globalcontext(Core::Constants::C_GLOBAL); + Core::Command *cmd; + mfind->addSeparator(globalcontext, Constants::G_FIND_FLAGS); + mfind->addSeparator(globalcontext, Constants::G_FIND_ACTIONS); + + Core::ActionContainer *mfindadvanced = Core::ActionManager::createMenu(Constants::M_FIND_ADVANCED); + mfindadvanced->menu()->setTitle(tr("Advanced Find")); + mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS); + d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this); + d->m_openFindDialog->setIconText(tr("Advanced...")); + cmd = Core::ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); + cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); + mfindadvanced->addAction(cmd); + connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter())); +} + +void FindPlugin::setupFilterMenuItems() +{ + QList<IFindFilter*> findInterfaces = + ExtensionSystem::PluginManager::getObjects<IFindFilter>(); + Core::Command *cmd; + Core::Context globalcontext(Core::Constants::C_GLOBAL); + + Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED); + d->m_filterActions.clear(); + bool haveEnabledFilters = false; + const Core::Id base("FindFilter."); + foreach (IFindFilter *filter, findInterfaces) { + QAction *action = new QAction(QLatin1String(" ") + filter->displayName(), this); + bool isEnabled = filter->isEnabled(); + if (isEnabled) + haveEnabledFilters = true; + action->setEnabled(isEnabled); + action->setData(qVariantFromValue(filter)); + cmd = Core::ActionManager::registerAction(action, + base.withSuffix(filter->id()), globalcontext); + cmd->setDefaultKeySequence(filter->defaultShortcut()); + mfindadvanced->addAction(cmd); + d->m_filterActions.insert(filter, action); + connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter())); + connect(filter, SIGNAL(enabledChanged(bool)), this, SLOT(filterChanged())); + } + d->m_findDialog->setFindFilters(findInterfaces); + d->m_openFindDialog->setEnabled(haveEnabledFilters); +} + +FindFlags FindPlugin::findFlags() const +{ + return d->m_findFlags; +} + +void FindPlugin::setCaseSensitive(bool sensitive) +{ + setFindFlag(FindCaseSensitively, sensitive); +} + +void FindPlugin::setWholeWord(bool wholeOnly) +{ + setFindFlag(FindWholeWords, wholeOnly); +} + +void FindPlugin::setBackward(bool backward) +{ + setFindFlag(FindBackward, backward); +} + +void FindPlugin::setRegularExpression(bool regExp) +{ + setFindFlag(FindRegularExpression, regExp); +} + +void FindPlugin::setPreserveCase(bool preserveCase) +{ + setFindFlag(FindPreserveCase, preserveCase); +} + +void FindPlugin::setFindFlag(FindFlag flag, bool enabled) +{ + bool hasFlag = hasFindFlag(flag); + if ((hasFlag && enabled) || (!hasFlag && !enabled)) + return; + if (enabled) + d->m_findFlags |= flag; + else + d->m_findFlags &= ~flag; + if (flag != FindBackward) + emit findFlagsChanged(); +} + +bool FindPlugin::hasFindFlag(FindFlag flag) +{ + return d->m_findFlags & flag; +} + +void FindPlugin::writeSettings() +{ + QSettings *settings = Core::ICore::settings(); + settings->beginGroup(QLatin1String("Find")); + settings->setValue(QLatin1String("Backward"), hasFindFlag(FindBackward)); + settings->setValue(QLatin1String("CaseSensitively"), hasFindFlag(FindCaseSensitively)); + settings->setValue(QLatin1String("WholeWords"), hasFindFlag(FindWholeWords)); + settings->setValue(QLatin1String("RegularExpression"), hasFindFlag(FindRegularExpression)); + settings->setValue(QLatin1String("PreserveCase"), hasFindFlag(FindPreserveCase)); + settings->setValue(QLatin1String("FindStrings"), d->m_findCompletions); + settings->setValue(QLatin1String("ReplaceStrings"), d->m_replaceCompletions); + settings->endGroup(); + d->m_findToolBar->writeSettings(); + d->m_findDialog->writeSettings(); + d->m_searchResultWindow->writeSettings(); +} + +void FindPlugin::readSettings() +{ + QSettings *settings = Core::ICore::settings(); + settings->beginGroup(QLatin1String("Find")); + bool block = blockSignals(true); + setBackward(settings->value(QLatin1String("Backward"), false).toBool()); + setCaseSensitive(settings->value(QLatin1String("CaseSensitively"), false).toBool()); + setWholeWord(settings->value(QLatin1String("WholeWords"), false).toBool()); + setRegularExpression(settings->value(QLatin1String("RegularExpression"), false).toBool()); + setPreserveCase(settings->value(QLatin1String("PreserveCase"), false).toBool()); + blockSignals(block); + d->m_findCompletions = settings->value(QLatin1String("FindStrings")).toStringList(); + d->m_replaceCompletions = settings->value(QLatin1String("ReplaceStrings")).toStringList(); + d->m_findCompletionModel->setStringList(d->m_findCompletions); + d->m_replaceCompletionModel->setStringList(d->m_replaceCompletions); + settings->endGroup(); + d->m_findToolBar->readSettings(); + d->m_findDialog->readSettings(); + emit findFlagsChanged(); // would have been done in the setXXX methods above +} + +void FindPlugin::updateFindCompletion(const QString &text) +{ + updateCompletion(text, d->m_findCompletions, d->m_findCompletionModel); +} + +void FindPlugin::updateReplaceCompletion(const QString &text) +{ + updateCompletion(text, d->m_replaceCompletions, d->m_replaceCompletionModel); +} + +void FindPlugin::updateCompletion(const QString &text, QStringList &completions, QStringListModel *model) +{ + if (text.isEmpty()) + return; + completions.removeAll(text); + completions.prepend(text); + while (completions.size() > MAX_COMPLETIONS) + completions.removeLast(); + model->setStringList(completions); +} + +void FindPlugin::setUseFakeVim(bool on) +{ + if (d->m_findToolBar) + d->m_findToolBar->setUseFakeVim(on); +} + +void FindPlugin::openFindToolBar(FindDirection direction) +{ + if (d->m_findToolBar) { + d->m_findToolBar->setBackward(direction == FindBackwardDirection); + d->m_findToolBar->openFindToolBar(); + } +} + +QStringListModel *FindPlugin::findCompletionModel() const +{ + return d->m_findCompletionModel; +} + +QStringListModel *FindPlugin::replaceCompletionModel() const +{ + return d->m_replaceCompletionModel; +} + +QKeySequence IFindFilter::defaultShortcut() const +{ + return QKeySequence(); +} + +// declared in textfindconstants.h +QTextDocument::FindFlags textDocumentFlagsForFindFlags(FindFlags flags) +{ + QTextDocument::FindFlags textDocFlags; + if (flags & FindBackward) + textDocFlags |= QTextDocument::FindBackward; + if (flags & FindCaseSensitively) + textDocFlags |= QTextDocument::FindCaseSensitively; + if (flags & FindWholeWords) + textDocFlags |= QTextDocument::FindWholeWords; + return textDocFlags; +} + +} // namespace Core diff --git a/src/plugins/find/findplugin.h b/src/plugins/coreplugin/find/findplugin.h index 872ae87ea22..0c8298052fc 100644 --- a/src/plugins/find/findplugin.h +++ b/src/plugins/coreplugin/find/findplugin.h @@ -30,7 +30,6 @@ #ifndef FINDPLUGIN_H #define FINDPLUGIN_H -#include "find_global.h" #include "textfindconstants.h" #include <extensionsystem/iplugin.h> @@ -39,23 +38,24 @@ QT_BEGIN_NAMESPACE class QStringListModel; QT_END_NAMESPACE -namespace Find { +namespace Core { class IFindFilter; class FindPluginPrivate; namespace Internal { +class CorePlugin; class FindToolBar; class CurrentDocumentFind; } // namespace Internal -class FIND_EXPORT FindPlugin : public ExtensionSystem::IPlugin +class CORE_EXPORT FindPlugin : public QObject { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Find.json") public: FindPlugin(); virtual ~FindPlugin(); + static FindPlugin *instance(); enum FindDirection { @@ -63,13 +63,8 @@ public: FindBackwardDirection }; - // IPlugin - bool initialize(const QStringList &arguments, QString *errorMessage); - void extensionsInitialized(); - ShutdownFlag aboutToShutdown(); - - FindFlags findFlags() const; - bool hasFindFlag(FindFlag flag); + Core::FindFlags findFlags() const; + bool hasFindFlag(Core::FindFlag flag); void updateFindCompletion(const QString &text); void updateReplaceCompletion(const QString &text); QStringListModel *findCompletionModel() const; @@ -78,6 +73,10 @@ public: void openFindToolBar(FindDirection direction); void openFindDialog(IFindFilter *filter); + void initialize(const QStringList &, QString *); + void extensionsInitialized(); + void aboutToShutdown(); + public slots: void setCaseSensitive(bool sensitive); void setWholeWord(bool wholeOnly); @@ -93,7 +92,7 @@ private slots: void openFindFilter(); private: - void setFindFlag(FindFlag flag, bool enabled); + void setFindFlag(Core::FindFlag flag, bool enabled); void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model); void setupMenu(); void setupFilterMenuItems(); @@ -104,6 +103,6 @@ private: FindPluginPrivate *d; }; -} // namespace Find +} // namespace Core #endif // FINDPLUGIN_H diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index bfb9158d849..e686c3fd481 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -28,10 +28,11 @@ ****************************************************************************/ #include "findtoolbar.h" -#include "findplugin.h" #include "ifindfilter.h" +#include "findplugin.h" #include <coreplugin/coreconstants.h> +#include <coreplugin/coreplugin.h> #include <coreplugin/icore.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actioncontainer.h> @@ -53,10 +54,10 @@ #include <QStringListModel> Q_DECLARE_METATYPE(QStringList) -Q_DECLARE_METATYPE(Find::IFindFilter*) +Q_DECLARE_METATYPE(Core::IFindFilter*) -using namespace Find; -using namespace Find::Internal; +using namespace Core; +using namespace Core::Internal; FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind) : m_plugin(plugin), diff --git a/src/plugins/find/findtoolbar.h b/src/plugins/coreplugin/find/findtoolbar.h index a5e2fcade7f..fb90dfbf1f7 100644 --- a/src/plugins/find/findtoolbar.h +++ b/src/plugins/coreplugin/find/findtoolbar.h @@ -38,10 +38,8 @@ #include <QTimer> namespace Core { -class FindToolBarPlaceHolder; -} -namespace Find { +class FindToolBarPlaceHolder; class FindPlugin; namespace Internal { @@ -146,6 +144,6 @@ private: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // FINDTOOLBAR_H diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/coreplugin/find/findtoolwindow.cpp index 77b48d28662..66521dc32b2 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/coreplugin/find/findtoolwindow.cpp @@ -39,8 +39,8 @@ #include <QKeyEvent> #include <QScrollArea> -using namespace Find; -using namespace Find::Internal; +using namespace Core; +using namespace Core::Internal; static FindToolWindow *m_instance = 0; diff --git a/src/plugins/find/findtoolwindow.h b/src/plugins/coreplugin/find/findtoolwindow.h index 49cb5211cb0..e78d0075ecd 100644 --- a/src/plugins/find/findtoolwindow.h +++ b/src/plugins/coreplugin/find/findtoolwindow.h @@ -31,13 +31,13 @@ #define FINDTOOLWINDOW_H #include "ui_finddialog.h" +#include "findplugin.h" #include <QList> QT_FORWARD_DECLARE_CLASS(QCompleter) -namespace Find { -class FindPlugin; +namespace Core { class IFindFilter; namespace Internal { @@ -82,6 +82,6 @@ private: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // FINDTOOLWINDOW_H diff --git a/src/plugins/find/findwidget.ui b/src/plugins/coreplugin/find/findwidget.ui index 7ff9c28f0f2..4472102781f 100644 --- a/src/plugins/find/findwidget.ui +++ b/src/plugins/coreplugin/find/findwidget.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Find::Internal::FindWidget</class> - <widget class="QWidget" name="Find::Internal::FindWidget"> + <class>Core::Internal::FindWidget</class> + <widget class="QWidget" name="Core::Internal::FindWidget"> <property name="geometry"> <rect> <x>0</x> diff --git a/src/plugins/find/ifindfilter.cpp b/src/plugins/coreplugin/find/ifindfilter.cpp index bcd8e8d2c4f..c9fda43f2a4 100644 --- a/src/plugins/find/ifindfilter.cpp +++ b/src/plugins/coreplugin/find/ifindfilter.cpp @@ -85,7 +85,7 @@ In the find filter's find/replaceAll function, get the shared \gui{Search Results} window, initiate a new search and connect the signals for handling selection of results and the replace action - (see the Find::SearchResultWindow class for details). + (see the Core::SearchResultWindow class for details). Start your search implementation via the corresponding QtConcurrent functions. Add the returned QFuture object to the Core::ProgressManager. Use a QFutureWatcher on the returned QFuture object to receive a signal @@ -143,7 +143,7 @@ */ /*! - \fn void IFindFilter::findAll(const QString &txt, Find::FindFlags findFlags) + \fn void IFindFilter::findAll(const QString &txt, Core::FindFlags findFlags) This function is called when the user selected this find scope and initiated a search. @@ -152,15 +152,15 @@ (add it to Core::ProgressManager for a progress bar!) and presents the search results to the user (using the \gui{Search Results} output pane). For more information, see the descriptions of this class, - Core::ProgressManager, and Find::SearchResultWindow. + Core::ProgressManager, and Core::SearchResultWindow. \sa replaceAll() \sa Core::ProgressManager - \sa Find::SearchResultWindow + \sa Core::SearchResultWindow */ /*! - \fn void IFindFilter::replaceAll(const QString &txt, Find::FindFlags findFlags) + \fn void IFindFilter::replaceAll(const QString &txt, Core::FindFlags findFlags) Override this function if you want to support search and replace. This function is called when the user selected this find scope and @@ -172,11 +172,11 @@ (add it to Core::ProgressManager for a progress bar!) and presents the search results to the user (using the \gui{Search Results} output pane). For more information see the descriptions of this class, - Core::ProgressManager, and Find::SearchResultWindow. + Core::ProgressManager, and Core::SearchResultWindow. \sa findAll() \sa Core::ProgressManager - \sa Find::SearchResultWindow + \sa Core::SearchResultWindow */ /*! @@ -207,7 +207,7 @@ */ /*! - \fn Find::FindFlags BaseTextFind::supportedFindFlags() const + \fn Core::FindFlags BaseTextFind::supportedFindFlags() const Returns the find flags, like whole words or regular expressions, that this find filter supports. @@ -217,7 +217,7 @@ and Find::FindWholeWords */ -namespace Find { +namespace Core { FindFlags IFindFilter::supportedFindFlags() const { @@ -282,4 +282,4 @@ QString IFindFilter::descriptionForFindFlags(FindFlags flags) return description; } -} // namespace Find +} // namespace Core diff --git a/src/plugins/find/ifindfilter.h b/src/plugins/coreplugin/find/ifindfilter.h index 378762c04d9..00bb66a04ec 100644 --- a/src/plugins/find/ifindfilter.h +++ b/src/plugins/coreplugin/find/ifindfilter.h @@ -30,7 +30,6 @@ #ifndef IFINDFILTER_H #define IFINDFILTER_H -#include "find_global.h" #include "textfindconstants.h" QT_BEGIN_NAMESPACE @@ -40,9 +39,9 @@ class QKeySequence; class Pixmap; QT_END_NAMESPACE -namespace Find { +namespace Core { -class FIND_EXPORT IFindFilter : public QObject +class CORE_EXPORT IFindFilter : public QObject { Q_OBJECT public: @@ -71,6 +70,6 @@ signals: void enabledChanged(bool enabled); }; -} // namespace Find +} // namespace Core #endif // IFINDFILTER_H diff --git a/src/plugins/find/ifindsupport.cpp b/src/plugins/coreplugin/find/ifindsupport.cpp index a001fc08660..f057352de63 100644 --- a/src/plugins/find/ifindsupport.cpp +++ b/src/plugins/coreplugin/find/ifindsupport.cpp @@ -35,7 +35,7 @@ #include <QPaintEvent> #include <QPainter> -namespace Find { +namespace Core { namespace Internal { class WrapIndicator : public QWidget @@ -88,7 +88,7 @@ private: } // Internal } // Find -using namespace Find; +using namespace Core; void IFindSupport::replace(const QString &before, const QString &after, FindFlags findFlags) { diff --git a/src/plugins/find/ifindsupport.h b/src/plugins/coreplugin/find/ifindsupport.h index d5b80023670..041de57fddd 100644 --- a/src/plugins/find/ifindsupport.h +++ b/src/plugins/coreplugin/find/ifindsupport.h @@ -30,15 +30,14 @@ #ifndef IFINDSUPPORT_H #define IFINDSUPPORT_H -#include "find_global.h" #include "textfindconstants.h" #include <QObject> #include <QString> -namespace Find { +namespace Core { -class FIND_EXPORT IFindSupport : public QObject +class CORE_EXPORT IFindSupport : public QObject { Q_OBJECT @@ -76,6 +75,6 @@ signals: inline void IFindSupport::highlightAll(const QString &, FindFlags) {} -} // namespace Find +} // namespace Core #endif // IFINDSUPPORT_H diff --git a/src/plugins/find/images/all.png b/src/plugins/coreplugin/find/images/all.png Binary files differindex f5c1c1f767d..f5c1c1f767d 100644 --- a/src/plugins/find/images/all.png +++ b/src/plugins/coreplugin/find/images/all.png diff --git a/src/plugins/find/images/casesensitively.png b/src/plugins/coreplugin/find/images/casesensitively.png Binary files differindex 029b41faa4d..029b41faa4d 100644 --- a/src/plugins/find/images/casesensitively.png +++ b/src/plugins/coreplugin/find/images/casesensitively.png diff --git a/src/plugins/find/images/empty.png b/src/plugins/coreplugin/find/images/empty.png Binary files differindex f02154247c2..f02154247c2 100644 --- a/src/plugins/find/images/empty.png +++ b/src/plugins/coreplugin/find/images/empty.png diff --git a/src/plugins/find/images/expand.png b/src/plugins/coreplugin/find/images/expand.png Binary files differindex 48fcb9b703b..48fcb9b703b 100644 --- a/src/plugins/find/images/expand.png +++ b/src/plugins/coreplugin/find/images/expand.png diff --git a/src/plugins/find/images/next.png b/src/plugins/coreplugin/find/images/next.png Binary files differindex 1844929119b..1844929119b 100644 --- a/src/plugins/find/images/next.png +++ b/src/plugins/coreplugin/find/images/next.png diff --git a/src/plugins/find/images/preservecase.png b/src/plugins/coreplugin/find/images/preservecase.png Binary files differindex 4869aabd719..4869aabd719 100644 --- a/src/plugins/find/images/preservecase.png +++ b/src/plugins/coreplugin/find/images/preservecase.png diff --git a/src/plugins/find/images/previous.png b/src/plugins/coreplugin/find/images/previous.png Binary files differindex 4fe50af9a87..4fe50af9a87 100644 --- a/src/plugins/find/images/previous.png +++ b/src/plugins/coreplugin/find/images/previous.png diff --git a/src/plugins/find/images/regexp.png b/src/plugins/coreplugin/find/images/regexp.png Binary files differindex be8a5cc48cb..be8a5cc48cb 100644 --- a/src/plugins/find/images/regexp.png +++ b/src/plugins/coreplugin/find/images/regexp.png diff --git a/src/plugins/find/images/replace_all.png b/src/plugins/coreplugin/find/images/replace_all.png Binary files differindex d2298a8aade..d2298a8aade 100644 --- a/src/plugins/find/images/replace_all.png +++ b/src/plugins/coreplugin/find/images/replace_all.png diff --git a/src/plugins/find/images/wholewords.png b/src/plugins/coreplugin/find/images/wholewords.png Binary files differindex 0ffcecd963c..0ffcecd963c 100644 --- a/src/plugins/find/images/wholewords.png +++ b/src/plugins/coreplugin/find/images/wholewords.png diff --git a/src/plugins/find/images/wordandcase.png b/src/plugins/coreplugin/find/images/wordandcase.png Binary files differindex 34c0ac31908..34c0ac31908 100644 --- a/src/plugins/find/images/wordandcase.png +++ b/src/plugins/coreplugin/find/images/wordandcase.png diff --git a/src/plugins/find/images/wrapindicator.png b/src/plugins/coreplugin/find/images/wrapindicator.png Binary files differindex a4f8ddf4177..a4f8ddf4177 100644 --- a/src/plugins/find/images/wrapindicator.png +++ b/src/plugins/coreplugin/find/images/wrapindicator.png diff --git a/src/plugins/find/searchresultcolor.h b/src/plugins/coreplugin/find/searchresultcolor.h index fab3e06bb28..0547f077490 100644 --- a/src/plugins/find/searchresultcolor.h +++ b/src/plugins/coreplugin/find/searchresultcolor.h @@ -3,7 +3,7 @@ #include <QColor> -namespace Find { +namespace Core { namespace Internal { class SearchResultColor{ @@ -15,6 +15,6 @@ public: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // SEARCHRESULTCOLOR_H diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp index 3f9e9b20981..949a298f62b 100644 --- a/src/plugins/find/searchresulttreeitemdelegate.cpp +++ b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp @@ -36,7 +36,7 @@ #include <QModelIndex> #include <QDebug> -using namespace Find::Internal; +using namespace Core::Internal; SearchResultTreeItemDelegate::SearchResultTreeItemDelegate(QObject *parent) : QItemDelegate(parent) diff --git a/src/plugins/find/searchresulttreeitemdelegate.h b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.h index e91882bd79d..af46024ede5 100644 --- a/src/plugins/find/searchresulttreeitemdelegate.h +++ b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.h @@ -32,7 +32,7 @@ #include <QItemDelegate> -namespace Find { +namespace Core { namespace Internal { class SearchResultTreeItemDelegate: public QItemDelegate @@ -50,6 +50,6 @@ private: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // SEARCHRESULTTREEITEMDELEGATE_H diff --git a/src/plugins/find/searchresulttreeitemroles.h b/src/plugins/coreplugin/find/searchresulttreeitemroles.h index 80cda671ca3..bd771d7c6a9 100644 --- a/src/plugins/find/searchresulttreeitemroles.h +++ b/src/plugins/coreplugin/find/searchresulttreeitemroles.h @@ -32,7 +32,7 @@ #include <QAbstractItemView> -namespace Find { +namespace Core { namespace Internal { namespace ItemDataRoles { @@ -50,7 +50,7 @@ enum Roles }; } // namespace Internal -} // namespace Find +} // namespace Core } // namespace ItemDataRoles #endif // SEARCHRESULTTREEITEMROLES_H diff --git a/src/plugins/find/searchresulttreeitems.cpp b/src/plugins/coreplugin/find/searchresulttreeitems.cpp index a49e4d03e16..d9f941bd02d 100644 --- a/src/plugins/find/searchresulttreeitems.cpp +++ b/src/plugins/coreplugin/find/searchresulttreeitems.cpp @@ -29,7 +29,7 @@ #include "searchresulttreeitems.h" -namespace Find { +namespace Core { namespace Internal { SearchResultTreeItem::SearchResultTreeItem(const SearchResultItem &item, @@ -142,4 +142,4 @@ void SearchResultTreeItem::appendChild(const SearchResultItem &item) } } // namespace Internal -} // namespace Find +} // namespace Core diff --git a/src/plugins/find/searchresulttreeitems.h b/src/plugins/coreplugin/find/searchresulttreeitems.h index e64c93e7598..3f41818ee1e 100644 --- a/src/plugins/find/searchresulttreeitems.h +++ b/src/plugins/coreplugin/find/searchresulttreeitems.h @@ -35,7 +35,7 @@ #include <QString> #include <QList> -namespace Find { +namespace Core { namespace Internal { class SearchResultTreeItem @@ -77,6 +77,6 @@ private: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // SEARCHRESULTTREEITEMS_H diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/coreplugin/find/searchresulttreemodel.cpp index feca87cc39d..7aafe033bbf 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/coreplugin/find/searchresulttreemodel.cpp @@ -36,8 +36,8 @@ #include <QFontMetrics> #include <QDebug> -using namespace Find; -using namespace Find::Internal; +using namespace Core; +using namespace Core::Internal; SearchResultTreeModel::SearchResultTreeModel(QObject *parent) : QAbstractItemModel(parent) diff --git a/src/plugins/find/searchresulttreemodel.h b/src/plugins/coreplugin/find/searchresulttreemodel.h index ad45c6f4b62..36ca6d94ac1 100644 --- a/src/plugins/find/searchresulttreemodel.h +++ b/src/plugins/coreplugin/find/searchresulttreemodel.h @@ -36,7 +36,7 @@ #include <QAbstractItemModel> #include <QFont> -namespace Find { +namespace Core { namespace Internal { class SearchResultTreeItem; @@ -94,6 +94,6 @@ private: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // SEARCHRESULTTREEMODEL_H diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/coreplugin/find/searchresulttreeview.cpp index 8b96176264e..d48efabd976 100644 --- a/src/plugins/find/searchresulttreeview.cpp +++ b/src/plugins/coreplugin/find/searchresulttreeview.cpp @@ -35,7 +35,7 @@ #include <QHeaderView> #include <QKeyEvent> -namespace Find { +namespace Core { namespace Internal { SearchResultTreeView::SearchResultTreeView(QWidget *parent) @@ -106,4 +106,4 @@ SearchResultTreeModel *SearchResultTreeView::model() const } } // namespace Internal -} // namespace Find +} // namespace Core diff --git a/src/plugins/find/searchresulttreeview.h b/src/plugins/coreplugin/find/searchresulttreeview.h index ecf290c90df..b5dcd792d38 100644 --- a/src/plugins/find/searchresulttreeview.h +++ b/src/plugins/coreplugin/find/searchresulttreeview.h @@ -34,7 +34,7 @@ #include <QTreeView> -namespace Find { +namespace Core { namespace Internal { class SearchResultTreeModel; @@ -68,6 +68,6 @@ protected: }; } // namespace Internal -} // namespace Find +} // namespace Core #endif // SEARCHRESULTTREEVIEW_H diff --git a/src/plugins/find/searchresultwidget.cpp b/src/plugins/coreplugin/find/searchresultwidget.cpp index bbdfe3d1386..6539cebdadd 100644 --- a/src/plugins/find/searchresultwidget.cpp +++ b/src/plugins/coreplugin/find/searchresultwidget.cpp @@ -37,6 +37,7 @@ #include "treeviewfind.h" #include <aggregation/aggregate.h> +#include <coreplugin/coreplugin.h> #include <QDir> #include <QFrame> @@ -50,7 +51,7 @@ static const int SEARCHRESULT_WARNING_LIMIT = 200000; static const char SIZE_WARNING_ID[] = "sizeWarningLabel"; -namespace Find { +namespace Core { namespace Internal { class WideEnoughLineEdit : public QLineEdit { @@ -71,11 +72,11 @@ public slots: void updateGeometry() { QLineEdit::updateGeometry(); } }; -} // Internal -} // Find +} // namespace Internal +} // namespace Core -using namespace Find; -using namespace Find::Internal; +using namespace Core; +using namespace Core::Internal; SearchResultWidget::SearchResultWidget(QWidget *parent) : QWidget(parent), diff --git a/src/plugins/find/searchresultwidget.h b/src/plugins/coreplugin/find/searchresultwidget.h index 76ec7da9350..e9f64b4164e 100644 --- a/src/plugins/find/searchresultwidget.h +++ b/src/plugins/coreplugin/find/searchresultwidget.h @@ -44,7 +44,7 @@ class QToolButton; class QCheckBox; QT_END_NAMESPACE -namespace Find { +namespace Core { namespace Internal { class SearchResultTreeView; @@ -97,8 +97,8 @@ public slots: void sendRequestPopup(); signals: - void activated(const Find::SearchResultItem &item); - void replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems, bool preserveCase); + void activated(const Core::SearchResultItem &item); + void replaceButtonClicked(const QString &replaceText, const QList<Core::SearchResultItem> &checkedItems, bool preserveCase); void searchAgainRequested(); void cancelled(); void paused(bool paused); diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp index a5dce4791db..dd4f87475f2 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/coreplugin/find/searchresultwindow.cpp @@ -50,7 +50,7 @@ static const char SETTINGSKEYSECTIONNAME[] = "SearchResults"; static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults"; static const int MAX_SEARCH_HISTORY = 12; -namespace Find { +namespace Core { namespace Internal { @@ -83,6 +83,7 @@ namespace Internal { int visibleSearchIndex() const; void setCurrentIndex(int index, bool focus); + FindPlugin *m_plugin; SearchResultWindow *q; QList<Internal::SearchResultWidget *> m_searchResultWidgets; QToolButton *m_expandCollapseButton; @@ -187,10 +188,10 @@ namespace Internal { } } -using namespace Find::Internal; +using namespace Core::Internal; /*! - \enum Find::SearchResultWindow::SearchMode + \enum Core::SearchResultWindow::SearchMode This enum type specifies whether a search should show the replace UI or not: \value SearchOnly @@ -200,7 +201,7 @@ using namespace Find::Internal; */ /*! - \class Find::SearchResult + \class Core::SearchResult \brief The SearchResult class reports user interaction, such as the activation of a search result item. @@ -210,13 +211,13 @@ using namespace Find::Internal; */ /*! - \fn void SearchResult::activated(const Find::SearchResultItem &item) + \fn void SearchResult::activated(const Core::SearchResultItem &item) Indicates that the user activated the search result \a item by double-clicking it, for example. */ /*! - \fn void SearchResult::replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems, bool preserveCase) + \fn void SearchResult::replaceButtonClicked(const QString &replaceText, const QList<Core::SearchResultItem> &checkedItems, bool preserveCase) Indicates that the user initiated a text replace by selecting \gui {Replace All}, for example. @@ -228,7 +229,7 @@ using namespace Find::Internal; */ /*! - \class Find::SearchResultWindow + \class Core::SearchResultWindow \brief The SearchResultWindow class is the implementation of a commonly shared \gui{Search Results} output pane. Use it to show search results to a user. @@ -272,6 +273,7 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) : d(new SearchResultWindowPrivate(this)) { m_instance = this; + d->m_spacer = new QWidget; d->m_spacer->setMinimumWidth(30); d->m_recentSearchesBox = new QComboBox; @@ -309,7 +311,6 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) */ SearchResultWindow::~SearchResultWindow() { - writeSettings(); qDeleteAll(d->m_searchResults); delete d->m_widget; d->m_widget = 0; @@ -586,10 +587,10 @@ bool SearchResultWindow::canNavigate() const SearchResult::SearchResult(SearchResultWidget *widget) : m_widget(widget) { - connect(widget, SIGNAL(activated(Find::SearchResultItem)), - this, SIGNAL(activated(Find::SearchResultItem))); - connect(widget, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)), - this, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool))); + connect(widget, SIGNAL(activated(Core::SearchResultItem)), + this, SIGNAL(activated(Core::SearchResultItem))); + connect(widget, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), + this, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool))); connect(widget, SIGNAL(cancelled()), this, SIGNAL(cancelled())); connect(widget, SIGNAL(paused(bool)), @@ -709,6 +710,6 @@ void SearchResult::popup() m_widget->sendRequestPopup(); } -} // namespace Find +} // namespace Core #include "searchresultwindow.moc" diff --git a/src/plugins/find/searchresultwindow.h b/src/plugins/coreplugin/find/searchresultwindow.h index 8c7f052c01f..c13b9ce32f9 100644 --- a/src/plugins/find/searchresultwindow.h +++ b/src/plugins/coreplugin/find/searchresultwindow.h @@ -30,8 +30,6 @@ #ifndef SEARCHRESULTWINDOW_H #define SEARCHRESULTWINDOW_H -#include "find_global.h" - #include <coreplugin/ioutputpane.h> #include <QVariant> @@ -42,15 +40,16 @@ QT_BEGIN_NAMESPACE class QFont; QT_END_NAMESPACE -namespace Find { +namespace Core { namespace Internal { class SearchResultTreeView; class SearchResultWindowPrivate; class SearchResultWidget; } +class FindPlugin; class SearchResultWindow; -class FIND_EXPORT SearchResultItem +class CORE_EXPORT SearchResultItem { public: SearchResultItem() @@ -83,7 +82,7 @@ public: QVariant userData; // user data for identification of the item }; -class FIND_EXPORT SearchResult : public QObject +class CORE_EXPORT SearchResult : public QObject { Q_OBJECT @@ -110,8 +109,8 @@ public slots: void popup(); signals: - void activated(const Find::SearchResultItem &item); - void replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems, bool preserveCase); + void activated(const Core::SearchResultItem &item); + void replaceButtonClicked(const QString &replaceText, const QList<Core::SearchResultItem> &checkedItems, bool preserveCase); void cancelled(); void paused(bool paused); void visibilityChanged(bool visible); @@ -128,7 +127,7 @@ private: QVariant m_userData; }; -class FIND_EXPORT SearchResultWindow : public Core::IOutputPane +class CORE_EXPORT SearchResultWindow : public Core::IOutputPane { Q_OBJECT @@ -182,16 +181,18 @@ public slots: private slots: void handleExpandCollapseToolButton(bool checked); +public: // Used by plugin, do not use + void writeSettings(); + private: void readSettings(); - void writeSettings(); Internal::SearchResultWindowPrivate *d; static SearchResultWindow *m_instance; }; -} // namespace Find +} // namespace Core -Q_DECLARE_METATYPE(Find::SearchResultItem) +Q_DECLARE_METATYPE(Core::SearchResultItem) #endif // SEARCHRESULTWINDOW_H diff --git a/src/plugins/find/textfindconstants.h b/src/plugins/coreplugin/find/textfindconstants.h index 0100df7d2d3..53292327b30 100644 --- a/src/plugins/find/textfindconstants.h +++ b/src/plugins/coreplugin/find/textfindconstants.h @@ -30,13 +30,13 @@ #ifndef TEXTFINDCONSTANTS_H #define TEXTFINDCONSTANTS_H -#include "find_global.h" +#include <coreplugin/core_global.h> #include <QMetaType> #include <QFlags> #include <QTextDocument> -namespace Find { +namespace Core { namespace Constants { const char M_FIND[] = "Find.FindMenu"; @@ -74,11 +74,11 @@ enum FindFlag { Q_DECLARE_FLAGS(FindFlags, FindFlag) // defined in findplugin.cpp -QTextDocument::FindFlags FIND_EXPORT textDocumentFlagsForFindFlags(FindFlags flags); +QTextDocument::FindFlags CORE_EXPORT textDocumentFlagsForFindFlags(FindFlags flags); -} // namespace Find +} // namespace Core -Q_DECLARE_OPERATORS_FOR_FLAGS(Find::FindFlags) -Q_DECLARE_METATYPE(Find::FindFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(Core::FindFlags) +Q_DECLARE_METATYPE(Core::FindFlags) #endif // TEXTFINDCONSTANTS_H diff --git a/src/plugins/find/treeviewfind.cpp b/src/plugins/coreplugin/find/treeviewfind.cpp index 24ac4e7e374..6a1c9375571 100644 --- a/src/plugins/find/treeviewfind.cpp +++ b/src/plugins/coreplugin/find/treeviewfind.cpp @@ -33,7 +33,7 @@ #include <QTextCursor> #include <QModelIndex> -namespace Find { +namespace Core { class ItemModelFindPrivate { @@ -274,4 +274,4 @@ QModelIndex TreeViewFind::followingIndex(const QModelIndex &idx, bool backward, return nextIndex(idx, wrapped); } -} // namespace Find +} // namespace Core diff --git a/src/plugins/find/treeviewfind.h b/src/plugins/coreplugin/find/treeviewfind.h index b7ac19468f9..06842d2b795 100644 --- a/src/plugins/find/treeviewfind.h +++ b/src/plugins/coreplugin/find/treeviewfind.h @@ -37,10 +37,10 @@ class QTreeView; class QModelIndex; QT_END_NAMESPACE -namespace Find { +namespace Core { class ItemModelFindPrivate; -class FIND_EXPORT TreeViewFind : public IFindSupport +class CORE_EXPORT TreeViewFind : public IFindSupport { Q_OBJECT public: @@ -70,6 +70,6 @@ private: ItemModelFindPrivate *d; }; -} // namespace Find +} // namespace Core #endif // TREEVIEWFIND_H diff --git a/src/plugins/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index c802014f1e8..920f5b570db 100644 --- a/src/plugins/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -36,7 +36,7 @@ #include <QStringMatcher> using namespace Core; -using namespace Locator; +using namespace Core; using namespace Utils; BaseFileFilter::BaseFileFilter() @@ -44,11 +44,11 @@ BaseFileFilter::BaseFileFilter() { } -QList<FilterEntry> BaseFileFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &origEntry) +QList<LocatorFilterEntry> BaseFileFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &origEntry) { updateFiles(); - QList<FilterEntry> betterEntries; - QList<FilterEntry> goodEntries; + QList<LocatorFilterEntry> betterEntries; + QList<LocatorFilterEntry> goodEntries; QString needle = trimWildcards(origEntry); const QString lineNoSuffix = EditorManager::splitLineNumber(&needle); QStringMatcher matcher(needle, Qt::CaseInsensitive); @@ -89,7 +89,7 @@ QList<FilterEntry> BaseFileFilter::matchesFor(QFutureInterface<Locator::FilterEn if ((hasWildcard && regexp.exactMatch(matchText)) || (!hasWildcard && matcher.indexIn(matchText) != -1)) { QFileInfo fi(path); - FilterEntry entry(this, fi.fileName(), QString(path + lineNoSuffix)); + LocatorFilterEntry entry(this, fi.fileName(), QString(path + lineNoSuffix)); entry.extraInfo = FileUtils::shortNativePath(FileName(fi)); entry.fileName = path; if (matchText.startsWith(needle, caseSensitivityForPrefix)) @@ -105,7 +105,7 @@ QList<FilterEntry> BaseFileFilter::matchesFor(QFutureInterface<Locator::FilterEn return betterEntries; } -void BaseFileFilter::accept(Locator::FilterEntry selection) const +void BaseFileFilter::accept(Core::LocatorFilterEntry selection) const { EditorManager::openEditor(selection.internalData.toString(), Id(), EditorManager::CanContainLineNumber); diff --git a/src/plugins/locator/basefilefilter.h b/src/plugins/coreplugin/locator/basefilefilter.h index 7e7c7fe7860..44102b30e4e 100644 --- a/src/plugins/locator/basefilefilter.h +++ b/src/plugins/coreplugin/locator/basefilefilter.h @@ -30,21 +30,20 @@ #ifndef BASEFILEFILTER_H #define BASEFILEFILTER_H -#include "locator_global.h" #include "ilocatorfilter.h" #include <QStringList> -namespace Locator { +namespace Core { -class LOCATOR_EXPORT BaseFileFilter : public Locator::ILocatorFilter +class CORE_EXPORT BaseFileFilter : public Core::ILocatorFilter { Q_OBJECT public: BaseFileFilter(); - 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; protected: virtual void updateFiles(); @@ -62,6 +61,6 @@ private: QString m_previousEntry; }; -} // namespace Locator +} // namespace Core #endif // BASEFILEFILTER_H diff --git a/src/plugins/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp index bf9e2eed8b9..13b4ec14859 100644 --- a/src/plugins/locator/commandlocator.cpp +++ b/src/plugins/coreplugin/locator/commandlocator.cpp @@ -35,7 +35,7 @@ #include <QAction> -namespace Locator { +namespace Core { struct CommandLocatorPrivate { @@ -46,7 +46,7 @@ CommandLocator::CommandLocator(Core::Id id, const QString &displayName, const QString &shortCutString, QObject *parent) : - Locator::ILocatorFilter(parent), + Core::ILocatorFilter(parent), d(new CommandLocatorPrivate) { setId(id); @@ -64,10 +64,10 @@ void CommandLocator::appendCommand(Core::Command *cmd) d->commands.push_back(cmd); } -QList<Locator::FilterEntry> CommandLocator::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) +QList<Core::LocatorFilterEntry> CommandLocator::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) { - QList<FilterEntry> goodEntries; - QList<FilterEntry> betterEntries; + QList<LocatorFilterEntry> goodEntries; + QList<LocatorFilterEntry> betterEntries; // Get active, enabled actions matching text, store in list. // Reference via index in extraInfo. const QChar ampersand = QLatin1Char('&'); @@ -82,9 +82,9 @@ QList<Locator::FilterEntry> CommandLocator::matchesFor(QFutureInterface<Locator: QString text = action->text(); text.remove(ampersand); if (text.startsWith(entry, caseSensitivity_)) - betterEntries.append(FilterEntry(this, text, QVariant(i))); + betterEntries.append(LocatorFilterEntry(this, text, QVariant(i))); else if (text.contains(entry, caseSensitivity_)) - goodEntries.append(FilterEntry(this, text, QVariant(i))); + goodEntries.append(LocatorFilterEntry(this, text, QVariant(i))); } } } @@ -92,7 +92,7 @@ QList<Locator::FilterEntry> CommandLocator::matchesFor(QFutureInterface<Locator: return betterEntries; } -void CommandLocator::accept(Locator::FilterEntry entry) const +void CommandLocator::accept(Core::LocatorFilterEntry entry) const { // Retrieve action via index. const int index = entry.internalData.toInt(); @@ -106,4 +106,4 @@ void CommandLocator::refresh(QFutureInterface<void> &) { } -} // namespace Locator +} // namespace Core diff --git a/src/plugins/locator/commandlocator.h b/src/plugins/coreplugin/locator/commandlocator.h index 3943c492825..d62f5bdfd4e 100644 --- a/src/plugins/locator/commandlocator.h +++ b/src/plugins/coreplugin/locator/commandlocator.h @@ -30,18 +30,16 @@ #ifndef COMMANDLOCATOR_H #define COMMANDLOCATOR_H -#include "locator_global.h" #include "ilocatorfilter.h" -namespace Core { class Command; } +namespace Core { -namespace Locator { /* Command locators: Provides completion for a set of * Core::Command's by sub-string of their action's text. */ - +class Command; struct CommandLocatorPrivate; -class LOCATOR_EXPORT CommandLocator : public Locator::ILocatorFilter +class CORE_EXPORT CommandLocator : public Core::ILocatorFilter { Q_OBJECT @@ -52,14 +50,14 @@ public: void appendCommand(Core::Command *cmd); - QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry); - void accept(FilterEntry selection) const; + QList<LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry); + void accept(LocatorFilterEntry selection) const; void refresh(QFutureInterface<void> &future); private: CommandLocatorPrivate *d; }; -} // namespace Locator +} // namespace Core #endif // COMMANDLOCATOR_H diff --git a/src/plugins/locator/directoryfilter.cpp b/src/plugins/coreplugin/locator/directoryfilter.cpp index f920c3de621..dd7639cfe47 100644 --- a/src/plugins/locator/directoryfilter.cpp +++ b/src/plugins/coreplugin/locator/directoryfilter.cpp @@ -32,8 +32,8 @@ #include <QFileDialog> #include <utils/filesearch.h> -using namespace Locator; -using namespace Locator::Internal; +using namespace Core; +using namespace Core::Internal; DirectoryFilter::DirectoryFilter() : m_name(tr("Generic Directory Filter")), diff --git a/src/plugins/locator/directoryfilter.h b/src/plugins/coreplugin/locator/directoryfilter.h index 021a5167923..67e97a6e30b 100644 --- a/src/plugins/locator/directoryfilter.h +++ b/src/plugins/coreplugin/locator/directoryfilter.h @@ -38,7 +38,7 @@ #include <QFutureInterface> #include <QMutex> -namespace Locator { +namespace Core { namespace Internal { class DirectoryFilter : public BaseFileFilter @@ -70,6 +70,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // DIRECTORYFILTER_H diff --git a/src/plugins/locator/directoryfilter.ui b/src/plugins/coreplugin/locator/directoryfilter.ui index d2b954ace19..051f7c5104e 100644 --- a/src/plugins/locator/directoryfilter.ui +++ b/src/plugins/coreplugin/locator/directoryfilter.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Locator::Internal::DirectoryFilterOptions</class> - <widget class="QDialog" name="Locator::Internal::DirectoryFilterOptions"> + <class>Core::Internal::DirectoryFilterOptions</class> + <widget class="QDialog" name="Core::Internal::DirectoryFilterOptions"> <property name="geometry"> <rect> <x>0</x> @@ -162,7 +162,7 @@ To do this, you type this shortcut and a space in the Locator entry field, and t <connection> <sender>buttonBox</sender> <signal>accepted()</signal> - <receiver>Locator::Internal::DirectoryFilterOptions</receiver> + <receiver>Core::Internal::DirectoryFilterOptions</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> @@ -178,7 +178,7 @@ To do this, you type this shortcut and a space in the Locator entry field, and t <connection> <sender>buttonBox</sender> <signal>rejected()</signal> - <receiver>Locator::Internal::DirectoryFilterOptions</receiver> + <receiver>Core::Internal::DirectoryFilterOptions</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> diff --git a/src/plugins/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp index 4f7cc7404e9..6c2e5f83bd5 100644 --- a/src/plugins/locator/executefilter.cpp +++ b/src/plugins/coreplugin/locator/executefilter.cpp @@ -36,8 +36,8 @@ #include <QMessageBox> using namespace Core; -using namespace Locator; -using namespace Locator::Internal; +using namespace Core; +using namespace Core::Internal; ExecuteFilter::ExecuteFilter() { @@ -57,13 +57,13 @@ ExecuteFilter::ExecuteFilter() connect(&m_runTimer, SIGNAL(timeout()), this, SLOT(runHeadCommand())); } -QList<FilterEntry> ExecuteFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, +QList<LocatorFilterEntry> ExecuteFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) { - QList<FilterEntry> value; + QList<LocatorFilterEntry> value; if (!entry.isEmpty()) // avoid empty entry - value.append(FilterEntry(this, entry, QVariant())); - QList<FilterEntry> others; + value.append(LocatorFilterEntry(this, entry, QVariant())); + QList<LocatorFilterEntry> others; const Qt::CaseSensitivity caseSensitivityForPrefix = caseSensitivity(entry); foreach (const QString &i, m_commandHistory) { if (future.isCanceled()) @@ -71,15 +71,15 @@ QList<FilterEntry> ExecuteFilter::matchesFor(QFutureInterface<Locator::FilterEnt if (i == entry) // avoid repeated entry continue; if (i.startsWith(entry, caseSensitivityForPrefix)) - value.append(FilterEntry(this, i, QVariant())); + value.append(LocatorFilterEntry(this, i, QVariant())); else - others.append(FilterEntry(this, i, QVariant())); + others.append(LocatorFilterEntry(this, i, QVariant())); } value.append(others); return value; } -void ExecuteFilter::accept(FilterEntry selection) const +void ExecuteFilter::accept(LocatorFilterEntry selection) const { ExecuteFilter *p = const_cast<ExecuteFilter *>(this); diff --git a/src/plugins/locator/executefilter.h b/src/plugins/coreplugin/locator/executefilter.h index 9d2f0e946ca..719d8514c85 100644 --- a/src/plugins/locator/executefilter.h +++ b/src/plugins/coreplugin/locator/executefilter.h @@ -39,10 +39,10 @@ #include <QTimer> #include <QTextCodec> -namespace Locator { +namespace Core { namespace Internal { -class ExecuteFilter : public Locator::ILocatorFilter +class ExecuteFilter : public Core::ILocatorFilter { Q_OBJECT struct ExecuteData @@ -54,9 +54,9 @@ class ExecuteFilter : public Locator::ILocatorFilter public: ExecuteFilter(); - QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, + QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry); - void accept(Locator::FilterEntry selection) const; + void accept(Core::LocatorFilterEntry selection) const; void refresh(QFutureInterface<void> &) {} private slots: @@ -78,6 +78,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // EXECUTEFILTER_H diff --git a/src/plugins/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index b5a11399641..84b05cfd5e9 100644 --- a/src/plugins/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -35,14 +35,14 @@ #include <QDir> using namespace Core; -using namespace Locator; -using namespace Locator::Internal; +using namespace Core; +using namespace Core::Internal; namespace { -QList<FilterEntry> *categorize(const QString &entry, const QString &candidate, +QList<LocatorFilterEntry> *categorize(const QString &entry, const QString &candidate, Qt::CaseSensitivity caseSensitivity, - QList<FilterEntry> *betterEntries, QList<FilterEntry> *goodEntries) + QList<LocatorFilterEntry> *betterEntries, QList<LocatorFilterEntry> *goodEntries) { if (entry.isEmpty() || candidate.startsWith(entry, caseSensitivity)) return betterEntries; @@ -62,10 +62,10 @@ FileSystemFilter::FileSystemFilter(LocatorWidget *locatorWidget) setIncludedByDefault(false); } -QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) +QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) { - QList<FilterEntry> goodEntries; - QList<FilterEntry> betterEntries; + QList<LocatorFilterEntry> goodEntries; + QList<LocatorFilterEntry> betterEntries; QFileInfo entryInfo(entry); QString name = entryInfo.fileName(); QString directory = entryInfo.path(); @@ -96,10 +96,10 @@ QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::Filter foreach (const QString &dir, dirs) { if (future.isCanceled()) break; - if (QList<FilterEntry> *category = categorize(name, dir, caseSensitivity_, &betterEntries, + if (QList<LocatorFilterEntry> *category = categorize(name, dir, caseSensitivity_, &betterEntries, &goodEntries)) { const QString fullPath = dirInfo.filePath(dir); - FilterEntry filterEntry(this, dir, QVariant()); + LocatorFilterEntry filterEntry(this, dir, QVariant()); filterEntry.fileName = fullPath; category->append(filterEntry); } @@ -111,10 +111,10 @@ QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::Filter foreach (const QString &file, files) { if (future.isCanceled()) break; - if (QList<FilterEntry> *category = categorize(name, file, caseSensitivity_, &betterEntries, + if (QList<LocatorFilterEntry> *category = categorize(name, file, caseSensitivity_, &betterEntries, &goodEntries)) { const QString fullPath = dirInfo.filePath(file); - FilterEntry filterEntry(this, file, QString(fullPath + lineNoSuffix)); + LocatorFilterEntry filterEntry(this, file, QString(fullPath + lineNoSuffix)); filterEntry.fileName = fullPath; category->append(filterEntry); } @@ -123,7 +123,7 @@ QList<FilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Locator::Filter return betterEntries; } -void FileSystemFilter::accept(FilterEntry selection) const +void FileSystemFilter::accept(LocatorFilterEntry selection) const { QString fileName = selection.fileName; QFileInfo info(fileName); diff --git a/src/plugins/locator/filesystemfilter.h b/src/plugins/coreplugin/locator/filesystemfilter.h index 9708dca4897..a6f0283065c 100644 --- a/src/plugins/locator/filesystemfilter.h +++ b/src/plugins/coreplugin/locator/filesystemfilter.h @@ -38,19 +38,19 @@ #include <QByteArray> #include <QFutureInterface> -namespace Locator { +namespace Core { namespace Internal { class LocatorWidget; -class FileSystemFilter : public Locator::ILocatorFilter +class FileSystemFilter : public Core::ILocatorFilter { Q_OBJECT public: explicit FileSystemFilter(LocatorWidget *locatorWidget); - 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; QByteArray saveState() const; bool restoreState(const QByteArray &state); bool openConfigDialog(QWidget *parent, bool &needsRefresh); @@ -62,6 +62,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // FILESYSTEMFILTER_H diff --git a/src/plugins/locator/filesystemfilter.ui b/src/plugins/coreplugin/locator/filesystemfilter.ui index 8fa9a0af01e..b6a8944c708 100644 --- a/src/plugins/locator/filesystemfilter.ui +++ b/src/plugins/coreplugin/locator/filesystemfilter.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Locator::Internal::FileSystemFilterOptions</class> - <widget class="QDialog" name="Locator::Internal::FileSystemFilterOptions"> + <class>Core::Internal::FileSystemFilterOptions</class> + <widget class="QDialog" name="Core::Internal::FileSystemFilterOptions"> <property name="geometry"> <rect> <x>0</x> @@ -78,7 +78,7 @@ <connection> <sender>buttonBox</sender> <signal>accepted()</signal> - <receiver>Locator::Internal::FileSystemFilterOptions</receiver> + <receiver>Core::Internal::FileSystemFilterOptions</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> @@ -94,7 +94,7 @@ <connection> <sender>buttonBox</sender> <signal>rejected()</signal> - <receiver>Locator::Internal::FileSystemFilterOptions</receiver> + <receiver>Core::Internal::FileSystemFilterOptions</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> diff --git a/src/plugins/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp index 70e8374c3ba..ea91197cc66 100644 --- a/src/plugins/locator/ilocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp @@ -36,7 +36,7 @@ #include <QLabel> #include <QLineEdit> -using namespace Locator; +using namespace Core; ILocatorFilter::ILocatorFilter(QObject *parent): QObject(parent), diff --git a/src/plugins/locator/ilocatorfilter.h b/src/plugins/coreplugin/locator/ilocatorfilter.h index b3ca3039fc3..3c6e213fa02 100644 --- a/src/plugins/locator/ilocatorfilter.h +++ b/src/plugins/coreplugin/locator/ilocatorfilter.h @@ -30,26 +30,24 @@ #ifndef ILOCATORFILTER_H #define ILOCATORFILTER_H -#include "locator_global.h" - #include <coreplugin/id.h> #include <QVariant> #include <QFutureInterface> #include <QIcon> -namespace Locator { +namespace Core { class ILocatorFilter; -struct FilterEntry +struct LocatorFilterEntry { - FilterEntry() + LocatorFilterEntry() : filter(0) , fileIconResolved(false) {} - FilterEntry(ILocatorFilter *fromFilter, const QString &name, const QVariant &data, + LocatorFilterEntry(ILocatorFilter *fromFilter, const QString &name, const QVariant &data, const QIcon &icon = QIcon()) : filter(fromFilter) , displayName(name) @@ -58,7 +56,7 @@ struct FilterEntry , fileIconResolved(false) {} - bool operator==(const FilterEntry &other) const { + bool operator==(const LocatorFilterEntry &other) const { if (internalData.canConvert(QVariant::String)) return (internalData.toString() == other.internalData.toString()); return internalData.constData() == other.internalData.constData(); @@ -80,7 +78,7 @@ struct FilterEntry bool fileIconResolved; }; -class LOCATOR_EXPORT ILocatorFilter : public QObject +class CORE_EXPORT ILocatorFilter : public QObject { Q_OBJECT @@ -103,10 +101,10 @@ public: QString shortcutString() const; /* List of matches for the given user entry. */ - virtual QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) = 0; + virtual QList<LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) = 0; /* User has selected the given entry that belongs to this filter. */ - virtual void accept(FilterEntry selection) const = 0; + virtual void accept(LocatorFilterEntry selection) const = 0; /* Implement to update caches on user request, if that's a long operation. */ virtual void refresh(QFutureInterface<void> &future) = 0; @@ -164,6 +162,6 @@ private: bool m_isConfigurable; }; -} // namespace Locator +} // namespace Core #endif // ILOCATORFILTER_H diff --git a/src/plugins/locator/images/locator.png b/src/plugins/coreplugin/locator/images/locator.png Binary files differindex 000ee1c0185..000ee1c0185 100644 --- a/src/plugins/locator/images/locator.png +++ b/src/plugins/coreplugin/locator/images/locator.png diff --git a/src/plugins/locator/images/reload.png b/src/plugins/coreplugin/locator/images/reload.png Binary files differindex b5afefb32bc..b5afefb32bc 100644 --- a/src/plugins/locator/images/reload.png +++ b/src/plugins/coreplugin/locator/images/reload.png diff --git a/src/plugins/coreplugin/locator/locator.pri b/src/plugins/coreplugin/locator/locator.pri new file mode 100644 index 00000000000..174e1684fee --- /dev/null +++ b/src/plugins/coreplugin/locator/locator.pri @@ -0,0 +1,46 @@ +HEADERS += \ + $$PWD/locatorplugin.h \ + $$PWD/commandlocator.h \ + $$PWD/locatorwidget.h \ + $$PWD/locatorfiltersfilter.h \ + $$PWD/settingspage.h \ + $$PWD/ilocatorfilter.h \ + $$PWD/opendocumentsfilter.h \ + $$PWD/filesystemfilter.h \ + $$PWD/locatorconstants.h \ + $$PWD/directoryfilter.h \ + $$PWD/locatormanager.h \ + $$PWD/basefilefilter.h \ + $$PWD/executefilter.h \ + $$PWD/locatorsearchutils.h + +SOURCES += \ + $$PWD/locatorplugin.cpp \ + $$PWD/commandlocator.cpp \ + $$PWD/locatorwidget.cpp \ + $$PWD/locatorfiltersfilter.cpp \ + $$PWD/opendocumentsfilter.cpp \ + $$PWD/filesystemfilter.cpp \ + $$PWD/settingspage.cpp \ + $$PWD/directoryfilter.cpp \ + $$PWD/locatormanager.cpp \ + $$PWD/basefilefilter.cpp \ + $$PWD/ilocatorfilter.cpp \ + $$PWD/executefilter.cpp \ + $$PWD/locatorsearchutils.cpp + +FORMS += \ + $$PWD/settingspage.ui \ + $$PWD/filesystemfilter.ui \ + $$PWD/directoryfilter.ui + +RESOURCES += \ + $$PWD/locator.qrc + +equals(TEST, 1) { + HEADERS += $$PWD/locatorfiltertest.h + SOURCES += \ + $$PWD/locatorfiltertest.cpp \ + $$PWD/locator_test.cpp + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/src/plugins/locator/locator.qrc b/src/plugins/coreplugin/locator/locator.qrc index 4cd5df4f13d..4cd5df4f13d 100644 --- a/src/plugins/locator/locator.qrc +++ b/src/plugins/coreplugin/locator/locator.qrc diff --git a/src/plugins/locator/locator_test.cpp b/src/plugins/coreplugin/locator/locator_test.cpp index ea68c53c125..35640285ece 100644 --- a/src/plugins/locator/locator_test.cpp +++ b/src/plugins/coreplugin/locator/locator_test.cpp @@ -40,13 +40,13 @@ #include <QTextStream> #include <QtTest> -using namespace Locator::Tests; +using namespace Core::Tests; namespace { QTC_DECLARE_MYTESTDATADIR("../../../tests/locators/") -class MyBaseFileFilter : public Locator::BaseFileFilter +class MyBaseFileFilter : public Core::BaseFileFilter { public: MyBaseFileFilter(const QStringList &theFiles) @@ -80,7 +80,7 @@ public: Q_DECLARE_METATYPE(ReferenceData) Q_DECLARE_METATYPE(QList<ReferenceData>) -void Locator::Internal::LocatorPlugin::test_basefilefilter() +void Core::Internal::LocatorPlugin::test_basefilefilter() { QFETCH(QStringList, testFiles); QFETCH(QList<ReferenceData>, referenceDataList); @@ -89,7 +89,7 @@ void Locator::Internal::LocatorPlugin::test_basefilefilter() BasicLocatorFilterTest test(&filter); foreach (const ReferenceData &reference, referenceDataList) { - const QList<FilterEntry> filterEntries = test.matchesFor(reference.searchText); + const QList<LocatorFilterEntry> filterEntries = test.matchesFor(reference.searchText); const ResultDataList results = ResultData::fromFilterEntryList(filterEntries); // QTextStream(stdout) << "----" << endl; // ResultData::printFilterEntries(results); @@ -97,7 +97,7 @@ void Locator::Internal::LocatorPlugin::test_basefilefilter() } } -void Locator::Internal::LocatorPlugin::test_basefilefilter_data() +void Core::Internal::LocatorPlugin::test_basefilefilter_data() { QTest::addColumn<QStringList>("testFiles"); QTest::addColumn<QList<ReferenceData> >("referenceDataList"); diff --git a/src/plugins/locator/locatorconstants.h b/src/plugins/coreplugin/locator/locatorconstants.h index 71bca5f0af0..bd39b411d3e 100644 --- a/src/plugins/locator/locatorconstants.h +++ b/src/plugins/coreplugin/locator/locatorconstants.h @@ -32,13 +32,13 @@ #include <QtGlobal> -namespace Locator { +namespace Core { namespace Constants { const char FILTER_OPTIONS_PAGE[] = QT_TRANSLATE_NOOP("Locator", "Locator"); const char TASK_INDEX[] = "Locator.Task.Index"; } // namespace Constants -} // namespace Locator +} // namespace Core #endif // LOCATORCONSTANTS_H diff --git a/src/plugins/locator/locatorfiltersfilter.cpp b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp index ff69e2a3fe3..3c52ad72d93 100644 --- a/src/plugins/locator/locatorfiltersfilter.cpp +++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp @@ -33,8 +33,8 @@ #include <coreplugin/coreconstants.h> -using namespace Locator; -using namespace Locator::Internal; +using namespace Core; +using namespace Core::Internal; Q_DECLARE_METATYPE(ILocatorFilter*) @@ -52,9 +52,9 @@ LocatorFiltersFilter::LocatorFiltersFilter(LocatorPlugin *plugin, setConfigurable(false); } -QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) +QList<LocatorFilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) { - QList<FilterEntry> entries; + QList<LocatorFilterEntry> entries; if (!entry.isEmpty()) return entries; @@ -68,7 +68,7 @@ QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::Fi if (future.isCanceled()) break; if (!filter->shortcutString().isEmpty() && !filter->isHidden() && filter->isEnabled()) { - FilterEntry filterEntry(this, + LocatorFilterEntry filterEntry(this, filter->shortcutString(), QVariant::fromValue(filter), m_icon); @@ -80,7 +80,7 @@ QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::Fi return entries; } -void LocatorFiltersFilter::accept(FilterEntry selection) const +void LocatorFiltersFilter::accept(LocatorFilterEntry selection) const { ILocatorFilter *filter = selection.internalData.value<ILocatorFilter *>(); if (filter) diff --git a/src/plugins/locator/locatorfiltersfilter.h b/src/plugins/coreplugin/locator/locatorfiltersfilter.h index 8fb7bab8e39..c775c3a824c 100644 --- a/src/plugins/locator/locatorfiltersfilter.h +++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.h @@ -34,7 +34,7 @@ #include <QIcon> -namespace Locator { +namespace Core { namespace Internal { class LocatorPlugin; @@ -53,8 +53,8 @@ public: LocatorWidget *locatorWidget); // ILocatorFilter - QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry); - void accept(FilterEntry selection) const; + QList<LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry); + void accept(LocatorFilterEntry selection) const; void refresh(QFutureInterface<void> &future); private: @@ -64,6 +64,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // LOCATORFILTERSFILTER_H diff --git a/src/plugins/locator/locatorfiltertest.cpp b/src/plugins/coreplugin/locator/locatorfiltertest.cpp index db5c63e4cf4..1bdf4998e0b 100644 --- a/src/plugins/locator/locatorfiltertest.cpp +++ b/src/plugins/coreplugin/locator/locatorfiltertest.cpp @@ -38,18 +38,18 @@ #include <QString> #include <QTextStream> -using namespace Locator; -using namespace Locator::Tests; +using namespace Core; +using namespace Core::Tests; BasicLocatorFilterTest::BasicLocatorFilterTest(ILocatorFilter *filter) : m_filter(filter) { } -QList<FilterEntry> BasicLocatorFilterTest::matchesFor(const QString &searchText) +QList<LocatorFilterEntry> BasicLocatorFilterTest::matchesFor(const QString &searchText) { doBeforeLocatorRun(); const QList<ILocatorFilter *> filters = QList<ILocatorFilter *>() << m_filter; - QFuture<FilterEntry> locatorSearch = QtConcurrent::run(Locator::Internal::runSearch, + QFuture<LocatorFilterEntry> locatorSearch = QtConcurrent::run(Core::Internal::runSearch, filters, searchText); locatorSearch.waitForFinished(); doAfterLocatorRun(); @@ -70,10 +70,10 @@ bool ResultData::operator==(const ResultData &other) const return textColumn1 == other.textColumn1 && textColumn2 == other.textColumn2; } -ResultData::ResultDataList ResultData::fromFilterEntryList(const QList<FilterEntry> &entries) +ResultData::ResultDataList ResultData::fromFilterEntryList(const QList<LocatorFilterEntry> &entries) { ResultDataList result; - foreach (const FilterEntry &entry, entries) + foreach (const LocatorFilterEntry &entry, entries) result << ResultData(entry.displayName, entry.extraInfo); return result; } diff --git a/src/plugins/locator/locatorfiltertest.h b/src/plugins/coreplugin/locator/locatorfiltertest.h index 84217808b81..6cbf1e115cc 100644 --- a/src/plugins/locator/locatorfiltertest.h +++ b/src/plugins/coreplugin/locator/locatorfiltertest.h @@ -31,30 +31,29 @@ #ifndef LOCATORFILTERTEST_H #define LOCATORFILTERTEST_H -#include "locator_global.h" #include "ilocatorfilter.h" #include <QTest> -namespace Locator { +namespace Core { namespace Tests { /// Runs a locator filter for a search text and returns the results. -class LOCATOR_EXPORT BasicLocatorFilterTest +class CORE_EXPORT BasicLocatorFilterTest { public: - BasicLocatorFilterTest(Locator::ILocatorFilter *filter); + BasicLocatorFilterTest(Core::ILocatorFilter *filter); - QList<Locator::FilterEntry> matchesFor(const QString &searchText = QString()); + QList<Core::LocatorFilterEntry> matchesFor(const QString &searchText = QString()); private: virtual void doBeforeLocatorRun() {} virtual void doAfterLocatorRun() {} - Locator::ILocatorFilter *m_filter; + Core::ILocatorFilter *m_filter; }; -class LOCATOR_EXPORT ResultData +class CORE_EXPORT ResultData { public: typedef QList<ResultData> ResultDataList; @@ -64,7 +63,7 @@ public: bool operator==(const ResultData &other) const; - static ResultDataList fromFilterEntryList(const QList<FilterEntry> &entries); + static ResultDataList fromFilterEntryList(const QList<LocatorFilterEntry> &entries); /// For debugging and creating reference data static void printFilterEntries(const ResultDataList &entries); @@ -76,15 +75,15 @@ public: typedef ResultData::ResultDataList ResultDataList; } // namespace Tests -} // namespace Locator +} // namespace Core -Q_DECLARE_METATYPE(Locator::Tests::ResultData) -Q_DECLARE_METATYPE(Locator::Tests::ResultDataList) +Q_DECLARE_METATYPE(Core::Tests::ResultData) +Q_DECLARE_METATYPE(Core::Tests::ResultDataList) QT_BEGIN_NAMESPACE namespace QTest { -template<> inline char *toString(const Locator::Tests::ResultData &data) +template<> inline char *toString(const Core::Tests::ResultData &data) { QByteArray ba = "\"" + data.textColumn1.toUtf8() + "\", \"" + data.textColumn2.toUtf8() + "\""; return qstrdup(ba.data()); diff --git a/src/plugins/locator/locatormanager.cpp b/src/plugins/coreplugin/locator/locatormanager.cpp index 279cecaaae6..9cc893f5f65 100644 --- a/src/plugins/locator/locatormanager.cpp +++ b/src/plugins/coreplugin/locator/locatormanager.cpp @@ -33,7 +33,7 @@ #include <extensionsystem/pluginmanager.h> #include <utils/qtcassert.h> -namespace Locator { +namespace Core { static Internal::LocatorWidget *m_locatorWidget = 0; diff --git a/src/plugins/locator/locatormanager.h b/src/plugins/coreplugin/locator/locatormanager.h index 9affcf8e611..67d2106c04d 100644 --- a/src/plugins/locator/locatormanager.h +++ b/src/plugins/coreplugin/locator/locatormanager.h @@ -30,15 +30,15 @@ #ifndef LOCATORMANAGER_H #define LOCATORMANAGER_H -#include "locator_global.h" +#include <coreplugin/core_global.h> #include <QObject> -namespace Locator { +namespace Core { namespace Internal { class LocatorWidget; } -class LOCATOR_EXPORT LocatorManager : public QObject +class CORE_EXPORT LocatorManager : public QObject { Q_OBJECT @@ -49,6 +49,6 @@ public: static void show(const QString &text, int selectionStart = -1, int selectionLength = 0); }; -} // namespace Locator +} // namespace Core #endif // LOCATORMANAGER_H diff --git a/src/plugins/coreplugin/locator/locatorplugin.cpp b/src/plugins/coreplugin/locator/locatorplugin.cpp new file mode 100644 index 00000000000..085c0071d21 --- /dev/null +++ b/src/plugins/coreplugin/locator/locatorplugin.cpp @@ -0,0 +1,261 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "locatorplugin.h" +#include "locatorconstants.h" +#include "locatorfiltersfilter.h" +#include "locatormanager.h" +#include "locatorwidget.h" +#include "opendocumentsfilter.h" +#include "filesystemfilter.h" +#include "settingspage.h" + +#include <coreplugin/coreplugin.h> +#include <coreplugin/statusbarwidget.h> +#include <coreplugin/coreconstants.h> +#include <coreplugin/settingsdatabase.h> +#include <coreplugin/icore.h> +#include <coreplugin/actionmanager/actionmanager.h> +#include <coreplugin/actionmanager/actioncontainer.h> +#include <coreplugin/progressmanager/progressmanager.h> +#include <coreplugin/progressmanager/futureprogress.h> +#include <extensionsystem/pluginmanager.h> +#include <utils/QtConcurrentTools> +#include <utils/qtcassert.h> + +#include <QSettings> +#include <QtPlugin> +#include <QFuture> +#include <QAction> + +namespace Core { +namespace Internal { + +namespace { + static bool filterLessThan(const ILocatorFilter *first, const ILocatorFilter *second) + { + if (first->priority() < second->priority()) + return true; + if (first->priority() > second->priority()) + return false; + return first->id().alphabeticallyBefore(second->id()); + } +} + +LocatorPlugin::LocatorPlugin() + : m_settingsInitialized(false) +{ + m_corePlugin = 0; + m_refreshTimer.setSingleShot(false); + connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); +} + +LocatorPlugin::~LocatorPlugin() +{ + m_corePlugin->removeObject(m_openDocumentsFilter); + m_corePlugin->removeObject(m_fileSystemFilter); + m_corePlugin->removeObject(m_executeFilter); + m_corePlugin->removeObject(m_settingsPage); + delete m_openDocumentsFilter; + delete m_fileSystemFilter; + delete m_executeFilter; + delete m_settingsPage; + qDeleteAll(m_customFilters); +} + +void LocatorPlugin::initialize(CorePlugin *corePlugin, const QStringList &, QString *) +{ + m_corePlugin = corePlugin; + + m_settingsPage = new SettingsPage(this); + m_corePlugin->addObject(m_settingsPage); + + m_locatorWidget = new LocatorWidget(this); + m_locatorWidget->setEnabled(false); + StatusBarWidget *view = new StatusBarWidget; + view->setWidget(m_locatorWidget); + view->setContext(Context("LocatorWidget")); + view->setPosition(StatusBarWidget::First); + m_corePlugin->addAutoReleasedObject(view); + + QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); + Command *cmd = ActionManager::registerAction(action, "QtCreator.Locate", + Context(Core::Constants::C_GLOBAL)); + cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); + connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); + connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); + updatePlaceholderText(cmd); + + ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); + mtools->addAction(cmd); + + m_corePlugin->addObject(new LocatorManager(m_locatorWidget)); + + m_openDocumentsFilter = new OpenDocumentsFilter; + m_corePlugin->addObject(m_openDocumentsFilter); + + m_fileSystemFilter = new FileSystemFilter(m_locatorWidget); + m_corePlugin->addObject(m_fileSystemFilter); + + m_executeFilter = new ExecuteFilter(); + m_corePlugin->addObject(m_executeFilter); + + m_corePlugin->addAutoReleasedObject(new LocatorFiltersFilter(this, m_locatorWidget)); +} + +void LocatorPlugin::updatePlaceholderText(Command *command) +{ + if (!command) + command = qobject_cast<Command *>(sender()); + QTC_ASSERT(command, return); + if (command->keySequence().isEmpty()) + m_locatorWidget->setPlaceholderText(tr("Type to locate")); + else + m_locatorWidget->setPlaceholderText(tr("Type to locate (%1)").arg( + command->keySequence().toString(QKeySequence::NativeText))); +} + +void LocatorPlugin::openLocator() +{ + m_locatorWidget->show(QString()); +} + +void LocatorPlugin::extensionsInitialized() +{ + m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>(); + qSort(m_filters.begin(), m_filters.end(), filterLessThan); + setFilters(m_filters); +} + +bool LocatorPlugin::delayedInitialize() +{ + loadSettings(); + return true; +} + +void LocatorPlugin::loadSettings() +{ + QSettings *qs = ICore::settings(); + + // Backwards compatibility to old settings location + if (qs->contains(QLatin1String("QuickOpen/FiltersFilter"))) { + loadSettingsHelper(qs); + } else { + SettingsDatabase *settings = ICore::settingsDatabase(); + loadSettingsHelper(settings); + } + + qs->remove(QLatin1String("QuickOpen")); + + m_locatorWidget->updateFilterList(); + m_locatorWidget->setEnabled(true); + if (m_refreshTimer.interval() > 0) + m_refreshTimer.start(); + m_settingsInitialized = true; +} + +void LocatorPlugin::saveSettings() +{ + if (m_settingsInitialized) { + SettingsDatabase *s = ICore::settingsDatabase(); + s->beginGroup(QLatin1String("QuickOpen")); + s->remove(QString()); + s->setValue(QLatin1String("RefreshInterval"), refreshInterval()); + foreach (ILocatorFilter *filter, m_filters) { + if (!m_customFilters.contains(filter)) + s->setValue(filter->id().toString(), filter->saveState()); + } + s->beginGroup(QLatin1String("CustomFilters")); + int i = 0; + foreach (ILocatorFilter *filter, m_customFilters) { + s->setValue(QLatin1String("directory") + QString::number(i), + filter->saveState()); + ++i; + } + s->endGroup(); + s->endGroup(); + } +} + +/*! + Return all filters, including the ones created by the user. +*/ +QList<ILocatorFilter *> LocatorPlugin::filters() +{ + return m_filters; +} + +/*! + This returns a subset of all the filters, that contains only the filters that + have been created by the user at some point (maybe in a previous session). + */ +QList<ILocatorFilter *> LocatorPlugin::customFilters() +{ + return m_customFilters; +} + +void LocatorPlugin::setFilters(QList<ILocatorFilter *> f) +{ + m_filters = f; + m_locatorWidget->updateFilterList(); +} + +void LocatorPlugin::setCustomFilters(QList<ILocatorFilter *> filters) +{ + m_customFilters = filters; +} + +int LocatorPlugin::refreshInterval() +{ + return m_refreshTimer.interval() / 60000; +} + +void LocatorPlugin::setRefreshInterval(int interval) +{ + if (interval < 1) { + m_refreshTimer.stop(); + m_refreshTimer.setInterval(0); + return; + } + m_refreshTimer.setInterval(interval * 60000); + m_refreshTimer.start(); +} + +void LocatorPlugin::refresh(QList<ILocatorFilter *> filters) +{ + if (filters.isEmpty()) + filters = m_filters; + QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters); + FutureProgress *progress = + ProgressManager::addTask(task, tr("Indexing"), Core::Constants::TASK_INDEX); + connect(progress, SIGNAL(finished()), this, SLOT(saveSettings())); +} + +} // namespace Internal +} // namespace Core diff --git a/src/plugins/locator/locatorplugin.h b/src/plugins/coreplugin/locator/locatorplugin.h index f9268e12f15..f0a8a719b2e 100644 --- a/src/plugins/locator/locatorplugin.h +++ b/src/plugins/coreplugin/locator/locatorplugin.h @@ -40,29 +40,24 @@ #include <QTimer> #include <QFutureWatcher> -#if QT_VERSION >= 0x050000 -# include <QtPlugin> -#endif - -namespace Locator { +namespace Core { namespace Internal { +class CorePlugin; class LocatorWidget; class OpenDocumentsFilter; class FileSystemFilter; class SettingsPage; -class LocatorPlugin; -class LocatorPlugin : public ExtensionSystem::IPlugin +class LocatorPlugin : public QObject { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Locator.json") public: LocatorPlugin(); ~LocatorPlugin(); - bool initialize(const QStringList &arguments, QString *errorMessage); + void initialize(CorePlugin *corePlugin, const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); bool delayedInitialize(); @@ -103,6 +98,7 @@ private: OpenDocumentsFilter *m_openDocumentsFilter; FileSystemFilter *m_fileSystemFilter; ExecuteFilter *m_executeFilter; + CorePlugin *m_corePlugin; }; template <typename S> @@ -133,6 +129,6 @@ void LocatorPlugin::loadSettingsHelper(S *settings) } } // namespace Internal -} // namespace Locator +} // namespace Core #endif // LOCATORPLUGIN_H diff --git a/src/plugins/locator/locatorsearchutils.cpp b/src/plugins/coreplugin/locator/locatorsearchutils.cpp index 51c37f31c01..189449fc663 100644 --- a/src/plugins/locator/locatorsearchutils.cpp +++ b/src/plugins/coreplugin/locator/locatorsearchutils.cpp @@ -34,27 +34,27 @@ #include <QString> #include <QVariant> -namespace Locator { +namespace Core { -uint qHash(const Locator::FilterEntry &entry) +uint qHash(const Core::LocatorFilterEntry &entry) { if (entry.internalData.canConvert(QVariant::String)) return QT_PREPEND_NAMESPACE(qHash)(entry.internalData.toString()); return QT_PREPEND_NAMESPACE(qHash)(entry.internalData.constData()); } -} // namespace Locator +} // namespace Core -void Locator::Internal::runSearch(QFutureInterface<Locator::FilterEntry> &entries, +void Core::Internal::runSearch(QFutureInterface<Core::LocatorFilterEntry> &entries, QList<ILocatorFilter *> filters, QString searchText) { - QSet<FilterEntry> alreadyAdded; + QSet<LocatorFilterEntry> alreadyAdded; const bool checkDuplicates = (filters.size() > 1); foreach (ILocatorFilter *filter, filters) { if (entries.isCanceled()) break; - foreach (const FilterEntry &entry, filter->matchesFor(entries, searchText)) { + foreach (const LocatorFilterEntry &entry, filter->matchesFor(entries, searchText)) { if (checkDuplicates && alreadyAdded.contains(entry)) continue; entries.reportResult(entry); diff --git a/src/plugins/locator/locatorsearchutils.h b/src/plugins/coreplugin/locator/locatorsearchutils.h index 59d90cdda3b..1abf03a8fd6 100644 --- a/src/plugins/locator/locatorsearchutils.h +++ b/src/plugins/coreplugin/locator/locatorsearchutils.h @@ -30,18 +30,17 @@ #ifndef LOCATORSEARCHUTILS_H #define LOCATORSEARCHUTILS_H -#include "locator_global.h" #include "ilocatorfilter.h" -namespace Locator { +namespace Core { namespace Internal { -void LOCATOR_EXPORT runSearch(QFutureInterface<Locator::FilterEntry> &entries, +void CORE_EXPORT runSearch(QFutureInterface<LocatorFilterEntry> &entries, QList<ILocatorFilter *> filters, QString searchText); } // namespace Internal -} // namespace Locator +} // namespace Core #endif // LOCATORSEARCHUTILS_H diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index d592b459a1e..483ebe1a3fb 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -59,12 +59,10 @@ #include <QTreeView> #include <QToolTip> -Q_DECLARE_METATYPE(Locator::ILocatorFilter*) -Q_DECLARE_METATYPE(Locator::FilterEntry) +Q_DECLARE_METATYPE(Core::ILocatorFilter*) +Q_DECLARE_METATYPE(Core::LocatorFilterEntry) -using namespace Core; - -namespace Locator { +namespace Core { namespace Internal { /* A model to represent the Locator results. */ @@ -80,11 +78,11 @@ public: int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - void setEntries(const QList<FilterEntry> &entries); + void setEntries(const QList<LocatorFilterEntry> &entries); //void setDisplayCount(int count); private: - mutable QList<FilterEntry> mEntries; + mutable QList<LocatorFilterEntry> mEntries; //int mDisplayCount; }; @@ -129,11 +127,7 @@ private: } // namespace Internal - -} // namespace Locator - -using namespace Locator; -using namespace Locator::Internal; +using namespace Core::Internal; // =========== LocatorModel =========== @@ -170,7 +164,7 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const return QVariant(mEntries.at(index.row()).displayName + QLatin1String("\n\n") + mEntries.at(index.row()).extraInfo); } else if (role == Qt::DecorationRole && index.column() == 0) { - FilterEntry &entry = mEntries[index.row()]; + LocatorFilterEntry &entry = mEntries[index.row()]; if (!entry.fileIconResolved && !entry.fileName.isEmpty() && entry.displayIcon.isNull()) { entry.fileIconResolved = true; entry.displayIcon = FileIconProvider::icon(entry.fileName); @@ -185,7 +179,7 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const return QVariant(); } -void LocatorModel::setEntries(const QList<FilterEntry> &entries) +void LocatorModel::setEntries(const QList<LocatorFilterEntry> &entries) { beginResetModel(); mEntries = entries; @@ -282,7 +276,7 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) : connect(m_completionList, SIGNAL(activated(QModelIndex)), this, SLOT(scheduleAcceptCurrentEntry())); - m_entriesWatcher = new QFutureWatcher<FilterEntry>(this); + m_entriesWatcher = new QFutureWatcher<LocatorFilterEntry>(this); connect(m_entriesWatcher, SIGNAL(finished()), SLOT(updateEntries())); m_showPopupTimer = new QTimer(this); @@ -490,7 +484,7 @@ void LocatorWidget::updateCompletionList(const QString &text) m_entriesWatcher->future().cancel(); m_entriesWatcher->future().waitForFinished(); - QFuture<FilterEntry> future = QtConcurrent::run(runSearch, filters, searchText); + QFuture<LocatorFilterEntry> future = QtConcurrent::run(runSearch, filters, searchText); m_entriesWatcher->setFuture(future); } @@ -503,7 +497,7 @@ void LocatorWidget::updateEntries() return; } - const QList<FilterEntry> entries = m_entriesWatcher->future().results(); + const QList<LocatorFilterEntry> entries = m_entriesWatcher->future().results(); m_locatorModel->setEntries(entries); if (m_locatorModel->rowCount() > 0) m_completionList->setCurrentIndex(m_locatorModel->index(0, 0)); @@ -533,7 +527,7 @@ void LocatorWidget::acceptCurrentEntry() const QModelIndex index = m_completionList->currentIndex(); if (!index.isValid()) return; - const FilterEntry entry = m_locatorModel->data(index, Qt::UserRole).value<FilterEntry>(); + const LocatorFilterEntry entry = m_locatorModel->data(index, Qt::UserRole).value<LocatorFilterEntry>(); m_completionList->hide(); m_fileLineEdit->clearFocus(); entry.filter->accept(entry); @@ -592,3 +586,5 @@ void LocatorWidget::showConfigureDialog() { ICore::showOptionsDialog(Core::Constants::SETTINGS_CATEGORY_CORE, Constants::FILTER_OPTIONS_PAGE); } + +} // namespace Core diff --git a/src/plugins/locator/locatorwidget.h b/src/plugins/coreplugin/locator/locatorwidget.h index aefa335a10f..5bc150b362a 100644 --- a/src/plugins/locator/locatorwidget.h +++ b/src/plugins/coreplugin/locator/locatorwidget.h @@ -46,7 +46,7 @@ namespace Utils { class FilterLineEdit; } -namespace Locator { +namespace Core { namespace Internal { class LocatorModel; @@ -94,7 +94,7 @@ private: QAction *m_configureAction; Utils::FilterLineEdit *m_fileLineEdit; QTimer *m_showPopupTimer; - QFutureWatcher<FilterEntry> *m_entriesWatcher; + QFutureWatcher<LocatorFilterEntry> *m_entriesWatcher; QMap<Core::Id, QAction *> m_filterActionMap; bool m_updateRequested; bool m_acceptRequested; @@ -102,6 +102,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // LOCATORWIDGET_H diff --git a/src/plugins/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp index f0e4549590e..61fb946c0ab 100644 --- a/src/plugins/locator/opendocumentsfilter.cpp +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp @@ -36,8 +36,8 @@ #include <QFileInfo> using namespace Core; -using namespace Locator; -using namespace Locator::Internal; +using namespace Core; +using namespace Core::Internal; using namespace Utils; OpenDocumentsFilter::OpenDocumentsFilter() @@ -53,10 +53,10 @@ OpenDocumentsFilter::OpenDocumentsFilter() this, SLOT(refreshInternally())); } -QList<FilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry_) +QList<LocatorFilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry_) { - QList<FilterEntry> goodEntries; - QList<FilterEntry> betterEntries; + QList<LocatorFilterEntry> goodEntries; + QList<LocatorFilterEntry> betterEntries; QString entry = entry_; const QString lineNoSuffix = EditorManager::splitLineNumber(&entry); const QChar asterisk = QLatin1Char('*'); @@ -76,10 +76,10 @@ QList<FilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Locator::Fil QString displayName = editorEntry.displayName(); if (regexp.exactMatch(displayName)) { QFileInfo fi(fileName); - FilterEntry fiEntry(this, fi.fileName(), QString(fileName + lineNoSuffix)); + LocatorFilterEntry fiEntry(this, fi.fileName(), QString(fileName + lineNoSuffix)); fiEntry.extraInfo = FileUtils::shortNativePath(FileName(fi)); fiEntry.fileName = fileName; - QList<FilterEntry> &category = displayName.startsWith(entry, caseSensitivityForPrefix) + QList<LocatorFilterEntry> &category = displayName.startsWith(entry, caseSensitivityForPrefix) ? betterEntries : goodEntries; category.append(fiEntry); } @@ -107,7 +107,7 @@ void OpenDocumentsFilter::refresh(QFutureInterface<void> &future) QMetaObject::invokeMethod(this, "refreshInternally", Qt::BlockingQueuedConnection); } -void OpenDocumentsFilter::accept(FilterEntry selection) const +void OpenDocumentsFilter::accept(LocatorFilterEntry selection) const { EditorManager::openEditor(selection.internalData.toString(), Id(), EditorManager::CanContainLineNumber); diff --git a/src/plugins/locator/opendocumentsfilter.h b/src/plugins/coreplugin/locator/opendocumentsfilter.h index e567d5b291e..b16ca7144b9 100644 --- a/src/plugins/locator/opendocumentsfilter.h +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.h @@ -38,17 +38,17 @@ #include <QList> #include <QFutureInterface> -namespace Locator { +namespace Core { namespace Internal { -class OpenDocumentsFilter : public Locator::ILocatorFilter +class OpenDocumentsFilter : public Core::ILocatorFilter { Q_OBJECT public: OpenDocumentsFilter(); - 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); public slots: @@ -59,6 +59,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // OPENDOCUMENTSFILTER_H diff --git a/src/plugins/locator/settingspage.cpp b/src/plugins/coreplugin/locator/settingspage.cpp index 2feec8d9a38..abdec8be5d8 100644 --- a/src/plugins/locator/settingspage.cpp +++ b/src/plugins/coreplugin/locator/settingspage.cpp @@ -39,16 +39,16 @@ #include <QCoreApplication> -Q_DECLARE_METATYPE(Locator::ILocatorFilter*) +Q_DECLARE_METATYPE(Core::ILocatorFilter*) -using namespace Locator; -using namespace Locator::Internal; +using namespace Core; +using namespace Core::Internal; SettingsPage::SettingsPage(LocatorPlugin *plugin) : m_plugin(plugin), m_widget(0) { setId(Constants::FILTER_OPTIONS_PAGE); - setDisplayName(QCoreApplication::translate("Locator", Locator::Constants::FILTER_OPTIONS_PAGE)); + setDisplayName(QCoreApplication::translate("Locator", Core::Constants::FILTER_OPTIONS_PAGE)); setCategory(Core::Constants::SETTINGS_CATEGORY_CORE); setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE)); setCategoryIcon(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE_ICON)); diff --git a/src/plugins/locator/settingspage.h b/src/plugins/coreplugin/locator/settingspage.h index 2042d9aec61..86ddb9d1a5e 100644 --- a/src/plugins/locator/settingspage.h +++ b/src/plugins/coreplugin/locator/settingspage.h @@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE class QListWidgetItem; QT_END_NAMESPACE -namespace Locator { +namespace Core { class ILocatorFilter; @@ -72,7 +72,7 @@ private: void restoreFilterStates(); void requestRefresh(); - Ui::SettingsWidget m_ui; + Ui::LocatorSettingsWidget m_ui; LocatorPlugin *m_plugin; QPointer<QWidget> m_widget; QList<ILocatorFilter *> m_filters; @@ -84,6 +84,6 @@ private: }; } // namespace Internal -} // namespace Locator +} // namespace Core #endif // SETTINGSPAGE_H diff --git a/src/plugins/locator/settingspage.ui b/src/plugins/coreplugin/locator/settingspage.ui index e600ca1cedd..797b650269f 100644 --- a/src/plugins/locator/settingspage.ui +++ b/src/plugins/coreplugin/locator/settingspage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Locator::Internal::SettingsWidget</class> - <widget class="QWidget" name="Locator::Internal::SettingsWidget"> + <class>Core::Internal::LocatorSettingsWidget</class> + <widget class="QWidget" name="Core::Internal::LocatorSettingsWidget"> <property name="geometry"> <rect> <x>0</x> diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 89818a6d317..5180a374114 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -129,7 +129,7 @@ using namespace Core::Internal; \c QFuture object. This is what you want to give the ProgressManager in the addTask() function. - Have a look at e.g Locator::ILocatorFilter. Locator filters implement + Have a look at e.g Core::ILocatorFilter. Locator filters implement a function \c refresh which takes a \c QFutureInterface object as a parameter. These functions look something like: \code diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index e2fd697ce2b..e61d14b30df 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -1934,10 +1934,10 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa } // find a include file through the locator - QFutureInterface<Locator::FilterEntry> dummyInterface; - QList<Locator::FilterEntry> matches = classesFilter->matchesFor(dummyInterface, className); + QFutureInterface<Core::LocatorFilterEntry> dummyInterface; + QList<Core::LocatorFilterEntry> matches = classesFilter->matchesFor(dummyInterface, className); bool classExists = false; - foreach (const Locator::FilterEntry &entry, matches) { + foreach (const Core::LocatorFilterEntry &entry, matches) { const ModelItemInfo info = entry.internalData.value<ModelItemInfo>(); if (info.symbolName != className) continue; diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp index faec76d150e..0e7542a2d77 100644 --- a/src/plugins/cpptools/builtinindexingsupport.cpp +++ b/src/plugins/cpptools/builtinindexingsupport.cpp @@ -92,7 +92,7 @@ public: ~BuiltinSymbolSearcher() {} - void runSearch(QFutureInterface<Find::SearchResultItem> &future) + void runSearch(QFutureInterface<Core::SearchResultItem> &future) { future.setProgressRange(0, m_snapshot.size()); future.setProgressValue(0); @@ -102,11 +102,11 @@ public: search.setSymbolsToSearchFor(m_parameters.types); CPlusPlus::Snapshot::const_iterator it = m_snapshot.begin(); - QString findString = (m_parameters.flags & Find::FindRegularExpression + QString findString = (m_parameters.flags & Core::FindRegularExpression ? m_parameters.text : QRegExp::escape(m_parameters.text)); - if (m_parameters.flags & Find::FindWholeWords) + if (m_parameters.flags & Core::FindWholeWords) findString = QString::fromLatin1("\\b%1\\b").arg(findString); - QRegExp matcher(findString, (m_parameters.flags & Find::FindCaseSensitively + QRegExp matcher(findString, (m_parameters.flags & Core::FindCaseSensitively ? Qt::CaseSensitive : Qt::CaseInsensitive)); while (it != m_snapshot.end()) { if (future.isPaused()) @@ -114,7 +114,7 @@ public: if (future.isCanceled()) break; if (m_fileNames.isEmpty() || m_fileNames.contains(it.value()->fileName())) { - QVector<Find::SearchResultItem> resultItems; + QVector<Core::SearchResultItem> resultItems; QList<ModelItemInfo> modelInfos = search(it.value()); foreach (const ModelItemInfo &info, modelInfos) { int index = matcher.indexIn(info.symbolName); @@ -130,7 +130,7 @@ public: info.symbolType); } - Find::SearchResultItem item; + Core::SearchResultItem item; item.path = scope.split(QLatin1String("::"), QString::SkipEmptyParts); item.text = text; item.textMarkPos = -1; diff --git a/src/plugins/cpptools/cppclassesfilter.cpp b/src/plugins/cpptools/cppclassesfilter.cpp index 5809e015201..a32ec4a562f 100644 --- a/src/plugins/cpptools/cppclassesfilter.cpp +++ b/src/plugins/cpptools/cppclassesfilter.cpp @@ -50,10 +50,10 @@ QList<QList<CppTools::ModelItemInfo> > CppClassesFilter::itemsToMatchUserInputAg return QList<QList<CppTools::ModelItemInfo> >() << m_data->classes(); } -Locator::FilterEntry CppClassesFilter::filterEntryFromModelItemInfo(const ModelItemInfo &info) +Core::LocatorFilterEntry CppClassesFilter::filterEntryFromModelItemInfo(const ModelItemInfo &info) { const QVariant id = qVariantFromValue(info); - Locator::FilterEntry filterEntry(this, info.symbolName, id, info.icon); + Core::LocatorFilterEntry filterEntry(this, info.symbolName, id, info.icon); filterEntry.extraInfo = info.symbolScope.isEmpty() ? info.shortNativeFilePath() : info.symbolScope; diff --git a/src/plugins/cpptools/cppclassesfilter.h b/src/plugins/cpptools/cppclassesfilter.h index ceb02b8e7d0..40888d6c336 100644 --- a/src/plugins/cpptools/cppclassesfilter.h +++ b/src/plugins/cpptools/cppclassesfilter.h @@ -46,7 +46,7 @@ public: private: QList<QList<CppTools::ModelItemInfo> > itemsToMatchUserInputAgainst() const; - Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); + Core::LocatorFilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); }; } // namespace CppTools diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index 2febb844c6b..fb5567d47c5 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -57,11 +57,11 @@ CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager) this, SLOT(onEditorAboutToClose(Core::IEditor*))); } -QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString & origEntry) +QList<Core::LocatorFilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString & origEntry) { QString entry = trimWildcards(origEntry); - QList<Locator::FilterEntry> goodEntries; - QList<Locator::FilterEntry> betterEntries; + QList<Core::LocatorFilterEntry> goodEntries; + QList<Core::LocatorFilterEntry> betterEntries; QStringMatcher matcher(entry, Qt::CaseInsensitive); const QChar asterisk = QLatin1Char('*'); QRegExp regexp(asterisk + entry + asterisk, Qt::CaseInsensitive, QRegExp::Wildcard); @@ -102,7 +102,7 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterfac if (info.unqualifiedNameAndScope(matchString, &name, &extraInfo)) name += info.symbolType; } - Locator::FilterEntry filterEntry(this, name, id, info.icon); + Core::LocatorFilterEntry filterEntry(this, name, id, info.icon); filterEntry.extraInfo = extraInfo; if (matchString.startsWith(entry, caseSensitivityForPrefix)) @@ -118,7 +118,7 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterfac return betterEntries; } -void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const +void CppCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection) const { ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData); Core::EditorManager::openEditorAt(info.fileName, info.line, info.column); diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.h b/src/plugins/cpptools/cppcurrentdocumentfilter.h index 5e2bb390d6b..b181bc40bf4 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.h +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.h @@ -31,7 +31,7 @@ #include "searchsymbols.h" -#include <locator/ilocatorfilter.h> +#include <coreplugin/locator/ilocatorfilter.h> namespace Core { class IEditor; } @@ -40,7 +40,7 @@ namespace Internal { class CppModelManager; -class CppCurrentDocumentFilter : public Locator::ILocatorFilter +class CppCurrentDocumentFilter : public Core::ILocatorFilter { Q_OBJECT @@ -48,8 +48,8 @@ public: explicit CppCurrentDocumentFilter(CppModelManager *manager); ~CppCurrentDocumentFilter() {} - 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); private slots: diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 0cce94007c3..8f846a90c21 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -325,15 +325,15 @@ void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol, bool replace) { Overview overview; - Find::SearchResult *search = Find::SearchResultWindow::instance()->startNewSearch(tr("C++ Usages:"), + Core::SearchResult *search = Core::SearchResultWindow::instance()->startNewSearch(tr("C++ Usages:"), QString(), overview.prettyName(context.fullyQualifiedName(symbol)), - replace ? Find::SearchResultWindow::SearchAndReplace - : Find::SearchResultWindow::SearchOnly, + replace ? Core::SearchResultWindow::SearchAndReplace + : Core::SearchResultWindow::SearchOnly, QLatin1String("CppEditor")); search->setTextToReplace(replacement); - connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)), - SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>,bool))); + connect(search, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), + SLOT(onReplaceButtonClicked(QString,QList<Core::SearchResultItem>,bool))); connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); search->setSearchAgainSupported(true); connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); @@ -354,7 +354,7 @@ void CppFindReferences::renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus: } } -void CppFindReferences::findAll_helper(Find::SearchResult *search, CPlusPlus::Symbol *symbol, +void CppFindReferences::findAll_helper(Core::SearchResult *search, CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) { if (!(symbol && symbol->identifier())) { @@ -362,10 +362,10 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search, CPlusPlus::Sy return; } connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); - connect(search, SIGNAL(activated(Find::SearchResultItem)), - this, SLOT(openEditor(Find::SearchResultItem))); + connect(search, SIGNAL(activated(Core::SearchResultItem)), + this, SLOT(openEditor(Core::SearchResultItem))); - Find::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus); + Core::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus); const CppModelManagerInterface::WorkingCopy workingCopy = m_modelManager->workingCopy(); QFuture<Usage> result; result = QtConcurrent::run(&find_helper, workingCopy, context, this, symbol); @@ -378,19 +378,19 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search, CPlusPlus::Sy } void CppFindReferences::onReplaceButtonClicked(const QString &text, - const QList<Find::SearchResultItem> &items, + const QList<Core::SearchResultItem> &items, bool preserveCase) { const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase); if (!fileNames.isEmpty()) { m_modelManager->updateSourceFiles(fileNames); - Find::SearchResultWindow::instance()->hide(); + Core::SearchResultWindow::instance()->hide(); } } void CppFindReferences::searchAgain() { - Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); CppFindReferencesParameters parameters = search->userData().value<CppFindReferencesParameters>(); Snapshot snapshot = CppModelManagerInterface::instance()->snapshot(); search->restart(); @@ -470,7 +470,7 @@ CPlusPlus::Symbol *CppFindReferences::findSymbol(const CppFindReferencesParamete void CppFindReferences::displayResults(int first, int last) { QFutureWatcher<Usage> *watcher = static_cast<QFutureWatcher<Usage> *>(sender()); - Find::SearchResult *search = m_watchers.value(watcher); + Core::SearchResult *search = m_watchers.value(watcher); if (!search) { // search was deleted while it was running watcher->cancel(); @@ -489,7 +489,7 @@ void CppFindReferences::displayResults(int first, int last) void CppFindReferences::searchFinished() { QFutureWatcher<Usage> *watcher = static_cast<QFutureWatcher<Usage> *>(sender()); - Find::SearchResult *search = m_watchers.value(watcher); + Core::SearchResult *search = m_watchers.value(watcher); if (search) search->finishSearch(watcher->isCanceled()); m_watchers.remove(watcher); @@ -498,7 +498,7 @@ void CppFindReferences::searchFinished() void CppFindReferences::cancel() { - Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); QTC_ASSERT(search, return); QFutureWatcher<Usage> *watcher = m_watchers.key(search); QTC_ASSERT(watcher, return); @@ -507,7 +507,7 @@ void CppFindReferences::cancel() void CppFindReferences::setPaused(bool paused) { - Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); QTC_ASSERT(search, return); QFutureWatcher<Usage> *watcher = m_watchers.key(search); QTC_ASSERT(watcher, return); @@ -515,7 +515,7 @@ void CppFindReferences::setPaused(bool paused) watcher->setPaused(paused); } -void CppFindReferences::openEditor(const Find::SearchResultItem &item) +void CppFindReferences::openEditor(const Core::SearchResultItem &item) { if (item.path.size() > 0) { EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), @@ -634,22 +634,22 @@ void CppFindReferences::findMacroUses(const Macro ¯o) void CppFindReferences::findMacroUses(const Macro ¯o, const QString &replacement, bool replace) { - Find::SearchResult *search = Find::SearchResultWindow::instance()->startNewSearch( + Core::SearchResult *search = Core::SearchResultWindow::instance()->startNewSearch( tr("C++ Macro Usages:"), QString(), QString::fromUtf8(macro.name()), - replace ? Find::SearchResultWindow::SearchAndReplace - : Find::SearchResultWindow::SearchOnly, + replace ? Core::SearchResultWindow::SearchAndReplace + : Core::SearchResultWindow::SearchOnly, QLatin1String("CppEditor")); search->setTextToReplace(replacement); - connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)), - SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>,bool))); + connect(search, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), + SLOT(onReplaceButtonClicked(QString,QList<Core::SearchResultItem>,bool))); - Find::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus); + Core::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus); - connect(search, SIGNAL(activated(Find::SearchResultItem)), - this, SLOT(openEditor(Find::SearchResultItem))); + connect(search, SIGNAL(activated(Core::SearchResultItem)), + this, SLOT(openEditor(Core::SearchResultItem))); connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); @@ -714,7 +714,7 @@ void CppFindReferences::setDependencyTable(const CPlusPlus::DependencyTable &new m_deps = newTable; } -void CppFindReferences::createWatcher(const QFuture<Usage> &future, Find::SearchResult *search) +void CppFindReferences::createWatcher(const QFuture<Usage> &future, Core::SearchResult *search) { QFutureWatcher<Usage> *watcher = new QFutureWatcher<Usage>(); watcher->setPendingResultsLimit(1); diff --git a/src/plugins/cpptools/cppfindreferences.h b/src/plugins/cpptools/cppfindreferences.h index 3b8863d0b0f..200907ed118 100644 --- a/src/plugins/cpptools/cppfindreferences.h +++ b/src/plugins/cpptools/cppfindreferences.h @@ -41,10 +41,10 @@ QT_FORWARD_DECLARE_CLASS(QTimer) -namespace Find { +namespace Core { class SearchResultItem; class SearchResult; -} // namespace Find +} // namespace Core namespace CppTools { class CppModelManagerInterface; @@ -86,8 +86,8 @@ private slots: void searchFinished(); void cancel(); void setPaused(bool paused); - void openEditor(const Find::SearchResultItem &item); - void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items, bool preserveCase); + void openEditor(const Core::SearchResultItem &item); + void onReplaceButtonClicked(const QString &text, const QList<Core::SearchResultItem> &items, bool preserveCase); void searchAgain(); private: @@ -95,17 +95,17 @@ private: const QString &replacement, bool replace); void findMacroUses(const CPlusPlus::Macro ¯o, const QString &replacement, bool replace); - void findAll_helper(Find::SearchResult *search, CPlusPlus::Symbol *symbol, + void findAll_helper(Core::SearchResult *search, CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context); CPlusPlus::DependencyTable dependencyTable() const; void setDependencyTable(const CPlusPlus::DependencyTable &newTable); - void createWatcher(const QFuture<CPlusPlus::Usage> &future, Find::SearchResult *search); + void createWatcher(const QFuture<CPlusPlus::Usage> &future, Core::SearchResult *search); CPlusPlus::Symbol *findSymbol(const CppFindReferencesParameters ¶meters, const CPlusPlus::Snapshot &snapshot, CPlusPlus::LookupContext *context); private: QPointer<CppModelManagerInterface> m_modelManager; - QMap<QFutureWatcher<CPlusPlus::Usage> *, QPointer<Find::SearchResult> > m_watchers; + QMap<QFutureWatcher<CPlusPlus::Usage> *, QPointer<Core::SearchResult> > m_watchers; mutable QMutex m_depsLock; CPlusPlus::DependencyTable m_deps; diff --git a/src/plugins/cpptools/cppfunctionsfilter.cpp b/src/plugins/cpptools/cppfunctionsfilter.cpp index 400d19c1e6c..1f17402763d 100644 --- a/src/plugins/cpptools/cppfunctionsfilter.cpp +++ b/src/plugins/cpptools/cppfunctionsfilter.cpp @@ -49,7 +49,7 @@ QList<QList<CppTools::ModelItemInfo> > CppFunctionsFilter::itemsToMatchUserInput return QList<QList<CppTools::ModelItemInfo> >() << m_data->functions(); } -Locator::FilterEntry CppFunctionsFilter::filterEntryFromModelItemInfo(const CppTools::ModelItemInfo &info) +Core::LocatorFilterEntry CppFunctionsFilter::filterEntryFromModelItemInfo(const CppTools::ModelItemInfo &info) { const QVariant id = qVariantFromValue(info); @@ -59,7 +59,7 @@ Locator::FilterEntry CppFunctionsFilter::filterEntryFromModelItemInfo(const CppT if (extraInfo.isEmpty()) extraInfo = info.shortNativeFilePath(); - Locator::FilterEntry filterEntry(this, name + info.symbolType, id, info.icon); + Core::LocatorFilterEntry filterEntry(this, name + info.symbolType, id, info.icon); filterEntry.extraInfo = extraInfo; return filterEntry; diff --git a/src/plugins/cpptools/cppfunctionsfilter.h b/src/plugins/cpptools/cppfunctionsfilter.h index a3aa7d3c092..5926f645cd7 100644 --- a/src/plugins/cpptools/cppfunctionsfilter.h +++ b/src/plugins/cpptools/cppfunctionsfilter.h @@ -46,7 +46,7 @@ public: private: QList<QList<ModelItemInfo> > itemsToMatchUserInputAgainst() const; - Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); + Core::LocatorFilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); }; } // namespace Internal diff --git a/src/plugins/cpptools/cppindexingsupport.h b/src/plugins/cpptools/cppindexingsupport.h index 00cb80f5d40..bd50dfc6361 100644 --- a/src/plugins/cpptools/cppindexingsupport.h +++ b/src/plugins/cpptools/cppindexingsupport.h @@ -34,8 +34,8 @@ #include "cppmodelmanagerinterface.h" -#include <find/searchresultwindow.h> -#include <find/textfindconstants.h> +#include <coreplugin/find/searchresultwindow.h> +#include <coreplugin/find/textfindconstants.h> #include <QFuture> #include <QStringList> @@ -64,7 +64,7 @@ public: struct Parameters { QString text; - Find::FindFlags flags; + Core::FindFlags flags; SymbolTypes types; SearchScope scope; }; @@ -73,7 +73,7 @@ public: public: SymbolSearcher(QObject *parent = 0); virtual ~SymbolSearcher() = 0; - virtual void runSearch(QFutureInterface<Find::SearchResultItem> &future) = 0; + virtual void runSearch(QFutureInterface<Core::SearchResultItem> &future) = 0; }; diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 5680d36dc06..e4286e13ee1 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -47,10 +47,10 @@ CppLocatorFilter::~CppLocatorFilter() { } -Locator::FilterEntry CppLocatorFilter::filterEntryFromModelItemInfo(const CppTools::ModelItemInfo &info) +Core::LocatorFilterEntry CppLocatorFilter::filterEntryFromModelItemInfo(const CppTools::ModelItemInfo &info) { const QVariant id = qVariantFromValue(info); - Locator::FilterEntry filterEntry(this, info.scopedSymbolName(), id, info.icon); + Core::LocatorFilterEntry filterEntry(this, info.scopedSymbolName(), id, info.icon); filterEntry.extraInfo = info.type == ModelItemInfo::Class || info.type == ModelItemInfo::Enum ? info.shortNativeFilePath() : info.symbolType; @@ -71,17 +71,17 @@ QList<QList<CppTools::ModelItemInfo> > CppLocatorFilter::itemsToMatchUserInputAg << m_data->enums(); } -static bool compareLexigraphically(const Locator::FilterEntry &a, - const Locator::FilterEntry &b) +static bool compareLexigraphically(const Core::LocatorFilterEntry &a, + const Core::LocatorFilterEntry &b) { return a.displayName < b.displayName; } -QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &origEntry) +QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &origEntry) { QString entry = trimWildcards(origEntry); - QList<Locator::FilterEntry> goodEntries; - QList<Locator::FilterEntry> betterEntries; + QList<Core::LocatorFilterEntry> goodEntries; + QList<Core::LocatorFilterEntry> betterEntries; const QChar asterisk = QLatin1Char('*'); QStringMatcher matcher(entry, Qt::CaseInsensitive); QRegExp regexp(asterisk + entry+ asterisk, Qt::CaseInsensitive, QRegExp::Wildcard); @@ -99,7 +99,7 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato const QString matchString = hasColonColon ? info.scopedSymbolName() : info.symbolName; if ((hasWildcard && regexp.exactMatch(matchString)) || (!hasWildcard && matcher.indexIn(matchString) != -1)) { - const Locator::FilterEntry filterEntry = filterEntryFromModelItemInfo(info); + const Core::LocatorFilterEntry filterEntry = filterEntryFromModelItemInfo(info); if (matchString.startsWith(entry, caseSensitivityForPrefix)) betterEntries.append(filterEntry); else @@ -117,7 +117,7 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato return betterEntries; } -void CppLocatorFilter::accept(Locator::FilterEntry selection) const +void CppLocatorFilter::accept(Core::LocatorFilterEntry selection) const { ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData); Core::EditorManager::openEditorAt(info.fileName, info.line, info.column); diff --git a/src/plugins/cpptools/cpplocatorfilter.h b/src/plugins/cpptools/cpplocatorfilter.h index c1702410372..aba6fe4a275 100644 --- a/src/plugins/cpptools/cpplocatorfilter.h +++ b/src/plugins/cpptools/cpplocatorfilter.h @@ -33,14 +33,14 @@ #include "cpplocatordata.h" #include "searchsymbols.h" -#include <locator/ilocatorfilter.h> +#include <coreplugin/locator/ilocatorfilter.h> namespace CppTools { namespace Internal { class CppModelManager; -class CppLocatorFilter : public Locator::ILocatorFilter +class CppLocatorFilter : public Core::ILocatorFilter { Q_OBJECT @@ -48,13 +48,13 @@ public: CppLocatorFilter(CppLocatorData *locatorData); ~CppLocatorFilter(); - 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); private: virtual QList<QList<ModelItemInfo> > itemsToMatchUserInputAgainst() const; - virtual Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); + virtual Core::LocatorFilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info); protected: CppLocatorData *m_data; diff --git a/src/plugins/cpptools/cpplocatorfilter_test.cpp b/src/plugins/cpptools/cpplocatorfilter_test.cpp index 5a0bb04654e..175ba94ea8d 100644 --- a/src/plugins/cpptools/cpplocatorfilter_test.cpp +++ b/src/plugins/cpptools/cpplocatorfilter_test.cpp @@ -39,7 +39,7 @@ #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/testdatadir.h> #include <extensionsystem/pluginmanager.h> -#include <locator/locatorfiltertest.h> +#include <coreplugin/locator/locatorfiltertest.h> #include <utils/fileutils.h> #include <QDebug> @@ -50,8 +50,6 @@ using namespace Core; using namespace Core::Tests; using namespace CppTools::Internal; using namespace ExtensionSystem; -using namespace Locator; -using namespace Locator::Tests; using namespace Utils; Q_DECLARE_METATYPE(ILocatorFilter *) diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs index 18cf784cb83..ddbc4feace3 100644 --- a/src/plugins/cpptools/cpptools.qbs +++ b/src/plugins/cpptools/cpptools.qbs @@ -8,10 +8,8 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } - Depends { name: "Find" } Depends { name: "TextEditor" } Depends { name: "ProjectExplorer" } - Depends { name: "Locator" } Depends { name: "CPlusPlus" } Depends { name: "LanguageUtils" } diff --git a/src/plugins/cpptools/cpptools_dependencies.pri b/src/plugins/cpptools/cpptools_dependencies.pri index 15f93ba8376..82a3b3fdf7e 100644 --- a/src/plugins/cpptools/cpptools_dependencies.pri +++ b/src/plugins/cpptools/cpptools_dependencies.pri @@ -5,6 +5,4 @@ QTC_LIB_DEPENDS += \ QTC_PLUGIN_DEPENDS += \ coreplugin \ projectexplorer \ - texteditor \ - locator \ - find + texteditor diff --git a/src/plugins/cpptools/symbolsearcher_test.cpp b/src/plugins/cpptools/symbolsearcher_test.cpp index 5056b942631..9c128b26300 100644 --- a/src/plugins/cpptools/symbolsearcher_test.cpp +++ b/src/plugins/cpptools/symbolsearcher_test.cpp @@ -62,10 +62,10 @@ public: return m_symbolName == other.m_symbolName && m_scope == other.m_scope; } - static ResultDataList fromSearchResultList(const QList<Find::SearchResultItem> &entries) + static ResultDataList fromSearchResultList(const QList<Core::SearchResultItem> &entries) { ResultDataList result; - foreach (const Find::SearchResultItem &entry, entries) + foreach (const Core::SearchResultItem &entry, entries) result << ResultData(entry.text, entry.path.join(QLatin1String("::"))); return result; } @@ -108,7 +108,7 @@ public: CppIndexingSupport *indexingSupport = m_modelManager->indexingSupport(); SymbolSearcher *symbolSearcher = indexingSupport->createSymbolSearcher(searchParameters, QSet<QString>() << testFile); - QFuture<Find::SearchResultItem> search + QFuture<Core::SearchResultItem> search = QtConcurrent::run(&SymbolSearcher::runSearch, symbolSearcher); search.waitForFinished(); ResultDataList results = ResultData::fromSearchResultList(search.results()); diff --git a/src/plugins/cpptools/symbolsfindfilter.cpp b/src/plugins/cpptools/symbolsfindfilter.cpp index adfdbc21912..6150c01bec6 100644 --- a/src/plugins/cpptools/symbolsfindfilter.cpp +++ b/src/plugins/cpptools/symbolsfindfilter.cpp @@ -84,35 +84,35 @@ bool SymbolsFindFilter::isEnabled() const void SymbolsFindFilter::cancel() { - Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); QTC_ASSERT(search, return); - QFutureWatcher<Find::SearchResultItem> *watcher = m_watchers.key(search); + QFutureWatcher<Core::SearchResultItem> *watcher = m_watchers.key(search); QTC_ASSERT(watcher, return); watcher->cancel(); } void SymbolsFindFilter::setPaused(bool paused) { - Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); QTC_ASSERT(search, return); - QFutureWatcher<Find::SearchResultItem> *watcher = m_watchers.key(search); + QFutureWatcher<Core::SearchResultItem> *watcher = m_watchers.key(search); QTC_ASSERT(watcher, return); if (!paused || watcher->isRunning()) // guard against pausing when the search is finished watcher->setPaused(paused); } -Find::FindFlags SymbolsFindFilter::supportedFindFlags() const +Core::FindFlags SymbolsFindFilter::supportedFindFlags() const { - return Find::FindCaseSensitively | Find::FindRegularExpression | Find::FindWholeWords; + return Core::FindCaseSensitively | Core::FindRegularExpression | Core::FindWholeWords; } -void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags) +void SymbolsFindFilter::findAll(const QString &txt, Core::FindFlags findFlags) { - Find::SearchResultWindow *window = Find::SearchResultWindow::instance(); - Find::SearchResult *search = window->startNewSearch(label(), toolTip(findFlags), txt); + Core::SearchResultWindow *window = Core::SearchResultWindow::instance(); + Core::SearchResult *search = window->startNewSearch(label(), toolTip(findFlags), txt); search->setSearchAgainSupported(true); - connect(search, SIGNAL(activated(Find::SearchResultItem)), - this, SLOT(openEditor(Find::SearchResultItem))); + connect(search, SIGNAL(activated(Core::SearchResultItem)), + this, SLOT(openEditor(Core::SearchResultItem))); connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); @@ -128,7 +128,7 @@ void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags) startSearch(search); } -void SymbolsFindFilter::startSearch(Find::SearchResult *search) +void SymbolsFindFilter::startSearch(Core::SearchResult *search) { SymbolSearcher::Parameters parameters = search->userData().value<SymbolSearcher::Parameters>(); QSet<QString> projectFileNames; @@ -137,7 +137,7 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search) projectFileNames += project->files(ProjectExplorer::Project::AllFiles).toSet(); } - QFutureWatcher<Find::SearchResultItem> *watcher = new QFutureWatcher<Find::SearchResultItem>(); + QFutureWatcher<Core::SearchResultItem> *watcher = new QFutureWatcher<Core::SearchResultItem>(); m_watchers.insert(watcher, search); connect(watcher, SIGNAL(finished()), this, SLOT(finish())); @@ -148,38 +148,38 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search) symbolSearcher, SLOT(deleteLater())); watcher->setFuture(QtConcurrent::run(&SymbolSearcher::runSearch, symbolSearcher)); FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching"), - Find::Constants::TASK_SEARCH); + Core::Constants::TASK_SEARCH); connect(progress, SIGNAL(clicked()), search, SLOT(popup())); } void SymbolsFindFilter::addResults(int begin, int end) { - QFutureWatcher<Find::SearchResultItem> *watcher = - static_cast<QFutureWatcher<Find::SearchResultItem> *>(sender()); - Find::SearchResult *search = m_watchers.value(watcher); + QFutureWatcher<Core::SearchResultItem> *watcher = + static_cast<QFutureWatcher<Core::SearchResultItem> *>(sender()); + Core::SearchResult *search = m_watchers.value(watcher); if (!search) { // search was removed from search history while the search is running watcher->cancel(); return; } - QList<Find::SearchResultItem> items; + QList<Core::SearchResultItem> items; for (int i = begin; i < end; ++i) items << watcher->resultAt(i); - search->addResults(items, Find::SearchResult::AddSorted); + search->addResults(items, Core::SearchResult::AddSorted); } void SymbolsFindFilter::finish() { - QFutureWatcher<Find::SearchResultItem> *watcher = - static_cast<QFutureWatcher<Find::SearchResultItem> *>(sender()); - Find::SearchResult *search = m_watchers.value(watcher); + QFutureWatcher<Core::SearchResultItem> *watcher = + static_cast<QFutureWatcher<Core::SearchResultItem> *>(sender()); + Core::SearchResult *search = m_watchers.value(watcher); if (search) search->finishSearch(watcher->isCanceled()); m_watchers.remove(watcher); watcher->deleteLater(); } -void SymbolsFindFilter::openEditor(const Find::SearchResultItem &item) +void SymbolsFindFilter::openEditor(const Core::SearchResultItem &item) { if (!item.userData.canConvert<ModelItemInfo>()) return; @@ -229,7 +229,7 @@ void SymbolsFindFilter::onAllTasksFinished(Core::Id type) void SymbolsFindFilter::searchAgain() { - Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); QTC_ASSERT(search, return); search->restart(); startSearch(search); @@ -240,7 +240,7 @@ QString SymbolsFindFilter::label() const return tr("C++ Symbols:"); } -QString SymbolsFindFilter::toolTip(Find::FindFlags findFlags) const +QString SymbolsFindFilter::toolTip(Core::FindFlags findFlags) const { QStringList types; if (m_symbolsToSearch & SymbolSearcher::Classes) @@ -254,7 +254,7 @@ QString SymbolsFindFilter::toolTip(Find::FindFlags findFlags) const return tr("Scope: %1\nTypes: %2\nFlags: %3") .arg(searchScope() == SymbolSearcher::SearchGlobal ? tr("All") : tr("Projects")) .arg(types.join(tr(", "))) - .arg(Find::IFindFilter::descriptionForFindFlags(findFlags)); + .arg(Core::IFindFilter::descriptionForFindFlags(findFlags)); } // #pragma mark -- SymbolsFindFilterConfigWidget diff --git a/src/plugins/cpptools/symbolsfindfilter.h b/src/plugins/cpptools/symbolsfindfilter.h index 998b58dba3e..6dc550763ef 100644 --- a/src/plugins/cpptools/symbolsfindfilter.h +++ b/src/plugins/cpptools/symbolsfindfilter.h @@ -32,7 +32,7 @@ #include "searchsymbols.h" -#include <find/ifindfilter.h> +#include <coreplugin/find/ifindfilter.h> #include <QFutureWatcher> #include <QPointer> @@ -45,7 +45,7 @@ namespace Internal { class CppModelManager; -class SymbolsFindFilter : public Find::IFindFilter +class SymbolsFindFilter : public Core::IFindFilter { Q_OBJECT @@ -58,9 +58,9 @@ public: QString id() const; QString displayName() const; bool isEnabled() const; - Find::FindFlags supportedFindFlags() const; + Core::FindFlags supportedFindFlags() const; - void findAll(const QString &txt, Find::FindFlags findFlags); + void findAll(const QString &txt, Core::FindFlags findFlags); QWidget *createConfigWidget(); void writeSettings(QSettings *settings); @@ -76,7 +76,7 @@ signals: void symbolsToSearchChanged(); private slots: - void openEditor(const Find::SearchResultItem &item); + void openEditor(const Core::SearchResultItem &item); void addResults(int begin, int end); void finish(); @@ -88,13 +88,13 @@ private slots: private: QString label() const; - QString toolTip(Find::FindFlags findFlags) const; - void startSearch(Find::SearchResult *search); + QString toolTip(Core::FindFlags findFlags) const; + void startSearch(Core::SearchResult *search); CppModelManager *m_manager; bool m_enabled; - QMap<QFutureWatcher<Find::SearchResultItem> *, QPointer<Find::SearchResult> > m_watchers; - QPointer<Find::SearchResult> m_currentSearch; + QMap<QFutureWatcher<Core::SearchResultItem> *, QPointer<Core::SearchResult> > m_watchers; + QPointer<Core::SearchResult> m_currentSearch; SearchSymbols::SymbolTypes m_symbolsToSearch; SearchScope m_scope; }; diff --git a/src/plugins/cvs/cvs.qbs b/src/plugins/cvs/cvs.qbs index a1021cfc6e7..810ae1211bc 100644 --- a/src/plugins/cvs/cvs.qbs +++ b/src/plugins/cvs/cvs.qbs @@ -8,9 +8,7 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "VcsBase" } - Depends { name: "Locator" } files: [ "annotationhighlighter.cpp", diff --git a/src/plugins/cvs/cvs_dependencies.pri b/src/plugins/cvs/cvs_dependencies.pri index a10e575988c..8761cf6570a 100644 --- a/src/plugins/cvs/cvs_dependencies.pri +++ b/src/plugins/cvs/cvs_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = CVS QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ texteditor \ coreplugin \ vcsbase diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 28a06acda81..9e85e9b7bfe 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -41,7 +41,6 @@ #include <vcsbase/basevcssubmiteditorfactory.h> #include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseeditorparameterwidget.h> -#include <locator/commandlocator.h> #include <utils/synchronousprocess.h> #include <utils/parameteraction.h> #include <utils/qtcassert.h> @@ -56,6 +55,7 @@ #include <coreplugin/actionmanager/command.h> #include <coreplugin/id.h> #include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/locator/commandlocator.h> #include <coreplugin/vcsmanager.h> #include <utils/stringutils.h> #include <utils/fileutils.h> @@ -251,7 +251,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(new CheckoutWizard); const QString prefix = QLatin1String("cvs"); - m_commandLocator = new Locator::CommandLocator("CVS", prefix, prefix); + m_commandLocator = new Core::CommandLocator("CVS", prefix, prefix); addAutoReleasedObject(m_commandLocator); // Register actions diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index cccd7af7ba7..bc725da7685 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -42,13 +42,13 @@ class QTextCodec; QT_END_NAMESPACE namespace Core { +class CommandLocator; class IEditorFactory; class IVersionControl; } namespace Utils { class ParameterAction; } namespace VcsBase { class VcsBaseSubmitEditor; } -namespace Locator { class CommandLocator; } namespace Cvs { namespace Internal { @@ -171,7 +171,7 @@ private: QString m_commitMessageFileName; QString m_commitRepository; - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; Utils::ParameterAction *m_addAction; Utils::ParameterAction *m_deleteAction; Utils::ParameterAction *m_revertAction; diff --git a/src/plugins/debugger/basewindow.cpp b/src/plugins/debugger/basewindow.cpp index b2757de790c..3da6a8aa7f3 100644 --- a/src/plugins/debugger/basewindow.cpp +++ b/src/plugins/debugger/basewindow.cpp @@ -34,7 +34,7 @@ #include <aggregation/aggregate.h> #include <coreplugin/findplaceholder.h> -#include <find/treeviewfind.h> +#include <coreplugin/find/treeviewfind.h> #include <utils/savedaction.h> #include <QMenu> @@ -69,7 +69,7 @@ BaseWindow::BaseWindow(QTreeView *treeView, QWidget *parent) Aggregation::Aggregate *agg = new Aggregation::Aggregate; agg->add(m_treeView); - agg->add(new Find::TreeViewFind(m_treeView)); + agg->add(new Core::TreeViewFind(m_treeView)); } } // namespace Internal diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index 290929db46d..16927cb79ba 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -8,7 +8,6 @@ QtcPlugin { Depends { name: "Qt"; submodules: ["widgets", "network", "script"] } Depends { name: "Core" } Depends { name: "CppTools" } - Depends { name: "Find" } Depends { name: "ProjectExplorer" } Depends { name: "TextEditor" } Depends { name: "CPlusPlus" } diff --git a/src/plugins/debugger/debugger_dependencies.pri b/src/plugins/debugger/debugger_dependencies.pri index 369a4fc2525..d537fa70d5f 100644 --- a/src/plugins/debugger/debugger_dependencies.pri +++ b/src/plugins/debugger/debugger_dependencies.pri @@ -8,7 +8,6 @@ QTC_LIB_DEPENDS += \ QTC_PLUGIN_DEPENDS += \ coreplugin \ cpptools \ - find \ projectexplorer \ texteditor QTC_PLUGIN_RECOMMENDS += \ diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 6ad66dbbdd3..74a3f3f525c 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -48,7 +48,7 @@ #include <aggregation/aggregate.h> #include <coreplugin/findplaceholder.h> #include <coreplugin/minisplitter.h> -#include <find/basetextfind.h> +#include <coreplugin/find/basetextfind.h> #include <utils/savedaction.h> #include <utils/fancylineedit.h> @@ -408,11 +408,11 @@ LogWindow::LogWindow(QWidget *parent) Aggregation::Aggregate *aggregate = new Aggregation::Aggregate; aggregate->add(m_combinedText); - aggregate->add(new Find::BaseTextFind(m_combinedText)); + aggregate->add(new Core::BaseTextFind(m_combinedText)); aggregate = new Aggregation::Aggregate; aggregate->add(m_inputText); - aggregate->add(new Find::BaseTextFind(m_inputText)); + aggregate->add(new Core::BaseTextFind(m_inputText)); connect(m_inputText, SIGNAL(statusMessageRequested(QString,int)), SIGNAL(statusMessageRequested(QString,int))); diff --git a/src/plugins/diffeditor/diffeditor.qbs b/src/plugins/diffeditor/diffeditor.qbs index 69ef2c01dca..622267fbb5c 100644 --- a/src/plugins/diffeditor/diffeditor.qbs +++ b/src/plugins/diffeditor/diffeditor.qbs @@ -8,7 +8,6 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } files: [ diff --git a/src/plugins/fakevim/fakevim.qbs b/src/plugins/fakevim/fakevim.qbs index 4864bc0b501..5ac7938928e 100644 --- a/src/plugins/fakevim/fakevim.qbs +++ b/src/plugins/fakevim/fakevim.qbs @@ -7,7 +7,6 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "Qt.widgets" } files: [ diff --git a/src/plugins/fakevim/fakevim_dependencies.pri b/src/plugins/fakevim/fakevim_dependencies.pri index abb8f31a74a..51a82fc372b 100644 --- a/src/plugins/fakevim/fakevim_dependencies.pri +++ b/src/plugins/fakevim/fakevim_dependencies.pri @@ -1,5 +1,4 @@ QTC_PLUGIN_NAME = FakeVim QTC_PLUGIN_DEPENDS += \ coreplugin \ - texteditor \ - find + texteditor diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index d0af40cd7dc..ed48448b385 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -42,6 +42,9 @@ #include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/documentmodel.h> +#include <coreplugin/find/findplugin.h> +#include <coreplugin/find/textfindconstants.h> +#include <coreplugin/find/ifindsupport.h> #include <coreplugin/documentmanager.h> #include <coreplugin/icore.h> #include <coreplugin/idocument.h> @@ -68,10 +71,6 @@ #include <texteditor/codeassist/iassistinterface.h> #include <texteditor/codeassist/genericproposal.h> -#include <find/findplugin.h> -#include <find/textfindconstants.h> -#include <find/ifindsupport.h> - #include <utils/hostosinfo.h> #include <utils/qtcassert.h> #include <utils/savedaction.h> @@ -1401,20 +1400,20 @@ void FakeVimPluginPrivate::keepOnlyWindow() void FakeVimPluginPrivate::find(bool reverse) { - if (Find::FindPlugin *plugin = Find::FindPlugin::instance()) { + if (FindPlugin *plugin = FindPlugin::instance()) { plugin->setUseFakeVim(true); plugin->openFindToolBar(reverse - ? Find::FindPlugin::FindBackwardDirection - : Find::FindPlugin::FindForwardDirection); + ? FindPlugin::FindBackwardDirection + : FindPlugin::FindForwardDirection); } } void FakeVimPluginPrivate::findNext(bool reverse) { if (reverse) - triggerAction(Find::Constants::FIND_PREVIOUS); + triggerAction(Core::Constants::FIND_PREVIOUS); else - triggerAction(Find::Constants::FIND_NEXT); + triggerAction(Core::Constants::FIND_NEXT); } void FakeVimPluginPrivate::foldToggle(int depth) @@ -1686,8 +1685,8 @@ void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value) { //qDebug() << "SET USE FAKEVIM" << value; bool on = value.toBool(); - if (Find::FindPlugin::instance()) - Find::FindPlugin::instance()->setUseFakeVim(on); + if (Core::FindPlugin::instance()) + Core::FindPlugin::instance()->setUseFakeVim(on); setUseFakeVimInternal(on); } @@ -1821,10 +1820,10 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd) showSettingsDialog(); } else if (cmd.args == _("ic") || cmd.args == _("ignorecase")) { // :set nc - setActionChecked(Find::Constants::CASE_SENSITIVE, false); + setActionChecked(Core::Constants::CASE_SENSITIVE, false); } else if (cmd.args == _("noic") || cmd.args == _("noignorecase")) { // :set noic - setActionChecked(Find::Constants::CASE_SENSITIVE, true); + setActionChecked(Core::Constants::CASE_SENSITIVE, true); } *handled = false; // Let the handler see it as well. } else if (cmd.matches(_("n"), _("next"))) { @@ -1990,9 +1989,9 @@ void FakeVimPluginPrivate::highlightMatches(const QString &needle) { foreach (IEditor *editor, EditorManager::visibleEditors()) { QWidget *w = editor->widget(); - Find::IFindSupport *find = Aggregation::query<Find::IFindSupport>(w); + Core::IFindSupport *find = Aggregation::query<Core::IFindSupport>(w); if (find != 0) - find->highlightAll(needle, Find::FindRegularExpression | Find::FindCaseSensitively); + find->highlightAll(needle, FindRegularExpression | FindCaseSensitively); } } diff --git a/src/plugins/find/Find.pluginspec.in b/src/plugins/find/Find.pluginspec.in index f670aa2f555..8af87eb2e56 100644 --- a/src/plugins/find/Find.pluginspec.in +++ b/src/plugins/find/Find.pluginspec.in @@ -1,4 +1,4 @@ -<plugin name=\"Find\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_COMPAT_VERSION\"> +<plugin name=\"Find\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_COMPAT_VERSION\" disabledByDefault=\"true\"> <vendor>Digia Plc</vendor> <copyright>(C) 2014 Digia Plc</copyright> <license> @@ -13,5 +13,4 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General <category>Qt Creator</category> <description>Provides the find widget and the hooks for find implementations.</description> <url>http://www.qt-project.org</url> - $$dependencyList </plugin> diff --git a/src/plugins/find/find.pro b/src/plugins/find/find.pro index 8666b26bdea..a7d911be0d5 100644 --- a/src/plugins/find/find.pro +++ b/src/plugins/find/find.pro @@ -1,38 +1,3 @@ include(../../qtcreatorplugin.pri) DEFINES += FIND_LIBRARY -HEADERS += findtoolwindow.h \ - textfindconstants.h \ - ifindsupport.h \ - ifindfilter.h \ - currentdocumentfind.h \ - basetextfind.h \ - find_global.h \ - findtoolbar.h \ - findplugin.h \ - searchresultcolor.h \ - searchresulttreeitemdelegate.h \ - searchresulttreeitemroles.h \ - searchresulttreeitems.h \ - searchresulttreemodel.h \ - searchresulttreeview.h \ - searchresultwindow.h \ - searchresultwidget.h \ - treeviewfind.h -SOURCES += findtoolwindow.cpp \ - currentdocumentfind.cpp \ - basetextfind.cpp \ - findtoolbar.cpp \ - findplugin.cpp \ - searchresulttreeitemdelegate.cpp \ - searchresulttreeitems.cpp \ - searchresulttreemodel.cpp \ - searchresulttreeview.cpp \ - searchresultwindow.cpp \ - ifindfilter.cpp \ - ifindsupport.cpp \ - searchresultwidget.cpp \ - treeviewfind.cpp -FORMS += findwidget.ui \ - finddialog.ui -RESOURCES += find.qrc - +SOURCES += findplugin.cpp diff --git a/src/plugins/find/find.qbs b/src/plugins/find/find.qbs index 0b4a08986bc..e0acdc006f2 100644 --- a/src/plugins/find/find.qbs +++ b/src/plugins/find/find.qbs @@ -5,44 +5,7 @@ import QtcPlugin QtcPlugin { name: "Find" - Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "script"] } Depends { name: "Core" } - files: [ - "basetextfind.cpp", - "basetextfind.h", - "currentdocumentfind.cpp", - "currentdocumentfind.h", - "find.qrc", - "find_global.h", - "finddialog.ui", - "findplugin.cpp", - "findplugin.h", - "findtoolbar.cpp", - "findtoolbar.h", - "findtoolwindow.cpp", - "findtoolwindow.h", - "findwidget.ui", - "ifindfilter.cpp", - "ifindfilter.h", - "ifindsupport.cpp", - "ifindsupport.h", - "searchresultcolor.h", - "searchresulttreeitemdelegate.cpp", - "searchresulttreeitemdelegate.h", - "searchresulttreeitemroles.h", - "searchresulttreeitems.cpp", - "searchresulttreeitems.h", - "searchresulttreemodel.cpp", - "searchresulttreemodel.h", - "searchresulttreeview.cpp", - "searchresulttreeview.h", - "searchresultwidget.cpp", - "searchresultwidget.h", - "searchresultwindow.cpp", - "searchresultwindow.h", - "textfindconstants.h", - "treeviewfind.cpp", - "treeviewfind.h", - ] + files: [ "findplugin.cpp" ] } diff --git a/src/plugins/find/find_dependencies.pri b/src/plugins/find/find_dependencies.pri index 52291a8aab4..39a0b86f75e 100644 --- a/src/plugins/find/find_dependencies.pri +++ b/src/plugins/find/find_dependencies.pri @@ -1,5 +1,3 @@ QTC_PLUGIN_NAME = Find -QTC_LIB_DEPENDS += \ - utils -QTC_PLUGIN_DEPENDS += \ - coreplugin +QTC_LIB_DEPENDS += +QTC_PLUGIN_DEPENDS += diff --git a/src/plugins/find/find_global.h b/src/plugins/find/find_global.h deleted file mode 100644 index 68d06d5145b..00000000000 --- a/src/plugins/find/find_global.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ -#ifndef FIND_GLOBAL_H -#define FIND_GLOBAL_H - -#include <qglobal.h> - -#if defined(FIND_LIBRARY) -# define FIND_EXPORT Q_DECL_EXPORT -#else -# define FIND_EXPORT Q_DECL_IMPORT -#endif - -#endif // FIND_GLOBAL_H diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index be9196e209d..a4428b657fd 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -1,398 +1,2 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ -#include "findplugin.h" - -#include "currentdocumentfind.h" -#include "findtoolbar.h" -#include "findtoolwindow.h" -#include "searchresultwindow.h" -#include "ifindfilter.h" - -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/actionmanager/actioncontainer.h> -#include <coreplugin/coreconstants.h> -#include <coreplugin/icore.h> -#include <coreplugin/id.h> - -#include <extensionsystem/pluginmanager.h> - -#include <utils/qtcassert.h> - -#include <QMenu> -#include <QStringListModel> -#include <QAction> - -#include <QtPlugin> -#include <QSettings> - -/*! - \namespace Find - The Find namespace provides everything that has to do with search term based searches. -*/ - -/*! - \namespace Find::Internal - \internal -*/ -/*! - \namespace Find::Internal::ItemDataRoles - \internal -*/ - -Q_DECLARE_METATYPE(Find::IFindFilter*) - -namespace { - const int MAX_COMPLETIONS = 50; -} - -namespace Find { - -class FindPluginPrivate { -public: - explicit FindPluginPrivate(FindPlugin *q); - - //variables - static FindPlugin *m_instance; - - QHash<IFindFilter *, QAction *> m_filterActions; - - Internal::CurrentDocumentFind *m_currentDocumentFind; - Internal::FindToolBar *m_findToolBar; - Internal::FindToolWindow *m_findDialog; - FindFlags m_findFlags; - QStringListModel *m_findCompletionModel; - QStringListModel *m_replaceCompletionModel; - QStringList m_findCompletions; - QStringList m_replaceCompletions; - QAction *m_openFindDialog; -}; - -FindPluginPrivate::FindPluginPrivate(FindPlugin *q) : - m_currentDocumentFind(0), m_findToolBar(0), m_findDialog(0), - m_findCompletionModel(new QStringListModel(q)), - m_replaceCompletionModel(new QStringListModel(q)) -{ -} - -FindPlugin *FindPluginPrivate::m_instance = 0; - -FindPlugin::FindPlugin() : d(new FindPluginPrivate(this)) -{ - QTC_ASSERT(!FindPluginPrivate::m_instance, return); - FindPluginPrivate::m_instance = this; -} - -FindPlugin::~FindPlugin() -{ - FindPluginPrivate::m_instance = 0; - delete d->m_currentDocumentFind; - delete d->m_findToolBar; - delete d->m_findDialog; - delete d; -} - -FindPlugin *FindPlugin::instance() -{ - return FindPluginPrivate::m_instance; -} - -bool FindPlugin::initialize(const QStringList &, QString *) -{ - setupMenu(); - - d->m_currentDocumentFind = new Internal::CurrentDocumentFind; - - d->m_findToolBar = new Internal::FindToolBar(this, d->m_currentDocumentFind); - d->m_findDialog = new Internal::FindToolWindow(this); - SearchResultWindow *searchResultWindow = new SearchResultWindow(d->m_findDialog); - addAutoReleasedObject(searchResultWindow); - return true; -} - -void FindPlugin::extensionsInitialized() -{ - setupFilterMenuItems(); - readSettings(); -} - -ExtensionSystem::IPlugin::ShutdownFlag FindPlugin::aboutToShutdown() -{ - d->m_findToolBar->setVisible(false); - d->m_findToolBar->setParent(0); - d->m_currentDocumentFind->removeConnections(); - writeSettings(); - return SynchronousShutdown; -} - -void FindPlugin::filterChanged() -{ - IFindFilter *changedFilter = qobject_cast<IFindFilter *>(sender()); - QAction *action = d->m_filterActions.value(changedFilter); - QTC_ASSERT(changedFilter, return); - QTC_ASSERT(action, return); - action->setEnabled(changedFilter->isEnabled()); - bool haveEnabledFilters = false; - foreach (const IFindFilter *filter, d->m_filterActions.keys()) { - if (filter->isEnabled()) { - haveEnabledFilters = true; - break; - } - } - d->m_openFindDialog->setEnabled(haveEnabledFilters); -} - -void FindPlugin::openFindFilter() -{ - QAction *action = qobject_cast<QAction*>(sender()); - QTC_ASSERT(action, return); - IFindFilter *filter = action->data().value<IFindFilter *>(); - openFindDialog(filter); -} - -void FindPlugin::openFindDialog(IFindFilter *filter) -{ - if (d->m_currentDocumentFind->candidateIsEnabled()) - d->m_currentDocumentFind->acceptCandidate(); - const QString currentFindString = - d->m_currentDocumentFind->isEnabled() ? - d->m_currentDocumentFind->currentFindString() : QString(); - if (!currentFindString.isEmpty()) - d->m_findDialog->setFindText(currentFindString); - d->m_findDialog->setCurrentFilter(filter); - SearchResultWindow::instance()->openNewSearchPanel(); -} - -void FindPlugin::setupMenu() -{ - Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); - Core::ActionContainer *mfind = Core::ActionManager::createMenu(Constants::M_FIND); - medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); - mfind->menu()->setTitle(tr("&Find/Replace")); - mfind->appendGroup(Constants::G_FIND_CURRENTDOCUMENT); - mfind->appendGroup(Constants::G_FIND_FILTERS); - mfind->appendGroup(Constants::G_FIND_FLAGS); - mfind->appendGroup(Constants::G_FIND_ACTIONS); - Core::Context globalcontext(Core::Constants::C_GLOBAL); - Core::Command *cmd; - mfind->addSeparator(globalcontext, Constants::G_FIND_FLAGS); - mfind->addSeparator(globalcontext, Constants::G_FIND_ACTIONS); - - Core::ActionContainer *mfindadvanced = Core::ActionManager::createMenu(Constants::M_FIND_ADVANCED); - mfindadvanced->menu()->setTitle(tr("Advanced Find")); - mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS); - d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this); - d->m_openFindDialog->setIconText(tr("Advanced...")); - cmd = Core::ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); - cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); - mfindadvanced->addAction(cmd); - connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter())); -} - -void FindPlugin::setupFilterMenuItems() -{ - QList<IFindFilter*> findInterfaces = - ExtensionSystem::PluginManager::getObjects<IFindFilter>(); - Core::Command *cmd; - Core::Context globalcontext(Core::Constants::C_GLOBAL); - - Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED); - d->m_filterActions.clear(); - bool haveEnabledFilters = false; - const Core::Id base("FindFilter."); - foreach (IFindFilter *filter, findInterfaces) { - QAction *action = new QAction(QLatin1String(" ") + filter->displayName(), this); - bool isEnabled = filter->isEnabled(); - if (isEnabled) - haveEnabledFilters = true; - action->setEnabled(isEnabled); - action->setData(qVariantFromValue(filter)); - cmd = Core::ActionManager::registerAction(action, - base.withSuffix(filter->id()), globalcontext); - cmd->setDefaultKeySequence(filter->defaultShortcut()); - mfindadvanced->addAction(cmd); - d->m_filterActions.insert(filter, action); - connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter())); - connect(filter, SIGNAL(enabledChanged(bool)), this, SLOT(filterChanged())); - } - d->m_findDialog->setFindFilters(findInterfaces); - d->m_openFindDialog->setEnabled(haveEnabledFilters); -} - -FindFlags FindPlugin::findFlags() const -{ - return d->m_findFlags; -} - -void FindPlugin::setCaseSensitive(bool sensitive) -{ - setFindFlag(FindCaseSensitively, sensitive); -} - -void FindPlugin::setWholeWord(bool wholeOnly) -{ - setFindFlag(FindWholeWords, wholeOnly); -} - -void FindPlugin::setBackward(bool backward) -{ - setFindFlag(FindBackward, backward); -} - -void FindPlugin::setRegularExpression(bool regExp) -{ - setFindFlag(FindRegularExpression, regExp); -} - -void FindPlugin::setPreserveCase(bool preserveCase) -{ - setFindFlag(FindPreserveCase, preserveCase); -} - -void FindPlugin::setFindFlag(FindFlag flag, bool enabled) -{ - bool hasFlag = hasFindFlag(flag); - if ((hasFlag && enabled) || (!hasFlag && !enabled)) - return; - if (enabled) - d->m_findFlags |= flag; - else - d->m_findFlags &= ~flag; - if (flag != FindBackward) - emit findFlagsChanged(); -} - -bool FindPlugin::hasFindFlag(FindFlag flag) -{ - return d->m_findFlags & flag; -} - -void FindPlugin::writeSettings() -{ - QSettings *settings = Core::ICore::settings(); - settings->beginGroup(QLatin1String("Find")); - settings->setValue(QLatin1String("Backward"), hasFindFlag(FindBackward)); - settings->setValue(QLatin1String("CaseSensitively"), hasFindFlag(FindCaseSensitively)); - settings->setValue(QLatin1String("WholeWords"), hasFindFlag(FindWholeWords)); - settings->setValue(QLatin1String("RegularExpression"), hasFindFlag(FindRegularExpression)); - settings->setValue(QLatin1String("PreserveCase"), hasFindFlag(FindPreserveCase)); - settings->setValue(QLatin1String("FindStrings"), d->m_findCompletions); - settings->setValue(QLatin1String("ReplaceStrings"), d->m_replaceCompletions); - settings->endGroup(); - d->m_findToolBar->writeSettings(); - d->m_findDialog->writeSettings(); -} - -void FindPlugin::readSettings() -{ - QSettings *settings = Core::ICore::settings(); - settings->beginGroup(QLatin1String("Find")); - bool block = blockSignals(true); - setBackward(settings->value(QLatin1String("Backward"), false).toBool()); - setCaseSensitive(settings->value(QLatin1String("CaseSensitively"), false).toBool()); - setWholeWord(settings->value(QLatin1String("WholeWords"), false).toBool()); - setRegularExpression(settings->value(QLatin1String("RegularExpression"), false).toBool()); - setPreserveCase(settings->value(QLatin1String("PreserveCase"), false).toBool()); - blockSignals(block); - d->m_findCompletions = settings->value(QLatin1String("FindStrings")).toStringList(); - d->m_replaceCompletions = settings->value(QLatin1String("ReplaceStrings")).toStringList(); - d->m_findCompletionModel->setStringList(d->m_findCompletions); - d->m_replaceCompletionModel->setStringList(d->m_replaceCompletions); - settings->endGroup(); - d->m_findToolBar->readSettings(); - d->m_findDialog->readSettings(); - emit findFlagsChanged(); // would have been done in the setXXX methods above -} - -void FindPlugin::updateFindCompletion(const QString &text) -{ - updateCompletion(text, d->m_findCompletions, d->m_findCompletionModel); -} - -void FindPlugin::updateReplaceCompletion(const QString &text) -{ - updateCompletion(text, d->m_replaceCompletions, d->m_replaceCompletionModel); -} - -void FindPlugin::updateCompletion(const QString &text, QStringList &completions, QStringListModel *model) -{ - if (text.isEmpty()) - return; - completions.removeAll(text); - completions.prepend(text); - while (completions.size() > MAX_COMPLETIONS) - completions.removeLast(); - model->setStringList(completions); -} - -void FindPlugin::setUseFakeVim(bool on) -{ - if (d->m_findToolBar) - d->m_findToolBar->setUseFakeVim(on); -} - -void FindPlugin::openFindToolBar(FindDirection direction) -{ - if (d->m_findToolBar) { - d->m_findToolBar->setBackward(direction == FindBackwardDirection); - d->m_findToolBar->openFindToolBar(); - } -} - -QStringListModel *FindPlugin::findCompletionModel() const -{ - return d->m_findCompletionModel; -} - -QStringListModel *FindPlugin::replaceCompletionModel() const -{ - return d->m_replaceCompletionModel; -} - -QKeySequence IFindFilter::defaultShortcut() const -{ - return QKeySequence(); -} - -} // namespace Find - -// declared in textfindconstants.h -QTextDocument::FindFlags Find::textDocumentFlagsForFindFlags(Find::FindFlags flags) -{ - QTextDocument::FindFlags textDocFlags; - if (flags & FindBackward) - textDocFlags |= QTextDocument::FindBackward; - if (flags & Find::FindCaseSensitively) - textDocFlags |= QTextDocument::FindCaseSensitively; - if (flags & Find::FindWholeWords) - textDocFlags |= QTextDocument::FindWholeWords; - return textDocFlags; -} - -Q_EXPORT_PLUGIN(Find::FindPlugin) +void dummyFindPlugin () {} diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.qbs b/src/plugins/genericprojectmanager/genericprojectmanager.qbs index 707264924ea..72729967a37 100644 --- a/src/plugins/genericprojectmanager/genericprojectmanager.qbs +++ b/src/plugins/genericprojectmanager/genericprojectmanager.qbs @@ -11,8 +11,6 @@ QtcPlugin { Depends { name: "CppTools" } Depends { name: "TextEditor" } Depends { name: "ProjectExplorer" } - Depends { name: "Find" } - Depends { name: "Locator" } Depends { name: "QtSupport" } files: [ diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 2acbc32fce1..733808a80eb 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -51,7 +51,7 @@ #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/command.h> #include <coreplugin/editormanager/editormanager.h> -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <vcsbase/vcsbaseoutputwindow.h> @@ -302,7 +302,7 @@ void GerritPlugin::updateActions(bool hasTopLevel) m_pushToGerritPair.first->setEnabled(hasTopLevel); } -void GerritPlugin::addToLocator(Locator::CommandLocator *locator) +void GerritPlugin::addToLocator(Core::CommandLocator *locator) { locator->appendCommand(m_gerritCommand); locator->appendCommand(m_pushToGerritPair.second); diff --git a/src/plugins/git/gerrit/gerritplugin.h b/src/plugins/git/gerrit/gerritplugin.h index cefa726d35a..1d7217d9c4c 100644 --- a/src/plugins/git/gerrit/gerritplugin.h +++ b/src/plugins/git/gerrit/gerritplugin.h @@ -42,10 +42,9 @@ QT_END_NAMESPACE namespace Core { class ActionContainer; class Command; +class CommandLocator; } -namespace Locator { class CommandLocator; } - namespace Gerrit { namespace Internal { @@ -66,7 +65,7 @@ public: static QString gitBinary(); static QString branch(const QString &repository); - void addToLocator(Locator::CommandLocator *locator); + void addToLocator(Core::CommandLocator *locator); void push(const QString &topLevel); public slots: diff --git a/src/plugins/git/git.qbs b/src/plugins/git/git.qbs index dd4e2e02055..bff95c4aca0 100644 --- a/src/plugins/git/git.qbs +++ b/src/plugins/git/git.qbs @@ -8,10 +8,8 @@ QtcPlugin { Depends { name: "Qt"; submodules: ["widgets", "network"] } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "VcsBase" } Depends { name: "DiffEditor" } - Depends { name: "Locator" } files: [ "annotationhighlighter.cpp", diff --git a/src/plugins/git/git_dependencies.pri b/src/plugins/git/git_dependencies.pri index 6e7123f2474..e78d2e2e5d7 100644 --- a/src/plugins/git/git_dependencies.pri +++ b/src/plugins/git/git_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Git QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ texteditor \ coreplugin \ vcsbase \ diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index a3b75828ea1..be1b7400197 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -71,7 +71,7 @@ #include <vcsbase/basevcssubmiteditorfactory.h> #include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/cleandialog.h> -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <QDebug> #include <QDir> @@ -298,7 +298,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(new Gitorious::Internal::GitoriousCloneWizard); const QString prefix = QLatin1String("git"); - m_commandLocator = new Locator::CommandLocator("Git", prefix, prefix); + m_commandLocator = new Core::CommandLocator("Git", prefix, prefix); addAutoReleasedObject(m_commandLocator); //register actions diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 4ebb2e48c39..27e3292630f 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -49,6 +49,7 @@ namespace Core { class IEditor; class IEditorFactory; class Command; +class CommandLocator; class Context; class ActionManager; class ActionContainer; @@ -56,9 +57,6 @@ class ActionContainer; namespace Utils { class ParameterAction; } -namespace Locator { - class CommandLocator; -} namespace Gerrit { namespace Internal { class GerritPlugin; @@ -206,7 +204,7 @@ private: void updateVersionWarning(); static GitPlugin *m_instance; - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; QAction *m_submitCurrentAction; QAction *m_diffSelectedFilesAction; diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index b99ba69487e..7480831ed98 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -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); diff --git a/src/plugins/help/centralwidget.h b/src/plugins/help/centralwidget.h index a260eb2326e..be8d5abf011 100644 --- a/src/plugins/help/centralwidget.h +++ b/src/plugins/help/centralwidget.h @@ -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: diff --git a/src/plugins/help/help.qbs b/src/plugins/help/help.qbs index b4c8b62f377..1761d5359c4 100644 --- a/src/plugins/help/help.qbs +++ b/src/plugins/help/help.qbs @@ -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"]) diff --git a/src/plugins/help/help_dependencies.pri b/src/plugins/help/help_dependencies.pri index 058256c5790..df048080748 100644 --- a/src/plugins/help/help_dependencies.pri +++ b/src/plugins/help/help_dependencies.pri @@ -1,5 +1,3 @@ QTC_PLUGIN_NAME = Help QTC_PLUGIN_DEPENDS += \ - coreplugin \ - find \ - locator + coreplugin diff --git a/src/plugins/help/helpfindsupport.cpp b/src/plugins/help/helpfindsupport.cpp index 16efef0b003..b971fb1d9ff 100644 --- a/src/plugins/help/helpfindsupport.cpp +++ b/src/plugins/help/helpfindsupport.cpp @@ -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; diff --git a/src/plugins/help/helpfindsupport.h b/src/plugins/help/helpfindsupport.h index fce9eaf45e6..c67a0a18d9a 100644 --- a/src/plugins/help/helpfindsupport.h +++ b/src/plugins/help/helpfindsupport.h @@ -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; }; diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index e964e9c428c..ebd04c3954c 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -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); diff --git a/src/plugins/help/helpindexfilter.h b/src/plugins/help/helpindexfilter.h index bf26413dac6..ae0e4bf7f4a 100644 --- a/src/plugins/help/helpindexfilter.h +++ b/src/plugins/help/helpindexfilter.h @@ -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: diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 33ab67a5bd7..e75d4860e89 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -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() diff --git a/src/plugins/help/helpviewer.h b/src/plugins/help/helpviewer.h index 1355684b1dd..8a877c317b0 100644 --- a/src/plugins/help/helpviewer.h +++ b/src/plugins/help/helpviewer.h @@ -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); diff --git a/src/plugins/help/helpviewer_qtb.cpp b/src/plugins/help/helpviewer_qtb.cpp index e643ccc1588..b43a9c2fa97 100644 --- a/src/plugins/help/helpviewer_qtb.cpp +++ b/src/plugins/help/helpviewer_qtb.cpp @@ -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); diff --git a/src/plugins/help/helpviewer_qwv.cpp b/src/plugins/help/helpviewer_qwv.cpp index f0f44bc66f2..d8301084a8c 100644 --- a/src/plugins/help/helpviewer_qwv.cpp +++ b/src/plugins/help/helpviewer_qwv.cpp @@ -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); diff --git a/src/plugins/help/remotehelpfilter.cpp b/src/plugins/help/remotehelpfilter.cpp index 130f196f1b8..4d09abde98a 100644 --- a/src/plugins/help/remotehelpfilter.cpp +++ b/src/plugins/help/remotehelpfilter.cpp @@ -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()) diff --git a/src/plugins/help/remotehelpfilter.h b/src/plugins/help/remotehelpfilter.h index a070a0f3fb4..958deb1cbd2 100644 --- a/src/plugins/help/remotehelpfilter.h +++ b/src/plugins/help/remotehelpfilter.h @@ -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); diff --git a/src/plugins/locator/Locator.pluginspec.in b/src/plugins/locator/Locator.pluginspec.in index ecd6d22c95a..a67f7977e9f 100644 --- a/src/plugins/locator/Locator.pluginspec.in +++ b/src/plugins/locator/Locator.pluginspec.in @@ -1,4 +1,4 @@ -<plugin name=\"Locator\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_COMPAT_VERSION\"> +<plugin name=\"Locator\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_COMPAT_VERSION\" disabledByDefault=\"true\"> <vendor>Digia Plc</vendor> <copyright>(C) 2014 Digia Plc</copyright> <license> @@ -13,5 +13,4 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General <category>Qt Creator</category> <description>Provides the Locator widget and the hooks for Locator filter implementations.</description> <url>http://www.qt-project.org</url> - $$dependencyList </plugin> diff --git a/src/plugins/locator/locator.pro b/src/plugins/locator/locator.pro index 69c237599b2..a293b5ae63a 100644 --- a/src/plugins/locator/locator.pro +++ b/src/plugins/locator/locator.pro @@ -1,43 +1,4 @@ DEFINES += LOCATOR_LIBRARY include(../../qtcreatorplugin.pri) -HEADERS += locatorplugin.h \ - commandlocator.h \ - locatorwidget.h \ - locatorfiltersfilter.h \ - settingspage.h \ - ilocatorfilter.h \ - opendocumentsfilter.h \ - filesystemfilter.h \ - locatorconstants.h \ - directoryfilter.h \ - locatormanager.h \ - basefilefilter.h \ - locator_global.h \ - executefilter.h \ - locatorsearchutils.h -SOURCES += locatorplugin.cpp \ - commandlocator.cpp \ - locatorwidget.cpp \ - locatorfiltersfilter.cpp \ - opendocumentsfilter.cpp \ - filesystemfilter.cpp \ - settingspage.cpp \ - directoryfilter.cpp \ - locatormanager.cpp \ - basefilefilter.cpp \ - ilocatorfilter.cpp \ - executefilter.cpp \ - locatorsearchutils.cpp -FORMS += settingspage.ui \ - filesystemfilter.ui \ - directoryfilter.ui -RESOURCES += locator.qrc - -equals(TEST, 1) { - HEADERS += locatorfiltertest.h - SOURCES += \ - locatorfiltertest.cpp \ - locator_test.cpp - DEFINES += SRCDIR=\\\"$$PWD\\\" -} +SOURCES += locatorplugin.cpp diff --git a/src/plugins/locator/locator.qbs b/src/plugins/locator/locator.qbs index 0e06a3b4341..b32738a9f72 100644 --- a/src/plugins/locator/locator.qbs +++ b/src/plugins/locator/locator.qbs @@ -5,56 +5,7 @@ import QtcPlugin QtcPlugin { name: "Locator" - - Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "script"] } Depends { name: "Core" } - files: [ - "basefilefilter.cpp", - "basefilefilter.h", - "commandlocator.cpp", - "commandlocator.h", - "directoryfilter.cpp", - "directoryfilter.h", - "directoryfilter.ui", - "executefilter.cpp", - "executefilter.h", - "filesystemfilter.cpp", - "filesystemfilter.h", - "filesystemfilter.ui", - "ilocatorfilter.cpp", - "ilocatorfilter.h", - "locator.qrc", - "locator_global.h", - "locatorconstants.h", - "locatorfiltersfilter.cpp", - "locatorfiltersfilter.h", - "locatormanager.cpp", - "locatormanager.h", - "locatorplugin.cpp", - "locatorplugin.h", - "locatorsearchutils.cpp", - "locatorsearchutils.h", - "locatorwidget.cpp", - "locatorwidget.h", - "opendocumentsfilter.cpp", - "opendocumentsfilter.h", - "settingspage.cpp", - "settingspage.h", - "settingspage.ui", - "images/locator.png", - "images/reload.png", - ] - - Group { - name: "Tests" - condition: project.testsEnabled - files: [ - "locatorfiltertest.cpp", - "locatorfiltertest.h", - "locator_test.cpp" - ] - - cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"']) - } + files: [ "locatorplugin.cpp" ] } diff --git a/src/plugins/locator/locator_dependencies.pri b/src/plugins/locator/locator_dependencies.pri index 899b5554a6c..bb53d187025 100644 --- a/src/plugins/locator/locator_dependencies.pri +++ b/src/plugins/locator/locator_dependencies.pri @@ -1,3 +1,2 @@ QTC_PLUGIN_NAME = Locator -QTC_PLUGIN_DEPENDS += \ - coreplugin +QTC_PLUGIN_DEPENDS += diff --git a/src/plugins/locator/locator_global.h b/src/plugins/locator/locator_global.h deleted file mode 100644 index 751f7c17b5c..00000000000 --- a/src/plugins/locator/locator_global.h +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LOCATOR_GLOBAL_H -#define LOCATOR_GLOBAL_H - -#include <qglobal.h> - -#if defined(LOCATOR_LIBRARY) -# define LOCATOR_EXPORT Q_DECL_EXPORT -#else -# define LOCATOR_EXPORT Q_DECL_IMPORT -#endif - -#endif // LOCATOR_GLOBAL_H diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index 4348254135e..802cedd7c5e 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -1,268 +1,2 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ -#include "locatorplugin.h" -#include "locatorconstants.h" -#include "locatorfiltersfilter.h" -#include "locatormanager.h" -#include "locatorwidget.h" -#include "opendocumentsfilter.h" -#include "filesystemfilter.h" -#include "settingspage.h" - -#include <coreplugin/statusbarwidget.h> -#include <coreplugin/coreconstants.h> -#include <coreplugin/settingsdatabase.h> -#include <coreplugin/icore.h> -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/actionmanager/actioncontainer.h> -#include <coreplugin/progressmanager/progressmanager.h> -#include <coreplugin/progressmanager/futureprogress.h> -#include <extensionsystem/pluginmanager.h> -#include <utils/QtConcurrentTools> -#include <utils/qtcassert.h> - -#include <QSettings> -#include <QtPlugin> -#include <QFuture> -#include <QAction> - -/*! - \namespace Locator - The Locator namespace provides the hooks for Locator content. -*/ -/*! - \namespace Locator::Internal - \internal -*/ - -using namespace Core; -using namespace Locator; -using namespace Locator::Internal; - -namespace { - static bool filterLessThan(const ILocatorFilter *first, const ILocatorFilter *second) - { - if (first->priority() < second->priority()) - return true; - if (first->priority() > second->priority()) - return false; - return first->id().alphabeticallyBefore(second->id()); - } -} - -LocatorPlugin::LocatorPlugin() - : m_settingsInitialized(false) -{ - m_refreshTimer.setSingleShot(false); - connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); -} - -LocatorPlugin::~LocatorPlugin() -{ - removeObject(m_openDocumentsFilter); - removeObject(m_fileSystemFilter); - removeObject(m_executeFilter); - removeObject(m_settingsPage); - delete m_openDocumentsFilter; - delete m_fileSystemFilter; - delete m_executeFilter; - delete m_settingsPage; - qDeleteAll(m_customFilters); -} - -bool LocatorPlugin::initialize(const QStringList &, QString *) -{ - m_settingsPage = new SettingsPage(this); - addObject(m_settingsPage); - - m_locatorWidget = new LocatorWidget(this); - m_locatorWidget->setEnabled(false); - StatusBarWidget *view = new StatusBarWidget; - view->setWidget(m_locatorWidget); - view->setContext(Context("LocatorWidget")); - view->setPosition(StatusBarWidget::First); - addAutoReleasedObject(view); - - QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); - Command *cmd = ActionManager::registerAction(action, "QtCreator.Locate", - Context(Core::Constants::C_GLOBAL)); - cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); - connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); - connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); - updatePlaceholderText(cmd); - - ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); - mtools->addAction(cmd); - - addObject(new LocatorManager(m_locatorWidget)); - - m_openDocumentsFilter = new OpenDocumentsFilter; - addObject(m_openDocumentsFilter); - - m_fileSystemFilter = new FileSystemFilter(m_locatorWidget); - addObject(m_fileSystemFilter); - - m_executeFilter = new ExecuteFilter(); - addObject(m_executeFilter); - - addAutoReleasedObject(new LocatorFiltersFilter(this, m_locatorWidget)); - - return true; -} - -void LocatorPlugin::updatePlaceholderText(Command *command) -{ - if (!command) - command = qobject_cast<Command *>(sender()); - QTC_ASSERT(command, return); - if (command->keySequence().isEmpty()) - m_locatorWidget->setPlaceholderText(tr("Type to locate")); - else - m_locatorWidget->setPlaceholderText(tr("Type to locate (%1)").arg( - command->keySequence().toString(QKeySequence::NativeText))); -} - -void LocatorPlugin::openLocator() -{ - m_locatorWidget->show(QString()); -} - -void LocatorPlugin::extensionsInitialized() -{ - m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>(); - qSort(m_filters.begin(), m_filters.end(), filterLessThan); - setFilters(m_filters); -} - -bool LocatorPlugin::delayedInitialize() -{ - loadSettings(); - return true; -} - -void LocatorPlugin::loadSettings() -{ - QSettings *qs = ICore::settings(); - - // Backwards compatibility to old settings location - if (qs->contains(QLatin1String("QuickOpen/FiltersFilter"))) { - loadSettingsHelper(qs); - } else { - SettingsDatabase *settings = ICore::settingsDatabase(); - loadSettingsHelper(settings); - } - - qs->remove(QLatin1String("QuickOpen")); - - m_locatorWidget->updateFilterList(); - m_locatorWidget->setEnabled(true); - if (m_refreshTimer.interval() > 0) - m_refreshTimer.start(); - m_settingsInitialized = true; -} - -void LocatorPlugin::saveSettings() -{ - if (m_settingsInitialized) { - SettingsDatabase *s = ICore::settingsDatabase(); - s->beginGroup(QLatin1String("QuickOpen")); - s->remove(QString()); - s->setValue(QLatin1String("RefreshInterval"), refreshInterval()); - foreach (ILocatorFilter *filter, m_filters) { - if (!m_customFilters.contains(filter)) - s->setValue(filter->id().toString(), filter->saveState()); - } - s->beginGroup(QLatin1String("CustomFilters")); - int i = 0; - foreach (ILocatorFilter *filter, m_customFilters) { - s->setValue(QLatin1String("directory") + QString::number(i), - filter->saveState()); - ++i; - } - s->endGroup(); - s->endGroup(); - } -} - -/*! - Return all filters, including the ones created by the user. -*/ -QList<ILocatorFilter *> LocatorPlugin::filters() -{ - return m_filters; -} - -/*! - This returns a subset of all the filters, that contains only the filters that - have been created by the user at some point (maybe in a previous session). - */ -QList<ILocatorFilter *> LocatorPlugin::customFilters() -{ - return m_customFilters; -} - -void LocatorPlugin::setFilters(QList<ILocatorFilter *> f) -{ - m_filters = f; - m_locatorWidget->updateFilterList(); -} - -void LocatorPlugin::setCustomFilters(QList<ILocatorFilter *> filters) -{ - m_customFilters = filters; -} - -int LocatorPlugin::refreshInterval() -{ - return m_refreshTimer.interval() / 60000; -} - -void LocatorPlugin::setRefreshInterval(int interval) -{ - if (interval < 1) { - m_refreshTimer.stop(); - m_refreshTimer.setInterval(0); - return; - } - m_refreshTimer.setInterval(interval * 60000); - m_refreshTimer.start(); -} - -void LocatorPlugin::refresh(QList<ILocatorFilter *> filters) -{ - if (filters.isEmpty()) - filters = m_filters; - QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters); - FutureProgress *progress = - ProgressManager::addTask(task, tr("Indexing"), Locator::Constants::TASK_INDEX); - connect(progress, SIGNAL(finished()), this, SLOT(saveSettings())); -} - -Q_EXPORT_PLUGIN(LocatorPlugin) +void dummyLocatorPlugin () {} diff --git a/src/plugins/macros/findmacrohandler.cpp b/src/plugins/macros/findmacrohandler.cpp index 4fe95088819..be7824019ae 100644 --- a/src/plugins/macros/findmacrohandler.cpp +++ b/src/plugins/macros/findmacrohandler.cpp @@ -32,11 +32,10 @@ #include "macro.h" #include "macrotextfind.h" -#include <find/ifindsupport.h> - #include <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/ieditor.h> +#include <coreplugin/find/ifindsupport.h> #include <aggregation/aggregate.h> @@ -79,32 +78,32 @@ bool FindMacroHandler::executeEvent(const MacroEvent ¯oEvent) if (!aggregate) return false; - Find::IFindSupport *currentFind = aggregate->component<Find::IFindSupport>(); + Core::IFindSupport *currentFind = aggregate->component<Core::IFindSupport>(); if (!currentFind) return false; switch (macroEvent.value(TYPE).toInt()) { case FINDINCREMENTAL: currentFind->findIncremental(macroEvent.value(BEFORE).toString(), - (Find::FindFlags)macroEvent.value(FLAGS).toInt()); + (Core::FindFlags)macroEvent.value(FLAGS).toInt()); break; case FINDSTEP: currentFind->findStep(macroEvent.value(BEFORE).toString(), - (Find::FindFlags)macroEvent.value(FLAGS).toInt()); + (Core::FindFlags)macroEvent.value(FLAGS).toInt()); break; case REPLACE: currentFind->replace(macroEvent.value(BEFORE).toString(), macroEvent.value(AFTER).toString(), - (Find::FindFlags)macroEvent.value(FLAGS).toInt()); + (Core::FindFlags)macroEvent.value(FLAGS).toInt()); case REPLACESTEP: currentFind->replaceStep(macroEvent.value(BEFORE).toString(), macroEvent.value(AFTER).toString(), - (Find::FindFlags)macroEvent.value(FLAGS).toInt()); + (Core::FindFlags)macroEvent.value(FLAGS).toInt()); break; case REPLACEALL: currentFind->replaceAll(macroEvent.value(BEFORE).toString(), macroEvent.value(AFTER).toString(), - (Find::FindFlags)macroEvent.value(FLAGS).toInt()); + (Core::FindFlags)macroEvent.value(FLAGS).toInt()); break; case RESET: currentFind->resetIncrementalSearch(); @@ -113,7 +112,7 @@ bool FindMacroHandler::executeEvent(const MacroEvent ¯oEvent) return true; } -void FindMacroHandler::findIncremental(const QString &txt, Find::FindFlags findFlags) +void FindMacroHandler::findIncremental(const QString &txt, Core::FindFlags findFlags) { if (!isRecording()) return; @@ -125,7 +124,7 @@ void FindMacroHandler::findIncremental(const QString &txt, Find::FindFlags findF addMacroEvent(e); } -void FindMacroHandler::findStep(const QString &txt, Find::FindFlags findFlags) +void FindMacroHandler::findStep(const QString &txt, Core::FindFlags findFlags) { if (!isRecording()) return; @@ -137,7 +136,7 @@ void FindMacroHandler::findStep(const QString &txt, Find::FindFlags findFlags) addMacroEvent(e); } -void FindMacroHandler::replace(const QString &before, const QString &after, Find::FindFlags findFlags) +void FindMacroHandler::replace(const QString &before, const QString &after, Core::FindFlags findFlags) { if (!isRecording()) return; @@ -150,7 +149,7 @@ void FindMacroHandler::replace(const QString &before, const QString &after, Find addMacroEvent(e); } -void FindMacroHandler::replaceStep(const QString &before, const QString &after, Find::FindFlags findFlags) +void FindMacroHandler::replaceStep(const QString &before, const QString &after, Core::FindFlags findFlags) { if (!isRecording()) return; @@ -163,7 +162,7 @@ void FindMacroHandler::replaceStep(const QString &before, const QString &after, addMacroEvent(e); } -void FindMacroHandler::replaceAll(const QString &before, const QString &after, Find::FindFlags findFlags) +void FindMacroHandler::replaceAll(const QString &before, const QString &after, Core::FindFlags findFlags) { if (!isRecording()) return; @@ -194,7 +193,7 @@ void FindMacroHandler::changeEditor(Core::IEditor *editor) Aggregation::Aggregate *aggregate = Aggregation::Aggregate::parentAggregate(editor->widget()); if (aggregate) { - Find::IFindSupport *currentFind = aggregate->component<Find::IFindSupport>(); + Core::IFindSupport *currentFind = aggregate->component<Core::IFindSupport>(); if (currentFind) { MacroTextFind *macroFind = qobject_cast<MacroTextFind *>(currentFind); if (macroFind) @@ -205,18 +204,18 @@ void FindMacroHandler::changeEditor(Core::IEditor *editor) aggregate->add(macroFind); // Connect all signals - connect(macroFind, SIGNAL(allReplaced(QString,QString,Find::FindFlags)), - this, SLOT(replaceAll(QString,QString,Find::FindFlags))); - connect(macroFind, SIGNAL(incrementalFound(QString,Find::FindFlags)), - this, SLOT(findIncremental(QString,Find::FindFlags))); + connect(macroFind, SIGNAL(allReplaced(QString,QString,Core::FindFlags)), + this, SLOT(replaceAll(QString,QString,Core::FindFlags))); + connect(macroFind, SIGNAL(incrementalFound(QString,Core::FindFlags)), + this, SLOT(findIncremental(QString,Core::FindFlags))); connect(macroFind, SIGNAL(incrementalSearchReseted()), this, SLOT(resetIncrementalSearch())); - connect(macroFind, SIGNAL(replaced(QString,QString,Find::FindFlags)), - this, SLOT(replace(QString,QString,Find::FindFlags))); - connect(macroFind, SIGNAL(stepFound(QString,Find::FindFlags)), - this, SLOT(findStep(QString,Find::FindFlags))); - connect(macroFind, SIGNAL(stepReplaced(QString,QString,Find::FindFlags)), - this, SLOT(replaceStep(QString,QString,Find::FindFlags))); + connect(macroFind, SIGNAL(replaced(QString,QString,Core::FindFlags)), + this, SLOT(replace(QString,QString,Core::FindFlags))); + connect(macroFind, SIGNAL(stepFound(QString,Core::FindFlags)), + this, SLOT(findStep(QString,Core::FindFlags))); + connect(macroFind, SIGNAL(stepReplaced(QString,QString,Core::FindFlags)), + this, SLOT(replaceStep(QString,QString,Core::FindFlags))); } } } diff --git a/src/plugins/macros/findmacrohandler.h b/src/plugins/macros/findmacrohandler.h index 7f35f1adfd4..33a68e5766d 100644 --- a/src/plugins/macros/findmacrohandler.h +++ b/src/plugins/macros/findmacrohandler.h @@ -32,7 +32,7 @@ #include "imacrohandler.h" -#include <find/textfindconstants.h> +#include <coreplugin/find/textfindconstants.h> namespace Core { class IEditor; @@ -54,11 +54,11 @@ public: bool executeEvent(const MacroEvent ¯oEvent); public slots: - void findIncremental(const QString &txt, Find::FindFlags findFlags); - void findStep(const QString &txt, Find::FindFlags findFlags); - void replace(const QString &before, const QString &after, Find::FindFlags findFlags); - void replaceStep(const QString &before, const QString &after, Find::FindFlags findFlags); - void replaceAll(const QString &before, const QString &after, Find::FindFlags findFlags); + void findIncremental(const QString &txt, Core::FindFlags findFlags); + void findStep(const QString &txt, Core::FindFlags findFlags); + void replace(const QString &before, const QString &after, Core::FindFlags findFlags); + void replaceStep(const QString &before, const QString &after, Core::FindFlags findFlags); + void replaceAll(const QString &before, const QString &after, Core::FindFlags findFlags); void resetIncrementalSearch(); private slots: diff --git a/src/plugins/macros/macrolocatorfilter.cpp b/src/plugins/macros/macrolocatorfilter.cpp index e1cd889445d..e63f1f090ed 100644 --- a/src/plugins/macros/macrolocatorfilter.cpp +++ b/src/plugins/macros/macrolocatorfilter.cpp @@ -52,11 +52,11 @@ MacroLocatorFilter::~MacroLocatorFilter() { } -QList<Locator::FilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) +QList<Core::LocatorFilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) { Q_UNUSED(future) - QList<Locator::FilterEntry> goodEntries; - QList<Locator::FilterEntry> betterEntries; + QList<Core::LocatorFilterEntry> goodEntries; + QList<Core::LocatorFilterEntry> betterEntries; const Qt::CaseSensitivity caseSensitivity_ = caseSensitivity(entry); @@ -67,7 +67,7 @@ QList<Locator::FilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<Loca it.next(); QString name = it.key(); - QList<Locator::FilterEntry> *category = 0; + QList<Core::LocatorFilterEntry> *category = 0; if (name.startsWith(entry, caseSensitivity_)) category = &betterEntries; else if (name.contains(entry, caseSensitivity_)) @@ -75,7 +75,7 @@ QList<Locator::FilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<Loca if (category) { QVariant id; - Locator::FilterEntry entry(this, it.key(), id, m_icon); + Core::LocatorFilterEntry entry(this, it.key(), id, m_icon); entry.extraInfo = it.value()->description(); category->append(entry); } @@ -84,7 +84,7 @@ QList<Locator::FilterEntry> MacroLocatorFilter::matchesFor(QFutureInterface<Loca return betterEntries; } -void MacroLocatorFilter::accept(Locator::FilterEntry selection) const +void MacroLocatorFilter::accept(Core::LocatorFilterEntry selection) const { // Give the focus back to the editor Core::IEditor *editor = Core::EditorManager::currentEditor(); diff --git a/src/plugins/macros/macrolocatorfilter.h b/src/plugins/macros/macrolocatorfilter.h index 40a685d746f..700a597f097 100644 --- a/src/plugins/macros/macrolocatorfilter.h +++ b/src/plugins/macros/macrolocatorfilter.h @@ -30,7 +30,7 @@ #ifndef MACROSPLUGIN_MACROLOCATORFILTER_H #define MACROSPLUGIN_MACROLOCATORFILTER_H -#include <locator/ilocatorfilter.h> +#include <coreplugin/locator/ilocatorfilter.h> #include <QIcon> @@ -40,7 +40,7 @@ class MacroManager; namespace Internal { -class MacroLocatorFilter : public Locator::ILocatorFilter +class MacroLocatorFilter : public Core::ILocatorFilter { Q_OBJECT @@ -48,8 +48,8 @@ public: MacroLocatorFilter(); ~MacroLocatorFilter(); - 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); private: diff --git a/src/plugins/macros/macros.qbs b/src/plugins/macros/macros.qbs index b9e90960a06..f6dac5cb8f3 100644 --- a/src/plugins/macros/macros.qbs +++ b/src/plugins/macros/macros.qbs @@ -7,8 +7,6 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } - Depends { name: "Locator" } - Depends { name: "Find" } Depends { name: "TextEditor" } Depends { name: "app_version_header" } diff --git a/src/plugins/macros/macros_dependencies.pri b/src/plugins/macros/macros_dependencies.pri index 3ae94328b31..e7850c9d526 100644 --- a/src/plugins/macros/macros_dependencies.pri +++ b/src/plugins/macros/macros_dependencies.pri @@ -1,6 +1,4 @@ QTC_PLUGIN_NAME = Macros QTC_PLUGIN_DEPENDS += \ coreplugin \ - locator \ - find \ texteditor diff --git a/src/plugins/macros/macrotextfind.cpp b/src/plugins/macros/macrotextfind.cpp index b56a81cdd33..1aeef19113c 100644 --- a/src/plugins/macros/macrotextfind.cpp +++ b/src/plugins/macros/macrotextfind.cpp @@ -34,8 +34,8 @@ using namespace Macros; using namespace Macros::Internal; -MacroTextFind::MacroTextFind(Find::IFindSupport *currentFind): - Find::IFindSupport(), +MacroTextFind::MacroTextFind(Core::IFindSupport *currentFind): + Core::IFindSupport(), m_currentFind(currentFind) { } @@ -46,7 +46,7 @@ bool MacroTextFind::supportsReplace() const return m_currentFind->supportsReplace(); } -Find::FindFlags MacroTextFind::supportedFindFlags() const +Core::FindFlags MacroTextFind::supportedFindFlags() const { QTC_ASSERT(m_currentFind, return 0); return m_currentFind->supportedFindFlags(); @@ -77,38 +77,38 @@ QString MacroTextFind::completedFindString() const return m_currentFind->completedFindString(); } -void MacroTextFind::highlightAll(const QString &txt, Find::FindFlags findFlags) +void MacroTextFind::highlightAll(const QString &txt, Core::FindFlags findFlags) { QTC_ASSERT(m_currentFind, return); m_currentFind->highlightAll(txt, findFlags); } -Find::IFindSupport::Result MacroTextFind::findIncremental(const QString &txt, Find::FindFlags findFlags) +Core::IFindSupport::Result MacroTextFind::findIncremental(const QString &txt, Core::FindFlags findFlags) { QTC_ASSERT(m_currentFind, return IFindSupport::NotFound); - Find::IFindSupport::Result result = m_currentFind->findIncremental(txt, findFlags); + Core::IFindSupport::Result result = m_currentFind->findIncremental(txt, findFlags); if (result == Found) emit incrementalFound(txt, findFlags); return result; } -Find::IFindSupport::Result MacroTextFind::findStep(const QString &txt, Find::FindFlags findFlags) +Core::IFindSupport::Result MacroTextFind::findStep(const QString &txt, Core::FindFlags findFlags) { QTC_ASSERT(m_currentFind, return IFindSupport::NotFound); - Find::IFindSupport::Result result = m_currentFind->findStep(txt, findFlags); + Core::IFindSupport::Result result = m_currentFind->findStep(txt, findFlags); if (result == Found) emit stepFound(txt, findFlags); return result; } -void MacroTextFind::replace(const QString &before, const QString &after, Find::FindFlags findFlags) +void MacroTextFind::replace(const QString &before, const QString &after, Core::FindFlags findFlags) { QTC_ASSERT(m_currentFind, return); m_currentFind->replace(before, after, findFlags); emit replaced(before, after, findFlags); } -bool MacroTextFind::replaceStep(const QString &before, const QString &after, Find::FindFlags findFlags) +bool MacroTextFind::replaceStep(const QString &before, const QString &after, Core::FindFlags findFlags) { QTC_ASSERT(m_currentFind, return false); bool result = m_currentFind->replaceStep(before, after, findFlags); @@ -116,7 +116,7 @@ bool MacroTextFind::replaceStep(const QString &before, const QString &after, Fin return result; } -int MacroTextFind::replaceAll(const QString &before, const QString &after, Find::FindFlags findFlags) +int MacroTextFind::replaceAll(const QString &before, const QString &after, Core::FindFlags findFlags) { QTC_ASSERT(m_currentFind, return 0); int result = m_currentFind->replaceAll(before, after, findFlags); diff --git a/src/plugins/macros/macrotextfind.h b/src/plugins/macros/macrotextfind.h index f2e6fecb66e..f703664dfdd 100644 --- a/src/plugins/macros/macrotextfind.h +++ b/src/plugins/macros/macrotextfind.h @@ -30,50 +30,50 @@ #ifndef MACROSPLUGIN_MACROTEXTFIND_H #define MACROSPLUGIN_MACROTEXTFIND_H -#include <find/ifindsupport.h> +#include <coreplugin/find/ifindsupport.h> #include <QPointer> namespace Macros { namespace Internal { -class MacroTextFind : public Find::IFindSupport +class MacroTextFind : public Core::IFindSupport { Q_OBJECT public: - MacroTextFind(Find::IFindSupport *currentFind); + MacroTextFind(Core::IFindSupport *currentFind); bool supportsReplace() const; - Find::FindFlags supportedFindFlags() const; + Core::FindFlags supportedFindFlags() const; void resetIncrementalSearch(); void clearResults(); QString currentFindString() const; QString completedFindString() const; - void highlightAll(const QString &txt, Find::FindFlags findFlags); - Find::IFindSupport::Result findIncremental(const QString &txt, Find::FindFlags findFlags); - Find::IFindSupport::Result findStep(const QString &txt, Find::FindFlags findFlags); - void replace(const QString &before, const QString &after, Find::FindFlags findFlags); - bool replaceStep(const QString &before, const QString &after, Find::FindFlags findFlags); - int replaceAll(const QString &before, const QString &after, Find::FindFlags findFlags); + void highlightAll(const QString &txt, Core::FindFlags findFlags); + Core::IFindSupport::Result findIncremental(const QString &txt, Core::FindFlags findFlags); + Core::IFindSupport::Result findStep(const QString &txt, Core::FindFlags findFlags); + void replace(const QString &before, const QString &after, Core::FindFlags findFlags); + bool replaceStep(const QString &before, const QString &after, Core::FindFlags findFlags); + int replaceAll(const QString &before, const QString &after, Core::FindFlags findFlags); void defineFindScope(); void clearFindScope(); signals: void incrementalSearchReseted(); - void incrementalFound(const QString &txt, Find::FindFlags findFlags); - void stepFound(const QString &txt, Find::FindFlags findFlags); + void incrementalFound(const QString &txt, Core::FindFlags findFlags); + void stepFound(const QString &txt, Core::FindFlags findFlags); void replaced(const QString &before, const QString &after, - Find::FindFlags findFlags); + Core::FindFlags findFlags); void stepReplaced(const QString &before, const QString &after, - Find::FindFlags findFlags); + Core::FindFlags findFlags); void allReplaced(const QString &before, const QString &after, - Find::FindFlags findFlags); + Core::FindFlags findFlags); private: - QPointer<Find::IFindSupport> m_currentFind; + QPointer<Core::IFindSupport> m_currentFind; }; } // namespace Internal diff --git a/src/plugins/mercurial/mercurial.qbs b/src/plugins/mercurial/mercurial.qbs index 80611787e7e..e6fec9fbedc 100644 --- a/src/plugins/mercurial/mercurial.qbs +++ b/src/plugins/mercurial/mercurial.qbs @@ -8,9 +8,7 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "VcsBase" } - Depends { name: "Locator" } files: [ "annotationhighlighter.cpp", diff --git a/src/plugins/mercurial/mercurial_dependencies.pri b/src/plugins/mercurial/mercurial_dependencies.pri index 8de4e4595d4..de8a0df27ac 100644 --- a/src/plugins/mercurial/mercurial_dependencies.pri +++ b/src/plugins/mercurial/mercurial_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Mercurial QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ texteditor \ coreplugin \ vcsbase diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index 8814c4f0eba..eac981f3b38 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -49,7 +49,7 @@ #include <coreplugin/documentmanager.h> #include <coreplugin/editormanager/editormanager.h> -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <utils/parameteraction.h> #include <utils/qtcassert.h> @@ -152,7 +152,7 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * addAutoReleasedObject(new CloneWizard); const QString prefix = QLatin1String("hg"); - m_commandLocator = new Locator::CommandLocator("Mercurial", prefix, prefix); + m_commandLocator = new Core::CommandLocator("Mercurial", prefix, prefix); addAutoReleasedObject(m_commandLocator); createMenu(); diff --git a/src/plugins/mercurial/mercurialplugin.h b/src/plugins/mercurial/mercurialplugin.h index 7c5ab3d2031..12676a99315 100644 --- a/src/plugins/mercurial/mercurialplugin.h +++ b/src/plugins/mercurial/mercurialplugin.h @@ -43,6 +43,7 @@ QT_END_NAMESPACE namespace Core { class ActionContainer; class ActionManager; +class CommandLocator; class ICore; class Id; class IEditor; @@ -50,7 +51,6 @@ class IEditor; namespace Utils { class ParameterAction; } namespace VcsBase { class VcsBaseSubmitEditor; } -namespace Locator { class CommandLocator; } namespace Mercurial { namespace Internal { @@ -143,7 +143,7 @@ private: MercurialClient *m_client; Core::ICore *core; - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; Core::ActionContainer *mercurialContainer; QList<QAction *> m_repositoryActionList; diff --git a/src/plugins/perforce/perforce.qbs b/src/plugins/perforce/perforce.qbs index 9bc46fcee5c..155da2891f0 100644 --- a/src/plugins/perforce/perforce.qbs +++ b/src/plugins/perforce/perforce.qbs @@ -8,9 +8,7 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "VcsBase" } - Depends { name: "Locator" } files: [ "annotationhighlighter.cpp", diff --git a/src/plugins/perforce/perforce_dependencies.pri b/src/plugins/perforce/perforce_dependencies.pri index 7e46fc79903..dca91be311c 100644 --- a/src/plugins/perforce/perforce_dependencies.pri +++ b/src/plugins/perforce/perforce_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Perforce QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ texteditor \ coreplugin \ vcsbase diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 99693b74ebb..cad43e661fa 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -48,7 +48,7 @@ #include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> #include <coreplugin/mimedatabase.h> -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <utils/qtcassert.h> #include <utils/synchronousprocess.h> #include <utils/parameteraction.h> @@ -226,7 +226,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er addAutoReleasedObject(new PerforceEditorFactory(editorParameters + i, this, describeSlot)); const QString prefix = QLatin1String("p4"); - m_commandLocator = new Locator::CommandLocator("Perforce", prefix, prefix); + m_commandLocator = new Core::CommandLocator("Perforce", prefix, prefix); addAutoReleasedObject(m_commandLocator); Core::ActionContainer *mtools = diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h index 7337181b223..9b6b48ca4de 100644 --- a/src/plugins/perforce/perforceplugin.h +++ b/src/plugins/perforce/perforceplugin.h @@ -53,7 +53,7 @@ namespace Utils { class TempFileSaver; } -namespace Locator { +namespace Core { class CommandLocator; } @@ -203,7 +203,7 @@ private: static PerforceVersionControl *perforceVersionControl(); - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; Utils::ParameterAction *m_editAction; Utils::ParameterAction *m_addAction; Utils::ParameterAction *m_deleteAction; diff --git a/src/plugins/projectexplorer/allprojectsfilter.cpp b/src/plugins/projectexplorer/allprojectsfilter.cpp index 0c45806127d..fe1e30b875b 100644 --- a/src/plugins/projectexplorer/allprojectsfilter.cpp +++ b/src/plugins/projectexplorer/allprojectsfilter.cpp @@ -33,7 +33,6 @@ #include "project.h" using namespace Core; -using namespace Locator; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; diff --git a/src/plugins/projectexplorer/allprojectsfilter.h b/src/plugins/projectexplorer/allprojectsfilter.h index 38dae1ae148..0e5b79b5617 100644 --- a/src/plugins/projectexplorer/allprojectsfilter.h +++ b/src/plugins/projectexplorer/allprojectsfilter.h @@ -30,14 +30,14 @@ #ifndef ALLPROJECTSFILTER_H #define ALLPROJECTSFILTER_H -#include <locator/basefilefilter.h> +#include <coreplugin/locator/basefilefilter.h> #include <QFutureInterface> namespace ProjectExplorer { namespace Internal { -class AllProjectsFilter : public Locator::BaseFileFilter +class AllProjectsFilter : public Core::BaseFileFilter { Q_OBJECT diff --git a/src/plugins/projectexplorer/allprojectsfind.cpp b/src/plugins/projectexplorer/allprojectsfind.cpp index cc93ff2af2b..d248fd454c2 100644 --- a/src/plugins/projectexplorer/allprojectsfind.cpp +++ b/src/plugins/projectexplorer/allprojectsfind.cpp @@ -43,7 +43,6 @@ #include <QGridLayout> #include <QLabel> -using namespace Find; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; using namespace TextEditor; diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 6765d81689b..38a0858fece 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -36,7 +36,7 @@ #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/outputwindow.h> -#include <find/basetextfind.h> +#include <coreplugin/find/basetextfind.h> #include <texteditor/fontsettings.h> #include <texteditor/texteditorsettings.h> #include <extensionsystem/pluginmanager.h> @@ -331,7 +331,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) ow->setMaxLineCount(ProjectExplorerPlugin::projectExplorerSettings().maxAppOutputLines); Aggregation::Aggregate *agg = new Aggregation::Aggregate; agg->add(ow); - agg->add(new Find::BaseTextFind(ow)); + agg->add(new Core::BaseTextFind(ow)); m_runControlTabs.push_back(RunControlTab(rc, ow)); m_tabWidget->addTab(ow, rc->displayName()); if (debug) diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 539ad34f45b..75df27230c6 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -36,7 +36,7 @@ #include "taskhub.h" #include <coreplugin/outputwindow.h> -#include <find/basetextfind.h> +#include <coreplugin/find/basetextfind.h> #include <extensionsystem/pluginmanager.h> #include <texteditor/texteditorsettings.h> #include <texteditor/fontsettings.h> @@ -127,7 +127,7 @@ CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/, QAction *cancelB Aggregation::Aggregate *agg = new Aggregation::Aggregate; agg->add(m_outputWindow); - agg->add(new Find::BaseTextFind(m_outputWindow)); + agg->add(new Core::BaseTextFind(m_outputWindow)); qRegisterMetaType<QTextCharFormat>("QTextCharFormat"); diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp index 0d05f8ff910..dabee908b71 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.cpp +++ b/src/plugins/projectexplorer/currentprojectfilter.cpp @@ -34,7 +34,6 @@ #include <QDebug> using namespace Core; -using namespace Locator; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; diff --git a/src/plugins/projectexplorer/currentprojectfilter.h b/src/plugins/projectexplorer/currentprojectfilter.h index f932b5aa207..25fe85a8acc 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.h +++ b/src/plugins/projectexplorer/currentprojectfilter.h @@ -30,7 +30,7 @@ #ifndef CURRENTPROJECTFILTER_H #define CURRENTPROJECTFILTER_H -#include <locator/basefilefilter.h> +#include <coreplugin/locator/basefilefilter.h> #include <QFutureInterface> @@ -40,7 +40,7 @@ class Project; namespace Internal { -class CurrentProjectFilter : public Locator::BaseFileFilter +class CurrentProjectFilter : public Core::BaseFileFilter { Q_OBJECT diff --git a/src/plugins/projectexplorer/currentprojectfind.cpp b/src/plugins/projectexplorer/currentprojectfind.cpp index c0b89a8bfba..8b7fce47782 100644 --- a/src/plugins/projectexplorer/currentprojectfind.cpp +++ b/src/plugins/projectexplorer/currentprojectfind.cpp @@ -39,7 +39,6 @@ #include <QDebug> #include <QSettings> -using namespace Find; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; using namespace TextEditor; @@ -103,7 +102,7 @@ void CurrentProjectFind::handleProjectChanged() void CurrentProjectFind::recheckEnabled() { - SearchResult *search = qobject_cast<SearchResult *>(sender()); + Core::SearchResult *search = qobject_cast<Core::SearchResult *>(sender()); if (!search) return; QString projectFile = getAdditionalParameters(search).toString(); diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 4e836e0cd48..1ca24358ed4 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -38,8 +38,8 @@ #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/fileutils.h> +#include <coreplugin/find/findplugin.h> -#include <find/findplugin.h> #include <texteditor/findinfiles.h> #include <utils/hostosinfo.h> diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 1a10feb66d6..5f8abc5ae1e 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -9,8 +9,6 @@ QtcPlugin { Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "script"] } Depends { name: "Qt.quick"; condition: QtcFunctions.versionIsAtLeast(Qt.core.version, "5.1"); } Depends { name: "Core" } - Depends { name: "Locator" } - Depends { name: "Find" } Depends { name: "TextEditor" } Depends { name: "QtcSsh" } diff --git a/src/plugins/projectexplorer/projectexplorer_dependencies.pri b/src/plugins/projectexplorer/projectexplorer_dependencies.pri index f970e87607c..ab0a5facc4e 100644 --- a/src/plugins/projectexplorer/projectexplorer_dependencies.pri +++ b/src/plugins/projectexplorer/projectexplorer_dependencies.pri @@ -3,8 +3,6 @@ QTC_LIB_DEPENDS += \ ssh \ utils QTC_PLUGIN_DEPENDS += \ - locator \ - find \ coreplugin \ texteditor QT *= network diff --git a/src/plugins/qmljseditor/qmljseditor.qbs b/src/plugins/qmljseditor/qmljseditor.qbs index 7284d2a3422..0ebd66d2a74 100644 --- a/src/plugins/qmljseditor/qmljseditor.qbs +++ b/src/plugins/qmljseditor/qmljseditor.qbs @@ -12,7 +12,6 @@ QtcPlugin { Depends { name: "QmlJSTools" } Depends { name: "QmlJS" } Depends { name: "LanguageUtils" } - Depends { name: "Find" } Depends { name: "QmlEditorWidgets" } Depends { name: "CPlusPlus" } diff --git a/src/plugins/qmljseditor/qmljseditor_dependencies.pri b/src/plugins/qmljseditor/qmljseditor_dependencies.pri index 481638aa2a9..56134f03348 100644 --- a/src/plugins/qmljseditor/qmljseditor_dependencies.pri +++ b/src/plugins/qmljseditor/qmljseditor_dependencies.pri @@ -4,7 +4,6 @@ QTC_LIB_DEPENDS += \ qmleditorwidgets QTC_PLUGIN_DEPENDS += \ coreplugin \ - find \ texteditor \ projectexplorer \ qmljstools diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 7dc4179aa2c..f4162da0c7e 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -30,7 +30,7 @@ #include "qmljsfindreferences.h" #include <texteditor/basefilefind.h> -#include <find/searchresultwindow.h> +#include <coreplugin/find/searchresultwindow.h> #include <extensionsystem/pluginmanager.h> #include <utils/filesearch.h> #include <coreplugin/progressmanager/progressmanager.h> @@ -925,20 +925,20 @@ void FindReferences::displayResults(int first, int last) const QString label = tr("QML/JS Usages:"); if (replacement.isEmpty()) { - m_currentSearch = Find::SearchResultWindow::instance()->startNewSearch( - label, QString(), symbolName, Find::SearchResultWindow::SearchOnly); + m_currentSearch = Core::SearchResultWindow::instance()->startNewSearch( + label, QString(), symbolName, Core::SearchResultWindow::SearchOnly); } else { - m_currentSearch = Find::SearchResultWindow::instance()->startNewSearch( - label, QString(), symbolName, Find::SearchResultWindow::SearchAndReplace); + m_currentSearch = Core::SearchResultWindow::instance()->startNewSearch( + label, QString(), symbolName, Core::SearchResultWindow::SearchAndReplace); m_currentSearch->setTextToReplace(replacement); - connect(m_currentSearch, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)), - SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>,bool))); + connect(m_currentSearch, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), + SLOT(onReplaceButtonClicked(QString,QList<Core::SearchResultItem>,bool))); } - connect(m_currentSearch, SIGNAL(activated(Find::SearchResultItem)), - this, SLOT(openEditor(Find::SearchResultItem))); + connect(m_currentSearch, SIGNAL(activated(Core::SearchResultItem)), + this, SLOT(openEditor(Core::SearchResultItem))); connect(m_currentSearch, SIGNAL(cancelled()), this, SLOT(cancel())); connect(m_currentSearch, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); - Find::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch | IOutputPane::WithFocus)); + Core::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch | IOutputPane::WithFocus)); FutureProgress *progress = ProgressManager::addTask( m_watcher.future(), tr("Searching"), @@ -981,7 +981,7 @@ void FindReferences::setPaused(bool paused) m_watcher.setPaused(paused); } -void FindReferences::openEditor(const Find::SearchResultItem &item) +void FindReferences::openEditor(const Core::SearchResultItem &item) { if (item.path.size() > 0) { EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), @@ -991,7 +991,7 @@ void FindReferences::openEditor(const Find::SearchResultItem &item) } } -void FindReferences::onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items, bool preserveCase) +void FindReferences::onReplaceButtonClicked(const QString &text, const QList<Core::SearchResultItem> &items, bool preserveCase) { const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase); @@ -1011,5 +1011,5 @@ void FindReferences::onReplaceButtonClicked(const QString &text, const QList<Fin if (!changedUnsavedEditors.isEmpty()) QmlJS::ModelManagerInterface::instance()->updateSourceFiles(changedUnsavedEditors, false); - Find::SearchResultWindow::instance()->hide(); + Core::SearchResultWindow::instance()->hide(); } diff --git a/src/plugins/qmljseditor/qmljsfindreferences.h b/src/plugins/qmljseditor/qmljsfindreferences.h index f4d3dc6c55c..a9fcd38de9a 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.h +++ b/src/plugins/qmljseditor/qmljsfindreferences.h @@ -40,10 +40,10 @@ QT_FORWARD_DECLARE_CLASS(QTimer) -namespace Find { +namespace Core { class SearchResultItem; class SearchResult; -} // namespace Find +} // namespace Core namespace QmlJSEditor { @@ -85,11 +85,11 @@ private Q_SLOTS: void searchFinished(); void cancel(); void setPaused(bool paused); - void openEditor(const Find::SearchResultItem &item); - void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items, bool preserveCase); + void openEditor(const Core::SearchResultItem &item); + void onReplaceButtonClicked(const QString &text, const QList<Core::SearchResultItem> &items, bool preserveCase); private: - QPointer<Find::SearchResult> m_currentSearch; + QPointer<Core::SearchResult> m_currentSearch; QFutureWatcher<Usage> m_watcher; }; diff --git a/src/plugins/qmljstools/qmlconsolepane.cpp b/src/plugins/qmljstools/qmlconsolepane.cpp index c55ecdfd31c..6f5c0f26d2f 100644 --- a/src/plugins/qmljstools/qmlconsolepane.cpp +++ b/src/plugins/qmljstools/qmlconsolepane.cpp @@ -36,7 +36,7 @@ #include <coreplugin/findplaceholder.h> #include <utils/savedaction.h> #include <aggregation/aggregate.h> -#include <find/treeviewfind.h> +#include <coreplugin/find/treeviewfind.h> #include <QToolButton> #include <QLabel> @@ -95,7 +95,7 @@ QmlConsolePane::QmlConsolePane(QObject *parent) Aggregation::Aggregate *aggregate = new Aggregation::Aggregate(); aggregate->add(m_consoleView); - aggregate->add(new Find::TreeViewFind(m_consoleView)); + aggregate->add(new Core::TreeViewFind(m_consoleView)); vbox->addWidget(m_consoleView); vbox->addWidget(new Core::FindToolBarPlaceHolder(m_consoleWidget)); diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.cpp b/src/plugins/qmljstools/qmljsfunctionfilter.cpp index 9da8cc3c683..32e709b5627 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.cpp +++ b/src/plugins/qmljstools/qmljsfunctionfilter.cpp @@ -39,7 +39,7 @@ using namespace QmlJSTools::Internal; Q_DECLARE_METATYPE(LocatorData::Entry) FunctionFilter::FunctionFilter(LocatorData *data, QObject *parent) - : Locator::ILocatorFilter(parent) + : Core::ILocatorFilter(parent) , m_data(data) { setId("Functions"); @@ -55,17 +55,17 @@ void FunctionFilter::refresh(QFutureInterface<void> &) { } -static bool compareLexigraphically(const Locator::FilterEntry &a, - const Locator::FilterEntry &b) +static bool compareLexigraphically(const Core::LocatorFilterEntry &a, + const Core::LocatorFilterEntry &b) { return a.displayName < b.displayName; } -QList<Locator::FilterEntry> FunctionFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &origEntry) +QList<Core::LocatorFilterEntry> FunctionFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &origEntry) { QString entry = trimWildcards(origEntry); - QList<Locator::FilterEntry> goodEntries; - QList<Locator::FilterEntry> betterEntries; + QList<Core::LocatorFilterEntry> goodEntries; + QList<Core::LocatorFilterEntry> betterEntries; const QChar asterisk = QLatin1Char('*'); QStringMatcher matcher(entry, Qt::CaseInsensitive); QRegExp regexp(asterisk + entry+ asterisk, Qt::CaseInsensitive, QRegExp::Wildcard); @@ -89,7 +89,7 @@ QList<Locator::FilterEntry> FunctionFilter::matchesFor(QFutureInterface<Locator: || (!hasWildcard && matcher.indexIn(info.symbolName) != -1)) { QVariant id = qVariantFromValue(info); - Locator::FilterEntry filterEntry(this, info.displayName, id/*, info.icon*/); + Core::LocatorFilterEntry filterEntry(this, info.displayName, id/*, info.icon*/); filterEntry.extraInfo = info.extraInfo; if (info.symbolName.startsWith(entry, caseSensitivityForPrefix)) @@ -109,7 +109,7 @@ QList<Locator::FilterEntry> FunctionFilter::matchesFor(QFutureInterface<Locator: return betterEntries; } -void FunctionFilter::accept(Locator::FilterEntry selection) const +void FunctionFilter::accept(Core::LocatorFilterEntry selection) const { const LocatorData::Entry entry = qvariant_cast<LocatorData::Entry>(selection.internalData); Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column); diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.h b/src/plugins/qmljstools/qmljsfunctionfilter.h index ee7d468c1d8..5728a46c6cf 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.h +++ b/src/plugins/qmljstools/qmljsfunctionfilter.h @@ -30,14 +30,14 @@ #ifndef QMLJSFUNCTIONFILTER_H #define QMLJSFUNCTIONFILTER_H -#include <locator/ilocatorfilter.h> +#include <coreplugin/locator/ilocatorfilter.h> namespace QmlJSTools { namespace Internal { class LocatorData; -class FunctionFilter : public Locator::ILocatorFilter +class FunctionFilter : public Core::ILocatorFilter { Q_OBJECT @@ -45,8 +45,8 @@ public: explicit FunctionFilter(LocatorData *data, QObject *parent = 0); ~FunctionFilter(); - 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); private: diff --git a/src/plugins/qmljstools/qmljstools.qbs b/src/plugins/qmljstools/qmljstools.qbs index 629cef4a153..ffbd0624322 100644 --- a/src/plugins/qmljstools/qmljstools.qbs +++ b/src/plugins/qmljstools/qmljstools.qbs @@ -12,7 +12,6 @@ QtcPlugin { Depends { name: "QmlJS" } Depends { name: "ProjectExplorer" } Depends { name: "TextEditor" } - Depends { name: "Locator" } Depends { name: "QmlDebug" } Depends { name: "QtSupport" } diff --git a/src/plugins/qmljstools/qmljstools_dependencies.pri b/src/plugins/qmljstools/qmljstools_dependencies.pri index 2dd8e9b1c66..198ce543edd 100644 --- a/src/plugins/qmljstools/qmljstools_dependencies.pri +++ b/src/plugins/qmljstools/qmljstools_dependencies.pri @@ -5,8 +5,6 @@ QTC_LIB_DEPENDS += \ qmljs QTC_PLUGIN_DEPENDS += \ coreplugin \ - find \ - locator \ projectexplorer \ qtsupport \ texteditor \ diff --git a/src/plugins/resourceeditor/resourceeditor.qbs b/src/plugins/resourceeditor/resourceeditor.qbs index bac08834000..193c9b75133 100644 --- a/src/plugins/resourceeditor/resourceeditor.qbs +++ b/src/plugins/resourceeditor/resourceeditor.qbs @@ -6,7 +6,6 @@ QtcPlugin { name: "ResourceEditor" Depends { name: "Core" } - Depends { name: "Find" } Depends { name: "Qt"; submodules: ["widgets", "xml"] } Group { diff --git a/src/plugins/resourceeditor/resourceeditor_dependencies.pri b/src/plugins/resourceeditor/resourceeditor_dependencies.pri index 753971d6dbe..8a82e801cfc 100644 --- a/src/plugins/resourceeditor/resourceeditor_dependencies.pri +++ b/src/plugins/resourceeditor/resourceeditor_dependencies.pri @@ -3,4 +3,3 @@ QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ coreplugin \ - find diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index ada5cdc8f24..36ce8a14a1f 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -39,7 +39,7 @@ #include <coreplugin/actionmanager/commandbutton.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/documentmanager.h> -#include <find/treeviewfind.h> +#include <coreplugin/find/treeviewfind.h> #include <utils/reloadpromptutils.h> #include <utils/fileutils.h> @@ -97,7 +97,7 @@ ResourceEditorW::ResourceEditorW(const Core::Context &context, Aggregation::Aggregate * agg = new Aggregation::Aggregate; agg->add(m_resourceEditor->treeView()); - agg->add(new Find::TreeViewFind(m_resourceEditor->treeView())); + agg->add(new Core::TreeViewFind(m_resourceEditor->treeView())); m_resourceEditor->setResourceDragEnabled(true); m_contextMenu->addAction(tr("Open File"), this, SLOT(openCurrentFile())); diff --git a/src/plugins/subversion/subversion.qbs b/src/plugins/subversion/subversion.qbs index 6c3c48286f0..b92fff54f35 100644 --- a/src/plugins/subversion/subversion.qbs +++ b/src/plugins/subversion/subversion.qbs @@ -8,9 +8,7 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "TextEditor" } - Depends { name: "Find" } Depends { name: "VcsBase" } - Depends { name: "Locator" } files: [ "annotationhighlighter.cpp", diff --git a/src/plugins/subversion/subversion_dependencies.pri b/src/plugins/subversion/subversion_dependencies.pri index 297af991b6d..87e1a57ad59 100644 --- a/src/plugins/subversion/subversion_dependencies.pri +++ b/src/plugins/subversion/subversion_dependencies.pri @@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Subversion QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - locator \ texteditor \ coreplugin \ vcsbase diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index cc068dd144a..e6faebde04a 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -59,7 +59,7 @@ #include <coreplugin/id.h> #include <coreplugin/editormanager/editormanager.h> -#include <locator/commandlocator.h> +#include <coreplugin/locator/commandlocator.h> #include <utils/qtcassert.h> @@ -267,7 +267,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e addAutoReleasedObject(new CheckoutWizard); const QString prefix = QLatin1String("svn"); - m_commandLocator = new Locator::CommandLocator("Subversion", prefix, prefix); + m_commandLocator = new Core::CommandLocator("Subversion", prefix, prefix); addAutoReleasedObject(m_commandLocator); //register actions diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 77a1a6c7860..14e818156d8 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -42,6 +42,7 @@ class QTextCodec; QT_END_NAMESPACE namespace Core { + class CommandLocator; class IVersionControl; class IEditor; } @@ -53,10 +54,6 @@ namespace VcsBase { class VcsBaseSubmitEditor; } -namespace Locator { - class CommandLocator; -} - namespace Subversion { namespace Internal { @@ -170,7 +167,7 @@ private: QString m_commitMessageFileName; QString m_commitRepository; - Locator::CommandLocator *m_commandLocator; + Core::CommandLocator *m_commandLocator; Utils::ParameterAction *m_addAction; Utils::ParameterAction *m_deleteAction; Utils::ParameterAction *m_revertAction; diff --git a/src/plugins/tasklist/tasklist.qbs b/src/plugins/tasklist/tasklist.qbs index 8374262e75b..ef105ea216c 100644 --- a/src/plugins/tasklist/tasklist.qbs +++ b/src/plugins/tasklist/tasklist.qbs @@ -8,8 +8,6 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Core" } Depends { name: "ProjectExplorer" } - Depends { name: "Find" } - Depends { name: "Locator" } Depends { name: "TextEditor" } files: [ diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index cb5d71fdd26..d6ad2f18abc 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -36,7 +36,7 @@ #include <coreplugin/progressmanager/futureprogress.h> #include <coreplugin/dialogs/readonlyfilesdialog.h> #include <coreplugin/documentmanager.h> -#include <find/ifindsupport.h> +#include <coreplugin/find/ifindsupport.h> #include <texteditor/itexteditor.h> #include <texteditor/refactoringchanges.h> #include <utils/stylehelper.h> @@ -56,27 +56,26 @@ namespace TextEditor { namespace Internal { -class BaseFileFindPrivate { + +class BaseFileFindPrivate +{ public: BaseFileFindPrivate() : m_resultLabel(0), m_filterCombo(0) {} - QMap<QFutureWatcher<Utils::FileSearchResultList> *, QPointer<Find::SearchResult> > m_watchers; - QPointer<Find::IFindSupport> m_currentFindSupport; + QMap<QFutureWatcher<Utils::FileSearchResultList> *, QPointer<Core::SearchResult> > m_watchers; + QPointer<Core::IFindSupport> m_currentFindSupport; QLabel *m_resultLabel; QStringListModel m_filterStrings; QString m_filterSetting; QPointer<QComboBox> m_filterCombo; }; + } // namespace Internal -} // namespace TextEditor -using namespace Core; +using namespace Internal; using namespace Utils; -using namespace Find; -using namespace TextEditor; -using namespace TextEditor::Internal; - +using namespace Core; BaseFileFind::BaseFileFind() : d(new BaseFileFindPrivate) { @@ -125,14 +124,14 @@ QStringList BaseFileFind::fileNameFilters() const return filters; } -void BaseFileFind::runNewSearch(const QString &txt, Find::FindFlags findFlags, +void BaseFileFind::runNewSearch(const QString &txt, Core::FindFlags findFlags, SearchResultWindow::SearchMode searchMode) { d->m_currentFindSupport = 0; if (d->m_filterCombo) updateComboEntries(d->m_filterCombo, true); - SearchResult *search = Find::SearchResultWindow::instance()->startNewSearch(label(), - toolTip().arg(Find::IFindFilter::descriptionForFindFlags(findFlags)), + SearchResult *search = Core::SearchResultWindow::instance()->startNewSearch(label(), + toolTip().arg(Core::IFindFilter::descriptionForFindFlags(findFlags)), txt, searchMode, QString::fromLatin1("TextEditor")); search->setTextToReplace(txt); search->setSearchAgainSupported(true); @@ -142,10 +141,10 @@ void BaseFileFind::runNewSearch(const QString &txt, Find::FindFlags findFlags, parameters.nameFilters = fileNameFilters(); parameters.additionalParameters = additionalParameters(); search->setUserData(qVariantFromValue(parameters)); - connect(search, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem))); + connect(search, SIGNAL(activated(Core::SearchResultItem)), this, SLOT(openEditor(Core::SearchResultItem))); if (searchMode == SearchResultWindow::SearchAndReplace) { - connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)), - this, SLOT(doReplace(QString,QList<Find::SearchResultItem>,bool))); + connect(search, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), + this, SLOT(doReplace(QString,QList<Core::SearchResultItem>,bool))); } connect(search, SIGNAL(visibilityChanged(bool)), this, SLOT(hideHighlightAll(bool))); connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); @@ -157,20 +156,20 @@ void BaseFileFind::runNewSearch(const QString &txt, Find::FindFlags findFlags, runSearch(search); } -void BaseFileFind::runSearch(Find::SearchResult *search) +void BaseFileFind::runSearch(Core::SearchResult *search) { FileFindParameters parameters = search->userData().value<FileFindParameters>(); CountingLabel *label = new CountingLabel; connect(search, SIGNAL(countChanged(int)), label, SLOT(updateCount(int))); CountingLabel *statusLabel = new CountingLabel; connect(search, SIGNAL(countChanged(int)), statusLabel, SLOT(updateCount(int))); - Find::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus)); + Core::SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus)); QFutureWatcher<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>(); d->m_watchers.insert(watcher, search); watcher->setPendingResultsLimit(1); connect(watcher, SIGNAL(resultReadyAt(int)), this, SLOT(displayResult(int))); connect(watcher, SIGNAL(finished()), this, SLOT(searchFinished())); - if (parameters.flags & Find::FindRegularExpression) { + if (parameters.flags & FindRegularExpression) { watcher->setFuture(Utils::findInFilesRegExp(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), @@ -188,24 +187,24 @@ void BaseFileFind::runSearch(Find::SearchResult *search) connect(progress, SIGNAL(clicked()), search, SLOT(popup())); } -void BaseFileFind::findAll(const QString &txt, Find::FindFlags findFlags) +void BaseFileFind::findAll(const QString &txt, Core::FindFlags findFlags) { runNewSearch(txt, findFlags, SearchResultWindow::SearchOnly); } -void BaseFileFind::replaceAll(const QString &txt, Find::FindFlags findFlags) +void BaseFileFind::replaceAll(const QString &txt, Core::FindFlags findFlags) { runNewSearch(txt, findFlags, SearchResultWindow::SearchAndReplace); } void BaseFileFind::doReplace(const QString &text, - const QList<Find::SearchResultItem> &items, + const QList<Core::SearchResultItem> &items, bool preserveCase) { QStringList files = replaceAll(text, items, preserveCase); if (!files.isEmpty()) { DocumentManager::notifyFilesChangedInternally(files); - Find::SearchResultWindow::instance()->hide(); + Core::SearchResultWindow::instance()->hide(); } } @@ -219,9 +218,9 @@ void BaseFileFind::displayResult(int index) { return; } Utils::FileSearchResultList results = watcher->resultAt(index); - QList<Find::SearchResultItem> items; + QList<Core::SearchResultItem> items; foreach (const Utils::FileSearchResult &result, results) { - Find::SearchResultItem item; + Core::SearchResultItem item; item.path = QStringList() << QDir::toNativeSeparators(result.fileName); item.lineNumber = result.lineNumber; item.text = result.matchingLine; @@ -231,7 +230,7 @@ void BaseFileFind::displayResult(int index) { item.userData = result.regexpCapturedTexts; items << item; } - search->addResults(items, Find::SearchResult::AddOrdered); + search->addResults(items, Core::SearchResult::AddOrdered); } void BaseFileFind::searchFinished() @@ -304,7 +303,7 @@ void BaseFileFind::updateComboEntries(QComboBox *combo, bool onTop) } } -void BaseFileFind::openEditor(const Find::SearchResultItem &item) +void BaseFileFind::openEditor(const Core::SearchResultItem &item) { SearchResult *result = qobject_cast<SearchResult *>(sender()); IEditor *openedEditor = 0; @@ -352,7 +351,7 @@ void BaseFileFind::recheckEnabled() } QStringList BaseFileFind::replaceAll(const QString &text, - const QList<Find::SearchResultItem> &items, + const QList<Core::SearchResultItem> &items, bool preserveCase) { if (items.isEmpty()) @@ -360,12 +359,12 @@ QStringList BaseFileFind::replaceAll(const QString &text, RefactoringChanges refactoring; - QHash<QString, QList<Find::SearchResultItem> > changes; - foreach (const Find::SearchResultItem &item, items) + QHash<QString, QList<Core::SearchResultItem> > changes; + foreach (const Core::SearchResultItem &item, items) changes[QDir::fromNativeSeparators(item.path.first())].append(item); // Checking for files without write permissions - QHashIterator<QString, QList<Find::SearchResultItem> > it(changes); + QHashIterator<QString, QList<Core::SearchResultItem> > it(changes); QSet<QString> roFiles; while (it.hasNext()) { it.next(); @@ -386,12 +385,12 @@ QStringList BaseFileFind::replaceAll(const QString &text, while (it.hasNext()) { it.next(); const QString fileName = it.key(); - const QList<Find::SearchResultItem> changeItems = it.value(); + const QList<Core::SearchResultItem> changeItems = it.value(); ChangeSet changeSet; RefactoringFilePtr file = refactoring.file(fileName); QSet<QPair<int, int> > processed; - foreach (const Find::SearchResultItem &item, changeItems) { + foreach (const Core::SearchResultItem &item, changeItems) { const QPair<int, int> &p = qMakePair(item.lineNumber, item.textMarkPos); if (processed.contains(p)) continue; @@ -441,3 +440,5 @@ void CountingLabel::updateCount(int count) { setText(tr("%1 found").arg(count)); } + +} // namespace TextEditor diff --git a/src/plugins/texteditor/basefilefind.h b/src/plugins/texteditor/basefilefind.h index e1d72b73247..f7f14662d52 100644 --- a/src/plugins/texteditor/basefilefind.h +++ b/src/plugins/texteditor/basefilefind.h @@ -32,8 +32,8 @@ #include "texteditor_global.h" -#include <find/ifindfilter.h> -#include <find/searchresultwindow.h> +#include <coreplugin/find/ifindfilter.h> +#include <coreplugin/find/searchresultwindow.h> QT_BEGIN_NAMESPACE class QLabel; @@ -41,18 +41,18 @@ class QComboBox; QT_END_NAMESPACE namespace Utils { class FileIterator; } -namespace Find { +namespace Core { class SearchResult; class SearchResultItem; class IFindSupport; -} // namespace Find +} // namespace Core namespace TextEditor { namespace Internal { class BaseFileFindPrivate; } // namespace Internal -class TEXTEDITOR_EXPORT BaseFileFind : public Find::IFindFilter +class TEXTEDITOR_EXPORT BaseFileFind : public Core::IFindFilter { Q_OBJECT @@ -62,21 +62,21 @@ public: bool isEnabled() const; bool isReplaceSupported() const { return true; } - void findAll(const QString &txt, Find::FindFlags findFlags); - void replaceAll(const QString &txt, Find::FindFlags findFlags); + void findAll(const QString &txt, Core::FindFlags findFlags); + void replaceAll(const QString &txt, Core::FindFlags findFlags); /* returns the list of unique files that were passed in items */ static QStringList replaceAll(const QString &txt, - const QList<Find::SearchResultItem> &items, + const QList<Core::SearchResultItem> &items, bool preserveCase = false); protected: virtual Utils::FileIterator *files(const QStringList &nameFilters, const QVariant &additionalParameters) const = 0; virtual QVariant additionalParameters() const = 0; - QVariant getAdditionalParameters(Find::SearchResult *search); - virtual QString label() const = 0; // see Find::SearchResultWindow::startNewSearch - virtual QString toolTip() const = 0; // see Find::SearchResultWindow::startNewSearch, + QVariant getAdditionalParameters(Core::SearchResult *search); + virtual QString label() const = 0; // see Core::SearchResultWindow::startNewSearch + virtual QString toolTip() const = 0; // see Core::SearchResultWindow::startNewSearch, // add %1 placeholder where the find flags should be put void writeCommonSettings(QSettings *settings); @@ -91,18 +91,18 @@ private slots: void searchFinished(); void cancel(); void setPaused(bool paused); - void openEditor(const Find::SearchResultItem &item); + void openEditor(const Core::SearchResultItem &item); void doReplace(const QString &txt, - const QList<Find::SearchResultItem> &items, + const QList<Core::SearchResultItem> &items, bool preserveCase); void hideHighlightAll(bool visible); void searchAgain(); void recheckEnabled(); private: - void runNewSearch(const QString &txt, Find::FindFlags findFlags, - Find::SearchResultWindow::SearchMode searchMode); - void runSearch(Find::SearchResult *search); + void runNewSearch(const QString &txt, Core::FindFlags findFlags, + Core::SearchResultWindow::SearchMode searchMode); + void runSearch(Core::SearchResult *search); Internal::BaseFileFindPrivate *d; }; diff --git a/src/plugins/texteditor/basefilefind_p.h b/src/plugins/texteditor/basefilefind_p.h index 8234a924d64..8622771c299 100644 --- a/src/plugins/texteditor/basefilefind_p.h +++ b/src/plugins/texteditor/basefilefind_p.h @@ -30,7 +30,7 @@ #ifndef BASEFILEFIND_P_H #define BASEFILEFIND_P_H -#include <find/ifindfilter.h> +#include <coreplugin/find/ifindfilter.h> #include <QVariant> #include <QLabel> @@ -52,7 +52,7 @@ class FileFindParameters { public: QString text; - Find::FindFlags flags; + Core::FindFlags flags; QStringList nameFilters; QVariant additionalParameters; }; diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index c374fa1775f..dbed95f3caf 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -57,7 +57,7 @@ #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/infobar.h> #include <coreplugin/manhattanstyle.h> -#include <find/basetextfind.h> +#include <coreplugin/find/basetextfind.h> #include <utils/linecolumnlabel.h> #include <utils/hostosinfo.h> #include <utils/qtcassert.h> @@ -104,6 +104,7 @@ \internal */ +using namespace Core; using namespace Utils; namespace TextEditor { @@ -2670,7 +2671,7 @@ void BaseTextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block l = m_searchExpr.matchedLength(); if (l == 0) break; - if ((m_findFlags & Find::FindWholeWords) + if ((m_findFlags & Core::FindWholeWords) && ((idx && text.at(idx-1).isLetterOrNumber()) || (idx + l < text.length() && text.at(idx + l).isLetterOrNumber()))) continue; @@ -4847,19 +4848,19 @@ void BaseTextEditorWidget::markBlocksAsChanged(QList<int> blockNumbers) } -void BaseTextEditorWidget::highlightSearchResults(const QString &txt, Find::FindFlags findFlags) +void BaseTextEditorWidget::highlightSearchResults(const QString &txt, Core::FindFlags findFlags) { QString pattern = txt; // highlighting single characters only if you're searching for whole words - if (pattern.size() < 2 && !(findFlags & Find::FindWholeWords)) + if (pattern.size() < 2 && !(findFlags & FindWholeWords)) pattern.clear(); if (d->m_searchExpr.pattern() == pattern) return; d->m_searchExpr.setPattern(pattern); - d->m_searchExpr.setPatternSyntax((findFlags & Find::FindRegularExpression) ? + d->m_searchExpr.setPatternSyntax((findFlags & FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString); - d->m_searchExpr.setCaseSensitivity((findFlags & Find::FindCaseSensitively) ? + d->m_searchExpr.setCaseSensitivity((findFlags & FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive); d->m_findFlags = findFlags; @@ -6128,11 +6129,10 @@ BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *editor) : m_editorWidget(editor) { setWidget(m_editorWidget); - using namespace Find; Aggregation::Aggregate *aggregate = new Aggregation::Aggregate; BaseTextFind *baseTextFind = new BaseTextFind(editor); - connect(baseTextFind, SIGNAL(highlightAll(QString,Find::FindFlags)), - editor, SLOT(highlightSearchResults(QString,Find::FindFlags))); + connect(baseTextFind, SIGNAL(highlightAll(QString,Core::FindFlags)), + editor, SLOT(highlightSearchResults(QString,Core::FindFlags))); connect(baseTextFind, SIGNAL(findScopeChanged(QTextCursor,QTextCursor,int,int)), editor, SLOT(setFindScope(QTextCursor,QTextCursor,int,int))); aggregate->add(baseTextFind); diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index be0dbae9184..4f8d97288d8 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -35,7 +35,7 @@ #include "codeassist/assistenums.h" #include <coreplugin/editormanager/editormanager.h> -#include <find/ifindsupport.h> +#include <coreplugin/find/ifindsupport.h> #include <QPlainTextEdit> #include <QSharedPointer> @@ -366,7 +366,7 @@ private slots: void editorContentsChange(int position, int charsRemoved, int charsAdded); void documentAboutToBeReloaded(); void documentReloadFinished(bool success); - void highlightSearchResults(const QString &txt, Find::FindFlags findFlags); + void highlightSearchResults(const QString &txt, Core::FindFlags findFlags); void setFindScope(const QTextCursor &start, const QTextCursor &end, int, int); bool inFindScope(const QTextCursor &cursor); bool inFindScope(int selectionStart, int selectionEnd); diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index 8d476bab311..9d9c85d12d5 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -185,7 +185,7 @@ public: QTextCharFormat m_ifdefedOutFormat; QRegExp m_searchExpr; - Find::FindFlags m_findFlags; + Core::FindFlags m_findFlags; QTextCharFormat m_searchResultFormat; QTextCharFormat m_searchScopeFormat; QTextCharFormat m_currentLineFormat; diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp index c8a93106da6..def758770cb 100644 --- a/src/plugins/texteditor/findincurrentfile.cpp +++ b/src/plugins/texteditor/findincurrentfile.cpp @@ -37,7 +37,6 @@ #include <QSettings> -using namespace Find; using namespace TextEditor; using namespace TextEditor::Internal; diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp index 9fc036e60aa..bfc56b7f248 100644 --- a/src/plugins/texteditor/findinfiles.cpp +++ b/src/plugins/texteditor/findinfiles.cpp @@ -30,7 +30,7 @@ #include "findinfiles.h" #include <coreplugin/editormanager/editormanager.h> -#include <find/findplugin.h> +#include <coreplugin/find/findplugin.h> #include <utils/filesearch.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> @@ -44,7 +44,7 @@ #include <QComboBox> #include <QHBoxLayout> -using namespace Find; +using namespace Core; using namespace TextEditor; static FindInFiles *m_instance = 0; @@ -72,7 +72,7 @@ QString FindInFiles::displayName() const return tr("Files on File System"); } -void FindInFiles::findAll(const QString &txt, Find::FindFlags findFlags) +void FindInFiles::findAll(const QString &txt, Core::FindFlags findFlags) { updateComboEntries(m_directory, true); BaseFileFind::findAll(txt, findFlags); @@ -195,5 +195,5 @@ void FindInFiles::findOnFileSystem(const QString &path) const QFileInfo fi(path); const QString folder = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath(); m_instance->setDirectory(folder); - Find::FindPlugin::instance()->openFindDialog(m_instance); + FindPlugin::instance()->openFindDialog(m_instance); } diff --git a/src/plugins/texteditor/findinfiles.h b/src/plugins/texteditor/findinfiles.h index 0038dd75bfb..6f9cac5b5f7 100644 --- a/src/plugins/texteditor/findinfiles.h +++ b/src/plugins/texteditor/findinfiles.h @@ -50,7 +50,7 @@ public: QString id() const; QString displayName() const; - void findAll(const QString &txt, Find::FindFlags findFlags); + void findAll(const QString &txt, Core::FindFlags findFlags); QWidget *createConfigWidget(); void writeSettings(QSettings *settings); void readSettings(QSettings *settings); diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp index dec1e278a80..f3fd8620814 100644 --- a/src/plugins/texteditor/findinopenfiles.cpp +++ b/src/plugins/texteditor/findinopenfiles.cpp @@ -37,7 +37,6 @@ #include <QSettings> -using namespace Find; using namespace TextEditor; using namespace TextEditor::Internal; diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp index 21e9576bfe7..a97af5dbdad 100644 --- a/src/plugins/texteditor/linenumberfilter.cpp +++ b/src/plugins/texteditor/linenumberfilter.cpp @@ -43,7 +43,6 @@ typedef QPair<int,int> LineColumn; Q_DECLARE_METATYPE(LineColumn) using namespace Core; -using namespace Locator; using namespace TextEditor; using namespace TextEditor::Internal; @@ -57,9 +56,9 @@ LineNumberFilter::LineNumberFilter(QObject *parent) setIncludedByDefault(true); } -QList<FilterEntry> LineNumberFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &, const QString &entry) +QList<LocatorFilterEntry> LineNumberFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &, const QString &entry) { - QList<FilterEntry> value; + QList<LocatorFilterEntry> value; QStringList lineAndColumn = entry.split(QLatin1Char(':')); int sectionCount = lineAndColumn.size(); int line = 0; @@ -82,12 +81,12 @@ QList<FilterEntry> LineNumberFilter::matchesFor(QFutureInterface<Locator::Filter text = tr("Line %1").arg(line); else text = tr("Column %1").arg(column); - value.append(FilterEntry(this, text, QVariant::fromValue(data))); + value.append(LocatorFilterEntry(this, text, QVariant::fromValue(data))); } return value; } -void LineNumberFilter::accept(FilterEntry selection) const +void LineNumberFilter::accept(LocatorFilterEntry selection) const { ITextEditor *editor = currentTextEditor(); if (editor) { diff --git a/src/plugins/texteditor/linenumberfilter.h b/src/plugins/texteditor/linenumberfilter.h index 304877812a0..01617c2e5b8 100644 --- a/src/plugins/texteditor/linenumberfilter.h +++ b/src/plugins/texteditor/linenumberfilter.h @@ -30,7 +30,7 @@ #ifndef LINENUMBERFILTER_H #define LINENUMBERFILTER_H -#include <locator/ilocatorfilter.h> +#include <coreplugin/locator/ilocatorfilter.h> #include <QString> #include <QList> @@ -42,15 +42,15 @@ class ITextEditor; namespace Internal { -class LineNumberFilter : public Locator::ILocatorFilter +class LineNumberFilter : public Core::ILocatorFilter { Q_OBJECT public: explicit LineNumberFilter(QObject *parent = 0); - 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> &) {} private: diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index 5cb8d7c1c60..f6472f7a18d 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -7,8 +7,6 @@ QtcPlugin { Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "script", "printsupport"] } Depends { name: "Core" } - Depends { name: "Find" } - Depends { name: "Locator" } cpp.includePaths: base.concat([path]) // Needed for the highlighterengine autotest. @@ -267,9 +265,4 @@ QtcPlugin { "snippetssettingspage.ui", ] } - - Export { - Depends { name: "Find" } - Depends { name: "Locator" } - } } diff --git a/src/plugins/texteditor/texteditor_dependencies.pri b/src/plugins/texteditor/texteditor_dependencies.pri index 0d4d168776e..389caeeaa66 100644 --- a/src/plugins/texteditor/texteditor_dependencies.pri +++ b/src/plugins/texteditor/texteditor_dependencies.pri @@ -2,6 +2,4 @@ QTC_PLUGIN_NAME = TextEditor QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ - find \ - locator \ coreplugin diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index cef93738e9f..7e5f9d45dc4 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -35,7 +35,7 @@ #include "texteditorconstants.h" #include "texteditorplugin.h" -#include <locator/locatormanager.h> +#include <coreplugin/locator/locatormanager.h> #include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> #include <coreplugin/actionmanager/actionmanager.h> @@ -425,7 +425,7 @@ void TextEditorActionHandler::gotoAction() locatorString += QLatin1Char(' '); const int selectionStart = locatorString.size(); locatorString += tr("<line>:<column>"); - Locator::LocatorManager::show(locatorString, selectionStart, locatorString.size() - selectionStart); + Core::LocatorManager::show(locatorString, selectionStart, locatorString.size() - selectionStart); } void TextEditorActionHandler::printAction() diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index fb1b52bf7f6..7265ecb215f 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -210,7 +210,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe void TextEditorPlugin::extensionsInitialized() { - m_searchResultWindow = Find::SearchResultWindow::instance(); + m_searchResultWindow = Core::SearchResultWindow::instance(); m_outlineFactory->setWidgetFactories(ExtensionSystem::PluginManager::getObjects<TextEditor::IOutlineWidgetFactory>()); diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h index 81110efbd0d..3fd323b156f 100644 --- a/src/plugins/texteditor/texteditorplugin.h +++ b/src/plugins/texteditor/texteditorplugin.h @@ -32,7 +32,7 @@ #include <extensionsystem/iplugin.h> -namespace Find { +namespace Core { class SearchResultWindow; } @@ -85,7 +85,7 @@ private: TextEditorSettings *m_settings; PlainTextEditorFactory *m_editorFactory; LineNumberFilter *m_lineNumberFilter; - Find::SearchResultWindow *m_searchResultWindow; + Core::SearchResultWindow *m_searchResultWindow; OutlineFactory *m_outlineFactory; BaseTextMarkRegistry *m_baseTextMarkRegistry; }; diff --git a/src/plugins/vcsbase/vcsbase.qbs b/src/plugins/vcsbase/vcsbase.qbs index ff0b5ce8e8b..1abc87493eb 100644 --- a/src/plugins/vcsbase/vcsbase.qbs +++ b/src/plugins/vcsbase/vcsbase.qbs @@ -8,7 +8,6 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "TextEditor" } Depends { name: "ProjectExplorer" } - Depends { name: "Find" } Depends { name: "Qt.widgets" } Depends { name: "CppTools" } Depends { name: "CPlusPlus" } diff --git a/src/plugins/vcsbase/vcsbase_dependencies.pri b/src/plugins/vcsbase/vcsbase_dependencies.pri index c089267094c..7126e57c9f3 100644 --- a/src/plugins/vcsbase/vcsbase_dependencies.pri +++ b/src/plugins/vcsbase/vcsbase_dependencies.pri @@ -3,5 +3,4 @@ QTC_PLUGIN_DEPENDS += \ coreplugin \ texteditor \ projectexplorer \ - find \ cpptools diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 069b867ad11..3aafe9398fe 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -46,7 +46,7 @@ #include <utils/synchronousprocess.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> -#include <find/basetextfind.h> +#include <coreplugin/find/basetextfind.h> #include <texteditor/fontsettings.h> #include <texteditor/texteditorsettings.h> @@ -241,7 +241,7 @@ VcsBaseSubmitEditor::VcsBaseSubmitEditor(const VcsBaseSubmitEditorParameters *pa this, SLOT(slotRefreshCommitData()), Qt::QueuedConnection); Aggregation::Aggregate *aggregate = new Aggregation::Aggregate; - aggregate->add(new Find::BaseTextFind(descriptionEdit)); + aggregate->add(new Core::BaseTextFind(descriptionEdit)); aggregate->add(this); } |