ProjectExplorer: Make ProjectConfiguration an AspectContainer

... instead of having one. AspectContainer are de-factor (q)objects
with "fat" properties, conceptionally not much different from QObject
itself, so there's not real need to differentiate between the QObject
interface and the (forwarded) aspectcontainer interface.

As a side-effect, this saves one QObject base object per instance.

Change-Id: I6eefe739b3aebcef1ece196ff8d70aa36738997b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-05-22 13:30:11 +02:00
parent 79dd2a8c8b
commit b41f7e87ae
5 changed files with 12 additions and 30 deletions

View File

@@ -19,10 +19,10 @@ const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayNam
// ProjectConfiguration
ProjectConfiguration::ProjectConfiguration(QObject *parent, Utils::Id id)
: QObject(parent)
: AspectContainer(parent)
, m_id(id)
{
m_aspects.setOwnsSubAspects(true);
setOwnsSubAspects(true);
QTC_CHECK(parent);
QTC_CHECK(id.isValid());
@@ -89,7 +89,7 @@ QVariantMap ProjectConfiguration::toMap() const
QVariantMap map;
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.toSetting());
m_displayName.toMap(map, DISPLAY_NAME_KEY);
m_aspects.toMap(map);
AspectContainer::toMap(map);
return map;
}
@@ -106,15 +106,10 @@ bool ProjectConfiguration::fromMap(const QVariantMap &map)
QTC_ASSERT(id.toString().startsWith(m_id.toString()), return false);
m_displayName.fromMap(map, DISPLAY_NAME_KEY);
m_aspects.fromMap(map);
AspectContainer::fromMap(map);
return true;
}
BaseAspect *ProjectConfiguration::aspect(Id id) const
{
return m_aspects.aspect(id);
}
FilePath ProjectConfiguration::mapFromBuildDeviceToGlobalPath(const FilePath &path) const
{
IDevice::ConstPtr dev = BuildDeviceKitAspect::device(kit());