Commit 14f3a86c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Project: Set filepath on ContainerNode



This fixes search via the context menu.

Change-Id: Ie675cae3f6e35d5d02234f3a49f7a71d02b08bc2
Reviewed-by: default avatarhjk <hjk@qt.io>
parent b0c7bb0f
......@@ -126,15 +126,13 @@ bool ProjectDocument::reload(QString *errorString, Core::IDocument::ReloadFlag f
class ProjectPrivate
{
public:
ProjectPrivate(Project *owner, Core::IDocument *document) :
m_document(document), m_containerNode(owner)
{ }
ProjectPrivate(Core::IDocument *document) : m_document(document) { }
~ProjectPrivate();
Core::Id m_id;
Core::IDocument *m_document = nullptr;
ProjectNode *m_rootProjectNode = nullptr;
ContainerNode m_containerNode;
ContainerNode *m_containerNode = nullptr;
QList<Target *> m_targets;
Target *m_activeTarget = nullptr;
EditorConfiguration m_editorConfiguration;
......@@ -156,17 +154,22 @@ ProjectPrivate::~ProjectPrivate()
m_rootProjectNode = nullptr;
delete oldNode;
delete m_containerNode;
delete m_document;
delete m_accessor;
}
Project::Project(const QString &mimeType, const Utils::FileName &fileName,
const ProjectDocument::ProjectCallback &callback) :
d(new ProjectPrivate(this, new ProjectDocument(mimeType, fileName, callback)))
d(new ProjectPrivate(new ProjectDocument(mimeType, fileName, callback)))
{
d->m_macroExpander.setDisplayName(tr("Project"));
d->m_macroExpander.registerVariable("Project:Name", tr("Project Name"),
[this] { return displayName(); });
// Only set up containernode after d is set so that it will find the project directory!
d->m_containerNode = new ContainerNode(this);
}
Project::~Project()
......@@ -475,7 +478,7 @@ void Project::setRootProjectNode(ProjectNode *root)
ProjectNode *oldNode = d->m_rootProjectNode;
d->m_rootProjectNode = root;
if (root)
root->setParentFolderNode(&d->m_containerNode);
root->setParentFolderNode(d->m_containerNode);
ProjectTree::emitSubtreeChanged(root);
emit fileListChanged();
......@@ -604,7 +607,7 @@ ProjectNode *Project::rootProjectNode() const
ContainerNode *Project::containerNode() const
{
return &d->m_containerNode;
return d->m_containerNode;
}
Project::RestoreResult Project::fromMap(const QVariantMap &map, QString *errorMessage)
......
......@@ -793,7 +793,7 @@ bool FolderNode::isEmpty() const
}
ContainerNode::ContainerNode(Project *project)
: FolderNode(Utils::FileName(), NodeType::Project), m_project(project)
: FolderNode(project->projectDirectory(), NodeType::Project), m_project(project)
{}
QString ContainerNode::displayName() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment