2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 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
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/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
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** 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-16 17:03:43 +02:00
|
|
|
#include "genericlinuxdeviceconfigurationwizard.h"
|
|
|
|
|
|
2011-06-21 12:44:52 +02:00
|
|
|
#include "genericlinuxdeviceconfigurationwizardpages.h"
|
2012-07-27 13:31:13 +02:00
|
|
|
#include "linuxdevice.h"
|
2011-07-21 11:30:56 +02:00
|
|
|
#include "linuxdevicetestdialog.h"
|
|
|
|
|
#include "linuxdevicetester.h"
|
2011-07-25 11:55:00 +02:00
|
|
|
#include "remotelinux_constants.h"
|
2012-07-27 13:31:13 +02:00
|
|
|
|
2012-02-28 10:34:50 +01:00
|
|
|
#include <utils/portlist.h>
|
2011-06-16 17:03:43 +02:00
|
|
|
|
2012-03-06 12:31:42 +01:00
|
|
|
using namespace ProjectExplorer;
|
2012-05-18 10:49:35 +02:00
|
|
|
using namespace QSsh;
|
2011-06-16 17:03:43 +02:00
|
|
|
|
|
|
|
|
namespace RemoteLinux {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
namespace {
|
|
|
|
|
enum PageId { SetupPageId, FinalPageId };
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
|
|
class GenericLinuxDeviceConfigurationWizardPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardPrivate(QWidget *parent)
|
|
|
|
|
: setupPage(parent), finalPage(parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardSetupPage setupPage;
|
|
|
|
|
GenericLinuxDeviceConfigurationWizardFinalPage finalPage;
|
|
|
|
|
};
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizard::GenericLinuxDeviceConfigurationWizard(QWidget *parent)
|
2012-03-26 14:01:58 +02:00
|
|
|
: QWizard(parent),
|
2011-09-15 09:10:10 +02:00
|
|
|
d(new Internal::GenericLinuxDeviceConfigurationWizardPrivate(this))
|
2011-06-16 17:03:43 +02:00
|
|
|
{
|
|
|
|
|
setWindowTitle(tr("New Generic Linux Device Configuration Setup"));
|
2011-09-15 09:10:10 +02:00
|
|
|
setPage(Internal::SetupPageId, &d->setupPage);
|
|
|
|
|
setPage(Internal::FinalPageId, &d->finalPage);
|
|
|
|
|
d->finalPage.setCommitPage(true);
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
delete d;
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
2012-03-06 12:31:42 +01:00
|
|
|
IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device()
|
2011-06-16 17:03:43 +02:00
|
|
|
{
|
2012-05-18 10:49:35 +02:00
|
|
|
QSsh::SshConnectionParameters sshParams;
|
2012-10-11 15:34:33 +02:00
|
|
|
sshParams.options &= ~SshConnectionOptions(SshEnableStrictConformanceChecks); // For older SSH servers.
|
2011-09-15 09:10:10 +02:00
|
|
|
sshParams.host = d->setupPage.hostName();
|
|
|
|
|
sshParams.userName = d->setupPage.userName();
|
2011-06-21 16:52:48 +02:00
|
|
|
sshParams.port = 22;
|
|
|
|
|
sshParams.timeout = 10;
|
2011-09-15 09:10:10 +02:00
|
|
|
sshParams.authenticationType = d->setupPage.authenticationType();
|
2011-06-21 16:52:48 +02:00
|
|
|
if (sshParams.authenticationType == SshConnectionParameters::AuthenticationByPassword)
|
2011-09-15 09:10:10 +02:00
|
|
|
sshParams.password = d->setupPage.password();
|
2011-06-21 16:52:48 +02:00
|
|
|
else
|
2011-09-15 09:10:10 +02:00
|
|
|
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
|
2012-07-27 13:31:13 +02:00
|
|
|
IDevice::Ptr device = LinuxDevice::create(d->setupPage.configurationName(),
|
2012-07-25 17:41:01 +02:00
|
|
|
Core::Id(Constants::GenericLinuxOsType), IDevice::Hardware);
|
2012-07-27 13:31:13 +02:00
|
|
|
device->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
|
|
|
|
|
device->setSshParameters(sshParams);
|
2012-09-03 17:21:31 +02:00
|
|
|
// Might be called after accept.
|
|
|
|
|
QWidget *parent = isVisible() ? this : static_cast<QWidget *>(0);
|
|
|
|
|
LinuxDeviceTestDialog dlg(device, new GenericLinuxDeviceTester(this), parent);
|
2011-12-21 20:14:42 +01:00
|
|
|
dlg.exec();
|
2012-07-27 13:31:13 +02:00
|
|
|
return device;
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace RemoteLinux
|