forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user