2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-07-27 13:31:13 +02:00
|
|
|
|
2011-06-21 12:44:52 +02:00
|
|
|
#include "genericlinuxdeviceconfigurationwizardpages.h"
|
2011-06-16 17:03:43 +02:00
|
|
|
#include "ui_genericlinuxdeviceconfigurationwizardsetuppage.h"
|
|
|
|
|
|
2012-07-27 13:31:13 +02:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
2011-06-16 17:03:43 +02:00
|
|
|
|
|
|
|
|
namespace RemoteLinux {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class GenericLinuxDeviceConfigurationWizardSetupPagePrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Ui::GenericLinuxDeviceConfigurationWizardSetupPage ui;
|
|
|
|
|
};
|
|
|
|
|
|
2011-08-02 12:20:16 +02:00
|
|
|
class GenericLinuxDeviceConfigurationWizardFinalPagePrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QLabel infoLabel;
|
|
|
|
|
};
|
|
|
|
|
|
2011-06-16 17:03:43 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
|
2012-05-18 10:49:35 +02:00
|
|
|
using namespace QSsh;
|
2011-06-16 17:03:43 +02:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationWizardSetupPage(QWidget *parent) :
|
2011-09-15 09:10:10 +02:00
|
|
|
QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate)
|
2011-06-16 17:03:43 +02:00
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->ui.setupUi(this);
|
2013-10-09 11:20:26 +02:00
|
|
|
setTitle(tr("Connection"));
|
2011-06-16 17:03:43 +02:00
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
2011-09-15 09:10:10 +02:00
|
|
|
d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File);
|
2013-11-25 14:37:43 +01:00
|
|
|
d->ui.privateKeyPathChooser->setHistoryCompleter(QLatin1String("Ssh.KeyFile.History"));
|
2013-04-17 10:07:26 +02:00
|
|
|
d->ui.privateKeyPathChooser->setPromptDialogTitle(tr("Choose a Private Key File"));
|
2016-06-30 23:04:57 +03:00
|
|
|
connect(d->ui.nameLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged);
|
|
|
|
|
connect(d->ui.hostNameLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged);
|
|
|
|
|
connect(d->ui.userNameLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged);
|
|
|
|
|
connect(d->ui.privateKeyPathChooser, &PathChooser::validChanged,
|
|
|
|
|
this, &QWizardPage::completeChanged);
|
2018-11-23 11:07:57 +01:00
|
|
|
connect(d->ui.defaultAuthButton, &QAbstractButton::toggled,
|
2016-06-30 23:04:57 +03:00
|
|
|
this, &GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged);
|
2016-07-20 18:04:56 +02:00
|
|
|
connect(d->ui.keyButton, &QAbstractButton::toggled,
|
|
|
|
|
this, &GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged);
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardSetupPage::~GenericLinuxDeviceConfigurationWizardSetupPage()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
delete d;
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage()
|
|
|
|
|
{
|
2011-09-28 10:14:16 +02:00
|
|
|
d->ui.nameLineEdit->setText(defaultConfigurationName());
|
2011-09-15 09:10:10 +02:00
|
|
|
d->ui.hostNameLineEdit->setText(defaultHostName());
|
|
|
|
|
d->ui.userNameLineEdit->setText(defaultUserName());
|
2018-11-23 11:07:57 +01:00
|
|
|
d->ui.defaultAuthButton->setChecked(true);
|
2012-07-25 17:41:01 +02:00
|
|
|
d->ui.privateKeyPathChooser->setPath(ProjectExplorer::IDevice::defaultPrivateKeyFilePath());
|
2011-06-16 17:03:43 +02:00
|
|
|
handleAuthTypeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GenericLinuxDeviceConfigurationWizardSetupPage::isComplete() const
|
|
|
|
|
{
|
2017-12-19 12:45:46 +01:00
|
|
|
return !configurationName().isEmpty()
|
|
|
|
|
&& !d->ui.hostNameLineEdit->text().trimmed().isEmpty()
|
|
|
|
|
&& !d->ui.userNameLineEdit->text().trimmed().isEmpty()
|
2018-11-23 11:07:57 +01:00
|
|
|
&& (authenticationType() != SshConnectionParameters::AuthenticationTypeSpecificKey
|
2011-09-15 09:10:10 +02:00
|
|
|
|| d->ui.privateKeyPathChooser->isValid());
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::configurationName() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->ui.nameLineEdit->text().trimmed();
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
2017-12-19 12:45:46 +01:00
|
|
|
QUrl GenericLinuxDeviceConfigurationWizardSetupPage::url() const
|
2011-06-16 17:03:43 +02:00
|
|
|
{
|
2017-12-19 12:45:46 +01:00
|
|
|
QUrl url;
|
|
|
|
|
url.setHost(d->ui.hostNameLineEdit->text().trimmed());
|
|
|
|
|
url.setUserName(d->ui.userNameLineEdit->text().trimmed());
|
|
|
|
|
url.setPort(22);
|
|
|
|
|
return url;
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const
|
|
|
|
|
{
|
2018-11-23 11:07:57 +01:00
|
|
|
return d->ui.keyButton->isChecked() ? SshConnectionParameters::AuthenticationTypeSpecificKey
|
|
|
|
|
: SshConnectionParameters::AuthenticationTypeAll;
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::privateKeyFilePath() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->ui.privateKeyPathChooser->path();
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-28 10:14:16 +02:00
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultConfigurationName() const
|
|
|
|
|
{
|
2011-09-28 10:30:16 +02:00
|
|
|
return tr("Generic Linux Device");
|
2011-09-28 10:14:16 +02:00
|
|
|
}
|
|
|
|
|
|
2011-06-16 17:03:43 +02:00
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultHostName() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultUserName() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-21 12:44:52 +02:00
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultPassWord() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-16 17:03:43 +02:00
|
|
|
void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
|
|
|
|
|
{
|
2016-07-20 18:04:56 +02:00
|
|
|
d->ui.privateKeyPathChooser->setEnabled(authenticationType()
|
2018-11-23 11:07:57 +01:00
|
|
|
== SshConnectionParameters::AuthenticationTypeSpecificKey);
|
2011-06-16 17:03:43 +02:00
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-21 12:44:52 +02:00
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent)
|
2011-09-15 09:10:10 +02:00
|
|
|
: QWizardPage(parent), d(new Internal::GenericLinuxDeviceConfigurationWizardFinalPagePrivate)
|
2011-06-21 12:44:52 +02:00
|
|
|
{
|
2013-10-09 11:20:26 +02:00
|
|
|
setTitle(tr("Summary"));
|
2011-06-21 12:44:52 +02:00
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
2011-09-15 09:10:10 +02:00
|
|
|
d->infoLabel.setWordWrap(true);
|
2018-11-24 17:06:01 +01:00
|
|
|
auto const layout = new QVBoxLayout(this);
|
2011-09-15 09:10:10 +02:00
|
|
|
layout->addWidget(&d->infoLabel);
|
2011-08-02 12:20:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardFinalPage::~GenericLinuxDeviceConfigurationWizardFinalPage()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
delete d;
|
2011-06-21 12:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->infoLabel.setText(infoText());
|
2011-06-21 12:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const
|
|
|
|
|
{
|
|
|
|
|
return tr("The new device configuration will now be created.\n"
|
|
|
|
|
"In addition, device connectivity will be tested.");
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-16 17:03:43 +02:00
|
|
|
} // namespace RemoteLinux
|