RemoteLinux: More preparations for introducing an abstract device class.

- Introduce clone() method.
- Rename "osType" to "type" and "deviceType" to "machineType".
- Move machine type display out of generic settings widget.
- Put only immutable attributes into the device constructor and set the
others via setters. As part of this, also give the
SshConnectionParameters a default proxy type. The necessity to give one
to the constructor explicitly was for historical reasons.

Change-Id: I84757b1b2d6371544b9ab1f3290973e5498176ce
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christian Kandeler
2012-03-05 12:37:32 +01:00
parent be1afbd6bb
commit effe56ef12
46 changed files with 264 additions and 282 deletions

View File

@@ -67,7 +67,7 @@ public:
typedef quint64 Id;
enum DeviceType { Hardware, Emulator };
enum MachineType { Hardware, Emulator };
enum Origin { ManuallyAdded, AutoDetected };
~LinuxDeviceConfiguration();
@@ -75,8 +75,8 @@ public:
Utils::PortList freePorts() const;
Utils::SshConnectionParameters sshParameters() const;
QString displayName() const;
QString osType() const;
DeviceType deviceType() const;
QString type() const;
MachineType machineType() const;
Id internalId() const;
bool isAutoDetected() const;
QVariantHash attributes() const;
@@ -92,22 +92,18 @@ public:
static const Id InvalidId;
static Ptr create();
static Ptr create(const QString &name, const QString &osType, DeviceType deviceType,
const Utils::PortList &freePorts, const Utils::SshConnectionParameters &sshParams,
const QVariantHash &attributes = QVariantHash(), Origin origin = ManuallyAdded);
static Ptr create(const QString &name, const QString &type, MachineType machineType,
Origin origin = ManuallyAdded);
private:
LinuxDeviceConfiguration();
LinuxDeviceConfiguration(const QString &name, const QString &osType, DeviceType deviceType,
const Utils::PortList &freePorts, const Utils::SshConnectionParameters &sshParams,
const QVariantHash &attributes, Origin origin);
LinuxDeviceConfiguration(const QString &name, const QString &type, MachineType machineType,
Origin origin);
LinuxDeviceConfiguration(const QSettings &settings);
LinuxDeviceConfiguration(const ConstPtr &other);
LinuxDeviceConfiguration(const LinuxDeviceConfiguration &);
LinuxDeviceConfiguration(const LinuxDeviceConfiguration &other);
LinuxDeviceConfiguration &operator=(const LinuxDeviceConfiguration &);
static Ptr create(const QSettings &settings);
static Ptr create(const ConstPtr &other);
void setDisplayName(const QString &name);
void setInternalId(Id id);
@@ -116,6 +112,8 @@ private:
void fromMap(const QVariantMap &map);
QVariantMap toMap() const;
Ptr clone() const;
Internal::LinuxDeviceConfigurationPrivate *d;
};
@@ -205,12 +203,12 @@ public:
/*!
Returns true iff this factory supports the given device type.
*/
virtual bool supportsOsType(const QString &osType) const = 0;
virtual bool supportsDeviceType(const QString &type) const = 0;
/*!
Returns a human-readable string for the given OS type, if this factory supports that type.
*/
virtual QString displayNameForOsType(const QString &osType) const = 0;
virtual QString displayType(const QString &type) const = 0;
/*!
Returns a list of ids representing actions that can be run on device configurations