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,7 +673,7 @@ AndroidDeviceFactory::AndroidDeviceFactory()
|
||||
":/android/images/androiddevice.png");
|
||||
|
||||
setConstructionFunction(&AndroidDevice::create);
|
||||
setCanCreate(m_androidConfig.sdkToolsOk());
|
||||
if (m_androidConfig.sdkToolsOk()) {
|
||||
setCreator([this] {
|
||||
AvdDialog dialog = AvdDialog(m_androidConfig, Core::ICore::dialogParent());
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
@@ -690,6 +690,7 @@ AndroidDeviceFactory::AndroidDeviceFactory()
|
||||
|
||||
return IDevice::Ptr(dev);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -126,7 +126,6 @@ BareMetalDeviceFactory::BareMetalDeviceFactory()
|
||||
setCombinedIcon(":/baremetal/images/baremetaldevicesmall.png",
|
||||
":/baremetal/images/baremetaldevice.png");
|
||||
setConstructionFunction(&BareMetalDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
BareMetalDeviceConfigurationWizard wizard;
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
|
@@ -287,7 +287,6 @@ QdbLinuxDeviceFactory::QdbLinuxDeviceFactory()
|
||||
setDisplayName(QdbDevice::tr("Boot2Qt Device"));
|
||||
setCombinedIcon(":/qdb/images/qdbdevicesmall.png", ":/qdb/images/qdbdevice.png");
|
||||
setConstructionFunction(&QdbDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
QdbDeviceWizard wizard(Core::ICore::dialogParent());
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
|
@@ -1892,7 +1892,6 @@ DockerDeviceFactory::DockerDeviceFactory()
|
||||
{
|
||||
setDisplayName(DockerDevice::tr("Docker Device"));
|
||||
setIcon(QIcon());
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
DockerDeviceSetupWizard wizard;
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
|
@@ -60,7 +60,6 @@ McuSupportDeviceFactory::McuSupportDeviceFactory()
|
||||
setCombinedIcon(":/mcusupport/images/mcusupportdevicesmall.png",
|
||||
":/mcusupport/images/mcusupportdevice.png");
|
||||
setConstructionFunction(&McuSupportDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator(&McuSupportDevice::create);
|
||||
}
|
||||
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/icon.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
@@ -78,7 +79,7 @@ namespace ProjectExplorer {
|
||||
|
||||
bool IDeviceFactory::canCreate() const
|
||||
{
|
||||
return m_canCreate;
|
||||
return bool(m_creator);
|
||||
}
|
||||
|
||||
IDevice::Ptr IDeviceFactory::create() const
|
||||
@@ -119,13 +120,9 @@ void IDeviceFactory::setCombinedIcon(const FilePath &small, const FilePath &larg
|
||||
Icon({{large, Theme::IconsBaseColor}})});
|
||||
}
|
||||
|
||||
void IDeviceFactory::setCanCreate(bool canCreate)
|
||||
{
|
||||
m_canCreate = canCreate;
|
||||
}
|
||||
|
||||
void IDeviceFactory::setCreator(const std::function<IDevice::Ptr ()> &creator)
|
||||
{
|
||||
QTC_ASSERT(creator, return);
|
||||
m_creator = creator;
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,6 @@ protected:
|
||||
void setDisplayName(const QString &displayName);
|
||||
void setIcon(const QIcon &icon);
|
||||
void setCombinedIcon(const Utils::FilePath &small, const Utils::FilePath &large);
|
||||
void setCanCreate(bool canCreate);
|
||||
void setConstructionFunction(const std::function<IDevice::Ptr ()> &constructor);
|
||||
void setCreator(const std::function<IDevice::Ptr()> &creator);
|
||||
|
||||
@@ -67,7 +66,6 @@ private:
|
||||
const Utils::Id m_deviceType;
|
||||
QString m_displayName;
|
||||
QIcon m_icon;
|
||||
bool m_canCreate = false;
|
||||
std::function<IDevice::Ptr()> m_constructor;
|
||||
};
|
||||
|
||||
|
@@ -176,7 +176,6 @@ QnxDeviceFactory::QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE
|
||||
setCombinedIcon(":/qnx/images/qnxdevicesmall.png",
|
||||
":/qnx/images/qnxdevice.png");
|
||||
setConstructionFunction(&QnxDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
QnxDeviceWizard wizard;
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
|
@@ -52,7 +52,6 @@ TestLinuxDeviceFactory::TestLinuxDeviceFactory()
|
||||
setDisplayName("Generic Linux Device");
|
||||
setIcon(QIcon());
|
||||
setConstructionFunction(&LinuxDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
LinuxDevice::Ptr newDev = LinuxDevice::create();
|
||||
qDebug() << "device : " << newDev->type();
|
||||
|
@@ -800,7 +800,6 @@ LinuxDeviceFactory::LinuxDeviceFactory()
|
||||
setDisplayName(LinuxDevice::tr("Generic Linux Device"));
|
||||
setIcon(QIcon());
|
||||
setConstructionFunction(&LinuxDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::dialogParent());
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
|
@@ -59,7 +59,6 @@ WebAssemblyDeviceFactory::WebAssemblyDeviceFactory()
|
||||
setCombinedIcon(":/webassembly/images/webassemblydevicesmall.png",
|
||||
":/webassembly/images/webassemblydevice.png");
|
||||
setConstructionFunction(&WebAssemblyDevice::create);
|
||||
setCanCreate(true);
|
||||
setCreator(&WebAssemblyDevice::create);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user