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/editormanager | |
parent | 4704f49fbb1201ebf10ab9dbaed0275ff25faba8 (diff) | |
download | qt-creator-473a741c9fcf09febba312464fab8385e2351181.tar.gz |
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/editormanager')
7 files changed, 21 insertions, 21 deletions
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, |