forked from qt-creator/qt-creator
ProjectExplorer: Add more Device{Const,}Ref interface
Change-Id: Iada993c11c645bbaf97ebdd269ce5929fa66c62f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -794,6 +794,11 @@ DeviceConstRef::DeviceConstRef(const IDevice::Ptr &device)
|
||||
: m_constDevice(device)
|
||||
{}
|
||||
|
||||
IDevice::ConstPtr DeviceConstRef::lock() const
|
||||
{
|
||||
return m_constDevice.lock();
|
||||
}
|
||||
|
||||
DeviceConstRef::~DeviceConstRef() = default;
|
||||
|
||||
Id DeviceConstRef::id() const
|
||||
@@ -817,12 +822,31 @@ SshParameters DeviceConstRef::sshParameters() const
|
||||
return device->sshParameters();
|
||||
}
|
||||
|
||||
QVariant DeviceConstRef::extraData(Id kind) const
|
||||
{
|
||||
const IDevice::ConstPtr device = m_constDevice.lock();
|
||||
QTC_ASSERT(device, return {});
|
||||
return device->extraData(kind);
|
||||
}
|
||||
|
||||
FilePath DeviceConstRef::filePath(const QString &pathOnDevice) const
|
||||
{
|
||||
const IDevice::ConstPtr device = m_constDevice.lock();
|
||||
QTC_ASSERT(device, return {});
|
||||
return device->filePath(pathOnDevice);
|
||||
}
|
||||
|
||||
// DeviceRef, mutable
|
||||
|
||||
DeviceRef::DeviceRef(const IDevice::Ptr &device)
|
||||
: DeviceConstRef(device), m_mutableDevice(device)
|
||||
{}
|
||||
|
||||
IDevice::Ptr DeviceRef::lock() const
|
||||
{
|
||||
return m_mutableDevice.lock();
|
||||
}
|
||||
|
||||
void DeviceRef::setDisplayName(const QString &displayName)
|
||||
{
|
||||
const IDevice::Ptr device = m_mutableDevice.lock();
|
||||
|
@@ -251,9 +251,13 @@ public:
|
||||
DeviceConstRef(const IDevice::Ptr &device);
|
||||
virtual ~DeviceConstRef();
|
||||
|
||||
IDevice::ConstPtr lock() const;
|
||||
|
||||
Utils::Id id() const;
|
||||
QString displayName() const;
|
||||
SshParameters sshParameters() const;
|
||||
Utils::FilePath filePath(const QString &pathOnDevice) const;
|
||||
QVariant extraData(Utils::Id kind) const;
|
||||
|
||||
private:
|
||||
std::weak_ptr<const IDevice> m_constDevice;
|
||||
@@ -264,6 +268,8 @@ class PROJECTEXPLORER_EXPORT DeviceRef : public DeviceConstRef
|
||||
public:
|
||||
DeviceRef(const IDevice::Ptr &device);
|
||||
|
||||
IDevice::Ptr lock() const;
|
||||
|
||||
void setDisplayName(const QString &displayName);
|
||||
void setSshParameters(const SshParameters ¶ms);
|
||||
|
||||
|
Reference in New Issue
Block a user