forked from qt-creator/qt-creator
ProjectExplorer: Refactor KitManager::registerKit()
The interface of this function was rather unfortunate. In particluar, the fact that it took ownership of the std::unique_ptr that was passed in required some weird boiler plate code at all the calling sites. Instead, it now becomes a proper factory function. Change-Id: Iecdc6f6345232fc0f0a08bffaf8f1780edb57201 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -300,17 +300,16 @@ void IosConfigurations::updateAutomaticKitList()
|
||||
kit->unblockNotification();
|
||||
} else {
|
||||
qCDebug(kitSetupLog) << " - Setting up new kit";
|
||||
auto newKit = std::make_unique<Kit>();
|
||||
kit = newKit.get();
|
||||
kit->blockNotification();
|
||||
kit->setAutoDetected(true);
|
||||
const QString baseDisplayName = isSimulatorDeviceId(pDeviceType)
|
||||
? tr("%1 Simulator").arg(qtVersion->unexpandedDisplayName())
|
||||
: qtVersion->unexpandedDisplayName();
|
||||
kit->setUnexpandedDisplayName(baseDisplayName);
|
||||
setupKit(kit, pDeviceType, platformToolchains, debuggerId, sdk.path, qtVersion);
|
||||
kit->unblockNotification();
|
||||
KitManager::registerKit(std::move(newKit));
|
||||
const auto init = [&](Kit *k) {
|
||||
k->setAutoDetected(true);
|
||||
const QString baseDisplayName = isSimulatorDeviceId(pDeviceType)
|
||||
? tr("%1 Simulator").arg(qtVersion->unexpandedDisplayName())
|
||||
: qtVersion->unexpandedDisplayName();
|
||||
k->setUnexpandedDisplayName(baseDisplayName);
|
||||
setupKit(k, pDeviceType, platformToolchains, debuggerId, sdk.path, qtVersion);
|
||||
return true;
|
||||
};
|
||||
kit = KitManager::registerKit(init);
|
||||
}
|
||||
resultingKits.insert(kit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user