Analyzers: Re-enable switch between global and project settings

This was apparently always using project settings for a while,
even when "Use Global Settings" were selected in the Run settings.

Change-Id: I1293a617edcbfd6bc47c57102fa53096c717ec4e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-02-18 07:18:40 +01:00
parent 31d3e3252f
commit 6bba37ab16
3 changed files with 13 additions and 1 deletions

View File

@@ -97,6 +97,7 @@ public:
virtual void fromMap(const QVariantMap &map);
virtual void toMap(QVariantMap &map) const;
virtual void toActiveMap(QVariantMap &map) const { toMap(map); }
virtual void acquaintSiblings(const BaseAspects &);
virtual void addToLayout(LayoutBuilder &builder);

View File

@@ -134,6 +134,16 @@ void GlobalOrProjectAspect::toMap(QVariantMap &map) const
map.insert(id().toString() + ".UseGlobalSettings", m_useGlobalSettings);
}
void GlobalOrProjectAspect::toActiveMap(QVariantMap &data) const
{
if (m_useGlobalSettings)
m_globalSettings->toMap(data);
else if (m_projectSettings)
m_projectSettings->toMap(data);
else
QTC_CHECK(false);
}
void GlobalOrProjectAspect::resetProjectToGlobalSettings()
{
QTC_ASSERT(m_globalSettings, return);
@@ -235,7 +245,7 @@ QMap<Utils::Id, QVariantMap> RunConfiguration::aspectData() const
{
QMap<Utils::Id, QVariantMap> data;
for (BaseAspect *aspect : qAsConst(m_aspects))
aspect->toMap(data[aspect->id()]);
aspect->toActiveMap(data[aspect->id()]);
return data;
}

View File

@@ -114,6 +114,7 @@ protected:
friend class RunConfiguration;
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &data) const override;
void toActiveMap(QVariantMap &data) const override;
private:
bool m_useGlobalSettings = false;