forked from qt-creator/qt-creator
BaseFileFind: Replace additionalParameters() with searchDir()
The FileFindParameters::additionalParameters, holding QVariant, was ambiguous. Since GitGrep and SilverSearcher need a search directory input unconditionally, replace the additionalParameters field with searchDir of FilePath type. For Internal search engine, this field isn't used - the searchDir is already passed in FindInFiles::fileContainerProvider() with lambda capture; for other BaseFileFind subclasses, not combined with non-Internal search engine, the field isn't used anyway. This change closes the chain of patches to eliminate the usage of ambiguous QVariant type inside FileFindParameters. Change-Id: Icddd1cfe46e86ea892221862d9d267f9c9fa173c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -61,23 +61,18 @@ QString FindInFiles::displayName() const
|
||||
FileContainerProvider FindInFiles::fileContainerProvider() const
|
||||
{
|
||||
return [nameFilters = fileNameFilters(), exclusionFilters = fileExclusionFilters(),
|
||||
filePath = path()] {
|
||||
filePath = searchDir()] {
|
||||
return SubDirFileContainer({filePath}, nameFilters, exclusionFilters,
|
||||
EditorManager::defaultTextCodec());
|
||||
};
|
||||
}
|
||||
|
||||
QVariant FindInFiles::additionalParameters() const
|
||||
{
|
||||
return path().toVariant();
|
||||
}
|
||||
|
||||
QString FindInFiles::label() const
|
||||
{
|
||||
QString title = currentSearchEngine()->title();
|
||||
|
||||
const QChar slash = QLatin1Char('/');
|
||||
const QStringList &nonEmptyComponents = path().toFileInfo().absoluteFilePath()
|
||||
const QStringList &nonEmptyComponents = searchDir().toFileInfo().absoluteFilePath()
|
||||
.split(slash, Qt::SkipEmptyParts);
|
||||
return Tr::tr("%1 \"%2\":")
|
||||
.arg(title)
|
||||
@@ -88,7 +83,7 @@ QString FindInFiles::toolTip() const
|
||||
{
|
||||
//: the last arg is filled by BaseFileFind::runNewSearch
|
||||
QString tooltip = Tr::tr("Path: %1\nFilter: %2\nExcluding: %3\n%4")
|
||||
.arg(path().toUserOutput())
|
||||
.arg(searchDir().toUserOutput())
|
||||
.arg(fileNameFilters().join(','))
|
||||
.arg(fileExclusionFilters().join(','));
|
||||
|
||||
@@ -186,7 +181,7 @@ QWidget *FindInFiles::createConfigWidget()
|
||||
return m_configWidget;
|
||||
}
|
||||
|
||||
FilePath FindInFiles::path() const
|
||||
FilePath FindInFiles::searchDir() const
|
||||
{
|
||||
return m_directory->filePath();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user