Commit 02c4f0dd authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

FindInFiles: Use Utils namespace



Change-Id: I7f61ee40ecb84b594018a04062c702bb36ad4510
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 6513fc88
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
using namespace Utils;
static FindInFiles *m_instance = 0; static FindInFiles *m_instance = 0;
...@@ -80,12 +81,12 @@ void FindInFiles::findAll(const QString &txt, FindFlags findFlags) ...@@ -80,12 +81,12 @@ void FindInFiles::findAll(const QString &txt, FindFlags findFlags)
BaseFileFind::findAll(txt, findFlags); BaseFileFind::findAll(txt, findFlags);
} }
Utils::FileIterator *FindInFiles::files(const QStringList &nameFilters, FileIterator *FindInFiles::files(const QStringList &nameFilters,
const QVariant &additionalParameters) const const QVariant &additionalParameters) const
{ {
return new Utils::SubDirFileIterator(QStringList() << additionalParameters.toString(), return new SubDirFileIterator(QStringList() << additionalParameters.toString(),
nameFilters, nameFilters,
EditorManager::defaultTextCodec()); EditorManager::defaultTextCodec());
} }
QVariant FindInFiles::additionalParameters() const QVariant FindInFiles::additionalParameters() const
...@@ -130,7 +131,7 @@ QWidget *FindInFiles::createConfigWidget() ...@@ -130,7 +131,7 @@ QWidget *FindInFiles::createConfigWidget()
syncComboWithSettings(m_directory, m_directorySetting.toUserOutput()); syncComboWithSettings(m_directory, m_directorySetting.toUserOutput());
dirLabel->setBuddy(m_directory); dirLabel->setBuddy(m_directory);
gridLayout->addWidget(m_directory, 0, 1); gridLayout->addWidget(m_directory, 0, 1);
QPushButton *browseButton = new QPushButton(Utils::PathChooser::browseButtonLabel()); QPushButton *browseButton = new QPushButton(PathChooser::browseButtonLabel());
gridLayout->addWidget(browseButton, 0, 2); gridLayout->addWidget(browseButton, 0, 2);
connect(browseButton, &QAbstractButton::clicked, this, &FindInFiles::openFileBrowser); connect(browseButton, &QAbstractButton::clicked, this, &FindInFiles::openFileBrowser);
...@@ -160,10 +161,9 @@ void FindInFiles::openFileBrowser() ...@@ -160,10 +161,9 @@ void FindInFiles::openFileBrowser()
m_directory->setEditText(QDir::toNativeSeparators(dir)); m_directory->setEditText(QDir::toNativeSeparators(dir));
} }
Utils::FileName FindInFiles::path() const FileName FindInFiles::path() const
{ {
return Utils::FileName::fromUserInput(Utils::FileUtils::normalizePathName( return FileName::fromUserInput(FileUtils::normalizePathName(m_directory->currentText()));
m_directory->currentText()));
} }
void FindInFiles::writeSettings(QSettings *settings) void FindInFiles::writeSettings(QSettings *settings)
...@@ -181,13 +181,13 @@ void FindInFiles::readSettings(QSettings *settings) ...@@ -181,13 +181,13 @@ void FindInFiles::readSettings(QSettings *settings)
settings->beginGroup(QLatin1String("FindInFiles")); settings->beginGroup(QLatin1String("FindInFiles"));
readCommonSettings(settings, QLatin1String("*.cpp,*.h")); readCommonSettings(settings, QLatin1String("*.cpp,*.h"));
m_directoryStrings.setStringList(settings->value(QLatin1String("directories")).toStringList()); m_directoryStrings.setStringList(settings->value(QLatin1String("directories")).toStringList());
m_directorySetting = Utils::FileName::fromString( m_directorySetting = FileName::fromString(
settings->value(QLatin1String("currentDirectory")).toString()); settings->value(QLatin1String("currentDirectory")).toString());
settings->endGroup(); settings->endGroup();
syncComboWithSettings(m_directory, m_directorySetting.toUserOutput()); syncComboWithSettings(m_directory, m_directorySetting.toUserOutput());
} }
void FindInFiles::setDirectory(const Utils::FileName &directory) void FindInFiles::setDirectory(const FileName &directory)
{ {
syncComboWithSettings(m_directory, directory.toUserOutput()); syncComboWithSettings(m_directory, directory.toUserOutput());
} }
...@@ -197,6 +197,6 @@ void FindInFiles::findOnFileSystem(const QString &path) ...@@ -197,6 +197,6 @@ void FindInFiles::findOnFileSystem(const QString &path)
QTC_ASSERT(m_instance, return); QTC_ASSERT(m_instance, return);
const QFileInfo fi(path); const QFileInfo fi(path);
const QString folder = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath(); const QString folder = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
m_instance->setDirectory(Utils::FileName::fromString(folder)); m_instance->setDirectory(FileName::fromString(folder));
FindPlugin::instance()->openFindDialog(m_instance); FindPlugin::instance()->openFindDialog(m_instance);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment