From c2627298d85ccbdb4816aeaeb0896126237fd6db Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 1 Apr 2020 09:30:07 +0200 Subject: [PATCH] ProjectExplorer: Introduce "extra data" handling for build system That's meant to replace the per-ProjectNode storage, which cannot (or is hard to be) used correctly for target/buildconfig/buildsystem dependent data. For now just redirect to the node storage to enable the users to port to the new interface before finally changing the storage as such. Change-Id: I14d30b4d68c93bac0f14b787e82d00d1e0ada3b2 Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/buildsystem.cpp | 14 ++++++++++++++ src/plugins/projectexplorer/buildsystem.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/plugins/projectexplorer/buildsystem.cpp b/src/plugins/projectexplorer/buildsystem.cpp index 8c06f928c1f..7b6f4bbf5ad 100644 --- a/src/plugins/projectexplorer/buildsystem.cpp +++ b/src/plugins/projectexplorer/buildsystem.cpp @@ -341,6 +341,20 @@ void BuildSystem::emitBuildSystemUpdated() target()->buildSystemUpdated(this); } +void BuildSystem::setExtraData(const QString &buildKey, Core::Id dataKey, const QVariant &data) +{ + const ProjectNode *node = d->m_target->project()->findNodeForBuildKey(buildKey); + QTC_ASSERT(node, return); + node->setData(dataKey, data); +} + +QVariant BuildSystem::extraData(const QString &buildKey, Core::Id dataKey) const +{ + const ProjectNode *node = d->m_target->project()->findNodeForBuildKey(buildKey); + QTC_ASSERT(node, return {}); + return node->data(dataKey); +} + QString BuildSystem::disabledReason(const QString &buildKey) const { if (!hasParsingData()) { diff --git a/src/plugins/projectexplorer/buildsystem.h b/src/plugins/projectexplorer/buildsystem.h index a96150bfc0c..af69ca29e48 100644 --- a/src/plugins/projectexplorer/buildsystem.h +++ b/src/plugins/projectexplorer/buildsystem.h @@ -121,6 +121,9 @@ public: void emitBuildSystemUpdated(); + void setExtraData(const QString &buildKey, Core::Id dataKey, const QVariant &data); + QVariant extraData(const QString &buildKey, Core::Id dataKey) const; + public: // FIXME: Make this private and the BuildSystem a friend ParseGuard guardParsingRun() { return ParseGuard(this); }