Commit 57092dc5 authored by Nicolas Arnaud-Cormos's avatar Nicolas Arnaud-Cormos Committed by Christian Kandeler

Add getter and setter for attribute in linuxdeviceconfiguration.

Change-Id: I7113255a3c100c74703f6f7552ee1569857a41af
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent ffe4ddf0
......@@ -233,6 +233,11 @@ void LinuxDeviceConfiguration::setFreePorts(const PortList &freePorts)
d->freePorts = freePorts;
}
void LinuxDeviceConfiguration::setAttribute(const QString &name, const QVariant &value)
{
d->attributes[name] = value;
}
bool LinuxDeviceConfiguration::isAutoDetected() const
{
return d->origin == AutoDetected;
......@@ -243,6 +248,11 @@ QVariantHash LinuxDeviceConfiguration::attributes() const
return d->attributes;
}
QVariant LinuxDeviceConfiguration::attribute(const QString &name) const
{
return d->attributes.value(name);
}
PortList LinuxDeviceConfiguration::freePorts() const { return d->freePorts; }
QString LinuxDeviceConfiguration::displayName() const { return d->displayName; }
QString LinuxDeviceConfiguration::osType() const { return d->osType; }
......
......@@ -80,6 +80,7 @@ public:
bool isDefault() const;
bool isAutoDetected() const;
QVariantHash attributes() const;
QVariant attribute(const QString &name) const;
static QString defaultPrivateKeyFilePath();
static QString defaultPublicKeyFilePath();
......@@ -107,6 +108,7 @@ private:
void setDefault(bool isDefault);
void setSshParameters(const Utils::SshConnectionParameters &sshParameters);
void setFreePorts(const PortList &freePorts);
void setAttribute(const QString &name, const QVariant &value);
void save(QSettings &settings) const;
Internal::LinuxDeviceConfigurationPrivate *d;
......
......@@ -255,6 +255,14 @@ void LinuxDeviceConfigurations::setDefaultDevice(int idx)
emit dataChanged(newDefaultIndex, newDefaultIndex);
}
void LinuxDeviceConfigurations::setAttribute(int index, const QString &name, const QVariant &value)
{
QTC_ASSERT(this != LinuxDeviceConfigurationsPrivate::instance, return);
Q_ASSERT(index >= 0 && index < rowCount());
d->devConfigs.at(index)->setAttribute(name, value);
}
LinuxDeviceConfigurations::LinuxDeviceConfigurations(QObject *parent)
: QAbstractListModel(parent), d(new LinuxDeviceConfigurationsPrivate)
{
......
......@@ -79,6 +79,7 @@ public:
void setSshParameters(int i, const Utils::SshConnectionParameters &params);
void setFreePorts(int i, const PortList &freePorts);
void setDefaultDevice(int index);
void setAttribute(int index, const QString &name, const QVariant &value);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment