forked from qt-creator/qt-creator
ProjectExplorer: De-virtualize some more virtual methods
Use setters/getters for the bool flags in Project::needsBuildConfigurations() and Project::hasMakeInstallEquivalent. Change-Id: I5ce937c3a5e8e0db627cda02a9007f8c28ccda0c Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -75,6 +75,8 @@ AutotoolsProject::AutotoolsProject(const Utils::FilePath &fileName) :
|
||||
setId(Constants::AUTOTOOLS_PROJECT_ID);
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
setDisplayName(projectDirectory().fileName());
|
||||
|
||||
setHasMakeInstallEquivalent(true);
|
||||
}
|
||||
|
||||
AutotoolsProject::~AutotoolsProject()
|
||||
|
@@ -60,8 +60,6 @@ protected:
|
||||
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
||||
|
||||
private:
|
||||
bool hasMakeInstallEquivalent() const override { return true; }
|
||||
|
||||
/**
|
||||
* Loads the project tree by parsing the makefiles.
|
||||
*/
|
||||
|
@@ -112,6 +112,7 @@ CMakeProject::CMakeProject(const FilePath &fileName)
|
||||
setDisplayName(projectDirectory().fileName());
|
||||
setCanBuildProducts();
|
||||
setKnowsAllBuildExecutables(false);
|
||||
setHasMakeInstallEquivalent(true);
|
||||
|
||||
// Timer:
|
||||
m_delayedParsingTimer.setSingleShot(true);
|
||||
|
@@ -99,7 +99,6 @@ private:
|
||||
QStringList filesGeneratedFrom(const QString &sourceFile) const final;
|
||||
|
||||
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
||||
bool hasMakeInstallEquivalent() const override { return true; }
|
||||
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
|
||||
const QString &installRoot) override;
|
||||
|
||||
|
@@ -58,7 +58,6 @@ public:
|
||||
explicit CompilationDatabaseProject(const Utils::FilePath &filename);
|
||||
~CompilationDatabaseProject() override;
|
||||
bool needsConfiguration() const override { return false; }
|
||||
bool needsBuildConfigurations() const override { return true; }
|
||||
|
||||
private:
|
||||
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
||||
|
@@ -167,6 +167,8 @@ public:
|
||||
bool m_needsInitialExpansion = false;
|
||||
bool m_canBuildProducts = false;
|
||||
bool m_knowsAllBuildExecutables = true;
|
||||
bool m_hasMakeInstallEquivalent = false;
|
||||
bool m_needsBuildConfigurations = true;
|
||||
std::unique_ptr<Core::IDocument> m_document;
|
||||
std::unique_ptr<ProjectNode> m_rootProjectNode;
|
||||
std::unique_ptr<ContainerNode> m_containerNode;
|
||||
@@ -809,6 +811,11 @@ void Project::setProjectLanguage(Core::Id id, bool enabled)
|
||||
removeProjectLanguage(id);
|
||||
}
|
||||
|
||||
void Project::setHasMakeInstallEquivalent(bool enabled)
|
||||
{
|
||||
d->m_hasMakeInstallEquivalent = enabled;
|
||||
}
|
||||
|
||||
void Project::projectLoaded()
|
||||
{
|
||||
}
|
||||
@@ -818,6 +825,11 @@ void Project::setKnowsAllBuildExecutables(bool value)
|
||||
d->m_knowsAllBuildExecutables = value;
|
||||
}
|
||||
|
||||
void Project::setNeedsBuildConfigurations(bool value)
|
||||
{
|
||||
d->m_needsBuildConfigurations = value;
|
||||
}
|
||||
|
||||
Task Project::createProjectTask(Task::TaskType type, const QString &description)
|
||||
{
|
||||
return Task(type, description, Utils::FilePath(), -1, Core::Id());
|
||||
@@ -861,7 +873,7 @@ bool Project::needsConfiguration() const
|
||||
|
||||
bool Project::needsBuildConfigurations() const
|
||||
{
|
||||
return true;
|
||||
return d->m_needsBuildConfigurations;
|
||||
}
|
||||
|
||||
void Project::configureAsExampleProject()
|
||||
@@ -873,6 +885,11 @@ bool Project::knowsAllBuildExecutables() const
|
||||
return d->m_knowsAllBuildExecutables;
|
||||
}
|
||||
|
||||
bool Project::hasMakeInstallEquivalent() const
|
||||
{
|
||||
return d->m_hasMakeInstallEquivalent;
|
||||
}
|
||||
|
||||
MakeInstallCommand Project::makeInstallCommand(const Target *target, const QString &installRoot)
|
||||
{
|
||||
QTC_ASSERT(hasMakeInstallEquivalent(), return MakeInstallCommand());
|
||||
|
@@ -157,7 +157,7 @@ public:
|
||||
void setNamedSettings(const QString &name, const QVariant &value);
|
||||
|
||||
virtual bool needsConfiguration() const;
|
||||
virtual bool needsBuildConfigurations() const;
|
||||
bool needsBuildConfigurations() const;
|
||||
virtual void configureAsExampleProject();
|
||||
|
||||
virtual ProjectImporter *projectImporter() const;
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
bool knowsAllBuildExecutables() const;
|
||||
|
||||
virtual DeploymentKnowledge deploymentKnowledge() const { return DeploymentKnowledge::Bad; }
|
||||
virtual bool hasMakeInstallEquivalent() const { return false; }
|
||||
bool hasMakeInstallEquivalent() const;
|
||||
virtual MakeInstallCommand makeInstallCommand(const Target *target, const QString &installRoot);
|
||||
|
||||
void setup(const QList<BuildInfo> &infoList);
|
||||
@@ -301,9 +301,11 @@ protected:
|
||||
void addProjectLanguage(Core::Id id);
|
||||
void removeProjectLanguage(Core::Id id);
|
||||
void setProjectLanguage(Core::Id id, bool enabled);
|
||||
void setHasMakeInstallEquivalent(bool enabled);
|
||||
virtual void projectLoaded(); // Called when the project is fully loaded.
|
||||
|
||||
void setKnowsAllBuildExecutables(bool value);
|
||||
void setNeedsBuildConfigurations(bool value);
|
||||
|
||||
static ProjectExplorer::Task createProjectTask(ProjectExplorer::Task::TaskType type,
|
||||
const QString &description);
|
||||
|
@@ -95,7 +95,6 @@ public:
|
||||
void refresh(Target *target = nullptr);
|
||||
|
||||
bool needsConfiguration() const final { return false; }
|
||||
bool needsBuildConfigurations() const final { return false; }
|
||||
|
||||
bool writePyProjectFile(const QString &fileName, QString &content,
|
||||
const QStringList &rawList, QString *errorMessage);
|
||||
@@ -408,6 +407,8 @@ PythonProject::PythonProject(const FilePath &fileName) :
|
||||
setId(PythonProjectId);
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
||||
|
||||
setNeedsBuildConfigurations(false);
|
||||
}
|
||||
|
||||
static QStringList readLines(const Utils::FilePath &projectFile)
|
||||
|
@@ -130,6 +130,7 @@ QmakeProject::QmakeProject(const FilePath &fileName) :
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
||||
setCanBuildProducts();
|
||||
setHasMakeInstallEquivalent(true);
|
||||
|
||||
const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
|
||||
m_qmakeVfs->setTextCodec(codec);
|
||||
|
@@ -122,7 +122,6 @@ protected:
|
||||
|
||||
private:
|
||||
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
||||
bool hasMakeInstallEquivalent() const override { return true; }
|
||||
|
||||
void asyncUpdate();
|
||||
void buildFinished(bool success);
|
||||
|
@@ -67,6 +67,8 @@ QmlProject::QmlProject(const Utils::FilePath &fileName) :
|
||||
setId(QmlProjectManager::Constants::QML_PROJECT_ID);
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
|
||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
||||
|
||||
setNeedsBuildConfigurations(false);
|
||||
}
|
||||
|
||||
QmlProject::~QmlProject()
|
||||
@@ -242,11 +244,6 @@ void QmlProject::refreshProjectFile()
|
||||
refresh(QmlProject::ProjectFile | Files);
|
||||
}
|
||||
|
||||
bool QmlProject::needsBuildConfigurations() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList QmlProject::makeAbsolute(const Utils::FilePath &path, const QStringList &relativePaths)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
|
@@ -75,8 +75,6 @@ public:
|
||||
|
||||
void refreshProjectFile();
|
||||
|
||||
bool needsBuildConfigurations() const final;
|
||||
|
||||
static QStringList makeAbsolute(const Utils::FilePath &path, const QStringList &relativePaths);
|
||||
|
||||
QVariant additionalData(Core::Id id, const ProjectExplorer::Target *target) const override;
|
||||
|
Reference in New Issue
Block a user