Meson: Rename ToolKitAspectWidget -> MesonToolKitAspectImpl

Following the (changed) global naming scheme.

Change-Id: If98d644b52013af4f973540cd56d1186d3656e52
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-07-22 10:13:01 +02:00
parent 231de93b26
commit 00d26f4e8e
4 changed files with 26 additions and 28 deletions

View File

@@ -65,7 +65,7 @@ public:
KitAspect *createKitAspect(Kit *k) const override KitAspect *createKitAspect(Kit *k) const override
{ {
return new ToolKitAspectWidget{k, this, ToolKitAspectWidget::ToolType::Meson}; return new MesonToolKitAspectImpl{k, this, MesonToolKitAspectImpl::ToolType::Meson};
} }
ItemList toUserOutput(const Kit *k) const override ItemList toUserOutput(const Kit *k) const override

View File

@@ -74,7 +74,7 @@ public:
KitAspect *createKitAspect(Kit *k) const final KitAspect *createKitAspect(Kit *k) const final
{ {
return new ToolKitAspectWidget(k, this, ToolKitAspectWidget::ToolType::Ninja); return new MesonToolKitAspectImpl(k, this, MesonToolKitAspectImpl::ToolType::Ninja);
} }
}; };

View File

@@ -9,13 +9,14 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
namespace MesonProjectManager { using namespace ProjectExplorer;
namespace Internal {
ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit, namespace MesonProjectManager::Internal {
const ProjectExplorer::KitAspectFactory *factory,
MesonToolKitAspectImpl::MesonToolKitAspectImpl(Kit *kit,
const KitAspectFactory *factory,
ToolType type) ToolType type)
: ProjectExplorer::KitAspect(kit, factory) : KitAspect(kit, factory)
, m_toolsComboBox(createSubWidget<QComboBox>()) , m_toolsComboBox(createSubWidget<QComboBox>())
, m_type{type} , m_type{type}
{ {
@@ -28,26 +29,26 @@ ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit,
loadTools(); loadTools();
connect(MesonTools::instance(), &MesonTools::toolAdded, connect(MesonTools::instance(), &MesonTools::toolAdded,
this, &ToolKitAspectWidget::addTool); this, &MesonToolKitAspectImpl::addTool);
connect(MesonTools::instance(), &MesonTools::toolRemoved, connect(MesonTools::instance(), &MesonTools::toolRemoved,
this, &ToolKitAspectWidget::removeTool); this, &MesonToolKitAspectImpl::removeTool);
connect(m_toolsComboBox, &QComboBox::currentIndexChanged, connect(m_toolsComboBox, &QComboBox::currentIndexChanged,
this, &ToolKitAspectWidget::setCurrentToolIndex); this, &MesonToolKitAspectImpl::setCurrentToolIndex);
} }
ToolKitAspectWidget::~ToolKitAspectWidget() MesonToolKitAspectImpl::~MesonToolKitAspectImpl()
{ {
delete m_toolsComboBox; delete m_toolsComboBox;
} }
void ToolKitAspectWidget::addTool(const MesonTools::Tool_t &tool) void MesonToolKitAspectImpl::addTool(const MesonTools::Tool_t &tool)
{ {
QTC_ASSERT(tool, return ); QTC_ASSERT(tool, return );
if (isCompatible(tool)) if (isCompatible(tool))
this->m_toolsComboBox->addItem(tool->name(), tool->id().toSetting()); this->m_toolsComboBox->addItem(tool->name(), tool->id().toSetting());
} }
void ToolKitAspectWidget::removeTool(const MesonTools::Tool_t &tool) void MesonToolKitAspectImpl::removeTool(const MesonTools::Tool_t &tool)
{ {
QTC_ASSERT(tool, return ); QTC_ASSERT(tool, return );
if (!isCompatible(tool)) if (!isCompatible(tool))
@@ -59,7 +60,7 @@ void ToolKitAspectWidget::removeTool(const MesonTools::Tool_t &tool)
m_toolsComboBox->removeItem(index); m_toolsComboBox->removeItem(index);
} }
void ToolKitAspectWidget::setCurrentToolIndex(int index) void MesonToolKitAspectImpl::setCurrentToolIndex(int index)
{ {
if (m_toolsComboBox->count() == 0) if (m_toolsComboBox->count() == 0)
return; return;
@@ -70,7 +71,7 @@ void ToolKitAspectWidget::setCurrentToolIndex(int index)
NinjaToolKitAspect::setNinjaTool(m_kit, id); NinjaToolKitAspect::setNinjaTool(m_kit, id);
} }
int ToolKitAspectWidget::indexOf(const Utils::Id &id) int MesonToolKitAspectImpl::indexOf(const Utils::Id &id)
{ {
for (int i = 0; i < m_toolsComboBox->count(); ++i) { for (int i = 0; i < m_toolsComboBox->count(); ++i) {
if (id == Utils::Id::fromSetting(m_toolsComboBox->itemData(i))) if (id == Utils::Id::fromSetting(m_toolsComboBox->itemData(i)))
@@ -79,13 +80,13 @@ int ToolKitAspectWidget::indexOf(const Utils::Id &id)
return -1; return -1;
} }
bool ToolKitAspectWidget::isCompatible(const MesonTools::Tool_t &tool) bool MesonToolKitAspectImpl::isCompatible(const MesonTools::Tool_t &tool)
{ {
return (m_type == ToolType::Meson && MesonTools::isMesonWrapper(tool)) return (m_type == ToolType::Meson && MesonTools::isMesonWrapper(tool))
|| (m_type == ToolType::Ninja && MesonTools::isNinjaWrapper(tool)); || (m_type == ToolType::Ninja && MesonTools::isNinjaWrapper(tool));
} }
void ToolKitAspectWidget::loadTools() void MesonToolKitAspectImpl::loadTools()
{ {
for (const MesonTools::Tool_t &tool : MesonTools::tools()) { for (const MesonTools::Tool_t &tool : MesonTools::tools()) {
addTool(tool); addTool(tool);
@@ -94,7 +95,7 @@ void ToolKitAspectWidget::loadTools()
m_toolsComboBox->setEnabled(m_toolsComboBox->count()); m_toolsComboBox->setEnabled(m_toolsComboBox->count());
} }
void ToolKitAspectWidget::setToDefault() void MesonToolKitAspectImpl::setToDefault()
{ {
const MesonTools::Tool_t autoDetected = [this] { const MesonTools::Tool_t autoDetected = [this] {
if (m_type == ToolType::Meson) if (m_type == ToolType::Meson)
@@ -112,5 +113,4 @@ void ToolKitAspectWidget::setToDefault()
} }
} }
} // namespace Internal } // MesonProjectManager::Internal
} // namespace MesonProjectManager

View File

@@ -12,18 +12,17 @@
#include <QComboBox> #include <QComboBox>
#include <QCoreApplication> #include <QCoreApplication>
namespace MesonProjectManager { namespace MesonProjectManager::Internal {
namespace Internal {
class ToolKitAspectWidget final : public ProjectExplorer::KitAspect class MesonToolKitAspectImpl final : public ProjectExplorer::KitAspect
{ {
public: public:
enum class ToolType { Meson, Ninja }; enum class ToolType { Meson, Ninja };
ToolKitAspectWidget(ProjectExplorer::Kit *kit, MesonToolKitAspectImpl(ProjectExplorer::Kit *kit,
const ProjectExplorer::KitAspectFactory *factory, const ProjectExplorer::KitAspectFactory *factory,
ToolType type); ToolType type);
~ToolKitAspectWidget(); ~MesonToolKitAspectImpl();
private: private:
void addTool(const MesonTools::Tool_t &tool); void addTool(const MesonTools::Tool_t &tool);
@@ -56,5 +55,4 @@ private:
ToolType m_type; ToolType m_type;
}; };
} // namespace Internal } // MesonProjectManager::Internal
} // namespace MesonProjectManager