ProjectExplorer: Remove IDeviceFactory::setCanCreate

That's implicit now by using setCreator()

The Android case looks odd as this is (and was) effectively static
information at startup. This will be addressed in a follow-up patch,
for now keep it functionally equivalent.

Change-Id: I4e6082f88dcd21379186340189acb581caef172a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-01-26 10:00:24 +01:00
parent 41fee90d8e
commit 75ef67615d
11 changed files with 19 additions and 31 deletions

View File

@@ -673,23 +673,24 @@ AndroidDeviceFactory::AndroidDeviceFactory()
":/android/images/androiddevice.png");
setConstructionFunction(&AndroidDevice::create);
setCanCreate(m_androidConfig.sdkToolsOk());
setCreator([this] {
AvdDialog dialog = AvdDialog(m_androidConfig, Core::ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted)
return IDevice::Ptr();
if (m_androidConfig.sdkToolsOk()) {
setCreator([this] {
AvdDialog dialog = AvdDialog(m_androidConfig, Core::ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted)
return IDevice::Ptr();
const IDevice::Ptr dev = dialog.device();
if (const auto androidDev = static_cast<AndroidDevice *>(dev.data())) {
qCDebug(androidDeviceLog, "Created new Android AVD id \"%s\".",
qPrintable(androidDev->avdName()));
} else {
AndroidDeviceWidget::criticalDialog(
AndroidDevice::tr("The device info returned from AvdDialog is invalid."));
}
const IDevice::Ptr dev = dialog.device();
if (const auto androidDev = static_cast<AndroidDevice *>(dev.data())) {
qCDebug(androidDeviceLog, "Created new Android AVD id \"%s\".",
qPrintable(androidDev->avdName()));
} else {
AndroidDeviceWidget::criticalDialog(
AndroidDevice::tr("The device info returned from AvdDialog is invalid."));
}
return IDevice::Ptr(dev);
});
return IDevice::Ptr(dev);
});
}
}
} // namespace Internal