2011-05-31 12:47:53 +02:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-05-31 12:47:53 +02:00
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
2011-05-31 12:47:53 +02:00
|
|
|
**
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
|
|
|
** 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, Nokia gives you certain additional
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** Other Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**************************************************************************/
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
#include "linuxdeviceconfiguration.h"
|
|
|
|
|
2012-04-06 18:28:16 +02:00
|
|
|
#include "genericlinuxdeviceconfigurationwidget.h"
|
|
|
|
#include "linuxdevicetestdialog.h"
|
|
|
|
#include "publickeydeploymentdialog.h"
|
|
|
|
#include "remotelinuxprocessesdialog.h"
|
|
|
|
#include "remotelinuxprocesslist.h"
|
2011-07-25 11:55:00 +02:00
|
|
|
#include "remotelinux_constants.h"
|
|
|
|
|
2012-06-05 14:30:31 +02:00
|
|
|
#include <coreplugin/id.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
#include <utils/portlist.h>
|
|
|
|
#include <ssh/sshconnection.h>
|
2012-02-15 14:47:45 -08:00
|
|
|
#include <utils/qtcassert.h>
|
2011-08-02 12:20:16 +02:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
namespace RemoteLinux {
|
2011-08-02 12:20:16 +02:00
|
|
|
|
2011-06-21 16:52:48 +02:00
|
|
|
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create(const QString &name,
|
2012-05-16 10:46:21 +02:00
|
|
|
Core::Id type, MachineType machineType, Origin origin, Core::Id id)
|
2011-05-31 12:47:53 +02:00
|
|
|
{
|
2012-04-13 15:58:55 +02:00
|
|
|
return Ptr(new LinuxDeviceConfiguration(name, type, machineType, origin, id));
|
2012-03-02 18:09:59 +01:00
|
|
|
}
|
|
|
|
|
2012-04-06 18:28:16 +02:00
|
|
|
QString LinuxDeviceConfiguration::displayType() const
|
|
|
|
{
|
|
|
|
return tr("Generic Linux");
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectExplorer::IDeviceWidget *LinuxDeviceConfiguration::createWidget()
|
|
|
|
{
|
|
|
|
return new GenericLinuxDeviceConfigurationWidget(sharedFromThis()
|
|
|
|
.staticCast<LinuxDeviceConfiguration>());
|
|
|
|
}
|
|
|
|
|
2012-05-01 19:07:55 +02:00
|
|
|
QList<Core::Id> LinuxDeviceConfiguration::actionIds() const
|
2012-04-06 18:28:16 +02:00
|
|
|
{
|
2012-05-01 19:07:55 +02:00
|
|
|
return QList<Core::Id>() << Core::Id(Constants::GenericTestDeviceActionId)
|
|
|
|
<< Core::Id(Constants::GenericDeployKeyToDeviceActionId)
|
|
|
|
<< Core::Id(Constants::GenericRemoteProcessesActionId);
|
2012-04-06 18:28:16 +02:00
|
|
|
}
|
|
|
|
|
2012-05-01 19:07:55 +02:00
|
|
|
QString LinuxDeviceConfiguration::displayNameForActionId(Core::Id actionId) const
|
2012-04-06 18:28:16 +02:00
|
|
|
{
|
|
|
|
QTC_ASSERT(actionIds().contains(actionId), return QString());
|
|
|
|
|
2012-05-01 19:07:55 +02:00
|
|
|
if (actionId == Core::Id(Constants::GenericTestDeviceActionId))
|
2012-04-06 18:28:16 +02:00
|
|
|
return tr("Test");
|
2012-05-01 19:07:55 +02:00
|
|
|
if (actionId == Core::Id(Constants::GenericRemoteProcessesActionId))
|
2012-04-06 18:28:16 +02:00
|
|
|
return tr("Remote Processes...");
|
2012-05-01 19:07:55 +02:00
|
|
|
if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId))
|
2012-04-06 18:28:16 +02:00
|
|
|
return tr("Deploy Public Key...");
|
|
|
|
return QString(); // Can't happen.
|
|
|
|
}
|
|
|
|
|
2012-05-05 11:03:10 +02:00
|
|
|
void LinuxDeviceConfiguration::executeAction(Core::Id actionId, QWidget *parent) const
|
2012-04-06 18:28:16 +02:00
|
|
|
{
|
2012-05-02 16:03:26 +02:00
|
|
|
QTC_ASSERT(actionIds().contains(actionId), return);
|
2012-04-06 18:28:16 +02:00
|
|
|
|
2012-06-06 22:53:11 +02:00
|
|
|
QDialog *d = 0;
|
2012-04-06 18:28:16 +02:00
|
|
|
const LinuxDeviceConfiguration::ConstPtr device
|
|
|
|
= sharedFromThis().staticCast<const LinuxDeviceConfiguration>();
|
2012-05-01 19:07:55 +02:00
|
|
|
if (actionId == Core::Id(Constants::GenericTestDeviceActionId))
|
2012-05-02 16:03:26 +02:00
|
|
|
d = new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent);
|
|
|
|
else if (actionId == Core::Id(Constants::GenericRemoteProcessesActionId))
|
|
|
|
d = new RemoteLinuxProcessesDialog(new GenericRemoteLinuxProcessList(device, parent));
|
|
|
|
else if (actionId == Core::Id(Constants::GenericDeployKeyToDeviceActionId))
|
|
|
|
d = PublicKeyDeploymentDialog::createDialog(device, parent);
|
|
|
|
if (d)
|
|
|
|
d->exec();
|
2012-04-06 18:28:16 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 17:10:20 +02:00
|
|
|
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType,
|
|
|
|
Origin origin, Core::Id id)
|
|
|
|
: IDevice(type, origin, machineType, id)
|
2011-05-31 12:47:53 +02:00
|
|
|
{
|
2012-03-06 12:31:42 +01:00
|
|
|
setDisplayName(name);
|
2011-05-31 12:47:53 +02:00
|
|
|
}
|
|
|
|
|
2012-03-05 12:37:32 +01:00
|
|
|
LinuxDeviceConfiguration::LinuxDeviceConfiguration(const LinuxDeviceConfiguration &other)
|
2012-06-05 14:30:31 +02:00
|
|
|
: IDevice(other)
|
2011-05-31 12:47:53 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-03-02 18:09:59 +01:00
|
|
|
LinuxDeviceConfiguration::Ptr LinuxDeviceConfiguration::create()
|
|
|
|
{
|
|
|
|
return Ptr(new LinuxDeviceConfiguration);
|
|
|
|
}
|
|
|
|
|
2012-03-06 12:31:42 +01:00
|
|
|
ProjectExplorer::IDevice::Ptr LinuxDeviceConfiguration::clone() const
|
2012-03-05 12:37:32 +01:00
|
|
|
{
|
|
|
|
return Ptr(new LinuxDeviceConfiguration(*this));
|
|
|
|
}
|
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
} // namespace RemoteLinux
|