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:
Christian Kandeler
2019-03-11 16:59:16 +01:00
parent 03d776a873
commit 3aea3a13cb
9 changed files with 89 additions and 101 deletions

View File

@@ -44,14 +44,13 @@ namespace Internal {
void QmlProfilerToolTest::testAttachToWaitingApplication()
{
auto newKit = std::make_unique<ProjectExplorer::Kit>("fookit");
ProjectExplorer::Kit * newKitPtr = newKit.get();
ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance();
QVERIFY(kitManager);
QVERIFY(kitManager->registerKit(std::move(newKit)));
ProjectExplorer::Kit * const newKit = kitManager->registerKit({}, "fookit");
QVERIFY(newKit);
QSettings *settings = Core::ICore::settings();
QVERIFY(settings);
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), newKitPtr->id().toSetting());
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), newKit->id().toSetting());
QmlProfilerTool profilerTool;