diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 34054025349..dbd4edd7fc3 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -2148,8 +2148,8 @@ void EditorManagerPrivate::updateWindowTitleForDocument(IDocument *document, QWi if (!documentName.isEmpty()) windowTitle.append(documentName); - const QString filePath = document ? document->filePath().absoluteFilePath().path() - : QString(); + const Utils::FilePath filePath = document ? document->filePath().absoluteFilePath() + : Utils::FilePath(); const QString windowTitleAddition = d->m_titleAdditionHandler ? d->m_titleAdditionHandler(filePath) : QString(); @@ -2181,7 +2181,7 @@ void EditorManagerPrivate::updateWindowTitleForDocument(IDocument *document, QWi windowTitle.append(dashSep); windowTitle.append(Core::Constants::IDE_DISPLAY_NAME); window->window()->setWindowTitle(windowTitle); - window->window()->setWindowFilePath(filePath); + window->window()->setWindowFilePath(filePath.path()); if (HostOsInfo::isMacHost()) { if (document) diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 4b722c6dce9..dbfe5849514 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -71,7 +71,7 @@ class CORE_EXPORT EditorManager : public QObject Q_OBJECT public: - using WindowTitleHandler = std::function; + using WindowTitleHandler = std::function; static EditorManager *instance(); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 67f1616c322..d5b3539bac2 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -96,8 +96,8 @@ public: QStringList dependenciesOrder() const; void dependencies(const QString &proName, QStringList &result) const; - static QString windowTitleAddition(const QString &filePath); - static QString sessionTitle(const QString &filePath); + static QString windowTitleAddition(const FilePath &filePath); + static QString sessionTitle(const FilePath &filePath); bool hasProjects() const { return !m_projects.isEmpty(); } @@ -118,7 +118,7 @@ public: PersistentSettingsWriter *m_writer = nullptr; private: - static QString locationInProject(const QString &filePath); + static QString locationInProject(const FilePath &filePath); }; static SessionManager *m_instance = nullptr; @@ -598,7 +598,7 @@ void SessionManagerPrivate::dependencies(const QString &proName, QStringList &re result.append(proName); } -QString SessionManagerPrivate::sessionTitle(const QString &filePath) +QString SessionManagerPrivate::sessionTitle(const FilePath &filePath) { if (SessionManager::isDefaultSession(d->m_sessionName)) { if (filePath.isEmpty()) { @@ -616,18 +616,17 @@ QString SessionManagerPrivate::sessionTitle(const QString &filePath) return QString(); } -QString SessionManagerPrivate::locationInProject(const QString &filePath) { - const Project *project = SessionManager::projectForFile(Utils::FilePath::fromString(filePath)); +QString SessionManagerPrivate::locationInProject(const FilePath &filePath) { + const Project *project = SessionManager::projectForFile(filePath); if (!project) return QString(); - const Utils::FilePath file = Utils::FilePath::fromString(filePath); - const Utils::FilePath parentDir = file.parentDir(); + const FilePath parentDir = filePath.parentDir(); if (parentDir == project->projectDirectory()) return "@ " + project->displayName(); - if (file.isChildOf(project->projectDirectory())) { - const Utils::FilePath dirInProject = parentDir.relativeChildPath(project->projectDirectory()); + if (filePath.isChildOf(project->projectDirectory())) { + const FilePath dirInProject = parentDir.relativeChildPath(project->projectDirectory()); return "(" + dirInProject.toUserOutput() + " @ " + project->displayName() + ")"; } @@ -637,7 +636,7 @@ QString SessionManagerPrivate::locationInProject(const QString &filePath) { return "(" + parentDir.toUserOutput() + " @ " + project->displayName() + ")"; } -QString SessionManagerPrivate::windowTitleAddition(const QString &filePath) +QString SessionManagerPrivate::windowTitleAddition(const FilePath &filePath) { return filePath.isEmpty() ? QString() : locationInProject(filePath); } diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index b371c8b2f64..74edfd3dd34 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -199,7 +199,7 @@ public: explicit StateListener(QObject *parent); ~StateListener(); - static QString windowTitleVcsTopic(const QString &filePath); + static QString windowTitleVcsTopic(const FilePath &filePath); signals: void stateChanged(const VcsBase::Internal::State &s, IVersionControl *vc); @@ -230,11 +230,11 @@ StateListener::~StateListener() EditorManager::setWindowTitleVcsTopicHandler({}); } -QString StateListener::windowTitleVcsTopic(const QString &filePath) +QString StateListener::windowTitleVcsTopic(const FilePath &filePath) { FilePath searchPath; if (!filePath.isEmpty()) { - searchPath = FilePath::fromString(filePath).absolutePath(); + searchPath = filePath.absolutePath(); } else { // use single project's information if there is only one loaded. const QList projects = SessionManager::projects();