diff --git a/src/plugins/ios/simulatorcontrol.cpp b/src/plugins/ios/simulatorcontrol.cpp index 2f63892025d..a533152b431 100644 --- a/src/plugins/ios/simulatorcontrol.cpp +++ b/src/plugins/ios/simulatorcontrol.cpp @@ -397,8 +397,8 @@ void SimulatorControlPrivate::startSimulator(QFutureInterface. +** 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 "findinfilessilversearcher.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "silversearcheroutputparser.h" + +#include +#include +#include + +using namespace Core; +using namespace TextEditor; +using namespace Utils; + +namespace { +const QLatin1String silverSearcherName("Silver Searcher"); + +using FutureInterfaceType = QFutureInterface; + +const QString metacharacters = "+()^$.{}[]|\\"; + +QString convertWildcardToRegex(const QString &wildcard) +{ + QString regex; + const int wildcardSize = wildcard.size(); + regex.append('^'); + for (int i = 0; i < wildcardSize; ++i) { + const QChar ch = wildcard[i]; + if (ch == '*') { + regex.append(".*"); + } else if (ch == '?') { + regex.append('.'); + } else if (metacharacters.indexOf(ch) != -1) { + regex.append('\\'); + regex.append(ch); + } else { + regex.append(ch); + } + } + regex.append('$'); + + return regex; +} + +bool isSilverSearcherAvailable() +{ + QProcess silverSearcherProcess; + silverSearcherProcess.start("ag", {"--version"}); + if (silverSearcherProcess.waitForFinished()) { + if (silverSearcherProcess.readAll().contains("ag version")) + return true; + } + + return false; +} + +void runSilverSeacher(FutureInterfaceType &fi, FileFindParameters parameters) +{ + ProgressTimer progress(fi, 5); + const QString directory = parameters.additionalParameters.toString(); + QStringList arguments = {"--parallel", "--ackmate"}; + + if (parameters.flags & FindCaseSensitively) + arguments << "-s"; + else + arguments << "-i"; + + if (parameters.flags & FindWholeWords) + arguments << "-w"; + + if (!(parameters.flags & FindRegularExpression)) + arguments << "-Q"; + + for (const QString &filter : parameters.exclusionFilters) + arguments << "--ignore" << filter; + + FileName path = FileName::fromUserInput(FileUtils::normalizePathName(directory)); + arguments << parameters.text << path.toString(); + + QString nameFiltersAsRegex; + for (const QString &filter : parameters.nameFilters) + nameFiltersAsRegex += QString("(%1)|").arg(convertWildcardToRegex(filter)); + nameFiltersAsRegex.remove(nameFiltersAsRegex.length() - 1, 1); + + arguments << "-G" << nameFiltersAsRegex; + + QProcess process; + process.start("ag", arguments); + if (process.waitForFinished()) { + typedef QList FileSearchResultList; + SilverSearcher::SilverSearcherOutputParser parser(process.readAll()); + FileSearchResultList items = parser.parse(); + if (!items.isEmpty()) + fi.reportResult(items); + } else { + fi.reportCanceled(); + } +} + +} // namespace + +namespace SilverSearcher { + +FindInFilesSilverSearcher::FindInFilesSilverSearcher() + : m_widget(0), + m_path("ag"), + m_toolName("SilverSearcher") +{ + m_widget = new QWidget; + FindInFiles *findInFiles = FindInFiles::instance(); + QTC_ASSERT(findInFiles, return); + findInFiles->addSearchEngine(this); + + setEnabled(isSilverSearcherAvailable()); + if (!isEnabled()) { + auto layout = new QHBoxLayout(m_widget); + layout->setMargin(0); + QLabel *label = new QLabel(tr("SilverSearcher is not available on system")); + label->setStyleSheet("QLabel { color : red; }"); + layout->addWidget(label); + } +} + +FindInFilesSilverSearcher::~FindInFilesSilverSearcher() +{ +} + +QVariant FindInFilesSilverSearcher::parameters() const +{ + return QVariant(); +} + +QString FindInFilesSilverSearcher::title() const +{ + return silverSearcherName; +} + +QString FindInFilesSilverSearcher::toolTip() const +{ + return QString(); +} + +QWidget *FindInFilesSilverSearcher::widget() const +{ + return m_widget; +} + +void FindInFilesSilverSearcher::writeSettings(QSettings * /*settings*/) const +{ +} + +QFuture FindInFilesSilverSearcher::executeSearch( + const FileFindParameters ¶meters, BaseFileFind * /*baseFileFind*/) +{ + return Utils::runAsync(runSilverSeacher, parameters); +} + +IEditor *FindInFilesSilverSearcher::openEditor(const SearchResultItem & /*item*/, + const FileFindParameters & /*parameters*/) +{ + return 0; +} + +void FindInFilesSilverSearcher::readSettings(QSettings */*settings*/) +{ +} + +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/findinfilessilversearcher.h b/src/plugins/silversearcher/findinfilessilversearcher.h new file mode 100644 index 00000000000..d290069cd5b --- /dev/null +++ b/src/plugins/silversearcher/findinfilessilversearcher.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Przemyslaw Gorszkowski . +** 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 + +namespace SilverSearcher { + +class FindInFilesSilverSearcher : public TextEditor::SearchEngine +{ + Q_OBJECT + +public: + FindInFilesSilverSearcher(); + ~FindInFilesSilverSearcher() override; + + // TextEditor::FileFindExtension + QString title() const override; + QString toolTip() const override; + QWidget *widget() const override; + QVariant parameters() const override; + void readSettings(QSettings *settings) override; + void writeSettings(QSettings *settings) const override; + QFuture executeSearch( + const TextEditor::FileFindParameters ¶meters, TextEditor::BaseFileFind *) override; + Core::IEditor *openEditor(const Core::SearchResultItem &item, + const TextEditor::FileFindParameters ¶meters) override; + +private: + QPointer m_currentFindSupport; + + Utils::FileName m_directorySetting; + QPointer m_widget; + QString m_path; + QString m_toolName; +}; + +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/outputparser_test.cpp b/src/plugins/silversearcher/outputparser_test.cpp new file mode 100644 index 00000000000..fb45d059410 --- /dev/null +++ b/src/plugins/silversearcher/outputparser_test.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "outputparser_test.h" +#include "silversearcheroutputparser.h" + +#include + +namespace SilverSearcher { +namespace Internal { + +void OutputParserTest::testNoResults() +{ + const char parserOutput[] = "\n"; + const QByteArray output(parserOutput); + SilverSearcher::SilverSearcherOutputParser ssop(output); + const QList items = ssop.parse(); + QCOMPARE(items.size(), 0); +} + +void OutputParserTest::testOneFileWithOneMatch() +{ + const char parserOutput[] = ":/file/path/to/filename.h\n" + "1;1 5:match\n"; + const QByteArray output(parserOutput); + SilverSearcher::SilverSearcherOutputParser ssop(output); + const QList items = ssop.parse(); + QCOMPARE(items.size(), 1); + QCOMPARE(items[0].fileName, QStringLiteral("/file/path/to/filename.h")); + QCOMPARE(items[0].lineNumber, 1); + QCOMPARE(items[0].matchingLine, QStringLiteral("match")); + QCOMPARE(items[0].matchStart, 1); + QCOMPARE(items[0].matchLength, 5); +} + +void OutputParserTest::testMultipleFilesWithOneMatch() +{ + const char parserOutput[] = ":/file/path/to/filename1.h\n" + "1;1 5:match\n" + "\n" + ":/file/path/to/filename2.h\n" + "2;2 5: match\n" + ; + const QByteArray output(parserOutput); + SilverSearcher::SilverSearcherOutputParser ssop(output); + const QList items = ssop.parse(); + QCOMPARE(items.size(), 2); + QCOMPARE(items[0].fileName, QStringLiteral("/file/path/to/filename1.h")); + QCOMPARE(items[0].lineNumber, 1); + QCOMPARE(items[0].matchingLine, QStringLiteral("match")); + QCOMPARE(items[0].matchStart, 1); + QCOMPARE(items[0].matchLength, 5); + + QCOMPARE(items[1].fileName, QStringLiteral("/file/path/to/filename2.h")); + QCOMPARE(items[1].lineNumber, 2); + QCOMPARE(items[1].matchingLine, QStringLiteral(" match")); + QCOMPARE(items[1].matchStart, 2); + QCOMPARE(items[1].matchLength, 5); +} + +void OutputParserTest::testOneFileWithMultipleMatches() +{ + const char parserOutput[] = ":/file/path/to/filename.h\n" + "1;1 5,7 5:match match\n"; + const QByteArray output(parserOutput); + SilverSearcher::SilverSearcherOutputParser ssop(output); + const QList items = ssop.parse(); + QCOMPARE(items.size(), 2); + QCOMPARE(items[0].fileName, QStringLiteral("/file/path/to/filename.h")); + QCOMPARE(items[0].lineNumber, 1); + QCOMPARE(items[0].matchingLine, QStringLiteral("match match")); + QCOMPARE(items[0].matchStart, 1); + QCOMPARE(items[0].matchLength, 5); + + QCOMPARE(items[1].fileName, QStringLiteral("/file/path/to/filename.h")); + QCOMPARE(items[1].lineNumber, 1); + QCOMPARE(items[1].matchingLine, QStringLiteral("match match")); + QCOMPARE(items[1].matchStart, 7); + QCOMPARE(items[1].matchLength, 5); +} + +void OutputParserTest::testMultipleFilesWithMultipleMatches() +{ + const char parserOutput[] = ":/file/path/to/filename1.h\n" + "1;1 5,7 5:match match\n" + "\n" + ":/file/path/to/filename2.h\n" + "2;2 5,8 5: match match\n"; + const QByteArray output(parserOutput); + SilverSearcher::SilverSearcherOutputParser ssop(output); + const QList items = ssop.parse(); + QCOMPARE(items.size(), 4); + QCOMPARE(items[0].fileName, QStringLiteral("/file/path/to/filename1.h")); + QCOMPARE(items[0].lineNumber, 1); + QCOMPARE(items[0].matchingLine, QStringLiteral("match match")); + QCOMPARE(items[0].matchStart, 1); + QCOMPARE(items[0].matchLength, 5); + + QCOMPARE(items[1].fileName, QStringLiteral("/file/path/to/filename1.h")); + QCOMPARE(items[1].lineNumber, 1); + QCOMPARE(items[1].matchingLine, QStringLiteral("match match")); + QCOMPARE(items[1].matchStart, 7); + QCOMPARE(items[1].matchLength, 5); + + QCOMPARE(items[2].fileName, QStringLiteral("/file/path/to/filename2.h")); + QCOMPARE(items[2].lineNumber, 2); + QCOMPARE(items[2].matchingLine, QStringLiteral(" match match")); + QCOMPARE(items[2].matchStart, 2); + QCOMPARE(items[2].matchLength, 5); + + QCOMPARE(items[3].fileName, QStringLiteral("/file/path/to/filename2.h")); + QCOMPARE(items[3].lineNumber, 2); + QCOMPARE(items[3].matchingLine, QStringLiteral(" match match")); + QCOMPARE(items[3].matchStart, 8); + QCOMPARE(items[3].matchLength, 5); +} + +} // namespace Internal +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/outputparser_test.h b/src/plugins/silversearcher/outputparser_test.h new file mode 100644 index 00000000000..a54ea7ac866 --- /dev/null +++ b/src/plugins/silversearcher/outputparser_test.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Przemyslaw Gorszkowski . +** 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 + +namespace SilverSearcher { +namespace Internal { + +class OutputParserTest : public QObject +{ + Q_OBJECT + +private slots: + void testNoResults(); + void testOneFileWithOneMatch(); + void testMultipleFilesWithOneMatch(); + void testOneFileWithMultipleMatches(); + void testMultipleFilesWithMultipleMatches(); +}; + +} // namespace Internal +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/silversearcher.pro b/src/plugins/silversearcher/silversearcher.pro new file mode 100644 index 00000000000..d3fa01f59c4 --- /dev/null +++ b/src/plugins/silversearcher/silversearcher.pro @@ -0,0 +1,16 @@ +include(../../qtcreatorplugin.pri) + +SOURCES += \ + findinfilessilversearcher.cpp \ + silversearcheroutputparser.cpp \ + silversearcherplugin.cpp + +HEADERS += \ + findinfilessilversearcher.h \ + silversearcheroutputparser.h \ + silversearcherplugin.h + +equals(TEST, 1) { + SOURCES += outputparser_test.cpp + HEADERS += outputparser_test.h +} diff --git a/src/plugins/silversearcher/silversearcher.qbs b/src/plugins/silversearcher/silversearcher.qbs new file mode 100644 index 00000000000..f099858f6e3 --- /dev/null +++ b/src/plugins/silversearcher/silversearcher.qbs @@ -0,0 +1,24 @@ +import qbs 1.0 + +QtcPlugin { + name: "SilverSearcher" + + Depends { name: "Utils" } + Depends { name: "Core" } + Depends { name: "TextEditor" } + + files: [ + "findinfilessilversearcher.cpp", "findinfilessilversearcher.h", + "silversearcheroutputparser.cpp", "silversearcheroutputparser.h", + "silversearcherplugin.cpp", "silversearcherplugin.h", + ] + + Group { + name: "Tests" + condition: qtc.testsEnabled + files: [ + "outputparser_test.cpp", + "outputparser_test.h", + ] + } +} diff --git a/src/plugins/silversearcher/silversearcher_dependencies.pri b/src/plugins/silversearcher/silversearcher_dependencies.pri new file mode 100644 index 00000000000..3b5379d2013 --- /dev/null +++ b/src/plugins/silversearcher/silversearcher_dependencies.pri @@ -0,0 +1,7 @@ +QTC_PLUGIN_NAME = SilverSearcher +QTC_LIB_DEPENDS += \ + utils + +QTC_PLUGIN_DEPENDS += \ + coreplugin \ + texteditor diff --git a/src/plugins/silversearcher/silversearcheroutputparser.cpp b/src/plugins/silversearcher/silversearcheroutputparser.cpp new file mode 100644 index 00000000000..cbc82c5632f --- /dev/null +++ b/src/plugins/silversearcher/silversearcheroutputparser.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Przemyslaw Gorszkowski . +** 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 "silversearcheroutputparser.h" + +#include + +namespace SilverSearcher { + +SilverSearcherOutputParser::SilverSearcherOutputParser( + const QByteArray &output) + : output(output) + , outputSize(output.size()) +{ +} + +QList SilverSearcherOutputParser::parse() +{ + while (index < outputSize - 1) { + if (output[index] == '\n') { + ++index; + continue; + } + parseFilePath(); + while (output[index] != '\n') { + parseLineNumber(); + if (index >= outputSize - 1) + break; + int matches = parseMatches(); + if (index >= outputSize - 1) + break; + parseText(); + for (int i = 0; i < matches; ++i) + items[items.size() - i - 1].matchingLine = item.matchingLine; + } + } + + return items; +} + +bool SilverSearcherOutputParser::parseFilePath() +{ + int startIndex = ++index; + while (index < outputSize && output[index] != '\n') + ++index; + item.fileName = QString::fromUtf8(output.data() + startIndex, index - startIndex); + ++index; + return true; +} + +bool SilverSearcherOutputParser::parseLineNumber() +{ + int startIndex = index; + while (index < outputSize && output[++index] != ';') { } + + item.lineNumber = QString::fromUtf8(output.data() + startIndex, index - startIndex).toInt(); + ++index; + return true; +} + +bool SilverSearcherOutputParser::parseMatchIndex() +{ + int startIndex = index; + while (index < outputSize && output[++index] != ' ') { } + + item.matchStart = QString::fromUtf8(output.data() + startIndex, index - startIndex).toInt(); + ++index; + return true; +} + +bool SilverSearcherOutputParser::parseMatchLength() +{ + int startIndex = index; + while (index < outputSize && output[++index] != ':' && output[index] != ',') { } + + item.matchLength = QString::fromUtf8(output.data() + startIndex, index - startIndex).toInt(); + return true; +} + +int SilverSearcherOutputParser::parseMatches() +{ + int matches = 1; + while (index < outputSize && output[index] != ':') { + if (output[index] == ',') { + ++matches; + ++index; + } + parseMatchIndex(); + parseMatchLength(); + items << item; + } + + ++index; + return matches; +} + +bool SilverSearcherOutputParser::parseText() +{ + int startIndex = index; + while (index < outputSize && output[++index] != '\n') { } + item.matchingLine = QString::fromUtf8(output.data() + startIndex, index - startIndex); + ++index; + return true; +} + +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/silversearcheroutputparser.h b/src/plugins/silversearcher/silversearcheroutputparser.h new file mode 100644 index 00000000000..fd96253427a --- /dev/null +++ b/src/plugins/silversearcher/silversearcheroutputparser.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Przemyslaw Gorszkowski . +** 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 + +namespace SilverSearcher { + +class SilverSearcherOutputParser +{ +public: + SilverSearcherOutputParser(const QByteArray &output); + + QList parse(); +private: + int parseMatches(); + bool parseMatchLength(); + bool parseMatchIndex(); + bool parseLineNumber(); + bool parseFilePath(); + bool parseText(); + + QByteArray output; + int outputSize = 0; + int index = 0; + Utils::FileSearchResult item; + QList items; +}; + +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/silversearcherplugin.cpp b/src/plugins/silversearcher/silversearcherplugin.cpp new file mode 100644 index 00000000000..80b5b0edc77 --- /dev/null +++ b/src/plugins/silversearcher/silversearcherplugin.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Przemyslaw Gorszkowski . +** 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 "silversearcherplugin.h" +#include "findinfilessilversearcher.h" +#include "outputparser_test.h" + +namespace SilverSearcher { +namespace Internal { + +bool SilverSearcherPlugin::initialize(const QStringList &arguments, QString *errorString) +{ + Q_UNUSED(arguments) + Q_UNUSED(errorString) + + addAutoReleasedObject(new FindInFilesSilverSearcher); + + return true; +} + +void SilverSearcherPlugin::extensionsInitialized() +{ +} + +QList SilverSearcherPlugin::createTestObjects() const +{ + return {new OutputParserTest}; +} + +} // namespace Internal +} // namespace SilverSearcher diff --git a/src/plugins/silversearcher/silversearcherplugin.h b/src/plugins/silversearcher/silversearcherplugin.h new file mode 100644 index 00000000000..5c3df4ea682 --- /dev/null +++ b/src/plugins/silversearcher/silversearcherplugin.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Przemyslaw Gorszkowski . +** 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 SilverSearcher { +namespace Internal { + +class SilverSearcherPlugin : public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "SilverSearcher.json") + +public: + bool initialize(const QStringList &arguments, QString *errorString); + void extensionsInitialized(); +#ifdef WITH_TESTS +private: + QList createTestObjects() const override; +#endif +}; + +} // namespace Internal +} // namespace SilverSearcher