diff options
author | hjk <hjk@qt.io> | 2019-05-28 13:49:26 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-05-28 12:23:26 +0000 |
commit | 473a741c9fcf09febba312464fab8385e2351181 (patch) | |
tree | 2d328a090993cb5c5fd34b43e9468bcbf7e4d4d0 /src/plugins/coreplugin | |
parent | 4704f49fbb1201ebf10ab9dbaed0275ff25faba8 (diff) |
Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.
Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/coreplugin')
29 files changed, 64 insertions, 64 deletions
diff --git a/src/plugins/coreplugin/corejsextensions.cpp b/src/plugins/coreplugin/corejsextensions.cpp index 02e6601640..b5cbd08973 100644 --- a/src/plugins/coreplugin/corejsextensions.cpp +++ b/src/plugins/coreplugin/corejsextensions.cpp @@ -118,7 +118,7 @@ QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const QString UtilsJsExtension::fileName(const QString &path, const QString &extension) const { - return Utils::FileName::fromStringWithExtension(path, extension).toString(); + return Utils::FilePath::fromStringWithExtension(path, extension).toString(); } QString UtilsJsExtension::mktemp(const QString &pattern) const diff --git a/src/plugins/coreplugin/dialogs/filepropertiesdialog.cpp b/src/plugins/coreplugin/dialogs/filepropertiesdialog.cpp index e4ed48648b..fef059d7fa 100644 --- a/src/plugins/coreplugin/dialogs/filepropertiesdialog.cpp +++ b/src/plugins/coreplugin/dialogs/filepropertiesdialog.cpp @@ -37,7 +37,7 @@ #include <QFileInfo> #include <QLocale> -FilePropertiesDialog::FilePropertiesDialog(const Utils::FileName &fileName, QWidget *parent) : +FilePropertiesDialog::FilePropertiesDialog(const Utils::FilePath &fileName, QWidget *parent) : QDialog(parent), m_ui(new Ui::FilePropertiesDialog), m_fileName(fileName.toString()) diff --git a/src/plugins/coreplugin/dialogs/filepropertiesdialog.h b/src/plugins/coreplugin/dialogs/filepropertiesdialog.h index db55abeb0e..95d8bfbceb 100644 --- a/src/plugins/coreplugin/dialogs/filepropertiesdialog.h +++ b/src/plugins/coreplugin/dialogs/filepropertiesdialog.h @@ -41,7 +41,7 @@ class FilePropertiesDialog : public QDialog Q_OBJECT public: - explicit FilePropertiesDialog(const Utils::FileName &fileName, QWidget *parent = nullptr); + explicit FilePropertiesDialog(const Utils::FilePath &fileName, QWidget *parent = nullptr); ~FilePropertiesDialog() override; private: diff --git a/src/plugins/coreplugin/dialogs/openwithdialog.cpp b/src/plugins/coreplugin/dialogs/openwithdialog.cpp index 7452fdb319..526a32f7e5 100644 --- a/src/plugins/coreplugin/dialogs/openwithdialog.cpp +++ b/src/plugins/coreplugin/dialogs/openwithdialog.cpp @@ -37,7 +37,7 @@ OpenWithDialog::OpenWithDialog(const QString &fileName, QWidget *parent) { setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - label->setText(tr("Open file \"%1\" with:").arg(Utils::FileName::fromString(fileName).fileName())); + label->setText(tr("Open file \"%1\" with:").arg(Utils::FilePath::fromString(fileName).fileName())); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); connect(buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp index edec9d7f25..d08c74ae96 100644 --- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp +++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp @@ -283,7 +283,7 @@ int ReadOnlyFilesDialog::exec() result = static_cast<ReadOnlyResult>(buttongroup.group->checkedId()); switch (result) { case RO_MakeWritable: - if (!Utils::FileUtils::makeWritable(Utils::FileName::fromFileInfo(buttongroup.fileName))) { + if (!Utils::FileUtils::makeWritable(Utils::FilePath::fromFileInfo(buttongroup.fileName))) { failedToMakeWritable << buttongroup.fileName; continue; } @@ -403,7 +403,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const QStringList &fileNames) auto item = new QTreeWidgetItem(ui.treeWidget); item->setText(FileName, visibleName); item->setIcon(FileName, FileIconProvider::icon(fileName)); - item->setText(Folder, Utils::FileName::fromFileInfo(directory).shortNativePath()); + item->setText(Folder, Utils::FilePath::fromFileInfo(directory).shortNativePath()); auto radioButtonGroup = new QButtonGroup; // Add a button for opening the file with a version control system diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 13b5b42546..933b20bd3f 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -164,7 +164,7 @@ public: QFileSystemWatcher *m_linkWatcher = nullptr; // Delayed creation (only UNIX/if a link is seen). QString m_lastVisitedDirectory = QDir::currentPath(); QString m_defaultLocationForNewFiles; - FileName m_projectsDirectory; + FilePath m_projectsDirectory; // When we are calling into an IDocument // we don't want to receive a changed() // signal @@ -438,14 +438,14 @@ void DocumentManager::renamedFile(const QString &from, const QString &to) foreach (IDocument *document, documentsToRename) { d->m_blockedIDocument = document; removeFileInfo(document); - document->setFilePath(FileName::fromString(to)); + document->setFilePath(FilePath::fromString(to)); addFileInfo(document); d->m_blockedIDocument = nullptr; } emit m_instance->allDocumentsRenamed(from, to); } -void DocumentManager::filePathChanged(const FileName &oldName, const FileName &newName) +void DocumentManager::filePathChanged(const FilePath &oldName, const FilePath &newName) { auto doc = qobject_cast<IDocument *>(sender()); QTC_ASSERT(doc, return); @@ -961,7 +961,7 @@ bool DocumentManager::saveModifiedDocument(IDocument *document, const QString &m alwaysSaveMessage, alwaysSave, failedToClose); } -void DocumentManager::showFilePropertiesDialog(const FileName &filePath) +void DocumentManager::showFilePropertiesDialog(const FilePath &filePath) { FilePropertiesDialog properties(filePath); properties.exec(); @@ -1340,12 +1340,12 @@ void readSettings() } s->beginGroup(QLatin1String(directoryGroupC)); - const FileName settingsProjectDir = FileName::fromString(s->value(QLatin1String(projectDirectoryKeyC), + const FilePath settingsProjectDir = FilePath::fromString(s->value(QLatin1String(projectDirectoryKeyC), QString()).toString()); if (!settingsProjectDir.isEmpty() && settingsProjectDir.toFileInfo().isDir()) d->m_projectsDirectory = settingsProjectDir; else - d->m_projectsDirectory = FileName::fromString(PathChooser::homePath()); + d->m_projectsDirectory = FilePath::fromString(PathChooser::homePath()); d->m_useProjectsDirectory = s->value(QLatin1String(useProjectDirectoryKeyC), d->m_useProjectsDirectory).toBool(); @@ -1398,7 +1398,7 @@ void DocumentManager::setDefaultLocationForNewFiles(const QString &location) \sa setProjectsDirectory, setUseProjectsDirectory */ -FileName DocumentManager::projectsDirectory() +FilePath DocumentManager::projectsDirectory() { return d->m_projectsDirectory; } @@ -1410,7 +1410,7 @@ FileName DocumentManager::projectsDirectory() \sa projectsDirectory, useProjectsDirectory */ -void DocumentManager::setProjectsDirectory(const FileName &directory) +void DocumentManager::setProjectsDirectory(const FilePath &directory) { if (d->m_projectsDirectory != directory) { d->m_projectsDirectory = directory; diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h index 911e46615a..92323efdc3 100644 --- a/src/plugins/coreplugin/documentmanager.h +++ b/src/plugins/coreplugin/documentmanager.h @@ -34,7 +34,7 @@ QT_BEGIN_NAMESPACE class QStringList; QT_END_NAMESPACE -namespace Utils { class FileName; } +namespace Utils { class FilePath; } namespace Core { @@ -123,7 +123,7 @@ public: const QString &alwaysSaveMessage = QString(), bool *alwaysSave = nullptr, QList<IDocument *> *failedToClose = nullptr); - static void showFilePropertiesDialog(const Utils::FileName &filePath); + static void showFilePropertiesDialog(const Utils::FilePath &filePath); static QString fileDialogLastVisitedDirectory(); static void setFileDialogLastVisitedDirectory(const QString &); @@ -136,8 +136,8 @@ public: static bool useProjectsDirectory(); static void setUseProjectsDirectory(bool); - static Utils::FileName projectsDirectory(); - static void setProjectsDirectory(const Utils::FileName &directory); + static Utils::FilePath projectsDirectory(); + static void setProjectsDirectory(const Utils::FilePath &directory); /* Used to notify e.g. the code model to update the given files. Does *not* lead to any editors to reload or any other editor manager actions. */ @@ -151,7 +151,7 @@ signals: void allDocumentsRenamed(const QString &from, const QString &to); /// emitted if one document changed its name e.g. due to save as void documentRenamed(Core::IDocument *document, const QString &from, const QString &to); - void projectsDirectoryChanged(const Utils::FileName &directory); + void projectsDirectoryChanged(const Utils::FilePath &directory); private: explicit DocumentManager(QObject *parent); @@ -161,7 +161,7 @@ private: void checkForNewFileName(); void checkForReload(); void changedFile(const QString &file); - void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName); + void filePathChanged(const Utils::FilePath &oldName, const Utils::FilePath &newName); friend class Core::Internal::MainWindow; friend class Core::Internal::DocumentManagerPrivate; diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp index 5406a59047..b3cec42210 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.cpp +++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp @@ -101,7 +101,7 @@ int DocumentModelPrivate::rowCount(const QModelIndex &parent) const void DocumentModelPrivate::addEntry(DocumentModel::Entry *entry) { - const Utils::FileName fileName = entry->fileName(); + const Utils::FilePath fileName = entry->fileName(); QString fixedPath; if (!fileName.isEmpty()) fixedPath = DocumentManager::filePathKey(fileName.toString(), DocumentManager::ResolveLinks); @@ -169,7 +169,7 @@ bool DocumentModelPrivate::disambiguateDisplayNames(DocumentModel::Entry *entry) bool seenDups = false; for (int i = 0; i < dupsCount - 1; ++i) { DynamicEntry &e = dups[i]; - const Utils::FileName myFileName = e->document->filePath(); + const Utils::FilePath myFileName = e->document->filePath(); if (e->document->isTemporary() || myFileName.isEmpty() || count > 10) { // path-less entry, append number e.setNumberedName(++serial); @@ -178,7 +178,7 @@ bool DocumentModelPrivate::disambiguateDisplayNames(DocumentModel::Entry *entry) for (int j = i + 1; j < dupsCount; ++j) { DynamicEntry &e2 = dups[j]; if (e->displayName().compare(e2->displayName(), Utils::HostOsInfo::fileNameCaseSensitivity()) == 0) { - const Utils::FileName otherFileName = e2->document->filePath(); + const Utils::FilePath otherFileName = e2->document->filePath(); if (otherFileName.isEmpty()) continue; seenDups = true; @@ -225,7 +225,7 @@ QIcon DocumentModelPrivate::pinnedIcon() return icon; } -Utils::optional<int> DocumentModelPrivate::indexOfFilePath(const Utils::FileName &filePath) const +Utils::optional<int> DocumentModelPrivate::indexOfFilePath(const Utils::FilePath &filePath) const { if (filePath.isEmpty()) return Utils::nullopt; @@ -420,7 +420,7 @@ DocumentModel::Entry *DocumentModelPrivate::addSuspendedDocument(const QString & { auto entry = new DocumentModel::Entry; entry->document = new IDocument; - entry->document->setFilePath(Utils::FileName::fromString(fileName)); + entry->document->setFilePath(Utils::FilePath::fromString(fileName)); entry->document->setPreferredDisplayName(displayName); entry->document->setId(id); entry->isSuspended = true; @@ -551,7 +551,7 @@ QAbstractItemModel *DocumentModel::model() return d; } -Utils::FileName DocumentModel::Entry::fileName() const +Utils::FilePath DocumentModel::Entry::fileName() const { return document->filePath(); } @@ -594,7 +594,7 @@ Utils::optional<int> DocumentModel::indexOfDocument(IDocument *document) return d->indexOfDocument(document); } -Utils::optional<int> DocumentModel::indexOfFilePath(const Utils::FileName &filePath) +Utils::optional<int> DocumentModel::indexOfFilePath(const Utils::FilePath &filePath) { return d->indexOfFilePath(filePath); } @@ -605,7 +605,7 @@ DocumentModel::Entry *DocumentModel::entryForDocument(IDocument *document) [&document](Entry *entry) { return entry->document == document; }); } -DocumentModel::Entry *DocumentModel::entryForFilePath(const Utils::FileName &filePath) +DocumentModel::Entry *DocumentModel::entryForFilePath(const Utils::FilePath &filePath) { const Utils::optional<int> index = d->indexOfFilePath(filePath); if (!index) @@ -620,7 +620,7 @@ QList<IDocument *> DocumentModel::openedDocuments() IDocument *DocumentModel::documentForFilePath(const QString &filePath) { - const Utils::optional<int> index = d->indexOfFilePath(Utils::FileName::fromString(filePath)); + const Utils::optional<int> index = d->indexOfFilePath(Utils::FilePath::fromString(filePath)); if (!index) return nullptr; return d->m_entries.at(*index)->document; diff --git a/src/plugins/coreplugin/editormanager/documentmodel.h b/src/plugins/coreplugin/editormanager/documentmodel.h index 8cb5286c55..72b4caeedb 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.h +++ b/src/plugins/coreplugin/editormanager/documentmodel.h @@ -53,7 +53,7 @@ public: struct CORE_EXPORT Entry { Entry(); ~Entry(); - Utils::FileName fileName() const; + Utils::FilePath fileName() const; QString displayName() const; QString plainDisplayName() const; QString uniqueDisplayName() const; @@ -79,9 +79,9 @@ public: static int entryCount(); static QList<Entry *> entries(); static Utils::optional<int> indexOfDocument(IDocument *document); - static Utils::optional<int> indexOfFilePath(const Utils::FileName &filePath); + static Utils::optional<int> indexOfFilePath(const Utils::FilePath &filePath); static Entry *entryForDocument(IDocument *document); - static Entry *entryForFilePath(const Utils::FileName &filePath); + static Entry *entryForFilePath(const Utils::FilePath &filePath); static QList<IDocument *> openedDocuments(); static IDocument *documentForFilePath(const QString &filePath); diff --git a/src/plugins/coreplugin/editormanager/documentmodel_p.h b/src/plugins/coreplugin/editormanager/documentmodel_p.h index 4a92baad7f..e5d7fa2a2c 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel_p.h +++ b/src/plugins/coreplugin/editormanager/documentmodel_p.h @@ -58,7 +58,7 @@ public: void addEntry(DocumentModel::Entry *entry); void removeDocument(int idx); - Utils::optional<int> indexOfFilePath(const Utils::FileName &filePath) const; + Utils::optional<int> indexOfFilePath(const Utils::FilePath &filePath) const; Utils::optional<int> indexOfDocument(IDocument *document) const; bool disambiguateDisplayNames(DocumentModel::Entry *entry); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 62fbe7a3f1..4d5bf55bb8 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -608,7 +608,7 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN Utils::MimeType mimeType = Utils::mimeTypeForFile(fn); QMessageBox msgbox(QMessageBox::Critical, EditorManager::tr("File Error"), tr("Could not open \"%1\": Cannot open files of type \"%2\".") - .arg(FileName::fromString(realFn).toUserOutput(), mimeType.name()), + .arg(FilePath::fromString(realFn).toUserOutput(), mimeType.name()), QMessageBox::Ok, ICore::dialogParent()); msgbox.exec(); return nullptr; @@ -650,7 +650,7 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN tr("Could not open \"%1\" for reading. " "Either the file does not exist or you do not have " "the permissions to open it.") - .arg(FileName::fromString(realFn).toUserOutput()), + .arg(FilePath::fromString(realFn).toUserOutput()), QMessageBox::Ok, ICore::dialogParent()); msgbox.exec(); return nullptr; @@ -659,7 +659,7 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN if (errorString.isEmpty()) { errorString = tr("Could not open \"%1\": Unknown error.") - .arg(FileName::fromString(realFn).toUserOutput()); + .arg(FilePath::fromString(realFn).toUserOutput()); } QMessageBox msgbox(QMessageBox::Critical, EditorManager::tr("File Error"), errorString, QMessageBox::Open | QMessageBox::Cancel, ICore::mainWindow()); @@ -2306,7 +2306,7 @@ void EditorManagerPrivate::findInDirectory() { if (!d->m_contextMenuEntry || d->m_contextMenuEntry->fileName().isEmpty()) return; - const FileName path = d->m_contextMenuEntry->fileName(); + const FilePath path = d->m_contextMenuEntry->fileName(); emit m_instance->findOnFileSystemRequest( (path.toFileInfo().isDir() ? path : path.parentDir()).toString()); } @@ -2467,7 +2467,7 @@ void EditorManager::addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentMod d->m_contextMenuEntry = entry; d->m_contextMenuEditor = editor; - const FileName filePath = entry ? entry->fileName() : FileName(); + const FilePath filePath = entry ? entry->fileName() : FilePath(); const bool copyActionsEnabled = !filePath.isEmpty(); d->m_copyFilePathContextAction->setEnabled(copyActionsEnabled); d->m_copyLocationContextAction->setEnabled(copyActionsEnabled); diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 808d5ca198..41429aedb1 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -182,7 +182,7 @@ signals: void editorsClosed(QList<Core::IEditor *> editors); void documentClosed(Core::IDocument *document); void findOnFileSystemRequest(const QString &path); - void openFileProperties(const Utils::FileName &path); + void openFileProperties(const Utils::FilePath &path); void aboutToSave(IDocument *document); void saved(IDocument *document); void autoSaved(); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index aea929a3aa..d38923be38 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -268,7 +268,7 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo const EditLocation &item = history.at(i); if (item.document == document || (!item.document - && !DocumentModel::indexOfFilePath(FileName::fromString(item.fileName)))) { + && !DocumentModel::indexOfFilePath(FilePath::fromString(item.fileName)))) { history.removeAt(i--); } } diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index d766531f51..ad1775f9d2 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -217,7 +217,7 @@ static DocumentModel::Entry *entryForEditLocation(const EditLocation &item) { if (!item.document.isNull()) return DocumentModel::entryForDocument(item.document); - return DocumentModel::entryForFilePath(Utils::FileName::fromString(item.fileName)); + return DocumentModel::entryForFilePath(Utils::FilePath::fromString(item.fileName)); } void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, EditorView *view, diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h index b41ae450f2..394ee091a5 100644 --- a/src/plugins/coreplugin/externaltool.h +++ b/src/plugins/coreplugin/externaltool.h @@ -145,7 +145,7 @@ private: bool resolve(); const ExternalTool *m_tool; // is a copy of the tool that was passed in - Utils::FileName m_resolvedExecutable; + Utils::FilePath m_resolvedExecutable; QString m_resolvedArguments; QString m_resolvedInput; QString m_resolvedWorkingDirectory; diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index 157dde7477..02392cb888 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -69,7 +69,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn) const QFileInfo fileInfo(pathIn); // Mac, Windows support folder or file. if (HostOsInfo::isWindowsHost()) { - const FileName explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe")); + const FilePath explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe")); if (explorer.isEmpty()) { QMessageBox::warning(parent, QApplication::translate("Core::Internal", diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp index 1f0d2f8c24..8fde404064 100644 --- a/src/plugins/coreplugin/idocument.cpp +++ b/src/plugins/coreplugin/idocument.cpp @@ -69,7 +69,7 @@ public: } QString mimeType; - Utils::FileName filePath; + Utils::FilePath filePath; QString preferredDisplayName; QString uniqueDisplayName; QString autoSaveName; @@ -168,7 +168,7 @@ bool IDocument::setContents(const QByteArray &contents) return false; } -const Utils::FileName &IDocument::filePath() const +const Utils::FilePath &IDocument::filePath() const { return d->filePath; } @@ -323,11 +323,11 @@ InfoBar *IDocument::infoBar() signals. Can be reimplemented by subclasses to do more. \sa filePath() */ -void IDocument::setFilePath(const Utils::FileName &filePath) +void IDocument::setFilePath(const Utils::FilePath &filePath) { if (d->filePath == filePath) return; - Utils::FileName oldName = d->filePath; + Utils::FilePath oldName = d->filePath; d->filePath = filePath; emit filePathChanged(oldName, d->filePath); emit changed(); diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h index 4af747dc97..feae466705 100644 --- a/src/plugins/coreplugin/idocument.h +++ b/src/plugins/coreplugin/idocument.h @@ -29,7 +29,7 @@ #include <QObject> -namespace Utils { class FileName; } +namespace Utils { class FilePath; } namespace Core { class Id; @@ -93,8 +93,8 @@ public: virtual QByteArray contents() const; virtual bool setContents(const QByteArray &contents); - const Utils::FileName &filePath() const; - virtual void setFilePath(const Utils::FileName &filePath); + const Utils::FilePath &filePath() const; + virtual void setFilePath(const Utils::FilePath &filePath); QString displayName() const; void setPreferredDisplayName(const QString &name); QString preferredDisplayName() const; @@ -144,7 +144,7 @@ signals: void aboutToReload(); void reloadFinished(bool success); - void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName); + void filePathChanged(const Utils::FilePath &oldName, const Utils::FilePath &newName); private: Internal::IDocumentPrivate *d; diff --git a/src/plugins/coreplugin/iversioncontrol.cpp b/src/plugins/coreplugin/iversioncontrol.cpp index befa60fbab..3bc7ddd6f8 100644 --- a/src/plugins/coreplugin/iversioncontrol.cpp +++ b/src/plugins/coreplugin/iversioncontrol.cpp @@ -79,7 +79,7 @@ QStringList IVersionControl::additionalToolsPath() const } ShellCommand *IVersionControl::createInitialCheckoutCommand(const QString &url, - const Utils::FileName &baseDirectory, + const Utils::FilePath &baseDirectory, const QString &localName, const QStringList &extraArgs) { diff --git a/src/plugins/coreplugin/iversioncontrol.h b/src/plugins/coreplugin/iversioncontrol.h index 9a5ef2e783..0846793b5a 100644 --- a/src/plugins/coreplugin/iversioncontrol.h +++ b/src/plugins/coreplugin/iversioncontrol.h @@ -103,7 +103,7 @@ public: * * This method needs to be thread safe! */ - virtual bool isVcsFileOrDirectory(const Utils::FileName &fileName) const = 0; + virtual bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const = 0; /*! * Returns whether files in this directory should be managed with this @@ -213,7 +213,7 @@ public: * \a extraArgs are passed on to the command being run. */ virtual ShellCommand *createInitialCheckoutCommand(const QString &url, - const Utils::FileName &baseDirectory, + const Utils::FilePath &baseDirectory, const QString &localName, const QStringList &extraArgs); @@ -245,7 +245,7 @@ public: { } ~TestVersionControl() override; - bool isVcsFileOrDirectory(const Utils::FileName &fileName) const final + bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final { Q_UNUSED(fileName); return false; } void setManagedDirectories(const QHash<QString, QString> &dirs); diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index f5f34a4f43..e2b26b57ae 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -153,7 +153,7 @@ QList<LocatorFilterEntry> BaseFileFilter::matchesFor(QFutureInterface<LocatorFil QFileInfo fi(path); LocatorFilterEntry filterEntry(this, fi.fileName(), QString(path + fp.postfix)); filterEntry.fileName = path; - filterEntry.extraInfo = FileName::fromFileInfo(fi).shortNativePath(); + filterEntry.extraInfo = FilePath::fromFileInfo(fi).shortNativePath(); const int matchLevel = matchLevelFor(match, matchText); if (hasPathSeparator) { diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp index 52766ed9f4..2d451a5b6e 100644 --- a/src/plugins/coreplugin/locator/executefilter.cpp +++ b/src/plugins/coreplugin/locator/executefilter.cpp @@ -160,7 +160,7 @@ void ExecuteFilter::runHeadCommand() { if (!m_taskQueue.isEmpty()) { const ExecuteData &d = m_taskQueue.head(); - const Utils::FileName fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable); + const Utils::FilePath fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable); if (fullPath.isEmpty()) { MessageManager::write(tr("Could not find executable for \"%1\".").arg(d.executable)); m_taskQueue.dequeue(); diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index d89974b96a..0719e9b781 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -142,7 +142,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF const QString fullFilePath = dirInfo.filePath(fileName); if (!QFileInfo::exists(fullFilePath) && dirInfo.exists()) { LocatorFilterEntry createAndOpen(this, tr("Create and Open \"%1\"").arg(entry), fullFilePath); - createAndOpen.extraInfo = Utils::FileName::fromString(dirInfo.absolutePath()).shortNativePath(); + createAndOpen.extraInfo = Utils::FilePath::fromString(dirInfo.absolutePath()).shortNativePath(); betterEntries.append(createAndOpen); } diff --git a/src/plugins/coreplugin/locator/locator_test.cpp b/src/plugins/coreplugin/locator/locator_test.cpp index 6547fbf4ee..c76a5633ea 100644 --- a/src/plugins/coreplugin/locator/locator_test.cpp +++ b/src/plugins/coreplugin/locator/locator_test.cpp @@ -89,7 +89,7 @@ void Core::Internal::CorePlugin::test_basefilefilter() void Core::Internal::CorePlugin::test_basefilefilter_data() { auto shortNativePath = [](const QString &file) { - return Utils::FileName::fromString(file).shortNativePath(); + return Utils::FilePath::fromString(file).shortNativePath(); }; QTest::addColumn<QStringList>("testFiles"); diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp index a7d2b3e194..fe67e5d884 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp @@ -76,7 +76,7 @@ QList<LocatorFilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Locat const QRegularExpressionMatch match = regexp.match(displayName); if (match.hasMatch()) { LocatorFilterEntry filterEntry(this, displayName, QString(fileName + fp.postfix)); - filterEntry.extraInfo = FileName::fromString(fileName).shortNativePath(); + filterEntry.extraInfo = FilePath::fromString(fileName).shortNativePath(); filterEntry.fileName = fileName; filterEntry.highlightInfo = highlightInfo(match); if (match.capturedStart() == 0) diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.h b/src/plugins/coreplugin/locator/opendocumentsfilter.h index 8d140c86d7..956dea22d2 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.h +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.h @@ -56,7 +56,7 @@ private: class Entry { public: - Utils::FileName fileName; + Utils::FilePath fileName; QString displayName; }; diff --git a/src/plugins/coreplugin/mimetypesettings.cpp b/src/plugins/coreplugin/mimetypesettings.cpp index e5ba03ace4..7b4d891339 100644 --- a/src/plugins/coreplugin/mimetypesettings.cpp +++ b/src/plugins/coreplugin/mimetypesettings.cpp @@ -501,7 +501,7 @@ void MimeTypeSettingsPrivate::ensurePendingMimeType(const Utils::MimeType &mimeT void MimeTypeSettingsPrivate::writeUserModifiedMimeTypes() { - static Utils::FileName modifiedMimeTypesFile = Utils::FileName::fromString( + static Utils::FilePath modifiedMimeTypesFile = Utils::FilePath::fromString( ICore::userResourcePath() + QLatin1String(kModifiedMimeTypesFile)); if (QFile::exists(modifiedMimeTypesFile.toString()) diff --git a/src/plugins/coreplugin/patchtool.cpp b/src/plugins/coreplugin/patchtool.cpp index 724fabd133..1442046325 100644 --- a/src/plugins/coreplugin/patchtool.cpp +++ b/src/plugins/coreplugin/patchtool.cpp @@ -88,7 +88,7 @@ static bool runPatchHelper(const QByteArray &input, const QString &workingDirect return false; } - if (!Utils::FileName::fromString(patch).exists() + if (!Utils::FilePath::fromString(patch).exists() && !Utils::Environment::systemEnvironment().searchInPath(patch).exists()) { MessageManager::write(QApplication::translate("Core::PatchTool", "The patch-command configured in the general \"Environment\" settings does not exist.")); return false; diff --git a/src/plugins/coreplugin/toolsettings.cpp b/src/plugins/coreplugin/toolsettings.cpp index 857d154125..200e425140 100644 --- a/src/plugins/coreplugin/toolsettings.cpp +++ b/src/plugins/coreplugin/toolsettings.cpp @@ -143,7 +143,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 = Utils::FileName::fromString(tool->preset()->fileName()).fileName(); + const QString &fileName = Utils::FilePath::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); |