diff options
author | Nicolas Arnaud-Cormos <nicolas@kdab.com> | 2012-02-07 18:07:26 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@nokia.com> | 2012-02-20 10:29:54 +0100 |
commit | 57092dc5fb55d9e028e96ace5c7b08ff5920f803 (patch) | |
tree | e9d48ee2f5048f1a5a1511dd6bbfeedaed6f65dd /src | |
parent | ffe4ddf0b252fe708a45302ff3ab6d736b609cd3 (diff) | |
download | qt-creator-57092dc5fb55d9e028e96ace5c7b08ff5920f803.tar.gz |
Add getter and setter for attribute in linuxdeviceconfiguration.
Change-Id: I7113255a3c100c74703f6f7552ee1569857a41af
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
Diffstat (limited to 'src')
4 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp index 1fcd6b1e3a..af8866dc52 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp @@ -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; } diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.h b/src/plugins/remotelinux/linuxdeviceconfiguration.h index c98ce2eb51..9e9b9a56a6 100644 --- a/src/plugins/remotelinux/linuxdeviceconfiguration.h +++ b/src/plugins/remotelinux/linuxdeviceconfiguration.h @@ -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; diff --git a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp index 47842bf568..58958662f6 100644 --- a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp @@ -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) { diff --git a/src/plugins/remotelinux/linuxdeviceconfigurations.h b/src/plugins/remotelinux/linuxdeviceconfigurations.h index 3a48697bc2..3e4a1adcb3 100644 --- a/src/plugins/remotelinux/linuxdeviceconfigurations.h +++ b/src/plugins/remotelinux/linuxdeviceconfigurations.h @@ -79,6 +79,7 @@ public: void setSshParameters(int i, const Utils::SshConnectionParameters ¶ms); 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, |