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
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-11-27 16:40:07 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.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-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.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
|
|
|
|
2011-02-14 16:34:17 +01:00
|
|
|
#include <utils/ssh/sshconnection.h>
|
2010-04-26 11:43:25 +02:00
|
|
|
|
2010-08-12 19:12:12 +02:00
|
|
|
#include <QtCore/QPair>
|
2011-01-13 13:49:23 +01:00
|
|
|
#include <QtCore/QSharedPointer>
|
2009-11-27 16:40:07 +01:00
|
|
|
#include <QtCore/QString>
|
2011-06-09 17:17:01 +02:00
|
|
|
#include <QtCore/QStringList>
|
|
|
|
|
#include <QtGui/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-05-31 12:47:53 +02:00
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
namespace RemoteLinux {
|
2009-11-27 16:40:07 +01:00
|
|
|
namespace Internal {
|
2011-05-31 12:47:53 +02:00
|
|
|
class LinuxDeviceConfigurations;
|
|
|
|
|
}
|
2009-11-27 16:40:07 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
class REMOTELINUX_EXPORT PortList
|
2010-08-12 19:12:12 +02:00
|
|
|
{
|
2010-08-12 19:46:58 +02:00
|
|
|
public:
|
2011-01-13 16:24:05 +01:00
|
|
|
void addPort(int port);
|
|
|
|
|
void addRange(int startPort, int endPort);
|
|
|
|
|
bool hasMore() const;
|
|
|
|
|
int count() const;
|
|
|
|
|
int getNext();
|
|
|
|
|
QString toString() const;
|
2010-08-12 19:12:12 +02:00
|
|
|
|
2011-06-21 16:52:48 +02:00
|
|
|
static QString regularExpression();
|
|
|
|
|
|
2010-08-12 19:12:12 +02:00
|
|
|
private:
|
2011-01-13 16:24:05 +01:00
|
|
|
typedef QPair<int, int> Range;
|
2010-08-12 19:12:12 +02:00
|
|
|
QList<Range> m_ranges;
|
|
|
|
|
};
|
|
|
|
|
|
2011-01-13 16:24:05 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
class REMOTELINUX_EXPORT LinuxDeviceConfiguration
|
2009-11-27 16:40:07 +01:00
|
|
|
{
|
2011-05-31 12:47:53 +02:00
|
|
|
friend class Internal::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
|
|
|
|
|
|
|
|
static const QString Maemo5OsType;
|
|
|
|
|
static const QString HarmattanOsType;
|
|
|
|
|
static const QString MeeGoOsType;
|
|
|
|
|
static const QString GenericLinuxOsType;
|
|
|
|
|
|
2011-02-14 13:56:39 +01:00
|
|
|
enum DeviceType { Physical, Emulator };
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
PortList freePorts() const;
|
2011-02-14 16:34:17 +01:00
|
|
|
Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; }
|
2011-01-13 13:49:23 +01:00
|
|
|
QString name() const { return m_name; }
|
2011-06-09 17:17:01 +02:00
|
|
|
void setName(const QString &name) { m_name = name; }
|
2011-06-07 12:12:30 +02:00
|
|
|
QString osType() const { return m_osType; }
|
2011-01-13 13:49:23 +01:00
|
|
|
DeviceType type() const { return m_type; }
|
|
|
|
|
QString portsSpec() const { return m_portsSpec; }
|
2011-02-04 15:04:20 +01:00
|
|
|
Id internalId() const { return m_internalId; }
|
2011-01-13 15:00:48 +01:00
|
|
|
bool isDefault() const { return m_isDefault; }
|
2011-06-09 17:17:01 +02:00
|
|
|
|
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
|
|
|
|
2011-06-21 16:52:48 +02:00
|
|
|
static Ptr create(const QString &name, const QString &osType, DeviceType deviceType,
|
|
|
|
|
const QString &freePortsSpec, const Utils::SshConnectionParameters &sshParams);
|
2011-06-09 17:17:01 +02:00
|
|
|
private:
|
2011-06-21 16:52:48 +02:00
|
|
|
LinuxDeviceConfiguration(const QString &name, const QString &osType, DeviceType deviceType,
|
|
|
|
|
const QString &freePortsSpec, const Utils::SshConnectionParameters &sshParams);
|
|
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
LinuxDeviceConfiguration(const QSettings &settings, Id &nextId);
|
|
|
|
|
LinuxDeviceConfiguration(const ConstPtr &other);
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
LinuxDeviceConfiguration(const LinuxDeviceConfiguration &);
|
|
|
|
|
LinuxDeviceConfiguration &operator=(const LinuxDeviceConfiguration &);
|
2011-01-13 13:49:23 +01:00
|
|
|
|
|
|
|
|
static Ptr create(const QSettings &settings, Id &nextId);
|
2011-01-13 14:32:15 +01:00
|
|
|
static Ptr create(const ConstPtr &other);
|
2011-01-13 13:49:23 +01:00
|
|
|
|
|
|
|
|
void save(QSettings &settings) const;
|
2010-08-12 19:12:12 +02:00
|
|
|
QString defaultPortsSpec(DeviceType type) const;
|
2010-04-08 17:31:55 +02:00
|
|
|
|
2011-02-14 16:34:17 +01:00
|
|
|
Utils::SshConnectionParameters m_sshParameters;
|
2011-01-13 13:49:23 +01:00
|
|
|
QString m_name;
|
2011-06-07 12:12:30 +02:00
|
|
|
QString m_osType;
|
2011-01-13 13:49:23 +01:00
|
|
|
DeviceType m_type;
|
|
|
|
|
QString m_portsSpec;
|
|
|
|
|
bool m_isDefault;
|
2011-01-13 14:32:15 +01:00
|
|
|
Id m_internalId;
|
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
|
|
|
|
|
Q_DISABLE_COPY(ILinuxDeviceConfigurationWizard)
|
|
|
|
|
public:
|
|
|
|
|
virtual LinuxDeviceConfiguration::Ptr deviceConfiguration()=0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
ILinuxDeviceConfigurationWizard(QWidget *parent) : QWizard(parent) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::ILinuxDeviceConfiguration factory.
|
|
|
|
|
|
|
|
|
|
\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
|
|
|
|
|
Q_DISABLE_COPY(ILinuxDeviceConfigurationFactory)
|
|
|
|
|
public:
|
|
|
|
|
/*!
|
|
|
|
|
A short, one-line description of what kind of device this factory supports.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString displayName() const=0;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
A wizard that can create the types of device configuration this factory supports.
|
|
|
|
|
*/
|
|
|
|
|
virtual ILinuxDeviceConfigurationWizard *createWizard(QWidget *parent = 0) const=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Returns true iff this factory supports the given device type.
|
|
|
|
|
*/
|
|
|
|
|
virtual bool supportsOsType(const QString &osType) const=0;
|
|
|
|
|
|
2011-06-21 16:52:48 +02:00
|
|
|
/*!
|
|
|
|
|
Returns a human-readable string for the given OS type, if this factory supports that type.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString displayNameForOsType(const QString &osType) const=0;
|
|
|
|
|
|
2011-06-09 17:17:01 +02:00
|
|
|
/*!
|
|
|
|
|
Returns a list of ids representing actions that can be run on device configurations
|
|
|
|
|
that this factory supports. These actions will be available in the "Linux Devices"
|
|
|
|
|
options page.
|
|
|
|
|
*/
|
|
|
|
|
virtual QStringList supportedDeviceActionIds() const=0;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
A human-readable string for the given id. Will be displayed on a button which, when clicked,
|
|
|
|
|
will start the respective action.
|
|
|
|
|
*/
|
2011-06-21 16:52:48 +02:00
|
|
|
virtual QString displayNameForActionId(const QString &actionId) const=0;
|
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,
|
|
|
|
|
const LinuxDeviceConfiguration::ConstPtr &deviceConfig, QWidget *parent = 0) const=0;
|
|
|
|
|
|
|
|
|
|
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
|