ProjectExplorer: Fix enabling state of main project nodes

Since the rootProjectNode() containing the parsed files is now nested
under a new project node the main node needs to delegate enable/disable
decisions.

Task-number: QTCREATORBUG-17922
Change-Id: Ie7bb6d6802072a2127b32c0fe51fb25fc1c9c6cc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2017-03-27 17:51:19 +02:00
parent 7f5b37ed14
commit 2ee7967750
7 changed files with 79 additions and 43 deletions

View File

@@ -84,38 +84,6 @@ const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Project.PluginSettings";
namespace ProjectExplorer {
class ContainerNode : public ProjectNode
{
public:
ContainerNode(Project *project)
: ProjectNode(Utils::FileName()),
m_project(project)
{}
QString displayName() const final
{
QString name = m_project->displayName();
const QFileInfo fi = m_project->projectFilePath().toFileInfo();
const QString dir = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
if (Core::IVersionControl *vc = Core::VcsManager::findVersionControlForDirectory(dir)) {
QString vcsTopic = vc->vcsTopic(dir);
if (!vcsTopic.isEmpty())
name += " [" + vcsTopic + ']';
}
return name;
}
QList<ProjectAction> supportedActions(Node *) const final
{
return {};
}
private:
Project *m_project;
};
// -------------------------------------------------------------------------
// Project
// -------------------------------------------------------------------------
@@ -601,7 +569,7 @@ ProjectNode *Project::rootProjectNode() const
return d->m_rootProjectNode;
}
ProjectNode *Project::containerNode() const
ContainerNode *Project::containerNode() const
{
return &d->m_containerNode;
}