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