From 3f79a077e8e10de9393210e5b6532e12ce3c7017 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 25 Jul 2023 11:38:22 +0200 Subject: [PATCH] Core: Proliferate FilePath use a bit Change-Id: I06c9a9875b0698e3ccab13a2f1136cdbcac621b3 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/editormanager/editormanager.cpp | 4 ++-- src/plugins/coreplugin/editormanager/editormanager.h | 2 +- src/plugins/projectexplorer/projectmanager.cpp | 5 ++--- src/plugins/projectexplorer/projectmanager.h | 2 +- src/plugins/qmlprofiler/qmlprofilertool.cpp | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 2e321341b01..946355a0abc 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1442,7 +1442,7 @@ IEditor *EditorManagerPrivate::createEditor(IEditorFactory *factory, const FileP connect(document, &IDocument::changed, d, [document] { d->handleDocumentStateChange(document); }); - emit m_instance->editorCreated(editor, filePath.toString()); + emit m_instance->editorCreated(editor, filePath); } return editor; @@ -1531,7 +1531,7 @@ IEditor *EditorManagerPrivate::duplicateEditor(IEditor *editor) return nullptr; IEditor *duplicate = editor->duplicate(); - emit m_instance->editorCreated(duplicate, duplicate->document()->filePath().toString()); + emit m_instance->editorCreated(duplicate, duplicate->document()->filePath()); addEditor(duplicate); return duplicate; } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index ea0fd5df8cd..5e211c88e2f 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -154,7 +154,7 @@ signals: void currentEditorChanged(Core::IEditor *editor); void currentDocumentStateChanged(); void documentStateChanged(Core::IDocument *document); - void editorCreated(Core::IEditor *editor, const QString &fileName); + void editorCreated(Core::IEditor *editor, const Utils::FilePath &filePath); void editorOpened(Core::IEditor *editor); void documentOpened(Core::IDocument *document); void editorAboutToClose(Core::IEditor *editor); diff --git a/src/plugins/projectexplorer/projectmanager.cpp b/src/plugins/projectexplorer/projectmanager.cpp index e3c8e65c59b..e1e8175b2fa 100644 --- a/src/plugins/projectexplorer/projectmanager.cpp +++ b/src/plugins/projectexplorer/projectmanager.cpp @@ -520,12 +520,11 @@ Project *ProjectManager::projectWithProjectFilePath(const FilePath &filePath) [&filePath](const Project *p) { return p->projectFilePath() == filePath; }); } -void ProjectManager::configureEditor(IEditor *editor, const QString &fileName) +void ProjectManager::configureEditor(IEditor *editor, const FilePath &filePath) { if (auto textEditor = qobject_cast(editor)) { - Project *project = projectForFile(Utils::FilePath::fromString(fileName)); // Global settings are the default. - if (project) + if (Project *project = projectForFile(filePath)) project->editorConfiguration()->configureEditor(textEditor); } } diff --git a/src/plugins/projectexplorer/projectmanager.h b/src/plugins/projectexplorer/projectmanager.h index f49cc96e54c..27913a00cd0 100644 --- a/src/plugins/projectexplorer/projectmanager.h +++ b/src/plugins/projectexplorer/projectmanager.h @@ -97,7 +97,7 @@ signals: void projectFinishedParsing(ProjectExplorer::Project *project); private: - static void configureEditor(Core::IEditor *editor, const QString &fileName); + static void configureEditor(Core::IEditor *editor, const Utils::FilePath &filePath); static void configureEditors(Project *project); static void registerProjectCreator(const QString &mimeType, diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index c8e38d100f6..1f27fb30124 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -228,9 +228,9 @@ QmlProfilerTool::QmlProfilerTool() QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel(); if (EditorManager *editorManager = EditorManager::instance()) { connect(editorManager, &EditorManager::editorCreated, - model, [this, model](Core::IEditor *editor, const QString &fileName) { + model, [this, model](Core::IEditor *editor, const FilePath &filePath) { Q_UNUSED(editor) - model->createMarks(d->m_viewContainer, fileName); + model->createMarks(d->m_viewContainer, filePath.toString()); }); }