diff --git a/src/plugins/clangcodemodel/clangcodemodel.pro b/src/plugins/clangcodemodel/clangcodemodel.pro index 0e444a350e2..ad0d93f2e1c 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.pro +++ b/src/plugins/clangcodemodel/clangcodemodel.pro @@ -21,6 +21,7 @@ SOURCES += \ clangcompletionassistprovider.cpp \ clangcompletionchunkstotextconverter.cpp \ clangcompletioncontextanalyzer.cpp \ + clangcurrentdocumentfilter.cpp \ clangdiagnosticfilter.cpp \ clangdiagnosticmanager.cpp \ clangdiagnostictooltipwidget.cpp \ @@ -58,6 +59,7 @@ HEADERS += \ clangcompletionchunkstotextconverter.h \ clangcompletioncontextanalyzer.h \ clangconstants.h \ + clangcurrentdocumentfilter.h \ clangdiagnosticfilter.h \ clangdiagnosticmanager.h \ clangdiagnostictooltipwidget.h \ @@ -75,9 +77,9 @@ HEADERS += \ clangprojectsettingswidget.h \ clangrefactoringengine.h \ clangtextmark.h \ + clangtokeninfosreporter.h \ clanguiheaderondiskmanager.h \ - clangutils.h \ - clangtokeninfosreporter.h + clangutils.h FORMS += clangprojectsettingswidget.ui diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs index 90105b86d38..a1c3d4d6df9 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.qbs +++ b/src/plugins/clangcodemodel/clangcodemodel.qbs @@ -62,6 +62,8 @@ QtcPlugin { "clangcompletioncontextanalyzer.cpp", "clangcompletioncontextanalyzer.h", "clangconstants.h", + "clangcurrentdocumentfilter.cpp", + "clangcurrentdocumentfilter.h", "clangdiagnosticfilter.cpp", "clangdiagnosticfilter.h", "clangdiagnosticmanager.cpp", diff --git a/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp b/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp new file mode 100644 index 00000000000..b28ac972918 --- /dev/null +++ b/src/plugins/clangcodemodel/clangcurrentdocumentfilter.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "clangcurrentdocumentfilter.h" + +#include + +namespace ClangCodeModel { + +ClangCurrentDocumentFilter::ClangCurrentDocumentFilter() +{ + setId(CppTools::Constants::CURRENT_DOCUMENT_FILTER_ID); + setDisplayName(CppTools::Constants::CURRENT_DOCUMENT_FILTER_DISPLAY_NAME); + setShortcutString(QString(QLatin1Char('.'))); + setPriority(High); + setIncludedByDefault(false); +} + +QList ClangCurrentDocumentFilter::matchesFor( + QFutureInterface &, const QString &) +{ + return QList(); +} + +void ClangCurrentDocumentFilter::accept(Core::LocatorFilterEntry, QString *, int *, int *) const +{ + +} + +void ClangCurrentDocumentFilter::refresh(QFutureInterface &) +{ + +} + +} // namespace ClangCodeModel diff --git a/src/plugins/clangcodemodel/clangcurrentdocumentfilter.h b/src/plugins/clangcodemodel/clangcurrentdocumentfilter.h new file mode 100644 index 00000000000..6adba5d775e --- /dev/null +++ b/src/plugins/clangcodemodel/clangcurrentdocumentfilter.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace ClangCodeModel { + +class ClangCurrentDocumentFilter : public Core::ILocatorFilter +{ + Q_OBJECT + +public: + explicit ClangCurrentDocumentFilter(); + + QList matchesFor(QFutureInterface &future, + const QString &entry) override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; + void refresh(QFutureInterface &future) override; +}; + +} // namespace ClangCodeModel diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 4de96c5a0ea..f4813c6eb69 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -31,6 +31,7 @@ #include "clangfollowsymbol.h" #include "clanghoverhandler.h" #include "clangrefactoringengine.h" +#include "clangcurrentdocumentfilter.h" #include #include diff --git a/src/plugins/clangrefactoring/clangrefactoring-source.pri b/src/plugins/clangrefactoring/clangrefactoring-source.pri index 027f81794d4..a3ef41ef573 100644 --- a/src/plugins/clangrefactoring/clangrefactoring-source.pri +++ b/src/plugins/clangrefactoring/clangrefactoring-source.pri @@ -1,28 +1,38 @@ INCLUDEPATH += $$PWD HEADERS += \ - $$PWD/refactoringengine.h \ - $$PWD/refactoringconnectionclient.h \ + $$PWD/clangqueryexamplehighlighter.h \ + $$PWD/clangqueryexamplehighlightmarker.h \ + $$PWD/clangqueryhighlighter.h \ + $$PWD/clangqueryhighlightmarker.h \ + $$PWD/clangqueryprojectsfindfilter.h \ + $$PWD/classesfilter.h \ + $$PWD/functionsfilter.h \ + $$PWD/includesfilter.h \ + $$PWD/locatorfilter.h \ + $$PWD/projectpartutilities.h \ $$PWD/refactoringclient.h \ + $$PWD/refactoringconnectionclient.h \ + $$PWD/refactoringengine.h \ + $$PWD/refactoringprojectupdater.h \ $$PWD/searchinterface.h \ $$PWD/searchhandle.h \ - $$PWD/projectpartutilities.h \ - $$PWD/clangqueryprojectsfindfilter.h \ - $$PWD/clangqueryexamplehighlightmarker.h \ - $$PWD/clangqueryhighlightmarker.h \ - $$PWD/clangqueryexamplehighlighter.h \ - $$PWD/clangqueryhighlighter.h \ - $$PWD/refactoringprojectupdater.h \ + $$PWD/symbolsfindfilter.h \ $$PWD/symbolqueryinterface.h SOURCES += \ - $$PWD/refactoringengine.cpp \ - $$PWD/refactoringconnectionclient.cpp \ - $$PWD/refactoringclient.cpp \ - $$PWD/searchinterface.cpp \ - $$PWD/searchhandle.cpp \ - $$PWD/projectpartutilities.cpp \ - $$PWD/clangqueryprojectsfindfilter.cpp \ $$PWD/clangqueryexamplehighlighter.cpp \ $$PWD/clangqueryhighlighter.cpp \ - $$PWD/refactoringprojectupdater.cpp + $$PWD/clangqueryprojectsfindfilter.cpp \ + $$PWD/classesfilter.cpp \ + $$PWD/functionsfilter.cpp \ + $$PWD/includesfilter.cpp \ + $$PWD/locatorfilter.cpp \ + $$PWD/projectpartutilities.cpp \ + $$PWD/refactoringclient.cpp \ + $$PWD/refactoringconnectionclient.cpp \ + $$PWD/refactoringengine.cpp \ + $$PWD/refactoringprojectupdater.cpp \ + $$PWD/searchinterface.cpp \ + $$PWD/searchhandle.cpp \ + $$PWD/symbolsfindfilter.cpp diff --git a/src/plugins/clangrefactoring/clangrefactoring.pro b/src/plugins/clangrefactoring/clangrefactoring.pro index d60de99636b..0326f612c13 100644 --- a/src/plugins/clangrefactoring/clangrefactoring.pro +++ b/src/plugins/clangrefactoring/clangrefactoring.pro @@ -8,28 +8,32 @@ requires(!isEmpty(LIBTOOLING_LIBS)) HEADERS += \ clangrefactoringplugin.h \ + baseclangquerytexteditorwidget.h \ + clangqueryexampletexteditorwidget.h \ + clangqueryhoverhandler.h \ + clangqueryprojectsfindfilterwidget.h \ + clangquerytexteditorwidget.h \ + qtcreatorclangqueryfindfilter.h \ qtcreatorsearch.h \ qtcreatorsearchhandle.h \ - qtcreatorclangqueryfindfilter.h \ - clangqueryprojectsfindfilterwidget.h \ - clangqueryexampletexteditorwidget.h \ - clangquerytexteditorwidget.h \ - baseclangquerytexteditorwidget.h \ - clangqueryhoverhandler.h \ - symbolquery.h \ + qtcreatorsymbolsfindfilter.h \ querysqlitestatementfactory.h \ - sourcelocations.h + sourcelocations.h \ + symbolsfindfilterconfigwidget.h \ + symbolquery.h SOURCES += \ clangrefactoringplugin.cpp \ + baseclangquerytexteditorwidget.cpp \ + clangqueryexampletexteditorwidget.cpp \ + clangqueryhoverhandler.cpp \ + clangqueryprojectsfindfilterwidget.cpp \ + clangquerytexteditorwidget.cpp \ + qtcreatorclangqueryfindfilter.cpp \ qtcreatorsearch.cpp \ qtcreatorsearchhandle.cpp \ - qtcreatorclangqueryfindfilter.cpp \ - clangqueryprojectsfindfilterwidget.cpp \ - clangqueryexampletexteditorwidget.cpp \ - clangquerytexteditorwidget.cpp \ - baseclangquerytexteditorwidget.cpp \ - clangqueryhoverhandler.cpp \ + qtcreatorsymbolsfindfilter.cpp \ + symbolsfindfilterconfigwidget.cpp \ symbolquery.cpp FORMS += \ diff --git a/src/plugins/clangrefactoring/clangrefactoring.qbs b/src/plugins/clangrefactoring/clangrefactoring.qbs index 15c2ada59e1..bf0bfba5dac 100644 --- a/src/plugins/clangrefactoring/clangrefactoring.qbs +++ b/src/plugins/clangrefactoring/clangrefactoring.qbs @@ -52,6 +52,14 @@ QtcPlugin { "clangquerytexteditorwidget.h", "clangrefactoringplugin.cpp", "clangrefactoringplugin.h", + "classesfilter.cpp", + "classesfilter.h", + "functionsfilter.cpp", + "functionsfilter.h", + "includesfilter.cpp", + "includesfilter.h", + "locatorfilter.cpp", + "locatorfilter.h", "projectpartutilities.cpp", "projectpartutilities.h", "qtcreatorclangqueryfindfilter.cpp", @@ -60,6 +68,8 @@ QtcPlugin { "qtcreatorsearch.h", "qtcreatorsearchhandle.cpp", "qtcreatorsearchhandle.h", + "qtcreatorsymbolsfindfilter.cpp", + "qtcreatorsymbolsfindfilter.h", "querysqlitestatementfactory.h", "refactoringclient.cpp", "refactoringclient.h", @@ -74,6 +84,10 @@ QtcPlugin { "searchinterface.cpp", "searchinterface.h", "sourcelocations.h", + "symbolsfindfilter.cpp", + "symbolsfindfilter.h", + "symbolsfindfilterconfigwidget.cpp", + "symbolsfindfilterconfigwidget.h", "symbolquery.cpp", "symbolquery.h", ] diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp index 17138f0cd9f..8e471b3beb2 100644 --- a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp +++ b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp @@ -24,6 +24,11 @@ ****************************************************************************/ #include "clangrefactoringplugin.h" +#include "classesfilter.h" +#include "functionsfilter.h" +#include "includesfilter.h" +#include "locatorfilter.h" +#include "symbolsfindfilter.h" #include "symbolquery.h" #include "sqlitereadstatement.h" #include "sqlitedatabase.h" @@ -94,6 +99,12 @@ ClangRefactoringPlugin::~ClangRefactoringPlugin() { } +static bool useClangFilters() +{ + static bool use = qEnvironmentVariableIntValue("QTC_CLANG_LOCATORS"); + return use; +} + bool ClangRefactoringPlugin::initialize(const QStringList & /*arguments*/, QString * /*errorMessage*/) { d.reset(new ClangRefactoringPluginData); @@ -105,13 +116,16 @@ bool ClangRefactoringPlugin::initialize(const QStringList & /*arguments*/, QStri connectBackend(); startBackend(); + CppTools::CppModelManager::addRefactoringEngine( + CppTools::RefactoringEngineType::ClangRefactoring, &refactoringEngine()); + + initializeFilters(); + return true; } void ClangRefactoringPlugin::extensionsInitialized() { - CppTools::CppModelManager::addRefactoringEngine( - CppTools::RefactoringEngineType::ClangRefactoring, &refactoringEngine()); } ExtensionSystem::IPlugin::ShutdownFlag ClangRefactoringPlugin::aboutToShutdown() @@ -152,4 +166,17 @@ void ClangRefactoringPlugin::backendIsConnected() d->engine.setRefactoringEngineAvailable(true); } +void ClangRefactoringPlugin::initializeFilters() +{ + if (!useClangFilters()) + return; + + CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance(); + modelManager->setLocatorFilter(std::make_unique()); + modelManager->setClassesFilter(std::make_unique()); + modelManager->setIncludesFilter(std::make_unique()); + modelManager->setFunctionsFilter(std::make_unique()); + modelManager->setSymbolsFindFilter(std::make_unique()); +} + } // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.h b/src/plugins/clangrefactoring/clangrefactoringplugin.h index c0b90c7668a..72a8d3efef6 100644 --- a/src/plugins/clangrefactoring/clangrefactoringplugin.h +++ b/src/plugins/clangrefactoring/clangrefactoringplugin.h @@ -29,8 +29,8 @@ #include "refactoringclient.h" #include "qtcreatorclangqueryfindfilter.h" #include "qtcreatorsearch.h" +#include "refactoringconnectionclient.h" -#include #include #include @@ -59,6 +59,7 @@ private: void startBackend(); void connectBackend(); void backendIsConnected(); + void initializeFilters(); private: static std::unique_ptr d; diff --git a/src/plugins/clangrefactoring/classesfilter.cpp b/src/plugins/clangrefactoring/classesfilter.cpp new file mode 100644 index 00000000000..11ea4fb6ab5 --- /dev/null +++ b/src/plugins/clangrefactoring/classesfilter.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "classesfilter.h" + +#include + +namespace ClangRefactoring { + +ClassesFilter::ClassesFilter() +{ + setId(CppTools::Constants::CLASSES_FILTER_ID); + setDisplayName(CppTools::Constants::CLASSES_FILTER_DISPLAY_NAME); + setShortcutString(QLatin1String("c")); + setIncludedByDefault(false); +} + +QList ClassesFilter::matchesFor( + QFutureInterface &, const QString &) +{ + return QList(); +} + +void ClassesFilter::accept(Core::LocatorFilterEntry, QString *, int *, int *) const +{ + +} + +void ClassesFilter::refresh(QFutureInterface &) +{ + +} + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/classesfilter.h b/src/plugins/clangrefactoring/classesfilter.h new file mode 100644 index 00000000000..6d994286f8d --- /dev/null +++ b/src/plugins/clangrefactoring/classesfilter.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace ClangRefactoring { + +class ClassesFilter : public Core::ILocatorFilter +{ + Q_OBJECT +public: + ClassesFilter(); + + QList matchesFor(QFutureInterface &future, + const QString &entry) override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; + void refresh(QFutureInterface &future) override; +}; + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/functionsfilter.cpp b/src/plugins/clangrefactoring/functionsfilter.cpp new file mode 100644 index 00000000000..a4a8a6f7a68 --- /dev/null +++ b/src/plugins/clangrefactoring/functionsfilter.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "functionsfilter.h" + +#include + +namespace ClangRefactoring { + +FunctionsFilter::FunctionsFilter() +{ + setId(CppTools::Constants::FUNCTIONS_FILTER_ID); + setDisplayName(CppTools::Constants::FUNCTIONS_FILTER_DISPLAY_NAME); + setShortcutString(QString(QLatin1Char('m'))); + setIncludedByDefault(false); +} + +QList FunctionsFilter::matchesFor( + QFutureInterface &, const QString &) +{ + return QList(); +} + +void FunctionsFilter::accept(Core::LocatorFilterEntry, QString *, int *, int *) const +{ + +} + +void FunctionsFilter::refresh(QFutureInterface &) +{ + +} + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/functionsfilter.h b/src/plugins/clangrefactoring/functionsfilter.h new file mode 100644 index 00000000000..95454915a9d --- /dev/null +++ b/src/plugins/clangrefactoring/functionsfilter.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace ClangRefactoring { + +class FunctionsFilter : public Core::ILocatorFilter +{ + Q_OBJECT +public: + FunctionsFilter(); + + QList matchesFor(QFutureInterface &future, + const QString &entry) override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; + void refresh(QFutureInterface &future) override; +}; + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/includesfilter.cpp b/src/plugins/clangrefactoring/includesfilter.cpp new file mode 100644 index 00000000000..50c8a3e957f --- /dev/null +++ b/src/plugins/clangrefactoring/includesfilter.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "includesfilter.h" + +#include + +namespace ClangRefactoring { + +IncludesFilter::IncludesFilter() +{ + setId(CppTools::Constants::INCLUDES_FILTER_ID); + setDisplayName(CppTools::Constants::INCLUDES_FILTER_DISPLAY_NAME); + setShortcutString(QString(QLatin1Char('a'))); + setIncludedByDefault(true); + setPriority(ILocatorFilter::Low); +} + +QList IncludesFilter::matchesFor( + QFutureInterface &, const QString &) +{ + return QList(); +} + +void IncludesFilter::accept(Core::LocatorFilterEntry, QString *, int *, int *) const +{ + +} + +void IncludesFilter::refresh(QFutureInterface &) +{ + +} + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/includesfilter.h b/src/plugins/clangrefactoring/includesfilter.h new file mode 100644 index 00000000000..23185660c92 --- /dev/null +++ b/src/plugins/clangrefactoring/includesfilter.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace ClangRefactoring { + +class IncludesFilter : public Core::ILocatorFilter +{ + Q_OBJECT +public: + IncludesFilter(); + + QList matchesFor(QFutureInterface &future, + const QString &entry) override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; + void refresh(QFutureInterface &future) override; +}; + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/locatorfilter.cpp b/src/plugins/clangrefactoring/locatorfilter.cpp new file mode 100644 index 00000000000..79e52b39996 --- /dev/null +++ b/src/plugins/clangrefactoring/locatorfilter.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "locatorfilter.h" + +#include + +namespace ClangRefactoring { + +LocatorFilter::LocatorFilter() +{ + setId(CppTools::Constants::LOCATOR_FILTER_ID); + setDisplayName(CppTools::Constants::LOCATOR_FILTER_DISPLAY_NAME); + setShortcutString(QString(QLatin1Char(':'))); + setIncludedByDefault(false); +} + +QList LocatorFilter::matchesFor( + QFutureInterface &, const QString &) +{ + return QList(); +} + +void LocatorFilter::accept(Core::LocatorFilterEntry, QString *, int *, int *) const +{ + +} + +void LocatorFilter::refresh(QFutureInterface &) +{ + +} + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/locatorfilter.h b/src/plugins/clangrefactoring/locatorfilter.h new file mode 100644 index 00000000000..00cbccfced4 --- /dev/null +++ b/src/plugins/clangrefactoring/locatorfilter.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace ClangRefactoring { + +class LocatorFilter : public Core::ILocatorFilter +{ + Q_OBJECT +public: + LocatorFilter(); + + QList matchesFor(QFutureInterface &future, + const QString &entry) override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; + void refresh(QFutureInterface &future) override; +}; + +} // namespace ClangRefactoring diff --git a/src/plugins/clangrefactoring/qtcreatorsymbolsfindfilter.cpp b/src/plugins/clangrefactoring/qtcreatorsymbolsfindfilter.cpp new file mode 100644 index 00000000000..9e5bd7a7500 --- /dev/null +++ b/src/plugins/clangrefactoring/qtcreatorsymbolsfindfilter.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "qtcreatorsymbolsfindfilter.h" + +#include "symbolsfindfilterconfigwidget.h" + +namespace ClangRefactoring { + +QtcreatorSymbolsFindFilter::QtcreatorSymbolsFindFilter() +{ +} + +QWidget *QtcreatorSymbolsFindFilter::createConfigWidget() +{ + return new SymbolsFindFilterConfigWidget(this); +} + +} // ClangRefactoring diff --git a/src/plugins/clangrefactoring/qtcreatorsymbolsfindfilter.h b/src/plugins/clangrefactoring/qtcreatorsymbolsfindfilter.h new file mode 100644 index 00000000000..db9a856ffd2 --- /dev/null +++ b/src/plugins/clangrefactoring/qtcreatorsymbolsfindfilter.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "symbolsfindfilter.h" + +namespace ClangRefactoring { + +class QtcreatorSymbolsFindFilter : public SymbolsFindFilter +{ + Q_OBJECT +public: + QtcreatorSymbolsFindFilter(); + + QWidget *createConfigWidget() override; +}; + +} // ClangRefactoring diff --git a/src/plugins/clangrefactoring/refactoringclient.h b/src/plugins/clangrefactoring/refactoringclient.h index d504538b3ee..fbf10d72940 100644 --- a/src/plugins/clangrefactoring/refactoringclient.h +++ b/src/plugins/clangrefactoring/refactoringclient.h @@ -27,7 +27,7 @@ #include "refactoringengine.h" -#include +#include "searchhandle.h" #include diff --git a/src/plugins/clangrefactoring/symbolquery.h b/src/plugins/clangrefactoring/symbolquery.h index 7f0b9f33acb..a65ab4eba36 100644 --- a/src/plugins/clangrefactoring/symbolquery.h +++ b/src/plugins/clangrefactoring/symbolquery.h @@ -27,8 +27,9 @@ #include "symbolqueryinterface.h" +#include "sourcelocations.h" + #include -#include #include diff --git a/src/plugins/clangrefactoring/symbolsfindfilter.cpp b/src/plugins/clangrefactoring/symbolsfindfilter.cpp new file mode 100644 index 00000000000..d6126826cb2 --- /dev/null +++ b/src/plugins/clangrefactoring/symbolsfindfilter.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "symbolsfindfilter.h" + +#include + +#include + +using namespace Core; + +namespace ClangRefactoring { + +SymbolsFindFilter::SymbolsFindFilter() +{ +} + +QString SymbolsFindFilter::id() const +{ + return QLatin1String(CppTools::Constants::SYMBOLS_FIND_FILTER_ID); +} + +QString SymbolsFindFilter::displayName() const +{ + return CppTools::Constants::SYMBOLS_FIND_FILTER_DISPLAY_NAME; +} + +bool SymbolsFindFilter::isEnabled() const +{ + return true; +} + +void SymbolsFindFilter::findAll(const QString &, FindFlags) +{ +} + +void SymbolsFindFilter::writeSettings(QSettings *) +{ +} + +void SymbolsFindFilter::readSettings(QSettings *) +{ +} + +} // ClangRefactoring diff --git a/src/plugins/clangrefactoring/symbolsfindfilter.h b/src/plugins/clangrefactoring/symbolsfindfilter.h new file mode 100644 index 00000000000..1693a19602d --- /dev/null +++ b/src/plugins/clangrefactoring/symbolsfindfilter.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +#include +#include +#include +#include +#include + +namespace Core { class SearchResult; } + +namespace ClangRefactoring { + +class CppModelManager; + +class SymbolsFindFilter : public Core::IFindFilter +{ + Q_OBJECT + +public: + explicit SymbolsFindFilter(); + + QString id() const; + QString displayName() const; + bool isEnabled() const; + + void findAll(const QString &txt, Core::FindFlags findFlags); + + void writeSettings(QSettings *settings); + void readSettings(QSettings *settings); +}; + +} // ClangRefactoring diff --git a/src/plugins/clangrefactoring/symbolsfindfilterconfigwidget.cpp b/src/plugins/clangrefactoring/symbolsfindfilterconfigwidget.cpp new file mode 100644 index 00000000000..9c391676e1f --- /dev/null +++ b/src/plugins/clangrefactoring/symbolsfindfilterconfigwidget.cpp @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + + +#include "symbolsfindfilterconfigwidget.h" + +#include "symbolsfindfilter.h" + +namespace ClangRefactoring { + +SymbolsFindFilterConfigWidget::SymbolsFindFilterConfigWidget(SymbolsFindFilter *) +{ + +} + +} // ClangRefactoring + diff --git a/src/plugins/clangrefactoring/symbolsfindfilterconfigwidget.h b/src/plugins/clangrefactoring/symbolsfindfilterconfigwidget.h new file mode 100644 index 00000000000..b51ab4ed1db --- /dev/null +++ b/src/plugins/clangrefactoring/symbolsfindfilterconfigwidget.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace ClangRefactoring { + +class SymbolsFindFilter; + +class SymbolsFindFilterConfigWidget : public QWidget +{ + Q_OBJECT +public: + SymbolsFindFilterConfigWidget(SymbolsFindFilter *filter); +}; + +} // ClangRefactoring diff --git a/src/plugins/coreplugin/corepluginunittestfiles.pri b/src/plugins/coreplugin/corepluginunittestfiles.pri index 51e1e6b4249..f2ec908f262 100644 --- a/src/plugins/coreplugin/corepluginunittestfiles.pri +++ b/src/plugins/coreplugin/corepluginunittestfiles.pri @@ -3,9 +3,11 @@ DEFINES += CORE_STATIC_LIBRARY HEADERS += \ $$PWD/coreicons.h \ $$PWD/id.h \ - $$PWD/find/ifindfilter.h + $$PWD/find/ifindfilter.h \ + $$PWD/locator/ilocatorfilter.h SOURCES += \ $$PWD/coreicons.cpp \ $$PWD/id.cpp \ - $$PWD/find/ifindfilter.cpp + $$PWD/find/ifindfilter.cpp \ + $$PWD/locator/ilocatorfilter.cpp diff --git a/src/plugins/cpptools/cppclassesfilter.cpp b/src/plugins/cpptools/cppclassesfilter.cpp index a589a2f610d..f4f29a35228 100644 --- a/src/plugins/cpptools/cppclassesfilter.cpp +++ b/src/plugins/cpptools/cppclassesfilter.cpp @@ -25,16 +25,18 @@ #include "cppclassesfilter.h" +#include "cpptoolsconstants.h" + using namespace CppTools; using namespace CppTools::Internal; CppClassesFilter::CppClassesFilter(CppLocatorData *locatorData) : CppLocatorFilter(locatorData) { - setId("Classes"); + setId(Constants::CLASSES_FILTER_ID); + setDisplayName(Constants::CLASSES_FILTER_DISPLAY_NAME); setShortcutString(QLatin1String("c")); setIncludedByDefault(false); - setDisplayName(tr("C++ Classes")); } CppClassesFilter::~CppClassesFilter() diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index d0d76d9d197..baace1529fc 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -26,6 +26,7 @@ #include "cppcurrentdocumentfilter.h" #include "cppmodelmanager.h" +#include "cpptoolsconstants.h" #include #include @@ -41,8 +42,8 @@ CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppTools::CppModelManager *ma : m_modelManager(manager) , search(stringTable) { - setId("Methods in current Document"); - setDisplayName(tr("C++ Symbols in Current Document")); + setId(Constants::CURRENT_DOCUMENT_FILTER_ID); + setDisplayName(Constants::CURRENT_DOCUMENT_FILTER_DISPLAY_NAME); setShortcutString("."); setPriority(High); setIncludedByDefault(false); diff --git a/src/plugins/cpptools/cppfunctionsfilter.cpp b/src/plugins/cpptools/cppfunctionsfilter.cpp index b841cac6f6d..c7c29fdca15 100644 --- a/src/plugins/cpptools/cppfunctionsfilter.cpp +++ b/src/plugins/cpptools/cppfunctionsfilter.cpp @@ -25,6 +25,8 @@ #include "cppfunctionsfilter.h" +#include "cpptoolsconstants.h" + #include using namespace CppTools; @@ -33,8 +35,8 @@ using namespace CppTools::Internal; CppFunctionsFilter::CppFunctionsFilter(CppLocatorData *locatorData) : CppLocatorFilter(locatorData) { - setId("Methods"); - setDisplayName(tr("C++ Functions")); + setId(Constants::FUNCTIONS_FILTER_ID); + setDisplayName(Constants::FUNCTIONS_FILTER_DISPLAY_NAME); setShortcutString("m"); setIncludedByDefault(false); } diff --git a/src/plugins/cpptools/cppincludesfilter.cpp b/src/plugins/cpptools/cppincludesfilter.cpp index 97fc66e6416..679d37b72a3 100644 --- a/src/plugins/cpptools/cppincludesfilter.cpp +++ b/src/plugins/cpptools/cppincludesfilter.cpp @@ -26,6 +26,7 @@ #include "cppincludesfilter.h" #include "cppmodelmanager.h" +#include "cpptoolsconstants.h" #include #include @@ -130,8 +131,8 @@ void CppIncludesIterator::fetchMore() CppIncludesFilter::CppIncludesFilter() { - setId("All Included C/C++ Files"); - setDisplayName(tr("All Included C/C++ Files")); + setId(Constants::INCLUDES_FILTER_ID); + setDisplayName(Constants::INCLUDES_FILTER_DISPLAY_NAME); setShortcutString("ai"); setIncludedByDefault(true); setPriority(ILocatorFilter::Low); diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index ffe854831fd..109e999b23b 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -25,6 +25,7 @@ #include "cpplocatorfilter.h" #include "cppmodelmanager.h" +#include "cpptoolsconstants.h" #include #include @@ -39,8 +40,8 @@ using namespace CppTools::Internal; CppLocatorFilter::CppLocatorFilter(CppLocatorData *locatorData) : m_data(locatorData) { - setId("Classes and Methods"); - setDisplayName(tr("C++ Classes, Enums and Functions")); + setId(Constants::LOCATOR_FILTER_ID); + setDisplayName(Constants::LOCATOR_FILTER_DISPLAY_NAME); setShortcutString(":"); setIncludedByDefault(false); } diff --git a/src/plugins/cpptools/cpptoolsconstants.h b/src/plugins/cpptools/cpptoolsconstants.h index b5e9d86bdbf..c8dad1066ba 100644 --- a/src/plugins/cpptools/cpptoolsconstants.h +++ b/src/plugins/cpptools/cpptoolsconstants.h @@ -77,5 +77,24 @@ const char CPP_CLANG_FIXIT_AVAILABLE_MARKER_ID[] = "ClangFixItAvailableMarker"; const char CPP_SETTINGS_ID[] = "Cpp"; const char CPP_SETTINGS_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C++"); +const char CURRENT_DOCUMENT_FILTER_ID[] = "Methods in current Document"; +const char CURRENT_DOCUMENT_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C++ Symbols in Current Document"); + +const char CLASSES_FILTER_ID[] = "Classes"; +const char CLASSES_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C++ Classes"); + +const char FUNCTIONS_FILTER_ID[] = "Methods"; +const char FUNCTIONS_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C++ Functions"); + +const char INCLUDES_FILTER_ID[] = "All Included C/C++ Files"; +const char INCLUDES_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "All Included C/C++ Files"); + +const char LOCATOR_FILTER_ID[] = "Classes and Methods"; +const char LOCATOR_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C++ Classes, Enums and Functions"); + +const char SYMBOLS_FIND_FILTER_ID[] = "Symbols"; +const char SYMBOLS_FIND_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C++ Symbols"); + + } // namespace Constants } // namespace CppTools diff --git a/src/plugins/cpptools/symbolsfindfilter.cpp b/src/plugins/cpptools/symbolsfindfilter.cpp index a011fb3a752..265a20ac7da 100644 --- a/src/plugins/cpptools/symbolsfindfilter.cpp +++ b/src/plugins/cpptools/symbolsfindfilter.cpp @@ -69,12 +69,12 @@ SymbolsFindFilter::SymbolsFindFilter(CppModelManager *manager) QString SymbolsFindFilter::id() const { - return QLatin1String("CppSymbols"); + return QLatin1String(Constants::SYMBOLS_FIND_FILTER_ID); } QString SymbolsFindFilter::displayName() const { - return tr("C++ Symbols"); + return Constants::SYMBOLS_FIND_FILTER_DISPLAY_NAME; } bool SymbolsFindFilter::isEnabled() const diff --git a/tests/unit/unittest/classesfilter-test.cpp b/tests/unit/unittest/classesfilter-test.cpp new file mode 100644 index 00000000000..f43ac7b3c1d --- /dev/null +++ b/tests/unit/unittest/classesfilter-test.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "googletest.h" + +#include + +namespace { + +class ClassesFilter : public ::testing::Test +{ +protected: + ClangRefactoring::ClassesFilter classesFilter; +}; + +TEST_F(ClassesFilter, MatchesFor) +{ + QFutureInterface dummy; + + auto matches = classesFilter.matchesFor(dummy, QString()); +} + +TEST_F(ClassesFilter, Accept) +{ + int start = 0; + int length = 0; + QString newText; + + classesFilter.accept(Core::LocatorFilterEntry(), &newText, &start, &length); +} + +TEST_F(ClassesFilter, Refresh) +{ + QFutureInterface dummy; + + classesFilter.refresh(dummy); +} + +} diff --git a/tests/unit/unittest/functionsfilter-test.cpp b/tests/unit/unittest/functionsfilter-test.cpp new file mode 100644 index 00000000000..77a6e4dbc47 --- /dev/null +++ b/tests/unit/unittest/functionsfilter-test.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "googletest.h" + +#include + +namespace { + +class FunctionsFilter : public ::testing::Test +{ +protected: + ClangRefactoring::FunctionsFilter functionsFilter; +}; + +TEST_F(FunctionsFilter, MatchesFor) +{ + QFutureInterface dummy; + + auto matches = functionsFilter.matchesFor(dummy, QString()); +} + +TEST_F(FunctionsFilter, Accept) +{ + int start = 0; + int length = 0; + QString newText; + + functionsFilter.accept(Core::LocatorFilterEntry(), &newText, &start, &length); +} + +TEST_F(FunctionsFilter, Refresh) +{ + QFutureInterface dummy; + + functionsFilter.refresh(dummy); +} + +} diff --git a/tests/unit/unittest/includesfilter-test.cpp b/tests/unit/unittest/includesfilter-test.cpp new file mode 100644 index 00000000000..084d0fdd2e7 --- /dev/null +++ b/tests/unit/unittest/includesfilter-test.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "googletest.h" + +#include + +namespace { + +class IncludesFilter : public ::testing::Test +{ +protected: + ClangRefactoring::IncludesFilter includesFilter; +}; + +TEST_F(IncludesFilter, MatchesFor) +{ + QFutureInterface dummy; + + auto matches = includesFilter.matchesFor(dummy, QString()); +} + +TEST_F(IncludesFilter, Accept) +{ + int start = 0; + int length = 0; + QString newText; + + includesFilter.accept(Core::LocatorFilterEntry(), &newText, &start, &length); +} + +TEST_F(IncludesFilter, Refresh) +{ + QFutureInterface dummy; + + includesFilter.refresh(dummy); +} + +} diff --git a/tests/unit/unittest/locatorfilter-test.cpp b/tests/unit/unittest/locatorfilter-test.cpp new file mode 100644 index 00000000000..2cc77cb5c7f --- /dev/null +++ b/tests/unit/unittest/locatorfilter-test.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "googletest.h" + +#include + +namespace { + +class LocatorFilter : public ::testing::Test +{ +protected: + ClangRefactoring::LocatorFilter locatorFilter; +}; + +TEST_F(LocatorFilter, MatchesFor) +{ + QFutureInterface dummy; + + auto matches = locatorFilter.matchesFor(dummy, QString()); +} + +TEST_F(LocatorFilter, Accept) +{ + int start = 0; + int length = 0; + QString newText; + + locatorFilter.accept(Core::LocatorFilterEntry(), &newText, &start, &length); +} + +TEST_F(LocatorFilter, Refresh) +{ + QFutureInterface dummy; + + locatorFilter.refresh(dummy); +} + +} diff --git a/tests/unit/unittest/symbolsfindfilter-test.cpp b/tests/unit/unittest/symbolsfindfilter-test.cpp new file mode 100644 index 00000000000..fad174dfceb --- /dev/null +++ b/tests/unit/unittest/symbolsfindfilter-test.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "googletest.h" + +#include + +namespace { + +class SymbolsFindFilter : public ::testing::Test +{ +protected: + ClangRefactoring::SymbolsFindFilter symbolsFindFilter; +}; + +TEST_F(SymbolsFindFilter, FindAll) +{ + symbolsFindFilter.findAll("*", Core::FindRegularExpression); +} + +} diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index 257a83370c9..c0fcdff3bae 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -42,6 +42,7 @@ SOURCES += \ clangpathwatcher-test.cpp \ clangqueryexamplehighlightmarker-test.cpp \ clangqueryhighlightmarker-test.cpp \ + classesfilter-test.cpp \ clientserverinprocess-test.cpp \ clientserveroutsideprocess-test.cpp \ cppprojectfilecategorizer-test.cpp \ @@ -50,9 +51,12 @@ SOURCES += \ fakeprocess.cpp \ filepath-test.cpp \ filepathview-test.cpp \ + functionsfilter-test.cpp \ gtest-creator-printing.cpp \ gtest-qt-printing.cpp \ + includesfilter-test.cpp \ lineprefixer-test.cpp \ + locatorfilter-test.cpp \ matchingtext-test.cpp \ mimedatabase-utilities.cpp \ pchgenerator-test.cpp \ @@ -68,6 +72,7 @@ SOURCES += \ sourcerangefilter-test.cpp \ spydummy.cpp \ symbolindexer-test.cpp \ + symbolsfindfilter-test.cpp \ stringcache-test.cpp \ eventspy.cpp \ unittests-main.cpp \