forked from qt-creator/qt-creator
ProjectExplorer: Use a lambda for DeviceFactory::create()
Somewhat slimmer interface on the user code side and follows existing practice. Change-Id: I20ed8f5a00591265d32ea9ce93e1f1bbc76d2437 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -1803,15 +1803,6 @@ QString DockerDevicePrivate::outputForRunInShell(const CommandLine &cmd) const
|
||||
|
||||
// Factory
|
||||
|
||||
DockerDeviceFactory::DockerDeviceFactory()
|
||||
: IDeviceFactory(Constants::DOCKER_DEVICE_TYPE)
|
||||
{
|
||||
setDisplayName(DockerDevice::tr("Docker Device"));
|
||||
setIcon(QIcon());
|
||||
setCanCreate(true);
|
||||
setConstructionFunction([] { return DockerDevice::create({}); });
|
||||
}
|
||||
|
||||
class DockerImageItem final : public TreeItem, public DockerDeviceData
|
||||
{
|
||||
public:
|
||||
@@ -1915,7 +1906,7 @@ public:
|
||||
m_process->start();
|
||||
}
|
||||
|
||||
DockerDevice::Ptr device() const
|
||||
IDevice::Ptr device() const
|
||||
{
|
||||
const QModelIndexList selectedRows = m_view->selectionModel()->selectedRows();
|
||||
QTC_ASSERT(selectedRows.size() == 1, return {});
|
||||
@@ -1940,14 +1931,6 @@ public:
|
||||
QString m_selectedId;
|
||||
};
|
||||
|
||||
IDevice::Ptr DockerDeviceFactory::create() const
|
||||
{
|
||||
DockerDeviceSetupWizard wizard;
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
return IDevice::Ptr();
|
||||
return wizard.device();
|
||||
}
|
||||
|
||||
void DockerDeviceWidget::updateDaemonStateTexts()
|
||||
{
|
||||
Utils::optional<bool> daemonState = DockerPlugin::isDaemonRunning();
|
||||
@@ -1963,5 +1946,22 @@ void DockerDeviceWidget::updateDaemonStateTexts()
|
||||
}
|
||||
}
|
||||
|
||||
// Factory
|
||||
|
||||
DockerDeviceFactory::DockerDeviceFactory()
|
||||
: IDeviceFactory(Constants::DOCKER_DEVICE_TYPE)
|
||||
{
|
||||
setDisplayName(DockerDevice::tr("Docker Device"));
|
||||
setIcon(QIcon());
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
DockerDeviceSetupWizard wizard;
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
return IDevice::Ptr();
|
||||
return wizard.device();
|
||||
});
|
||||
setConstructionFunction([] { return DockerDevice::create({}); });
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Docker
|
||||
|
||||
@@ -157,8 +157,6 @@ class DockerDeviceFactory final : public ProjectExplorer::IDeviceFactory
|
||||
{
|
||||
public:
|
||||
DockerDeviceFactory();
|
||||
|
||||
ProjectExplorer::IDevice::Ptr create() const override;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
Reference in New Issue
Block a user