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());
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return {deviceTypeId(k)};
|
||||
|
@@ -126,8 +126,6 @@ public:
|
||||
static const Core::Id deviceTypeId(const Kit *k);
|
||||
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> availableFeatures(const Kit *k) const override;
|
||||
};
|
||||
|
@@ -173,15 +173,11 @@ void QnxPlugin::extensionsInitialized()
|
||||
|
||||
void QnxPluginPrivate::updateDebuggerActions()
|
||||
{
|
||||
bool hasValidQnxKit = false;
|
||||
|
||||
auto matcher = DeviceTypeKitAspect::deviceTypePredicate(Constants::QNX_QNX_OS_TYPE);
|
||||
foreach (Kit *qnxKit, KitManager::kits(matcher)) {
|
||||
if (qnxKit->isValid() && !DeviceKitAspect::device(qnxKit).isNull()) {
|
||||
hasValidQnxKit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const bool hasValidQnxKit = KitManager::kit([](const Kit *kit) {
|
||||
return kit->isValid()
|
||||
&& DeviceTypeKitAspect::deviceTypeId(kit) == Constants::QNX_QNX_OS_TYPE
|
||||
&& !DeviceKitAspect::device(kit).isNull();
|
||||
}) != nullptr;
|
||||
|
||||
m_attachToQnxApplication.setVisible(hasValidQnxKit);
|
||||
m_debugSeparator->setVisible(hasValidQnxKit);
|
||||
|
Reference in New Issue
Block a user