RemoteLinux: Make generic wizard reusable

Reuse it in QnxPlugin.

Change-Id: Ie60e2829dffa90a4097ef2a0cf1ab19220c2631f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-07-21 00:21:07 +02:00
parent 5a3dc42485
commit 661f89be41
7 changed files with 36 additions and 97 deletions

View File

@@ -12,7 +12,7 @@
#include <projectexplorer/devicesupport/sshparameters.h>
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/genericlinuxdeviceconfigurationwizard.h>
#include <remotelinux/remotelinuxsignaloperation.h>
#include <remotelinux/linuxdevice.h>
@@ -86,36 +86,6 @@ public:
DeviceTester *createDeviceTester() const final { return new QnxDeviceTester; }
};
class QnxDeviceWizard : public Wizard
{
public:
QnxDeviceWizard() : Wizard(Core::ICore::dialogParent())
{
setWindowTitle(Tr::tr("New QNX Device Configuration Setup"));
addPage(&m_setupPage);
addPage(&m_keyDeploymentPage);
addPage(&m_finalPage);
m_finalPage.setCommitPage(true);
m_device.reset(new QnxDevice);
m_setupPage.setDevice(m_device);
m_keyDeploymentPage.setDevice(m_device);
}
IDevice::Ptr device() const { return m_device; }
private:
GenericLinuxDeviceConfigurationWizardSetupPage m_setupPage;
GenericLinuxDeviceConfigurationWizardKeyDeploymentPage m_keyDeploymentPage;
GenericLinuxDeviceConfigurationWizardFinalPage m_finalPage;
LinuxDevice::Ptr m_device;
};
// Factory
QnxDeviceFactory::QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
{
setDisplayName(Tr::tr("QNX Device"));
@@ -123,11 +93,13 @@ QnxDeviceFactory::QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE
":/qnx/images/qnxdevice.png");
setQuickCreationAllowed(true);
setConstructionFunction([] { return IDevice::Ptr(new QnxDevice); });
setCreator([] {
QnxDeviceWizard wizard;
setCreator([]() -> IDevice::Ptr {
const IDevice::Ptr device = IDevice::Ptr(new QnxDevice);
GenericLinuxDeviceConfigurationWizard wizard(
Tr::tr("New QNX Device Configuration Setup"), device);
if (wizard.exec() != QDialog::Accepted)
return IDevice::Ptr();
return wizard.device();
return {};
return device;
});
}