RemoteLinux: Improve device wizard

We add a new wizard page for deploying a public key. This way,
the user has to enter the password only once during initial device
setup, just as it used to be before we switched the SSH backend.

Change-Id: Ic30e830a839033e7e7664c2713d3b74b5472e969
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2018-12-21 14:01:17 +01:00
parent 9332828d0c
commit abb4aea171
7 changed files with 209 additions and 185 deletions

View File

@@ -36,20 +36,20 @@ using namespace QSsh;
namespace RemoteLinux {
namespace Internal {
namespace {
enum PageId { SetupPageId, FinalPageId };
} // anonymous namespace
enum PageId { SetupPageId, KeyDeploymentPageId, FinalPageId };
class GenericLinuxDeviceConfigurationWizardPrivate
{
public:
GenericLinuxDeviceConfigurationWizardPrivate(QWidget *parent)
: setupPage(parent), finalPage(parent)
: setupPage(parent), keyDeploymentPage(parent), finalPage(parent)
{
}
GenericLinuxDeviceConfigurationWizardSetupPage setupPage;
GenericLinuxDeviceConfigurationWizardKeyDeploymentPage keyDeploymentPage;
GenericLinuxDeviceConfigurationWizardFinalPage finalPage;
LinuxDevice::Ptr device;
};
} // namespace Internal
@@ -59,8 +59,17 @@ GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWi
{
setWindowTitle(tr("New Generic Linux Device Configuration Setup"));
setPage(Internal::SetupPageId, &d->setupPage);
setPage(Internal::KeyDeploymentPageId, &d->keyDeploymentPage);
setPage(Internal::FinalPageId, &d->finalPage);
d->finalPage.setCommitPage(true);
d->device = LinuxDevice::create(tr("Generic Linux Device"),
Core::Id(Constants::GenericLinuxOsType), IDevice::Hardware);
d->device->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
SshConnectionParameters sshParams;
sshParams.timeout = 10;
d->device->setSshParameters(sshParams);
d->setupPage.setDevice(d->device);
d->keyDeploymentPage.setDevice(d->device);
}
GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard()
@@ -70,17 +79,7 @@ GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard()
IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device()
{
SshConnectionParameters sshParams;
sshParams.url = d->setupPage.url();
sshParams.timeout = 10;
sshParams.authenticationType = d->setupPage.authenticationType();
if (sshParams.authenticationType == SshConnectionParameters::AuthenticationTypeSpecificKey)
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
IDevice::Ptr device = LinuxDevice::create(d->setupPage.configurationName(),
Core::Id(Constants::GenericLinuxOsType), IDevice::Hardware);
device->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
device->setSshParameters(sshParams);
return device;
return d->device;
}
} // namespace RemoteLinux