ProjectExplorer: More KitAspect related renamings

Change-Id: I10ad7aacaaf7346f91cadec479f4bba8481b1502
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
hjk
2023-08-16 10:20:01 +02:00
parent aa093c1e91
commit e02de2ddde
9 changed files with 51 additions and 55 deletions

View File

@@ -66,13 +66,13 @@ static Id defaultCMakeToolId()
class CMakeKitAspectImpl final : public KitAspect class CMakeKitAspectImpl final : public KitAspect
{ {
public: public:
CMakeKitAspectImpl(Kit *kit, const KitAspectFactory *ki) : KitAspect(kit, ki), CMakeKitAspectImpl(Kit *kit, const KitAspectFactory *factory) : KitAspect(kit, factory),
m_comboBox(createSubWidget<QComboBox>()), m_comboBox(createSubWidget<QComboBox>()),
m_manageButton(createManageButton(Constants::Settings::TOOLS_ID)) m_manageButton(createManageButton(Constants::Settings::TOOLS_ID))
{ {
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy()); m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setEnabled(false); m_comboBox->setEnabled(false);
m_comboBox->setToolTip(ki->description()); m_comboBox->setToolTip(factory->description());
refresh(); refresh();
@@ -293,8 +293,8 @@ const char TOOLSET_KEY[] = "Toolset";
class CMakeGeneratorKitAspectImpl final : public KitAspect class CMakeGeneratorKitAspectImpl final : public KitAspect
{ {
public: public:
CMakeGeneratorKitAspectImpl(Kit *kit, const KitAspectFactory *ki) CMakeGeneratorKitAspectImpl(Kit *kit, const KitAspectFactory *factory)
: KitAspect(kit, ki), : KitAspect(kit, factory),
m_label(createSubWidget<ElidingLabel>()), m_label(createSubWidget<ElidingLabel>()),
m_changeButton(createSubWidget<QPushButton>()) m_changeButton(createSubWidget<QPushButton>())
{ {
@@ -303,7 +303,7 @@ public:
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-generators.7.html"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-generators.7.html");
}); });
m_label->setToolTip(ki->description()); m_label->setToolTip(factory->description());
m_changeButton->setText(Tr::tr("Change...")); m_changeButton->setText(Tr::tr("Change..."));
refresh(); refresh();
connect(m_changeButton, &QPushButton::clicked, connect(m_changeButton, &QPushButton::clicked,
@@ -847,8 +847,8 @@ const char QTC_CMAKE_PRESET_KEY[] = "QTC_CMAKE_PRESET";
class CMakeConfigurationKitAspectWidget final : public KitAspect class CMakeConfigurationKitAspectWidget final : public KitAspect
{ {
public: public:
CMakeConfigurationKitAspectWidget(Kit *kit, const KitAspectFactory *ki) CMakeConfigurationKitAspectWidget(Kit *kit, const KitAspectFactory *factory)
: KitAspect(kit, ki), : KitAspect(kit, factory),
m_summaryLabel(createSubWidget<ElidingLabel>()), m_summaryLabel(createSubWidget<ElidingLabel>()),
m_manageButton(createSubWidget<QPushButton>()) m_manageButton(createSubWidget<QPushButton>())
{ {

View File

@@ -38,15 +38,15 @@ namespace Internal {
class DebuggerKitAspectImpl final : public KitAspect class DebuggerKitAspectImpl final : public KitAspect
{ {
public: public:
DebuggerKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) DebuggerKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory)
: KitAspect(workingCopy, ki) : KitAspect(workingCopy, factory)
{ {
m_comboBox = createSubWidget<QComboBox>(); m_comboBox = createSubWidget<QComboBox>();
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy()); m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setEnabled(true); m_comboBox->setEnabled(true);
refresh(); refresh();
m_comboBox->setToolTip(ki->description()); m_comboBox->setToolTip(factory->description());
connect(m_comboBox, &QComboBox::currentIndexChanged, this, [this] { connect(m_comboBox, &QComboBox::currentIndexChanged, this, [this] {
if (m_ignoreChanges.isLocked()) if (m_ignoreChanges.isLocked())
return; return;

View File

@@ -16,8 +16,8 @@ namespace {
class McuDependenciesKitAspectImpl final : public KitAspect class McuDependenciesKitAspectImpl final : public KitAspect
{ {
public: public:
McuDependenciesKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) McuDependenciesKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory)
: KitAspect(workingCopy, ki) : KitAspect(workingCopy, factory)
{} {}
void makeReadOnly() override {} void makeReadOnly() override {}

View File

@@ -13,9 +13,9 @@ namespace MesonProjectManager {
namespace Internal { namespace Internal {
ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit, ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit,
const ProjectExplorer::KitAspectFactory *ki, const ProjectExplorer::KitAspectFactory *factory,
ToolType type) ToolType type)
: ProjectExplorer::KitAspect(kit, ki) : ProjectExplorer::KitAspect(kit, factory)
, m_toolsComboBox(createSubWidget<QComboBox>()) , m_toolsComboBox(createSubWidget<QComboBox>())
, m_manageButton(createManageButton(Constants::SettingsPage::TOOLS_ID)) , m_manageButton(createManageButton(Constants::SettingsPage::TOOLS_ID))
, m_type{type} , m_type{type}
@@ -23,7 +23,7 @@ ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit,
m_toolsComboBox->setSizePolicy(QSizePolicy::Ignored, m_toolsComboBox->setSizePolicy(QSizePolicy::Ignored,
m_toolsComboBox->sizePolicy().verticalPolicy()); m_toolsComboBox->sizePolicy().verticalPolicy());
m_toolsComboBox->setEnabled(false); m_toolsComboBox->setEnabled(false);
m_toolsComboBox->setToolTip(ki->description()); m_toolsComboBox->setToolTip(factory->description());
loadTools(); loadTools();
connect(MesonTools::instance(), &MesonTools::toolAdded, connect(MesonTools::instance(), &MesonTools::toolAdded,

View File

@@ -21,7 +21,7 @@ public:
enum class ToolType { Meson, Ninja }; enum class ToolType { Meson, Ninja };
ToolKitAspectWidget(ProjectExplorer::Kit *kit, ToolKitAspectWidget(ProjectExplorer::Kit *kit,
const ProjectExplorer::KitAspectFactory *ki, const ProjectExplorer::KitAspectFactory *factory,
ToolType type); ToolType type);
~ToolKitAspectWidget(); ~ToolKitAspectWidget();

View File

@@ -49,7 +49,7 @@ namespace Internal {
class SysRootKitAspectImpl : public KitAspect class SysRootKitAspectImpl : public KitAspect
{ {
public: public:
SysRootKitAspectImpl(Kit *k, const KitAspectFactory *ki) : KitAspect(k, ki) SysRootKitAspectImpl(Kit *k, const KitAspectFactory *factory) : KitAspect(k, factory)
{ {
m_chooser = createSubWidget<PathChooser>(); m_chooser = createSubWidget<PathChooser>();
m_chooser->setExpectedKind(PathChooser::ExistingDirectory); m_chooser->setExpectedKind(PathChooser::ExistingDirectory);
@@ -200,7 +200,7 @@ namespace Internal {
class ToolChainKitAspectImpl final : public KitAspect class ToolChainKitAspectImpl final : public KitAspect
{ {
public: public:
ToolChainKitAspectImpl(Kit *k, const KitAspectFactory *ki) : KitAspect(k, ki) ToolChainKitAspectImpl(Kit *k, const KitAspectFactory *factory) : KitAspect(k, factory)
{ {
m_mainWidget = createSubWidget<QWidget>(); m_mainWidget = createSubWidget<QWidget>();
m_mainWidget->setContentsMargins(0, 0, 0, 0); m_mainWidget->setContentsMargins(0, 0, 0, 0);
@@ -219,7 +219,7 @@ public:
layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0); layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0);
auto cb = new QComboBox; auto cb = new QComboBox;
cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy()); cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
cb->setToolTip(ki->description()); cb->setToolTip(factory->description());
m_languageComboboxMap.insert(l, cb); m_languageComboboxMap.insert(l, cb);
layout->addWidget(cb, row, 1); layout->addWidget(cb, row, 1);
@@ -802,12 +802,12 @@ namespace Internal {
class DeviceTypeKitAspectImpl final : public KitAspect class DeviceTypeKitAspectImpl final : public KitAspect
{ {
public: public:
DeviceTypeKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) DeviceTypeKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory)
: KitAspect(workingCopy, ki), m_comboBox(createSubWidget<QComboBox>()) : KitAspect(workingCopy, factory), m_comboBox(createSubWidget<QComboBox>())
{ {
for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories()) for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories())
m_comboBox->addItem(factory->displayName(), factory->deviceType().toSetting()); m_comboBox->addItem(factory->displayName(), factory->deviceType().toSetting());
m_comboBox->setToolTip(ki->description()); m_comboBox->setToolTip(factory->description());
refresh(); refresh();
connect(m_comboBox, &QComboBox::currentIndexChanged, connect(m_comboBox, &QComboBox::currentIndexChanged,
this, &DeviceTypeKitAspectImpl::currentTypeChanged); this, &DeviceTypeKitAspectImpl::currentTypeChanged);
@@ -937,8 +937,8 @@ namespace Internal {
class DeviceKitAspectImpl final : public KitAspect class DeviceKitAspectImpl final : public KitAspect
{ {
public: public:
DeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) DeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory)
: KitAspect(workingCopy, ki), : KitAspect(workingCopy, factory),
m_comboBox(createSubWidget<QComboBox>()), m_comboBox(createSubWidget<QComboBox>()),
m_model(new DeviceManagerModel(DeviceManager::instance())) m_model(new DeviceManagerModel(DeviceManager::instance()))
{ {
@@ -948,7 +948,7 @@ public:
m_comboBox->setMinimumContentsLength(16); // Don't stretch too much for Kit Page m_comboBox->setMinimumContentsLength(16); // Don't stretch too much for Kit Page
m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID); m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID);
refresh(); refresh();
m_comboBox->setToolTip(ki->description()); m_comboBox->setToolTip(factory->description());
connect(m_model, &QAbstractItemModel::modelAboutToBeReset, connect(m_model, &QAbstractItemModel::modelAboutToBeReset,
this, &DeviceKitAspectImpl::modelAboutToReset); this, &DeviceKitAspectImpl::modelAboutToReset);
@@ -1228,8 +1228,8 @@ namespace Internal {
class BuildDeviceKitAspectImpl final : public KitAspect class BuildDeviceKitAspectImpl final : public KitAspect
{ {
public: public:
BuildDeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) BuildDeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory)
: KitAspect(workingCopy, ki), : KitAspect(workingCopy, factory),
m_comboBox(createSubWidget<QComboBox>()), m_comboBox(createSubWidget<QComboBox>()),
m_model(new DeviceManagerModel(DeviceManager::instance())) m_model(new DeviceManagerModel(DeviceManager::instance()))
{ {
@@ -1237,7 +1237,7 @@ public:
m_comboBox->setModel(m_model); m_comboBox->setModel(m_model);
m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID); m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID);
refresh(); refresh();
m_comboBox->setToolTip(ki->description()); m_comboBox->setToolTip(factory->description());
connect(m_model, &QAbstractItemModel::modelAboutToBeReset, connect(m_model, &QAbstractItemModel::modelAboutToBeReset,
this, &BuildDeviceKitAspectImpl::modelAboutToReset); this, &BuildDeviceKitAspectImpl::modelAboutToReset);
@@ -1506,8 +1506,8 @@ namespace Internal {
class EnvironmentKitAspectImpl final : public KitAspect class EnvironmentKitAspectImpl final : public KitAspect
{ {
public: public:
EnvironmentKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) EnvironmentKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory)
: KitAspect(workingCopy, ki), : KitAspect(workingCopy, factory),
m_summaryLabel(createSubWidget<ElidingLabel>()), m_summaryLabel(createSubWidget<ElidingLabel>()),
m_manageButton(createSubWidget<QPushButton>()), m_manageButton(createSubWidget<QPushButton>()),
m_mainWidget(createSubWidget<QWidget>()) m_mainWidget(createSubWidget<QWidget>())

View File

@@ -116,7 +116,7 @@ public:
static QString msgManage(); static QString msgManage();
Kit *kit() const { return m_kit; } Kit *kit() const { return m_kit; }
const KitAspectFactory *kitInformation() const { return m_factory; } const KitAspectFactory *factory() const { return m_factory; }
QAction *mutableAction() const { return m_mutableAction; } QAction *mutableAction() const { return m_mutableAction; }
void addMutableAction(QWidget *child); void addMutableAction(QWidget *child);
QWidget *createManageButton(Utils::Id pageId); QWidget *createManageButton(Utils::Id pageId);

View File

@@ -210,21 +210,19 @@ void KitManagerConfigWidget::addAspectToWorkingCopy(Layouting::LayoutItem &paren
void KitManagerConfigWidget::updateVisibility() void KitManagerConfigWidget::updateVisibility()
{ {
int count = m_kitAspects.count(); for (KitAspect *aspect : std::as_const(m_kitAspects)) {
for (int i = 0; i < count; ++i) { const KitAspectFactory *factory = aspect->factory();
KitAspect *aspect = m_kitAspects.at(i); const bool visibleInKit = factory->isApplicableToKit(m_modifiedKit.get());
const KitAspectFactory *ki = aspect->kitInformation(); const bool irrelevant = m_modifiedKit->irrelevantAspects().contains(factory->id());
const bool visibleInKit = ki->isApplicableToKit(m_modifiedKit.get());
const bool irrelevant = m_modifiedKit->irrelevantAspects().contains(ki->id());
aspect->setVisible(visibleInKit && !irrelevant); aspect->setVisible(visibleInKit && !irrelevant);
} }
} }
void KitManagerConfigWidget::makeStickySubWidgetsReadOnly() void KitManagerConfigWidget::makeStickySubWidgetsReadOnly()
{ {
for (KitAspect *w : std::as_const(m_kitAspects)) { for (KitAspect *aspect : std::as_const(m_kitAspects)) {
if (w->kit()->isSticky(w->kitInformation()->id())) if (aspect->kit()->isSticky(aspect->factory()->id()))
w->makeReadOnly(); aspect->makeReadOnly();
} }
} }

View File

@@ -49,8 +49,7 @@
using namespace Utils; using namespace Utils;
namespace ProjectExplorer { namespace ProjectExplorer::Internal {
namespace Internal {
const int RunColumnWidth = 30; const int RunColumnWidth = 30;
@@ -565,9 +564,9 @@ int SelectorView::padding()
///////// /////////
// KitAreaWidget // KitAreaWidget
///////// /////////
void doLayout(KitAspect *widget, Layouting::LayoutItem &builder) void doLayout(KitAspect *aspect, Layouting::LayoutItem &builder)
{ {
widget->addToLayout(builder); aspect->addToLayout(builder);
} }
class KitAreaWidget : public QWidget class KitAreaWidget : public QWidget
@@ -584,8 +583,8 @@ public:
void setKit(Kit *k) void setKit(Kit *k)
{ {
qDeleteAll(m_widgets); qDeleteAll(m_kitAspects);
m_widgets.clear(); m_kitAspects.clear();
if (!k) if (!k)
return; return;
@@ -595,9 +594,9 @@ public:
Layouting::Grid grid; Layouting::Grid grid;
for (KitAspectFactory *factory : KitManager::kitAspectFactories()) { for (KitAspectFactory *factory : KitManager::kitAspectFactories()) {
if (k && k->isMutable(factory->id())) { if (k && k->isMutable(factory->id())) {
KitAspect *widget = factory->createKitAspect(k); KitAspect *aspect = factory->createKitAspect(k);
m_widgets << widget; m_kitAspects << aspect;
grid.addItems({factory->displayName(), widget, Layouting::br}); grid.addItems({factory->displayName(), aspect, Layouting::br});
} }
} }
grid.attachTo(this); grid.attachTo(this);
@@ -605,7 +604,7 @@ public:
m_kit = k; m_kit = k;
setHidden(m_widgets.isEmpty()); setHidden(m_kitAspects.isEmpty());
} }
private: private:
@@ -616,7 +615,7 @@ private:
bool addedMutables = false; bool addedMutables = false;
QList<const KitAspectFactory *> knownList QList<const KitAspectFactory *> knownList
= Utils::transform(m_widgets, &KitAspect::kitInformation); = Utils::transform(m_kitAspects, &KitAspect::factory);
for (KitAspectFactory *factory : KitManager::kitAspectFactories()) { for (KitAspectFactory *factory : KitManager::kitAspectFactories()) {
const Utils::Id currentId = factory->id(); const Utils::Id currentId = factory->id();
@@ -632,13 +631,13 @@ private:
setKit(m_kit); setKit(m_kit);
} else { } else {
// Refresh all widgets if the number of mutable settings did not change // Refresh all widgets if the number of mutable settings did not change
for (KitAspect *w : std::as_const(m_widgets)) for (KitAspect *w : std::as_const(m_kitAspects))
w->refresh(); w->refresh();
} }
} }
Kit *m_kit = nullptr; Kit *m_kit = nullptr;
QList<KitAspect *> m_widgets; QList<KitAspect *> m_kitAspects;
}; };
///////// /////////
@@ -1592,7 +1591,6 @@ void MiniProjectTargetSelector::switchToProjectsMode()
hide(); hide();
} }
} // namespace Internal } // ProjectExplorer::Internal
} // namespace ProjectExplorer
#include <miniprojecttargetselector.moc> #include <miniprojecttargetselector.moc>