ProjectExplorer: Un-protect ProjectNode constructor

Not much protection needed, and not provided either, as seen in
the removed workarounds.

Change-Id: Ib33f6481cdb04481c0324bdeb57eb50143ecb62f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-25 18:35:34 +01:00
parent 65be7c2915
commit 4d2981b1f4
4 changed files with 6 additions and 25 deletions

View File

@@ -61,13 +61,6 @@ namespace CompilationDatabaseProjectManager {
namespace Internal {
namespace {
class DBProjectNode : public ProjectNode
{
public:
explicit DBProjectNode(const Utils::FileName &projectFilePath)
: ProjectNode(projectFilePath)
{}
};
QStringList jsonObjectFlags(const QJsonObject &object)
{
@@ -356,7 +349,7 @@ void CompilationDatabaseProject::buildTreeAndProjectParts(const Utils::FileName
return;
}
auto root = std::make_unique<DBProjectNode>(projectDirectory());
auto root = std::make_unique<ProjectNode>(projectDirectory());
CppTools::KitInfo kitInfo(this);
QTC_ASSERT(kitInfo.isValid(), return);

View File

@@ -958,12 +958,6 @@ public:
bool needsConfiguration() const final { return false; }
};
class TestProjectNode : public ProjectNode
{
public:
TestProjectNode(const Utils::FileName &dir) : ProjectNode(dir) { }
};
void ProjectExplorerPlugin::testProject_setup()
{
TestProject project;
@@ -1060,7 +1054,7 @@ void ProjectExplorerPlugin::testProject_parsingFail()
std::unique_ptr<ProjectNode> createFileTree(Project *project)
{
std::unique_ptr<ProjectNode> root = std::make_unique<TestProjectNode>(project->projectDirectory());
std::unique_ptr<ProjectNode> root = std::make_unique<ProjectNode>(project->projectDirectory());
std::vector<std::unique_ptr<FileNode>> nodes;
nodes.emplace_back(std::make_unique<FileNode>(TEST_PROJECT_PATH, FileType::Project));
nodes.emplace_back(std::make_unique<FileNode>(TEST_PROJECT_CPP_FILE, FileType::Source));
@@ -1080,7 +1074,7 @@ void ProjectExplorerPlugin::testProject_projectTree()
QCOMPARE(fileSpy.count(), 0);
QVERIFY(!project.rootProjectNode());
project.setRootProjectNode(std::make_unique<TestProjectNode>(project.projectDirectory()));
project.setRootProjectNode(std::make_unique<ProjectNode>(project.projectDirectory()));
QCOMPARE(fileSpy.count(), 0);
QVERIFY(!project.rootProjectNode());

View File

@@ -322,6 +322,8 @@ private:
class PROJECTEXPLORER_EXPORT ProjectNode : public FolderNode
{
public:
explicit ProjectNode(const Utils::FileName &projectFilePath);
virtual bool canAddSubProject(const QString &proFilePath) const;
virtual bool addSubProject(const QString &proFile);
virtual QStringList subProjectFileNamePatterns() const;
@@ -353,7 +355,6 @@ public:
virtual bool setData(Core::Id role, const QVariant &value) const;
protected:
explicit ProjectNode(const Utils::FileName &projectFilePath);
QString m_target;
};

View File

@@ -41,13 +41,6 @@
namespace QmlProfiler {
namespace Internal {
class DummyProjectNode : public ProjectExplorer::ProjectNode
{
public:
DummyProjectNode(const Utils::FileName &file) : ProjectExplorer::ProjectNode(file)
{}
};
class DummyProject : public ProjectExplorer::Project
{
Q_OBJECT
@@ -57,7 +50,7 @@ public:
{
auto fileNode
= std::make_unique<ProjectExplorer::FileNode>(file, ProjectExplorer::FileType::Source);
auto root = std::make_unique<DummyProjectNode>(file);
auto root = std::make_unique<ProjectExplorer::ProjectNode>(file);
root->addNode(std::move(fileNode));
fileNode = std::make_unique<ProjectExplorer::FileNode>(
Utils::FileName::fromLatin1(