forked from qt-creator/qt-creator
EditorManager: Sprinkle const over the window title logic
This amends 2ab5561b9a.
Change-Id: Ic7c36348e88b72d6c1fed75ca149958be332345e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1766,7 +1766,7 @@ void EditorManagerPrivate::updateWindowTitleForDocument(IDocument *document, QWi
|
|||||||
if (!documentName.isEmpty())
|
if (!documentName.isEmpty())
|
||||||
windowTitle.append(documentName);
|
windowTitle.append(documentName);
|
||||||
|
|
||||||
QString filePath = document ? document->filePath().toFileInfo().absoluteFilePath()
|
const QString filePath = document ? document->filePath().toFileInfo().absoluteFilePath()
|
||||||
: QString();
|
: QString();
|
||||||
const QString windowTitleAddition = d->m_titleAdditionHandler
|
const QString windowTitleAddition = d->m_titleAdditionHandler
|
||||||
? d->m_titleAdditionHandler(filePath)
|
? d->m_titleAdditionHandler(filePath)
|
||||||
|
|||||||
@@ -558,17 +558,17 @@ QString SessionManagerPrivate::sessionTitle(const QString &filePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString SessionManagerPrivate::locationInProject(const QString &filePath) {
|
QString SessionManagerPrivate::locationInProject(const QString &filePath) {
|
||||||
Project *project = SessionManager::projectForFile(Utils::FileName::fromString(filePath));
|
const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(filePath));
|
||||||
if (!project)
|
if (!project)
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
Utils::FileName file = Utils::FileName::fromString(filePath);
|
const Utils::FileName file = Utils::FileName::fromString(filePath);
|
||||||
Utils::FileName parentDir = file.parentDir();
|
const Utils::FileName parentDir = file.parentDir();
|
||||||
if (parentDir == project->projectDirectory())
|
if (parentDir == project->projectDirectory())
|
||||||
return "@ " + project->displayName();
|
return "@ " + project->displayName();
|
||||||
|
|
||||||
if (file.isChildOf(project->projectDirectory())) {
|
if (file.isChildOf(project->projectDirectory())) {
|
||||||
Utils::FileName dirInProject = parentDir.relativeChildPath(project->projectDirectory());
|
const Utils::FileName dirInProject = parentDir.relativeChildPath(project->projectDirectory());
|
||||||
return "(" + dirInProject.toUserOutput() + " @ " + project->displayName() + ")";
|
return "(" + dirInProject.toUserOutput() + " @ " + project->displayName() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user