Qbs: Rename some of the KitAspect related classes

... and split out the static interface.

Change-Id: I62d2a188e75bbc3e3d912c3ebf0c4300bec9fb79
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-08-10 16:33:11 +02:00
parent bb06155f09
commit 1fa67e1c67
3 changed files with 24 additions and 17 deletions

View File

@@ -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<Utils::ElidingLabel>()),
m_changeButton(createSubWidget<QPushButton>(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

View File

@@ -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;

View File

@@ -74,7 +74,7 @@ public:
QbsInstallStepFactory installStepFactory;
QbsSettingsPage settingsPage;
QbsProfilesSettingsPage profilesSetttingsPage;
QbsKitAspect qbsKitAspect;
QbsKitAspectFactory qbsKitAspectFactory;
};
QbsProjectManagerPlugin::~QbsProjectManagerPlugin()