2011-02-17 17:53:52 +01:00
|
|
|
/**************************************************************************
|
2009-11-27 16:40:07 +01:00
|
|
|
**
|
2011-02-17 17:53:52 +01: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).
|
2009-11-27 16:40:07 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-11-27 16:40:07 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2011-02-17 17:53:52 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2009-11-27 16:40:07 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2009-11-27 16:40:07 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
2009-11-27 16:40:07 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-11-27 16:40:07 +01:00
|
|
|
**
|
2011-02-17 17:53:52 +01:00
|
|
|
**************************************************************************/
|
2011-05-31 12:47:53 +02:00
|
|
|
#ifndef LINUXDEVICECONFIGURATION_H
|
|
|
|
|
#define LINUXDEVICECONFIGURATION_H
|
2009-11-27 16:40:07 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
#include "remotelinux_export.h"
|
2009-11-27 16:40:07 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QSharedPointer>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QVariantHash>
|
2012-03-02 18:09:59 +01:00
|
|
|
#include <QVariantMap>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QWizard>
|
2009-11-27 16:40:07 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2011-06-09 17:17:01 +02:00
|
|
|
class QDialog;
|
2009-11-27 16:40:07 +01:00
|
|
|
class QSettings;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2011-08-02 12:20:16 +02:00
|
|
|
namespace Utils {
|
|
|
|
|
class SshConnectionParameters;
|
2012-02-28 10:34:50 +01:00
|
|
|
class PortList;
|
2011-08-02 12:20:16 +02:00
|
|
|
}
|
2011-05-31 12:47:53 +02:00
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
namespace RemoteLinux {
|
2011-08-15 11:23:14 +02:00
|
|
|
class LinuxDeviceConfigurations;
|
2011-08-02 12:20:16 +02:00
|
|
|
|
2009-11-27 16:40:07 +01:00
|
|
|
namespace Internal {
|
2011-08-02 12:20:16 +02:00
|
|
|
class LinuxDeviceConfigurationPrivate;
|
|
|
|
|
} // namespace Internal
|
2009-11-27 16:40:07 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
class REMOTELINUX_EXPORT LinuxDeviceConfiguration
|
2009-11-27 16:40:07 +01:00
|
|
|
{
|
2011-08-15 11:23:14 +02:00
|
|
|
friend class LinuxDeviceConfigurations;
|
2009-11-27 16:40:07 +01:00
|
|
|
public:
|
2011-06-09 17:17:01 +02:00
|
|
|
typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
|
2011-05-31 12:47:53 +02:00
|
|
|
typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
2011-01-13 13:49:23 +01:00
|
|
|
typedef quint64 Id;
|
2011-06-07 12:12:30 +02:00
|
|
|
|
2012-03-05 12:37:32 +01:00
|
|
|
enum MachineType { Hardware, Emulator };
|
2011-08-15 10:36:53 +02:00
|
|
|
enum Origin { ManuallyAdded, AutoDetected };
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2011-06-22 10:00:50 +02:00
|
|
|
~LinuxDeviceConfiguration();
|
|
|
|
|
|
2012-02-28 10:34:50 +01:00
|
|
|
Utils::PortList freePorts() const;
|
2011-08-02 12:20:16 +02:00
|
|
|
Utils::SshConnectionParameters sshParameters() const;
|
2011-11-16 09:37:29 +00:00
|
|
|
QString displayName() const;
|
2012-03-05 12:37:32 +01:00
|
|
|
QString type() const;
|
|
|
|
|
MachineType machineType() const;
|
2011-08-02 12:20:16 +02:00
|
|
|
Id internalId() const;
|
2011-08-15 10:36:53 +02:00
|
|
|
bool isAutoDetected() const;
|
2011-11-25 12:23:57 +01:00
|
|
|
QVariantHash attributes() const;
|
2012-02-07 18:07:26 +01:00
|
|
|
QVariant attribute(const QString &name) const;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
2012-02-15 14:47:45 -08:00
|
|
|
void setSshParameters(const Utils::SshConnectionParameters &sshParameters);
|
2012-02-28 10:34:50 +01:00
|
|
|
void setFreePorts(const Utils::PortList &freePorts);
|
2012-02-15 14:47:45 -08:00
|
|
|
void setAttribute(const QString &name, const QVariant &value);
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
static QString defaultPrivateKeyFilePath();
|
2011-02-10 15:37:12 +01:00
|
|
|
static QString defaultPublicKeyFilePath();
|
2010-04-26 11:43:25 +02:00
|
|
|
|
2011-01-13 16:24:05 +01:00
|
|
|
static const Id InvalidId;
|
2009-12-01 14:04:25 +01:00
|
|
|
|
2012-03-02 18:09:59 +01:00
|
|
|
static Ptr create();
|
2012-03-05 12:37:32 +01:00
|
|
|
static Ptr create(const QString &name, const QString &type, MachineType machineType,
|
|
|
|
|
Origin origin = ManuallyAdded);
|
2011-06-09 17:17:01 +02:00
|
|
|
private:
|
2012-03-02 18:09:59 +01:00
|
|
|
LinuxDeviceConfiguration();
|
2012-03-05 12:37:32 +01:00
|
|
|
LinuxDeviceConfiguration(const QString &name, const QString &type, MachineType machineType,
|
|
|
|
|
Origin origin);
|
2012-03-02 14:08:43 +01:00
|
|
|
LinuxDeviceConfiguration(const QSettings &settings);
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2012-03-05 12:37:32 +01:00
|
|
|
LinuxDeviceConfiguration(const LinuxDeviceConfiguration &other);
|
2011-05-31 12:47:53 +02:00
|
|
|
LinuxDeviceConfiguration &operator=(const LinuxDeviceConfiguration &);
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2012-03-02 14:08:43 +01:00
|
|
|
static Ptr create(const QSettings &settings);
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2011-11-16 09:37:29 +00:00
|
|
|
void setDisplayName(const QString &name);
|
2011-08-02 12:20:16 +02:00
|
|
|
void setInternalId(Id id);
|
|
|
|
|
void setDefault(bool isDefault);
|
2012-03-02 18:09:59 +01:00
|
|
|
|
|
|
|
|
void fromMap(const QVariantMap &map);
|
|
|
|
|
QVariantMap toMap() const;
|
2010-04-08 17:31:55 +02:00
|
|
|
|
2012-03-05 12:37:32 +01:00
|
|
|
Ptr clone() const;
|
|
|
|
|
|
2011-09-16 11:33:48 +02:00
|
|
|
Internal::LinuxDeviceConfigurationPrivate *d;
|
2009-12-23 10:53:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2011-06-09 17:17:01 +02:00
|
|
|
/*!
|
|
|
|
|
\class RemoteLinux::ILinuxDeviceConfigurationWizard
|
|
|
|
|
|
|
|
|
|
\brief Provides an interface for wizards creating a LinuxDeviceConfiguration
|
|
|
|
|
|
|
|
|
|
A class implementing this interface is a wizard whose final result is
|
|
|
|
|
a LinuxDeviceConfiguration object. The wizard will be started when the user chooses the
|
|
|
|
|
"Add..." action from the "Linux devices" options page.
|
|
|
|
|
*/
|
|
|
|
|
class REMOTELINUX_EXPORT ILinuxDeviceConfigurationWizard : public QWizard
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2011-07-13 18:02:35 +02:00
|
|
|
|
2011-06-09 17:17:01 +02:00
|
|
|
public:
|
2011-09-16 11:28:41 +02:00
|
|
|
virtual LinuxDeviceConfiguration::Ptr deviceConfiguration() = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
ILinuxDeviceConfigurationWizard(QWidget *parent) : QWizard(parent) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2012-02-15 14:47:45 -08:00
|
|
|
\class RemoteLinux::LinuxDeviceConfigurationWidget : public QWidget
|
|
|
|
|
|
|
|
|
|
\brief Provides an interface for the widget configuring a LinuxDeviceConfiguration
|
|
|
|
|
|
|
|
|
|
A class implementing this interface will display a widget in the configuration
|
|
|
|
|
options page "Linux Device", in the "Device configuration" tab.
|
|
|
|
|
It's used to configure a particular device, the default widget is empty.
|
|
|
|
|
*/
|
|
|
|
|
class REMOTELINUX_EXPORT ILinuxDeviceConfigurationWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ILinuxDeviceConfigurationWidget(const LinuxDeviceConfiguration::Ptr &deviceConfig,
|
|
|
|
|
QWidget *parent = 0);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void defaultSshKeyFilePathChanged(const QString &path);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
LinuxDeviceConfiguration::Ptr deviceConfiguration() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
LinuxDeviceConfiguration::Ptr m_deviceConfiguration;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\class RemoteLinux::ILinuxDeviceConfiguration factory.
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
\brief Provides an interface for classes providing services related to certain type of Linux devices.
|
|
|
|
|
|
|
|
|
|
The main service is a wizard providing the device configuration itself.
|
|
|
|
|
|
|
|
|
|
The factory objects have to be added to the global object pool via
|
|
|
|
|
\c ExtensionSystem::PluginManager::addObject().
|
|
|
|
|
\sa ExtensionSystem::PluginManager::addObject()
|
|
|
|
|
*/
|
|
|
|
|
class REMOTELINUX_EXPORT ILinuxDeviceConfigurationFactory : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2011-07-13 18:02:35 +02:00
|
|
|
|
2011-06-09 17:17:01 +02:00
|
|
|
public:
|
|
|
|
|
/*!
|
|
|
|
|
A short, one-line description of what kind of device this factory supports.
|
|
|
|
|
*/
|
2011-09-15 09:10:10 +02:00
|
|
|
virtual QString displayName() const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
A wizard that can create the types of device configuration this factory supports.
|
|
|
|
|
*/
|
2011-09-15 09:10:10 +02:00
|
|
|
virtual ILinuxDeviceConfigurationWizard *createWizard(QWidget *parent = 0) const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
2012-02-15 14:47:45 -08:00
|
|
|
/*!
|
|
|
|
|
A widget that can configure the device this factory supports.
|
|
|
|
|
*/
|
|
|
|
|
virtual ILinuxDeviceConfigurationWidget *createWidget(
|
|
|
|
|
const LinuxDeviceConfiguration::Ptr &deviceConfig,
|
|
|
|
|
QWidget *parent = 0) const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Returns true iff this factory supports the given device type.
|
|
|
|
|
*/
|
2012-03-05 12:37:32 +01:00
|
|
|
virtual bool supportsDeviceType(const QString &type) const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
2011-06-21 16:52:48 +02:00
|
|
|
/*!
|
|
|
|
|
Returns a human-readable string for the given OS type, if this factory supports that type.
|
|
|
|
|
*/
|
2012-03-05 12:37:32 +01:00
|
|
|
virtual QString displayType(const QString &type) const = 0;
|
2011-06-21 16:52:48 +02:00
|
|
|
|
2011-06-09 17:17:01 +02:00
|
|
|
/*!
|
|
|
|
|
Returns a list of ids representing actions that can be run on device configurations
|
2012-02-28 17:16:27 +01:00
|
|
|
that this factory supports. These actions will be available in the "Devices"
|
2011-06-09 17:17:01 +02:00
|
|
|
options page.
|
|
|
|
|
*/
|
2011-09-15 09:10:10 +02:00
|
|
|
virtual QStringList supportedDeviceActionIds() const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
A human-readable string for the given id. Will be displayed on a button which, when clicked,
|
|
|
|
|
will start the respective action.
|
|
|
|
|
*/
|
2011-09-15 09:10:10 +02:00
|
|
|
virtual QString displayNameForActionId(const QString &actionId) const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
2011-08-01 18:01:00 +02:00
|
|
|
/*!
|
|
|
|
|
True iff the user should be allowed to edit the device configurations created by this
|
|
|
|
|
factory. Returns true by default. Override if your factory creates fixed configurations
|
|
|
|
|
for which later editing makes no sense.
|
|
|
|
|
*/
|
|
|
|
|
bool isUserEditable() const { return true; }
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Produces a dialog implementing the respective action. The dialog is supposed to be
|
|
|
|
|
modal, so implementers must make sure to make it interruptible as to not needlessly
|
|
|
|
|
block the UI.
|
|
|
|
|
*/
|
|
|
|
|
virtual QDialog *createDeviceAction(const QString &actionId,
|
2011-09-15 09:10:10 +02:00
|
|
|
const LinuxDeviceConfiguration::ConstPtr &deviceConfig, QWidget *parent = 0) const = 0;
|
2011-06-09 17:17:01 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
ILinuxDeviceConfigurationFactory(QObject *parent) : QObject(parent) {}
|
|
|
|
|
};
|
|
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
} // namespace RemoteLinux
|
2009-11-27 16:40:07 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
#endif // LINUXDEVICECONFIGURATION_H
|