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>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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-05-31 12:47:53 +02:00
|
|
|
typedef QSharedPointer<const LinuxDeviceConfiguration> ConstPtr;
|
2011-01-13 13:49:23 +01:00
|
|
|
typedef quint64 Id;
|
2011-04-21 14:39:57 +02:00
|
|
|
enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux };
|
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-04-21 14:39:57 +02:00
|
|
|
OsVersion osVersion() const { return m_osVersion; }
|
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; }
|
2010-08-12 17:10:39 +02:00
|
|
|
static QString portsRegExpr();
|
2011-04-21 14:39:57 +02:00
|
|
|
static QString defaultHost(DeviceType type, OsVersion osVersion);
|
2011-02-02 17:53:36 +01:00
|
|
|
static QString defaultPrivateKeyFilePath();
|
2011-02-10 15:37:12 +01:00
|
|
|
static QString defaultPublicKeyFilePath();
|
2011-04-21 14:39:57 +02:00
|
|
|
static QString defaultUser(OsVersion osVersion);
|
2011-02-03 14:17:13 +01:00
|
|
|
static int defaultSshPort(DeviceType type);
|
2011-04-21 14:39:57 +02:00
|
|
|
static QString defaultQemuPassword(OsVersion osVersion);
|
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
|
|
|
|
2009-12-23 10:53:57 +01:00
|
|
|
private:
|
2011-05-31 12:47:53 +02:00
|
|
|
typedef QSharedPointer<LinuxDeviceConfiguration> Ptr;
|
2011-01-13 13:49:23 +01:00
|
|
|
|
2011-05-31 12:47:53 +02:00
|
|
|
LinuxDeviceConfiguration(const QString &name, OsVersion osVersion,
|
2011-02-14 16:34:17 +01:00
|
|
|
DeviceType type, const Utils::SshConnectionParameters &sshParams,
|
2011-02-03 16:09:35 +01:00
|
|
|
Id &nextId);
|
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
|
|
|
|
2011-04-21 14:39:57 +02:00
|
|
|
static Ptr createHardwareConfig(const QString &name, OsVersion osVersion,
|
|
|
|
|
const QString &hostName, const QString &privateKeyFilePath, Id &nextId);
|
2011-03-09 12:07:35 +01:00
|
|
|
static Ptr createGenericLinuxConfigUsingPassword(const QString &name,
|
|
|
|
|
const QString &hostName, const QString &userName,
|
|
|
|
|
const QString &password, Id &nextId);
|
|
|
|
|
static Ptr createGenericLinuxConfigUsingKey(const QString &name,
|
|
|
|
|
const QString &hostName, const QString &userName,
|
|
|
|
|
const QString &privateKeyFilePath, Id &nextId);
|
2011-04-21 14:39:57 +02:00
|
|
|
static Ptr createEmulatorConfig(const QString &name, OsVersion osVersion,
|
|
|
|
|
Id &nextId);
|
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-04-21 14:39:57 +02:00
|
|
|
OsVersion m_osVersion;
|
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-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
|