From 1fa67e1c678959fc104bd9d7aa533b1434e0360a Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 10 Aug 2023 16:33:11 +0200 Subject: [PATCH] Qbs: Rename some of the KitAspect related classes ... and split out the static interface. Change-Id: I62d2a188e75bbc3e3d912c3ebf0c4300bec9fb79 Reviewed-by: Christian Kandeler Reviewed-by: --- .../qbsprojectmanager/qbskitinformation.cpp | 23 +++++++++++-------- .../qbsprojectmanager/qbskitinformation.h | 16 ++++++++----- .../qbsprojectmanagerplugin.cpp | 2 +- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbskitinformation.cpp b/src/plugins/qbsprojectmanager/qbskitinformation.cpp index 6a93a73ef16..84ad6d34a47 100644 --- a/src/plugins/qbsprojectmanager/qbskitinformation.cpp +++ b/src/plugins/qbsprojectmanager/qbskitinformation.cpp @@ -20,15 +20,15 @@ using namespace ProjectExplorer; namespace QbsProjectManager { namespace Internal { -class AspectWidget final : public KitAspect +class QbsKitAspectImpl final : public KitAspect { public: - AspectWidget(Kit *kit, const KitAspectFactory *kitInfo) + QbsKitAspectImpl(Kit *kit, const KitAspectFactory *kitInfo) : KitAspect(kit, kitInfo), m_contentLabel(createSubWidget()), m_changeButton(createSubWidget(Tr::tr("Change..."))) { - connect(m_changeButton, &QPushButton::clicked, this, &AspectWidget::changeProperties); + connect(m_changeButton, &QPushButton::clicked, this, &QbsKitAspectImpl::changeProperties); } private: @@ -53,7 +53,7 @@ private: QPushButton * const m_changeButton; }; -QbsKitAspect::QbsKitAspect() +QbsKitAspectFactory::QbsKitAspectFactory() { setObjectName(QLatin1String("QbsKitAspect")); setId(QbsKitAspect::id()); @@ -90,16 +90,19 @@ Utils::Id QbsKitAspect::id() return "Qbs.KitInformation"; } -Tasks QbsKitAspect::validate(const Kit *) const { return {}; } - -KitAspectFactory::ItemList QbsKitAspect::toUserOutput(const Kit *k) const +Tasks QbsKitAspectFactory::validate(const Kit *) const { - return {{displayName(), representation(k)}}; + return {}; } -KitAspect *QbsKitAspect::createKitAspect(Kit *k) const +KitAspectFactory::ItemList QbsKitAspectFactory::toUserOutput(const Kit *k) const { - return new AspectWidget(k, this); + return {{displayName(), QbsKitAspect::representation(k)}}; +} + +KitAspect *QbsKitAspectFactory::createKitAspect(Kit *k) const +{ + return new QbsKitAspectImpl(k, this); } } // namespace Internal diff --git a/src/plugins/qbsprojectmanager/qbskitinformation.h b/src/plugins/qbsprojectmanager/qbskitinformation.h index 737e1ba384d..f6f846ecb41 100644 --- a/src/plugins/qbsprojectmanager/qbskitinformation.h +++ b/src/plugins/qbsprojectmanager/qbskitinformation.h @@ -8,20 +8,24 @@ namespace QbsProjectManager { namespace Internal { -class QbsKitAspect final : public ProjectExplorer::KitAspectFactory +class QbsKitAspect final { - Q_OBJECT - public: - QbsKitAspect(); - static QString representation(const ProjectExplorer::Kit *kit); static QVariantMap properties(const ProjectExplorer::Kit *kit); static void setProperties(ProjectExplorer::Kit *kit, const QVariantMap &properties); -private: static Utils::Id id(); +}; +class QbsKitAspectFactory final : public ProjectExplorer::KitAspectFactory +{ + Q_OBJECT + +public: + QbsKitAspectFactory(); + +private: ProjectExplorer::Tasks validate(const ProjectExplorer::Kit *) const override; ItemList toUserOutput(const ProjectExplorer::Kit *) const override; ProjectExplorer::KitAspect *createKitAspect(ProjectExplorer::Kit *) const override; diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index acb6dc45e49..0f4a08aad11 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -74,7 +74,7 @@ public: QbsInstallStepFactory installStepFactory; QbsSettingsPage settingsPage; QbsProfilesSettingsPage profilesSetttingsPage; - QbsKitAspect qbsKitAspect; + QbsKitAspectFactory qbsKitAspectFactory; }; QbsProjectManagerPlugin::~QbsProjectManagerPlugin()