2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-06-16 17:03:43 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
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"));
|
2011-09-15 09:10:10 +02:00
|
|
|
connect(d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
|
|
|
|
connect(d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
|
|
|
|
connect(d->ui.userNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
|
|
|
|
connect(d->ui.privateKeyPathChooser, SIGNAL(validChanged()), SIGNAL(completeChanged()));
|
|
|
|
|
connect(d->ui.passwordButton, SIGNAL(toggled(bool)), SLOT(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());
|
|
|
|
|
d->ui.passwordButton->setChecked(true);
|
|
|
|
|
d->ui.passwordLineEdit->setText(defaultPassWord());
|
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
|
|
|
|
|
{
|
|
|
|
|
return !configurationName().isEmpty() && !hostName().isEmpty() && !userName().isEmpty()
|
2013-06-18 18:12:34 +02:00
|
|
|
&& (authenticationType() != SshConnectionParameters::AuthenticationTypePublicKey
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::hostName() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->ui.hostNameLineEdit->text().trimmed();
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::userName() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->ui.userNameLineEdit->text().trimmed();
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->ui.passwordButton->isChecked()
|
2013-06-18 18:12:34 +02:00
|
|
|
? SshConnectionParameters::AuthenticationTypeTryAllPasswordBasedMethods
|
|
|
|
|
: SshConnectionParameters::AuthenticationTypePublicKey;
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::password() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->ui.passwordLineEdit->text();
|
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()
|
|
|
|
|
{
|
2013-06-18 18:12:34 +02:00
|
|
|
d->ui.passwordLineEdit->setEnabled(authenticationType() != SshConnectionParameters::AuthenticationTypePublicKey);
|
|
|
|
|
d->ui.privateKeyPathChooser->setEnabled(!d->ui.passwordLineEdit->isEnabled());
|
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);
|
2011-06-21 12:44:52 +02:00
|
|
|
QVBoxLayout * 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
|