diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 6d27dfc77aa..9861c0ff8d8 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -66,13 +66,13 @@ static Id defaultCMakeToolId() class CMakeKitAspectImpl final : public KitAspect { public: - CMakeKitAspectImpl(Kit *kit, const KitAspectFactory *ki) : KitAspect(kit, ki), + CMakeKitAspectImpl(Kit *kit, const KitAspectFactory *factory) : KitAspect(kit, factory), m_comboBox(createSubWidget()), m_manageButton(createManageButton(Constants::Settings::TOOLS_ID)) { m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy()); m_comboBox->setEnabled(false); - m_comboBox->setToolTip(ki->description()); + m_comboBox->setToolTip(factory->description()); refresh(); @@ -293,8 +293,8 @@ const char TOOLSET_KEY[] = "Toolset"; class CMakeGeneratorKitAspectImpl final : public KitAspect { public: - CMakeGeneratorKitAspectImpl(Kit *kit, const KitAspectFactory *ki) - : KitAspect(kit, ki), + CMakeGeneratorKitAspectImpl(Kit *kit, const KitAspectFactory *factory) + : KitAspect(kit, factory), m_label(createSubWidget()), m_changeButton(createSubWidget()) { @@ -303,7 +303,7 @@ public: 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...")); refresh(); connect(m_changeButton, &QPushButton::clicked, @@ -847,8 +847,8 @@ const char QTC_CMAKE_PRESET_KEY[] = "QTC_CMAKE_PRESET"; class CMakeConfigurationKitAspectWidget final : public KitAspect { public: - CMakeConfigurationKitAspectWidget(Kit *kit, const KitAspectFactory *ki) - : KitAspect(kit, ki), + CMakeConfigurationKitAspectWidget(Kit *kit, const KitAspectFactory *factory) + : KitAspect(kit, factory), m_summaryLabel(createSubWidget()), m_manageButton(createSubWidget()) { diff --git a/src/plugins/debugger/debuggerkitaspect.cpp b/src/plugins/debugger/debuggerkitaspect.cpp index 54318360b82..bcf3faee62c 100644 --- a/src/plugins/debugger/debuggerkitaspect.cpp +++ b/src/plugins/debugger/debuggerkitaspect.cpp @@ -38,15 +38,15 @@ namespace Internal { class DebuggerKitAspectImpl final : public KitAspect { public: - DebuggerKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) - : KitAspect(workingCopy, ki) + DebuggerKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory) + : KitAspect(workingCopy, factory) { m_comboBox = createSubWidget(); m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy()); m_comboBox->setEnabled(true); refresh(); - m_comboBox->setToolTip(ki->description()); + m_comboBox->setToolTip(factory->description()); connect(m_comboBox, &QComboBox::currentIndexChanged, this, [this] { if (m_ignoreChanges.isLocked()) return; diff --git a/src/plugins/mcusupport/mcukitinformation.cpp b/src/plugins/mcusupport/mcukitinformation.cpp index bf2eb489b3e..1d95f877cd1 100644 --- a/src/plugins/mcusupport/mcukitinformation.cpp +++ b/src/plugins/mcusupport/mcukitinformation.cpp @@ -16,8 +16,8 @@ namespace { class McuDependenciesKitAspectImpl final : public KitAspect { public: - McuDependenciesKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) - : KitAspect(workingCopy, ki) + McuDependenciesKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory) + : KitAspect(workingCopy, factory) {} void makeReadOnly() override {} diff --git a/src/plugins/mesonprojectmanager/toolkitaspectwidget.cpp b/src/plugins/mesonprojectmanager/toolkitaspectwidget.cpp index 26c6ee8e9f7..e3398aa9f79 100644 --- a/src/plugins/mesonprojectmanager/toolkitaspectwidget.cpp +++ b/src/plugins/mesonprojectmanager/toolkitaspectwidget.cpp @@ -13,9 +13,9 @@ namespace MesonProjectManager { namespace Internal { ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit, - const ProjectExplorer::KitAspectFactory *ki, + const ProjectExplorer::KitAspectFactory *factory, ToolType type) - : ProjectExplorer::KitAspect(kit, ki) + : ProjectExplorer::KitAspect(kit, factory) , m_toolsComboBox(createSubWidget()) , m_manageButton(createManageButton(Constants::SettingsPage::TOOLS_ID)) , m_type{type} @@ -23,7 +23,7 @@ ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit, m_toolsComboBox->setSizePolicy(QSizePolicy::Ignored, m_toolsComboBox->sizePolicy().verticalPolicy()); m_toolsComboBox->setEnabled(false); - m_toolsComboBox->setToolTip(ki->description()); + m_toolsComboBox->setToolTip(factory->description()); loadTools(); connect(MesonTools::instance(), &MesonTools::toolAdded, diff --git a/src/plugins/mesonprojectmanager/toolkitaspectwidget.h b/src/plugins/mesonprojectmanager/toolkitaspectwidget.h index 26d73788d7f..3cfb186b4f9 100644 --- a/src/plugins/mesonprojectmanager/toolkitaspectwidget.h +++ b/src/plugins/mesonprojectmanager/toolkitaspectwidget.h @@ -21,7 +21,7 @@ public: enum class ToolType { Meson, Ninja }; ToolKitAspectWidget(ProjectExplorer::Kit *kit, - const ProjectExplorer::KitAspectFactory *ki, + const ProjectExplorer::KitAspectFactory *factory, ToolType type); ~ToolKitAspectWidget(); diff --git a/src/plugins/projectexplorer/kitaspects.cpp b/src/plugins/projectexplorer/kitaspects.cpp index 4175ebceb3c..c7fe79debc4 100644 --- a/src/plugins/projectexplorer/kitaspects.cpp +++ b/src/plugins/projectexplorer/kitaspects.cpp @@ -49,7 +49,7 @@ namespace Internal { class SysRootKitAspectImpl : public KitAspect { public: - SysRootKitAspectImpl(Kit *k, const KitAspectFactory *ki) : KitAspect(k, ki) + SysRootKitAspectImpl(Kit *k, const KitAspectFactory *factory) : KitAspect(k, factory) { m_chooser = createSubWidget(); m_chooser->setExpectedKind(PathChooser::ExistingDirectory); @@ -200,7 +200,7 @@ namespace Internal { class ToolChainKitAspectImpl final : public KitAspect { public: - ToolChainKitAspectImpl(Kit *k, const KitAspectFactory *ki) : KitAspect(k, ki) + ToolChainKitAspectImpl(Kit *k, const KitAspectFactory *factory) : KitAspect(k, factory) { m_mainWidget = createSubWidget(); m_mainWidget->setContentsMargins(0, 0, 0, 0); @@ -219,7 +219,7 @@ public: layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0); auto cb = new QComboBox; cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy()); - cb->setToolTip(ki->description()); + cb->setToolTip(factory->description()); m_languageComboboxMap.insert(l, cb); layout->addWidget(cb, row, 1); @@ -802,12 +802,12 @@ namespace Internal { class DeviceTypeKitAspectImpl final : public KitAspect { public: - DeviceTypeKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) - : KitAspect(workingCopy, ki), m_comboBox(createSubWidget()) + DeviceTypeKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory) + : KitAspect(workingCopy, factory), m_comboBox(createSubWidget()) { for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories()) m_comboBox->addItem(factory->displayName(), factory->deviceType().toSetting()); - m_comboBox->setToolTip(ki->description()); + m_comboBox->setToolTip(factory->description()); refresh(); connect(m_comboBox, &QComboBox::currentIndexChanged, this, &DeviceTypeKitAspectImpl::currentTypeChanged); @@ -937,8 +937,8 @@ namespace Internal { class DeviceKitAspectImpl final : public KitAspect { public: - DeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) - : KitAspect(workingCopy, ki), + DeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory) + : KitAspect(workingCopy, factory), m_comboBox(createSubWidget()), m_model(new DeviceManagerModel(DeviceManager::instance())) { @@ -948,7 +948,7 @@ public: m_comboBox->setMinimumContentsLength(16); // Don't stretch too much for Kit Page m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID); refresh(); - m_comboBox->setToolTip(ki->description()); + m_comboBox->setToolTip(factory->description()); connect(m_model, &QAbstractItemModel::modelAboutToBeReset, this, &DeviceKitAspectImpl::modelAboutToReset); @@ -1228,8 +1228,8 @@ namespace Internal { class BuildDeviceKitAspectImpl final : public KitAspect { public: - BuildDeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) - : KitAspect(workingCopy, ki), + BuildDeviceKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory) + : KitAspect(workingCopy, factory), m_comboBox(createSubWidget()), m_model(new DeviceManagerModel(DeviceManager::instance())) { @@ -1237,7 +1237,7 @@ public: m_comboBox->setModel(m_model); m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID); refresh(); - m_comboBox->setToolTip(ki->description()); + m_comboBox->setToolTip(factory->description()); connect(m_model, &QAbstractItemModel::modelAboutToBeReset, this, &BuildDeviceKitAspectImpl::modelAboutToReset); @@ -1506,8 +1506,8 @@ namespace Internal { class EnvironmentKitAspectImpl final : public KitAspect { public: - EnvironmentKitAspectImpl(Kit *workingCopy, const KitAspectFactory *ki) - : KitAspect(workingCopy, ki), + EnvironmentKitAspectImpl(Kit *workingCopy, const KitAspectFactory *factory) + : KitAspect(workingCopy, factory), m_summaryLabel(createSubWidget()), m_manageButton(createSubWidget()), m_mainWidget(createSubWidget()) diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h index f90e0a0b5c1..bb5de22bf0f 100644 --- a/src/plugins/projectexplorer/kitmanager.h +++ b/src/plugins/projectexplorer/kitmanager.h @@ -116,7 +116,7 @@ public: static QString msgManage(); 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; } void addMutableAction(QWidget *child); QWidget *createManageButton(Utils::Id pageId); diff --git a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp index da825d5169d..9aa111bd693 100644 --- a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp @@ -210,21 +210,19 @@ void KitManagerConfigWidget::addAspectToWorkingCopy(Layouting::LayoutItem &paren void KitManagerConfigWidget::updateVisibility() { - int count = m_kitAspects.count(); - for (int i = 0; i < count; ++i) { - KitAspect *aspect = m_kitAspects.at(i); - const KitAspectFactory *ki = aspect->kitInformation(); - const bool visibleInKit = ki->isApplicableToKit(m_modifiedKit.get()); - const bool irrelevant = m_modifiedKit->irrelevantAspects().contains(ki->id()); + for (KitAspect *aspect : std::as_const(m_kitAspects)) { + const KitAspectFactory *factory = aspect->factory(); + const bool visibleInKit = factory->isApplicableToKit(m_modifiedKit.get()); + const bool irrelevant = m_modifiedKit->irrelevantAspects().contains(factory->id()); aspect->setVisible(visibleInKit && !irrelevant); } } void KitManagerConfigWidget::makeStickySubWidgetsReadOnly() { - for (KitAspect *w : std::as_const(m_kitAspects)) { - if (w->kit()->isSticky(w->kitInformation()->id())) - w->makeReadOnly(); + for (KitAspect *aspect : std::as_const(m_kitAspects)) { + if (aspect->kit()->isSticky(aspect->factory()->id())) + aspect->makeReadOnly(); } } diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 1ee113c7239..8163e6693e6 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -49,8 +49,7 @@ using namespace Utils; -namespace ProjectExplorer { -namespace Internal { +namespace ProjectExplorer::Internal { const int RunColumnWidth = 30; @@ -565,9 +564,9 @@ int SelectorView::padding() ///////// // 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 @@ -584,8 +583,8 @@ public: void setKit(Kit *k) { - qDeleteAll(m_widgets); - m_widgets.clear(); + qDeleteAll(m_kitAspects); + m_kitAspects.clear(); if (!k) return; @@ -595,9 +594,9 @@ public: Layouting::Grid grid; for (KitAspectFactory *factory : KitManager::kitAspectFactories()) { if (k && k->isMutable(factory->id())) { - KitAspect *widget = factory->createKitAspect(k); - m_widgets << widget; - grid.addItems({factory->displayName(), widget, Layouting::br}); + KitAspect *aspect = factory->createKitAspect(k); + m_kitAspects << aspect; + grid.addItems({factory->displayName(), aspect, Layouting::br}); } } grid.attachTo(this); @@ -605,7 +604,7 @@ public: m_kit = k; - setHidden(m_widgets.isEmpty()); + setHidden(m_kitAspects.isEmpty()); } private: @@ -616,7 +615,7 @@ private: bool addedMutables = false; QList knownList - = Utils::transform(m_widgets, &KitAspect::kitInformation); + = Utils::transform(m_kitAspects, &KitAspect::factory); for (KitAspectFactory *factory : KitManager::kitAspectFactories()) { const Utils::Id currentId = factory->id(); @@ -632,13 +631,13 @@ private: setKit(m_kit); } else { // 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(); } } Kit *m_kit = nullptr; - QList m_widgets; + QList m_kitAspects; }; ///////// @@ -1592,7 +1591,6 @@ void MiniProjectTargetSelector::switchToProjectsMode() hide(); } -} // namespace Internal -} // namespace ProjectExplorer +} // ProjectExplorer::Internal #include