forked from qt-creator/qt-creator
ProjectExplorer: Simplify collection of RunConfigurationCreationInfos
Instead of calling twice for AutoCreated and UserCreated, call once and record to which case it belongs. Only the 'both' and 'user only' combination are ever used. Change-Id: I9c15085bcbb4bf6584a6156135f2084dbfc51c1c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -385,7 +385,7 @@ bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &
|
||||
}
|
||||
|
||||
QList<RunConfigurationCreationInfo>
|
||||
QbsRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
|
||||
QbsRunConfigurationFactory::availableCreators(Target *parent) const
|
||||
{
|
||||
QList<qbs::ProductData> products;
|
||||
|
||||
@@ -398,19 +398,23 @@ QbsRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode)
|
||||
products << product;
|
||||
}
|
||||
|
||||
if (mode == AutoCreate) {
|
||||
std::function<bool (const qbs::ProductData &)> hasQtcRunnable = [](const qbs::ProductData &product) {
|
||||
return product.properties().value("qtcRunnable").toBool();
|
||||
};
|
||||
const auto isQtcRunnable = [](const qbs::ProductData &product) {
|
||||
return product.properties().value("qtcRunnable").toBool();
|
||||
};
|
||||
const bool hasAnyQtcRunnable = Utils::anyOf(products, isQtcRunnable);
|
||||
|
||||
if (Utils::anyOf(products, hasQtcRunnable))
|
||||
Utils::erase(products, std::not1(hasQtcRunnable));
|
||||
}
|
||||
|
||||
return Utils::transform(products, [this, project](const qbs::ProductData &product) {
|
||||
return Utils::transform(products, [&](const qbs::ProductData &product) {
|
||||
const QString displayName = product.fullDisplayName();
|
||||
const QString targetName = QbsProject::uniqueProductName(product) + rcNameSeparator() + displayName;
|
||||
return convert(displayName, targetName);
|
||||
return RunConfigurationCreationInfo {
|
||||
this,
|
||||
runConfigurationBaseId(),
|
||||
targetName,
|
||||
displayName,
|
||||
(hasAnyQtcRunnable && !isQtcRunnable(product))
|
||||
? RunConfigurationCreationInfo::ManualCreationOnly
|
||||
: RunConfigurationCreationInfo::AlwaysCreate
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
|
||||
|
||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
|
||||
availableCreators(ProjectExplorer::Target *parent) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user