ToolChainManager: Allow for filtering of toolchains

Allow to provide a Predicate to ToolChainManager::toolChains and
add a ToolChainManager::toolChain method.

Change-Id: I0849f6fa67ffd8d5c6cfe4253cb0a326e1b023fa
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-01-11 16:12:32 +01:00
parent 6553c3c99e
commit a89100fe47
11 changed files with 60 additions and 69 deletions

View File

@@ -275,15 +275,14 @@ static ToolChain *preferredToolChain(BaseQtVersion *qtVersion, const FileName &m
{
const FileName spec = ms.isEmpty() ? qtVersion->mkspec() : ms;
QList<ToolChain *> toolchains = ToolChainManager::toolChains();
const QList<ToolChain *> toolchains = ToolChainManager::toolChains();
QList<Abi> qtAbis = qtVersion->qtAbis();
return findOr(toolchains,
toolchains.isEmpty() ? 0 : toolchains.first(),
[&spec, &archConfig, &qtAbis, &qtVersion](ToolChain *tc) -> bool{
return qtAbis.contains(tc->targetAbi())
&& tc->suggestedMkspecList().contains(spec)
&& QMakeStepConfig::targetArchFor(tc->targetAbi(), qtVersion) == archConfig;
});
return findOr(toolchains, toolchains.isEmpty() ? nullptr : toolchains.first(),
[&](ToolChain *tc) {
return qtAbis.contains(tc->targetAbi())
&& tc->suggestedMkspecList().contains(spec)
&& QMakeStepConfig::targetArchFor(tc->targetAbi(), qtVersion) == archConfig;
});
}
Kit *QmakeProjectImporter::createTemporaryKit(const QtProjectImporter::QtVersionData &data,