Commit 8b5dcc13 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

Replace QFileInfo::fileName() with FileName::fileName()

Change-Id: I4852ff215abf25649fc5eac1e922ae901839ca3d
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 6fd0d4ed
......@@ -36,6 +36,7 @@
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <qtsingleapplication.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <QDebug>
......@@ -172,7 +173,7 @@ static bool copyRecursively(const QString &srcFilePath,
if (srcFileInfo.isDir()) {
QDir targetDir(tgtFilePath);
targetDir.cdUp();
if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName()))
if (!targetDir.mkdir(Utils::FileName::fromString(tgtFilePath).fileName()))
return false;
QDir sourceDir(srcFilePath);
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
......
......@@ -29,7 +29,8 @@
****************************************************************************/
#include "fileinprojectfinder.h"
#include <utils/qtcassert.h>
#include "fileutils.h"
#include "qtcassert.h"
#include <QDebug>
#include <QFileInfo>
......@@ -215,9 +216,9 @@ QString FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const
if (debug)
qDebug() << "FileInProjectFinder: checking project files ...";
const QString fileName = QFileInfo(originalPath).fileName();
const QString fileName = FileName::fromString(originalPath).fileName();
foreach (const QString &f, m_projectFiles) {
if (QFileInfo(f).fileName() == fileName) {
if (FileName::fromString(f).fileName() == fileName) {
m_cache.insert(originalPath, f);
if (success)
*success = true;
......
......@@ -156,7 +156,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
if (!tgtFilePath.exists()) {
QDir targetDir(tgtFilePath.toString());
targetDir.cdUp();
if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
if (!targetDir.mkdir(tgtFilePath.fileName())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils", "Failed to create directory \"%1\".")
.arg(tgtFilePath.toUserOutput());
......
......@@ -372,7 +372,7 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix,
registerVariable(prefix + kFileNamePostfix,
tr("%1: File name without path.").arg(heading),
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).fileName(); },
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : Utils::FileName::fromString(tmp).fileName(); },
visibleInChooser);
registerVariable(prefix + kFileBaseNamePostfix,
......
......@@ -28,6 +28,7 @@
**
****************************************************************************/
#include "fileutils.h"
#include "reloadpromptutils.h"
#include <QCoreApplication>
......@@ -53,7 +54,7 @@ QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &fileName,
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The file <i>%1</i> has changed outside Qt Creator. Do you want to reload it?");
}
msg = msg.arg(QFileInfo(fileName).fileName());
msg = msg.arg(FileName::fromString(fileName).fileName());
return reloadPrompt(title, msg, QDir::toNativeSeparators(fileName), parent);
}
......
......@@ -28,8 +28,9 @@
**
****************************************************************************/
#include "unixutils.h"
#include "fileutils.h"
#include <QSettings>
#include <QFileInfo>
#include <QCoreApplication>
......@@ -81,7 +82,7 @@ QString UnixUtils::substituteFileBrowserParameters(const QString &pre, const QSt
} else if (c == QLatin1Char('f')) {
s = QLatin1Char('"') + file + QLatin1Char('"');
} else if (c == QLatin1Char('n')) {
s = QLatin1Char('"') + QFileInfo(file).fileName() + QLatin1Char('"');
s = QLatin1Char('"') + FileName::fromString(file).fileName() + QLatin1Char('"');
} else if (c == QLatin1Char('%')) {
s = c;
} else {
......
......@@ -61,7 +61,7 @@ QString AndroidManifestDocument::defaultPath() const
QString AndroidManifestDocument::suggestedFileName() const
{
return filePath().toFileInfo().fileName();
return filePath().fileName();
}
bool AndroidManifestDocument::isModified() const
......
......@@ -301,7 +301,7 @@ QList<AndroidToolChainFactory::AndroidToolChainInformation> AndroidToolChainFact
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
QStringList() << QLatin1String("*"), QDir::Dirs);
while (it.hasNext()) {
const QString &fileName = QFileInfo(it.next()).fileName();
const QString &fileName = FileName::fromString(it.next()).fileName();
int idx = versionRegExp.indexIn(fileName);
if (idx == -1)
continue;
......@@ -376,7 +376,7 @@ QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::
QMap<Abi::Architecture, AndroidToolChain *> newestToolChainForArch;
while (it.hasNext()) {
const QString &fileName = QFileInfo(it.next()).fileName();
const QString &fileName = FileName::fromString(it.next()).fileName();
int idx = versionRegExp.indexIn(fileName);
if (idx == -1)
continue;
......@@ -417,7 +417,7 @@ QList<int> AndroidToolChainFactory::newestToolChainVersionForArch(Abi::Architect
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
QStringList() << QLatin1String("*"), QDir::Dirs);
while (it.hasNext()) {
const QString &fileName = QFileInfo(it.next()).fileName();
const QString &fileName = FileName::fromString(it.next()).fileName();
int idx = versionRegExp.indexIn(fileName);
if (idx == -1)
continue;
......
......@@ -76,7 +76,7 @@ QString JavaDocument::defaultPath() const
QString JavaDocument::suggestedFileName() const
{
return filePath().toFileInfo().fileName();
return filePath().fileName();
}
......
......@@ -388,7 +388,7 @@ QVariant BookmarkManager::data(const QModelIndex &index, int role) const
Bookmark *bookMark = m_bookmarksList.at(index.row());
if (role == BookmarkManager::Filename)
return QFileInfo(bookMark->fileName()).fileName();
return FileName::fromString(bookMark->fileName()).fileName();
if (role == BookmarkManager::LineNumber)
return bookMark->lineNumber();
if (role == BookmarkManager::Directory)
......
......@@ -63,7 +63,7 @@ static QString shadowBuildDirectory(const QString &projectFilePath, const Kit *k
return QString();
QFileInfo info(projectFilePath);
const QString projectName = QFileInfo(info.absolutePath()).fileName();
const QString projectName = FileName::fromString(info.absolutePath()).fileName();
ProjectMacroExpander expander(projectName, k, bcName);
QDir projectDir = QDir(Project::projectDirectory(FileName::fromString(projectFilePath)).toString());
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
......
......@@ -257,7 +257,7 @@ QString CMakeDocument::defaultPath() const
QString CMakeDocument::suggestedFileName() const
{
return filePath().toFileInfo().fileName();
return filePath().fileName();
}
//
......
......@@ -1213,7 +1213,7 @@ void CMakeCbpParser::parseUnit()
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
} else {
bool generated = false;
QString onlyFileName = QFileInfo(fileName).fileName();
QString onlyFileName = Utils::FileName::fromString(fileName).fileName();
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
......
......@@ -30,8 +30,9 @@
#include "openwithdialog.h"
#include <utils/fileutils.h>
#include <QPushButton>
#include <QFileInfo>
using namespace Core;
using namespace Core::Internal;
......@@ -41,7 +42,7 @@ OpenWithDialog::OpenWithDialog(const QString &fileName, QWidget *parent)
{
setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
label->setText(tr("Open file \"%1\" with:").arg(QFileInfo(fileName).fileName()));
label->setText(tr("Open file \"%1\" with:").arg(Utils::FileName::fromString(fileName).fileName()));
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
connect(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
......
......@@ -1612,7 +1612,7 @@ void EditorManagerPrivate::copyFileNameFromContextMenu()
{
if (!d->m_contextMenuEntry)
return;
QApplication::clipboard()->setText(QFileInfo(d->m_contextMenuEntry->fileName()).fileName());
QApplication::clipboard()->setText(FileName::fromString(d->m_contextMenuEntry->fileName()).fileName());
}
void EditorManagerPrivate::saveDocumentFromContextMenu()
......
......@@ -32,6 +32,7 @@
#include "infobar.h"
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QFile>
......@@ -263,7 +264,7 @@ QString IDocument::displayName() const
{
if (!d->displayName.isEmpty())
return d->displayName;
return d->filePath.toFileInfo().fileName();
return d->filePath.fileName();
}
/*!
......
......@@ -119,7 +119,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
// file names can match with +linenumber or :linenumber
name = entry;
const QString lineNoSuffix = EditorManager::splitLineNumber(&name);
name = QFileInfo(name).fileName();
name = Utils::FileName::fromString(name).fileName();
foreach (const QString &file, files) {
if (future.isCanceled())
break;
......
......@@ -149,7 +149,7 @@ void ToolSettings::apply()
if (tool->preset() && (*tool) != (*(tool->preset()))) {
// check if we need to choose a new file name
if (tool->preset()->fileName() == tool->fileName()) {
const QString &fileName = QFileInfo(tool->preset()->fileName()).fileName();
const QString &fileName = Utils::FileName::fromString(tool->preset()->fileName()).fileName();
const QString &newFilePath = getUserFilePath(fileName);
// TODO error handling if newFilePath.isEmpty() (i.e. failed to find a unused name)
tool->setFileName(newFilePath);
......
......@@ -30,7 +30,8 @@
#include "argumentscollector.h"
#include <QFileInfo>
#include <utils/fileutils.h>
#include <QCoreApplication>
static QString pasteRequestString() { return QLatin1String("paste"); }
......@@ -72,7 +73,7 @@ bool ArgumentsCollector::collect(const QStringList &args)
QString ArgumentsCollector::usageString() const
{
QString usage = QString::fromLatin1("Usage:\n\t%1 <request> [ <request options>]\n\t")
.arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
.arg(Utils::FileName::fromString(QCoreApplication::applicationFilePath()).fileName());
usage += QString::fromLatin1("Possible requests: \"%1\", \"%2\", \"%3\"\n\t")
.arg(pasteRequestString(), listProtocolsRequestString(), helpRequestString());
usage += QString::fromLatin1("Possible options for request \"%1\": \"%2 <file>\" (default: stdin), "
......
......@@ -38,7 +38,6 @@
#include <cplusplus/TypeOfExpression.h>
#include <QDir>
#include <QFileInfo>
#include <QSet>
#include <QQueue>
......@@ -258,7 +257,7 @@ Unknown::Unknown(const QString &type) : type(type)
CppInclude::CppInclude(const Document::Include &includeFile) :
path(QDir::toNativeSeparators(includeFile.resolvedFileName())),
fileName(QFileInfo(includeFile.resolvedFileName()).fileName())
fileName(Utils::FileName::fromString(includeFile.resolvedFileName()).fileName())
{
helpCategory = TextEditor::HelpItem::Brief;
helpIdCandidates = QStringList(fileName);
......
......@@ -53,7 +53,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(QWidget *parent, const QString &fil
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_ui->editorLabel->setText(m_ui->editorLabel->text().arg(QFileInfo(m_filePath).fileName()));
m_ui->editorLabel->setText(m_ui->editorLabel->text().arg(Utils::FileName::fromString(m_filePath).fileName()));
m_ui->editWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
CppSnippetProvider().decorateEditor(m_ui->editWidget);
......
......@@ -1917,7 +1917,7 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa
header.toString(),
headerPaths);
if (include.size() > 2) {
const QString headerFileName = QFileInfo(info->fileName()).fileName();
const QString headerFileName = Utils::FileName::fromString(info->fileName()).fileName();
QTC_ASSERT(!headerFileName.isEmpty(), break);
int priority = 0;
......
......@@ -40,11 +40,11 @@
#include <cppeditor/cppeditorconstants.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <QSettings>
#include <QDebug>
#include <QFile>
#include <QFileInfo>
#include <QCoreApplication>
#include <QDate>
#include <QLocale>
......@@ -157,7 +157,7 @@ static bool keyWordReplacement(const QString &keyWord,
return true;
}
if (keyWord == QLatin1String("%FILENAME%")) {
*value = QFileInfo(file).fileName();
*value = Utils::FileName::fromString(file).fileName();
return true;
}
if (keyWord == QLatin1String("%DATE%")) {
......
......@@ -45,7 +45,6 @@
#include <utils/hostosinfo.h>
#include <QDebug>
#include <QFileInfo>
#include <QtTest>
using namespace CppTools;
......@@ -653,7 +652,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
QHashIterator<Utils::FileName, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
fileNamesInWorkinCopy << QFileInfo(it.key().toString()).fileName();
fileNamesInWorkinCopy << Utils::FileName::fromString(it.key().toString()).fileName();
}
fileNamesInWorkinCopy.sort();
const QString expectedUiHeaderFileName = _("ui_mainwindow.h");
......@@ -671,8 +670,8 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
QVERIFY(document);
const QStringList includedFiles = document->includedFiles();
QCOMPARE(includedFiles.size(), 2);
QCOMPARE(QFileInfo(includedFiles.at(0)).fileName(), _("mainwindow.h"));
QCOMPARE(QFileInfo(includedFiles.at(1)).fileName(), _("ui_mainwindow.h"));
QCOMPARE(Utils::FileName::fromString(includedFiles.at(0)).fileName(), _("mainwindow.h"));
QCOMPARE(Utils::FileName::fromString(includedFiles.at(1)).fileName(), _("ui_mainwindow.h"));
}
/// QTCREATORBUG-9828: Locator shows symbols of closed files
......
......@@ -620,7 +620,7 @@ QVariant BreakpointItem::data(int column, int role) const
if (str.isEmpty() && !m_params.fileName.isEmpty())
str = m_params.fileName;
if (str.isEmpty()) {
QString s = QFileInfo(str).fileName();
QString s = Utils::FileName::fromString(str).fileName();
if (!s.isEmpty())
str = s;
}
......
......@@ -37,6 +37,7 @@
#include <debugger/shared/hostutils.h>
#include <debugger/threaddata.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QDir>
......@@ -87,7 +88,7 @@ static inline QString cdbBreakPointFileName(const BreakpointParameters &bp,
if (bp.fileName.isEmpty())
return bp.fileName;
if (bp.pathUsage == BreakpointUseShortPath)
return QFileInfo(bp.fileName).fileName();
return Utils::FileName::fromString(bp.fileName).fileName();
return cdbSourcePathMapping(QDir::toNativeSeparators(bp.fileName), sourcePathMapping, SourceToDebugger);
}
......
......@@ -181,7 +181,7 @@ QString StartApplicationParameters::displayName() const
{
const int maxLength = 60;
QString name = QFileInfo(localExecutable).fileName() + QLatin1Char(' ') + processArgs;
QString name = FileName::fromString(localExecutable).fileName() + QLatin1Char(' ') + processArgs;
if (name.size() > 60) {
int index = name.lastIndexOf(QLatin1Char(' '), maxLength);
if (index == -1)
......
......@@ -634,7 +634,7 @@ public:
message = tr("0x%1 hit").arg(data.address, 0, 16);
} else {
//: Message tracepoint: %1 file, %2 line %3 function hit.
message = tr("%1:%2 %3() hit").arg(QFileInfo(data.fileName).fileName()).
message = tr("%1:%2 %3() hit").arg(FileName::fromString(data.fileName).fileName()).
arg(data.lineNumber).
arg(cppFunctionAt(data.fileName, data.lineNumber));
}
......
......@@ -1860,7 +1860,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
}
cleanFilePath.clear();
const QString base = QFileInfo(fileName).fileName();
const QString base = FileName::fromString(fileName).fileName();
QMap<QString, QString>::const_iterator jt = m_baseNameToFullName.find(base);
while (jt != m_baseNameToFullName.end() && jt.key() == base) {
......@@ -2438,7 +2438,7 @@ QString GdbEngine::breakLocation(const QString &file) const
{
QString where = m_fullToShortName.value(file);
if (where.isEmpty())
return QFileInfo(file).fileName();
return FileName::fromString(file).fileName();
return where;
}
......
......@@ -37,11 +37,11 @@
#include <debugger/watchhandler.h>
#include <qmldebug/qmldebugconstants.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QElapsedTimer>
#include <QFileInfo>
#include <QLoggingCategory>
using namespace QmlDebug;
......@@ -583,7 +583,7 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file,
log(LogSend, QString::fromLatin1("FETCH_OBJECTS_FOR_LOCATION %1:%2:%3").arg(file)
.arg(QString::number(lineNumber)).arg(QString::number(columnNumber)));
quint32 queryId = m_engineClient->queryObjectsForLocation(QFileInfo(file).fileName(),
quint32 queryId = m_engineClient->queryObjectsForLocation(Utils::FileName::fromString(file).fileName(),
lineNumber, columnNumber);
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber
<< ':' << columnNumber << ')' << " - query id" << queryId;
......
......@@ -471,7 +471,7 @@ void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString
args.setProperty(_(TYPE), QScriptValue(type));
if (type == _(SCRIPTREGEXP))
args.setProperty(_(TARGET),
QScriptValue(QFileInfo(target).fileName()));
QScriptValue(Utils::FileName::fromString(target).fileName()));
else
args.setProperty(_(TARGET), QScriptValue(target));
......
......@@ -40,10 +40,10 @@
#include <cppeditor/cppeditorconstants.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QDebug>
#include <QFileInfo>
#include <QTextBlock>
#include <limits.h>
......@@ -107,7 +107,7 @@ void SourceAgent::setContent(const QString &filePath, const QString &content)
if (!d->editor) {
QString titlePattern = d->producer + QLatin1String(": ")
+ QFileInfo(filePath).fileName();
+ Utils::FileName::fromString(filePath).fileName();
d->editor = qobject_cast<BaseTextEditor *>(
EditorManager::openEditorWithContents(
CppEditor::Constants::CPPEDITOR_ID,
......
......@@ -34,11 +34,11 @@
#include "debuggercore.h"
#include "simplifytype.h"
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QDebug>
#include <QFileInfo>
namespace Debugger {
namespace Internal {
......@@ -111,7 +111,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const
case StackFunctionNameColumn:
return simplifyType(frame.function);
case StackFileNameColumn:
return frame.file.isEmpty() ? frame.from : QFileInfo(frame.file).fileName();
return frame.file.isEmpty() ? frame.from : Utils::FileName::fromString(frame.file).fileName();
case StackLineNumberColumn:
return frame.line > 0 ? QVariant(frame.line) : QVariant();
case StackAddressColumn:
......
......@@ -44,6 +44,8 @@
#include <texteditor/displaysettings.h>
#include <texteditor/marginsettings.h>
#include <utils/fileutils.h>
#include <QStackedWidget>
#include <QToolButton>
#include <QSpinBox>
......@@ -52,7 +54,6 @@
#include <QHBoxLayout>
#include <QToolBar>
#include <QComboBox>
#include <QFileInfo>
#include <QDir>
#include <QTextCodec>
#include <QTextBlock>
......@@ -421,8 +422,8 @@ void DiffEditor::slotDiffFilesChanged(const QList<FileData> &diffFileList,
for (int i = 0; i < count; i++) {
const DiffFileInfo leftEntry = diffFileList.at(i).leftFileInfo;
const DiffFileInfo rightEntry = diffFileList.at(i).rightFileInfo;
const QString leftShortFileName = QFileInfo(leftEntry.fileName).fileName();
const QString rightShortFileName = QFileInfo(rightEntry.fileName).fileName();
const QString leftShortFileName = Utils::FileName::fromString(leftEntry.fileName).fileName();
const QString rightShortFileName = Utils::FileName::fromString(rightEntry.fileName).fileName();
QString itemText;
QString itemToolTip;
if (leftEntry.fileName == rightEntry.fileName) {
......
......@@ -536,7 +536,7 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch
branchRegexp.reset(); // Oops.
}
foreach (const QString &repository, gitRepositories) {
const QString fileName = QFileInfo(repository).fileName();
const QString fileName = Utils::FileName::fromString(repository).fileName();
if ((!branchRegexp.isNull() && branchRegexp->exactMatch(fileName))
|| fileName == project) {
// Perform a check on the branch.
......
......@@ -46,6 +46,8 @@
#include <qtsupport/qtoutputformatter.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/fileutils.h>
#include <QList>
#include <QStandardItemModel>
......@@ -301,7 +303,7 @@ QString IosRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.")
.arg(QFileInfo(m_profilePath).fileName());
.arg(FileName::fromString(m_profilePath).fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())
->disabledReasonForRunConfiguration(m_profilePath);
......
......@@ -415,7 +415,7 @@ void AbstractProcessStep::taskAdded(const Task &task)
// 3. give up.
QList<QFileInfo> possibleFiles;
QString fileName = QFileInfo(filePath).fileName();
QString fileName = Utils::FileName::fromString(filePath).fileName();
foreach (const QString &file, project()->files(Project::AllFiles)) {
QFileInfo candidate(file);
if (candidate.fileName() == fileName)
......
......@@ -93,7 +93,7 @@ Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFi
foreach (const QString &file, projectFiles) {
if (Utils::anyOf(filterRegs,
[&file](QRegExp reg) {
return (reg.exactMatch(file) || reg.exactMatch(QFileInfo(file).fileName()));
return (reg.exactMatch(file) || reg.exactMatch(Utils::FileName::fromString(file).fileName()));
})) {
filteredFiles.append(file);
}
......
......@@ -30,7 +30,8 @@
#include "deployablefile.h"
#include <QFileInfo>
#include <utils/fileutils.h>
#include <QHash>
using namespace Utils;
......@@ -55,7 +56,7 @@ DeployableFile::DeployableFile(const FileName &localFilePath, const QString &rem
QString DeployableFile::remoteFilePath() const
{
return m_remoteDir.isEmpty()
? QString() : m_remoteDir + QLatin1Char('/') + m_localFilePath.toFileInfo().fileName();
? QString() : m_remoteDir + QLatin1Char('/') + m_localFilePath.fileName();
}
bool DeployableFile::isValid() const
......
......@@ -30,10 +30,10 @@
#include "processparameters.h"
#include <utils/fileutils.h>
#include <utils/macroexpander.h>
#include <utils/qtcprocess.h>
#include <QFileInfo>
#include <QDir>
/*!
......@@ -163,7 +163,7 @@ QString ProcessParameters::prettyCommand() const
QString cmd = m_command;
if (m_macroExpander)
cmd = m_macroExpander->expand(cmd);
return QFileInfo(cmd).fileName();
return Utils::FileName::fromString(cmd).fileName();
}
QString ProcessParameters::prettyArguments() const
......
......@@ -63,8 +63,8 @@ bool sortNodes(Node *n1, Node *n2)
FileNode *file2 = dynamic_cast<FileNode*>(n2);
if (file1 && file1->fileType() == ProjectFileType) {
if (file2 && file2->fileType() == ProjectFileType) {
const QString fileName1 = QFileInfo(file1->path()).fileName();
const QString fileName2 = QFileInfo(file2->path()).fileName();
const QString fileName1 = Utils::FileName::fromString(file1->path()).fileName();
const QString fileName2 = Utils::FileName::fromString(file2->path()).fileName();
int result = caseFriendlyCompare(fileName1, fileName2);
if (result != 0)
......@@ -149,8 +149,8 @@ bool sortNodes(Node *n1, Node *n2)
const QString filePath1 = n1->path();
const QString filePath2 = n2->path();
const QString fileName1 = QFileInfo(filePath1).fileName();
const QString fileName2 = QFileInfo(filePath2).fileName();
const QString fileName1 = Utils::FileName::fromString(filePath1).fileName();
const QString fileName2 = Utils::FileName::fromString(filePath2).fileName();
result = caseFriendlyCompare(fileName1, fileName2);
if (result != 0) {
......@@ -288,7 +288,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
break;
}
case Qt::EditRole: {
result = QFileInfo(node->path()).fileName();
result = Utils::FileName::fromString(node->path()).fileName();
break;
}
case Qt::ToolTipRole: {
......
......@@ -40,6 +40,7 @@
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
......@@ -168,7 +169,7 @@ int Node::line() const
QString Node::displayName() const
{
return QFileInfo(path()).fileName();
return Utils::FileName::fromString(path()).fileName();