forked from qt-creator/qt-creator
ProjectExplorer: Change IDevice::toMap signature
From Store toMap() to toMap(Store). More symmetric code on the user side and better in line with ProjectConfiguration/AspectContainer at the price of a few more lines in the base. Change-Id: I6069c96c250c1846e870879bcb52c58fdd806478 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -241,8 +241,11 @@ Store DeviceManager::toMap() const
|
||||
|
||||
map.insert(DefaultDevicesKey, variantFromStore(defaultDeviceMap));
|
||||
QVariantList deviceList;
|
||||
for (const IDevice::Ptr &device : std::as_const(d->devices))
|
||||
deviceList << variantFromStore(device->toMap());
|
||||
for (const IDevice::Ptr &device : std::as_const(d->devices)) {
|
||||
Store store;
|
||||
device->toMap(store);
|
||||
deviceList << variantFromStore(store);
|
||||
}
|
||||
map.insert(DeviceListKey, deviceList);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -541,9 +541,8 @@ void IDevice::fromMap(const Store &map)
|
||||
call the base class implementation.
|
||||
*/
|
||||
|
||||
Store IDevice::toMap() const
|
||||
void IDevice::toMap(Store &map) const
|
||||
{
|
||||
Store map;
|
||||
d->settings->toMap(map);
|
||||
|
||||
map.insert(TypeKey, d->type.toString());
|
||||
@@ -570,21 +569,21 @@ Store IDevice::toMap() const
|
||||
map.insert(QmlRuntimeKey, d->qmlRunCommand.toSettings());
|
||||
|
||||
map.insert(ExtraDataKey, variantFromStore(d->extraData));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
IDevice::Ptr IDevice::clone() const
|
||||
{
|
||||
IDeviceFactory *factory = IDeviceFactory::find(d->type);
|
||||
QTC_ASSERT(factory, return {});
|
||||
Store store;
|
||||
toMap(store);
|
||||
IDevice::Ptr device = factory->construct();
|
||||
QTC_ASSERT(device, return {});
|
||||
device->d->deviceState = d->deviceState;
|
||||
device->d->deviceActions = d->deviceActions;
|
||||
device->d->deviceIcons = d->deviceIcons;
|
||||
device->d->osType = d->osType;
|
||||
device->fromMap(toMap());
|
||||
device->fromMap(store);
|
||||
return device;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ protected:
|
||||
IDevice(std::unique_ptr<DeviceSettings> settings = nullptr);
|
||||
|
||||
virtual void fromMap(const Utils::Store &map);
|
||||
virtual Utils::Store toMap() const;
|
||||
virtual void toMap(Utils::Store &map) const;
|
||||
|
||||
using OpenTerminal = std::function<Utils::expected_str<void>(const Utils::Environment &,
|
||||
const Utils::FilePath &)>;
|
||||
|
||||
Reference in New Issue
Block a user