diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-08-13 12:11:07 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-08-13 10:24:30 +0000 |
commit | ae345003aae27595de1db71bf69e5d53f89e08af (patch) | |
tree | f0436cd6d876c8f405cc9f0e5a443daf174b58dd /src | |
parent | afb4fb474f23c49691ff3d3a07c5b95cdea93c57 (diff) | |
download | qt-creator-ae345003aae27595de1db71bf69e5d53f89e08af.tar.gz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/autotoolsprojectmanager/autotoolsproject.cpp | 2 | ||||
-rw-r--r-- | src/plugins/autotoolsprojectmanager/autotoolsproject.h | 2 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeproject.cpp | 1 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeproject.h | 1 | ||||
-rw-r--r-- | src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h | 1 | ||||
-rw-r--r-- | src/plugins/projectexplorer/project.cpp | 19 | ||||
-rw-r--r-- | src/plugins/projectexplorer/project.h | 6 | ||||
-rw-r--r-- | src/plugins/python/pythonplugin.cpp | 3 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakeproject.cpp | 1 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakeproject.h | 1 | ||||
-rw-r--r-- | src/plugins/qmlprojectmanager/qmlproject.cpp | 7 | ||||
-rw-r--r-- | src/plugins/qmlprojectmanager/qmlproject.h | 2 |
12 files changed, 30 insertions, 16 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index 5095dde955..f5a675e99b 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -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() diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.h b/src/plugins/autotoolsprojectmanager/autotoolsproject.h index 7338adddb8..44e0153a0f 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.h @@ -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. */ diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 43702812e6..d174f60276 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -112,6 +112,7 @@ CMakeProject::CMakeProject(const FilePath &fileName) setDisplayName(projectDirectory().fileName()); setCanBuildProducts(); setKnowsAllBuildExecutables(false); + setHasMakeInstallEquivalent(true); // Timer: m_delayedParsingTimer.setSingleShot(true); diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index 4413c69b91..32e1a12628 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -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; diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h index 2ea4b870ec..47687a0c6f 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h @@ -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; diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 879fedcb0d..ccf2f59247 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -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()); diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index b5de003a53..091b5b163f 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -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); diff --git a/src/plugins/python/pythonplugin.cpp b/src/plugins/python/pythonplugin.cpp index 0aae69d905..7223dd772f 100644 --- a/src/plugins/python/pythonplugin.cpp +++ b/src/plugins/python/pythonplugin.cpp @@ -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) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 3e5496b546..3473564c92 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -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); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h index 584e16a15e..601c0246c7 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.h +++ b/src/plugins/qmakeprojectmanager/qmakeproject.h @@ -122,7 +122,6 @@ protected: private: ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override; - bool hasMakeInstallEquivalent() const override { return true; } void asyncUpdate(); void buildFinished(bool success); diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 145538e110..8c3c06bce7 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -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()) diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index ae7341d38d..9b09cbd528 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -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; |