forked from qt-creator/qt-creator
ProjectExplorer/Qnx: Replace DeviceTypeKitAspect::deviceTypePredicate
There was just a single user that can achieve the same result with less code and no temporary list. Change-Id: I2e4260d19b281618a2e87117635ef4419246d3fb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -859,11 +859,6 @@ void DeviceTypeKitAspect::setDeviceTypeId(Kit *k, Core::Id type)
|
|||||||
k->setValue(DeviceTypeKitAspect::id(), type.toSetting());
|
k->setValue(DeviceTypeKitAspect::id(), type.toSetting());
|
||||||
}
|
}
|
||||||
|
|
||||||
Kit::Predicate DeviceTypeKitAspect::deviceTypePredicate(Core::Id type)
|
|
||||||
{
|
|
||||||
return [type](const Kit *kit) { return type.isValid() && deviceTypeId(kit) == type; };
|
|
||||||
}
|
|
||||||
|
|
||||||
QSet<Core::Id> DeviceTypeKitAspect::supportedPlatforms(const Kit *k) const
|
QSet<Core::Id> DeviceTypeKitAspect::supportedPlatforms(const Kit *k) const
|
||||||
{
|
{
|
||||||
return {deviceTypeId(k)};
|
return {deviceTypeId(k)};
|
||||||
|
@@ -126,8 +126,6 @@ public:
|
|||||||
static const Core::Id deviceTypeId(const Kit *k);
|
static const Core::Id deviceTypeId(const Kit *k);
|
||||||
static void setDeviceTypeId(Kit *k, Core::Id type);
|
static void setDeviceTypeId(Kit *k, Core::Id type);
|
||||||
|
|
||||||
static Kit::Predicate deviceTypePredicate(Core::Id type);
|
|
||||||
|
|
||||||
QSet<Core::Id> supportedPlatforms(const Kit *k) const override;
|
QSet<Core::Id> supportedPlatforms(const Kit *k) const override;
|
||||||
QSet<Core::Id> availableFeatures(const Kit *k) const override;
|
QSet<Core::Id> availableFeatures(const Kit *k) const override;
|
||||||
};
|
};
|
||||||
|
@@ -173,15 +173,11 @@ void QnxPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
void QnxPluginPrivate::updateDebuggerActions()
|
void QnxPluginPrivate::updateDebuggerActions()
|
||||||
{
|
{
|
||||||
bool hasValidQnxKit = false;
|
const bool hasValidQnxKit = KitManager::kit([](const Kit *kit) {
|
||||||
|
return kit->isValid()
|
||||||
auto matcher = DeviceTypeKitAspect::deviceTypePredicate(Constants::QNX_QNX_OS_TYPE);
|
&& DeviceTypeKitAspect::deviceTypeId(kit) == Constants::QNX_QNX_OS_TYPE
|
||||||
foreach (Kit *qnxKit, KitManager::kits(matcher)) {
|
&& !DeviceKitAspect::device(kit).isNull();
|
||||||
if (qnxKit->isValid() && !DeviceKitAspect::device(qnxKit).isNull()) {
|
}) != nullptr;
|
||||||
hasValidQnxKit = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_attachToQnxApplication.setVisible(hasValidQnxKit);
|
m_attachToQnxApplication.setVisible(hasValidQnxKit);
|
||||||
m_debugSeparator->setVisible(hasValidQnxKit);
|
m_debugSeparator->setVisible(hasValidQnxKit);
|
||||||
|
Reference in New Issue
Block a user