forked from qt-creator/qt-creator
BaseFileFind: Some cleanup, also in derived classes
Change-Id: I1fb3d3937543f9c4fd8ca723410494cfc76322ee Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -266,7 +266,7 @@ SearchExecutor GitGrep::searchExecutor() const
|
|||||||
|
|
||||||
EditorOpener GitGrep::editorOpener() const
|
EditorOpener GitGrep::editorOpener() const
|
||||||
{
|
{
|
||||||
return [params = gitParameters()](const Utils::SearchResultItem &item,
|
return [params = gitParameters()](const SearchResultItem &item,
|
||||||
const FileFindParameters ¶meters) -> IEditor * {
|
const FileFindParameters ¶meters) -> IEditor * {
|
||||||
const QStringList &itemPath = item.path();
|
const QStringList &itemPath = item.path();
|
||||||
if (params.ref.isEmpty() || itemPath.isEmpty())
|
if (params.ref.isEmpty() || itemPath.isEmpty())
|
||||||
|
|||||||
@@ -11,14 +11,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
|
|
||||||
#include <utils/filesearch.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#include "projecttree.h"
|
#include "projecttree.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/filesearch.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -24,7 +22,7 @@ CurrentProjectFind::CurrentProjectFind()
|
|||||||
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
||||||
this, &CurrentProjectFind::handleProjectChanged);
|
this, &CurrentProjectFind::handleProjectChanged);
|
||||||
connect(ProjectManager::instance(), &ProjectManager::projectDisplayNameChanged,
|
connect(ProjectManager::instance(), &ProjectManager::projectDisplayNameChanged,
|
||||||
this, [this](ProjectExplorer::Project *p) {
|
this, [this](Project *p) {
|
||||||
if (p == ProjectTree::currentProject())
|
if (p == ProjectTree::currentProject())
|
||||||
emit displayNameChanged();
|
emit displayNameChanged();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/filesearch.h>
|
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
|||||||
@@ -19,22 +19,19 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fadingindicator.h>
|
#include <utils/fadingindicator.h>
|
||||||
#include <utils/filesearch.h>
|
|
||||||
#include <utils/futuresynchronizer.h>
|
#include <utils/futuresynchronizer.h>
|
||||||
#include <utils/process.h>
|
#include <utils/process.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stylehelper.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QHash>
|
|
||||||
#include <QPair>
|
|
||||||
#include <QPromise>
|
|
||||||
#include <QStringListModel>
|
|
||||||
#include <QFutureWatcher>
|
|
||||||
#include <QPointer>
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QFutureWatcher>
|
||||||
|
#include <QHash>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPair>
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QPromise>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStringListModel>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -389,9 +386,8 @@ void BaseFileFind::doReplace(const QString &text, const SearchResultItems &items
|
|||||||
{
|
{
|
||||||
const FilePaths files = replaceAll(text, items, preserveCase);
|
const FilePaths files = replaceAll(text, items, preserveCase);
|
||||||
if (!files.isEmpty()) {
|
if (!files.isEmpty()) {
|
||||||
Utils::FadingIndicator::showText(ICore::dialogParent(),
|
FadingIndicator::showText(ICore::dialogParent(),
|
||||||
Tr::tr("%n occurrences replaced.", nullptr, items.size()),
|
Tr::tr("%n occurrences replaced.", nullptr, items.size()), FadingIndicator::SmallText);
|
||||||
Utils::FadingIndicator::SmallText);
|
|
||||||
DocumentManager::notifyFilesChangedInternally(files);
|
DocumentManager::notifyFilesChangedInternally(files);
|
||||||
SearchResultWindow::instance()->hide();
|
SearchResultWindow::instance()->hide();
|
||||||
}
|
}
|
||||||
@@ -428,7 +424,7 @@ QList<QPair<QWidget *, QWidget *>> BaseFileFind::createPatternWidgets()
|
|||||||
syncComboWithSettings(d->m_filterCombo, d->m_filterSetting);
|
syncComboWithSettings(d->m_filterCombo, d->m_filterSetting);
|
||||||
QLabel *exclusionLabel = createLabel(msgExclusionPatternLabel());
|
QLabel *exclusionLabel = createLabel(msgExclusionPatternLabel());
|
||||||
d->m_exclusionCombo = createCombo(&d->m_exclusionStrings);
|
d->m_exclusionCombo = createCombo(&d->m_exclusionStrings);
|
||||||
d->m_exclusionCombo->setToolTip(msgFilePatternToolTip(Utils::InclusionType::Excluded));
|
d->m_exclusionCombo->setToolTip(msgFilePatternToolTip(InclusionType::Excluded));
|
||||||
exclusionLabel->setBuddy(d->m_exclusionCombo);
|
exclusionLabel->setBuddy(d->m_exclusionCombo);
|
||||||
syncComboWithSettings(d->m_exclusionCombo, d->m_exclusionSetting);
|
syncComboWithSettings(d->m_exclusionCombo, d->m_exclusionSetting);
|
||||||
return {{filterLabel, d->m_filterCombo}, {exclusionLabel, d->m_exclusionCombo}};
|
return {{filterLabel, d->m_filterCombo}, {exclusionLabel, d->m_exclusionCombo}};
|
||||||
|
|||||||
@@ -6,13 +6,9 @@
|
|||||||
#include "textdocument.h"
|
#include "textdocument.h"
|
||||||
#include "texteditortr.h"
|
#include "texteditortr.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <utils/filesearch.h>
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|||||||
@@ -9,20 +9,13 @@
|
|||||||
#include <coreplugin/find/findplugin.h>
|
#include <coreplugin/find/findplugin.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <utils/filesearch.h>
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
#include <utils/historycompleter.h>
|
#include <utils/historycompleter.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
@@ -153,7 +146,7 @@ QWidget *FindInFiles::createConfigWidget()
|
|||||||
/*restoreLastItemFromHistory=*/ true);
|
/*restoreLastItemFromHistory=*/ true);
|
||||||
if (!HistoryCompleter::historyExistsFor(QLatin1String(HistoryKey))) {
|
if (!HistoryCompleter::historyExistsFor(QLatin1String(HistoryKey))) {
|
||||||
auto completer = static_cast<HistoryCompleter *>(m_directory->lineEdit()->completer());
|
auto completer = static_cast<HistoryCompleter *>(m_directory->lineEdit()->completer());
|
||||||
const QStringList legacyHistory = Core::ICore::settings()->value(
|
const QStringList legacyHistory = ICore::settings()->value(
|
||||||
QLatin1String("Find/FindInFiles/directories")).toStringList();
|
QLatin1String("Find/FindInFiles/directories")).toStringList();
|
||||||
for (const QString &dir: legacyHistory)
|
for (const QString &dir: legacyHistory)
|
||||||
completer->addEntry(dir);
|
completer->addEntry(dir);
|
||||||
|
|||||||
@@ -5,10 +5,7 @@
|
|||||||
|
|
||||||
#include "basefilefind.h"
|
#include "basefilefind.h"
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QStringListModel>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
|||||||
@@ -6,12 +6,9 @@
|
|||||||
#include "textdocument.h"
|
#include "textdocument.h"
|
||||||
#include "texteditortr.h"
|
#include "texteditortr.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/documentmodel.h>
|
#include <coreplugin/editormanager/documentmodel.h>
|
||||||
|
|
||||||
#include <utils/filesearch.h>
|
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|||||||
Reference in New Issue
Block a user