Commit e4dad4e7 authored by Rolf Eike Beer's avatar Rolf Eike Beer

use algorithm and lambda to find launcher

parent c79b1ba3
Pipeline #13976 failed with stage
in 60 minutes
......@@ -62,15 +62,14 @@ static KJob* createTestJob(const QString& launchModeId, const QStringList& argum
qCDebug(CMAKE) << "got mode and type:" << type << type->id() << mode << mode->id();
Q_ASSERT(type && mode);
ILauncher* launcher = nullptr;
const auto launchers = type->launchers();
for (ILauncher* l : launchers) {
//qCDebug(CMAKE) << "available launcher" << l << l->id() << l->supportedModes();
if (l->supportedModes().contains(mode->id())) {
launcher = l;
break;
}
}
ILauncher* launcher = [type, mode]() {
const auto launchers = type->launchers();
auto it = std::find_if(launchers.begin(), launchers.end(), [mode](ILauncher *l) {
return l->supportedModes().contains(mode->id());
});
Q_ASSERT(it != launchers.end());
return *it;
}();
Q_ASSERT(launcher);
auto ilaunch = [type]() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment