Update device names when changed by the plugin

pull/243/head
Michael Zanetti 2020-01-05 14:58:02 +01:00
parent 6cdcd47f9b
commit b3ebbc18c0
2 changed files with 12 additions and 2 deletions

View File

@ -463,8 +463,6 @@ Device::DeviceError DeviceManagerImplementation::editDevice(const DeviceId &devi
return Device::DeviceErrorDeviceNotFound;
device->setName(name);
storeConfiguredDevices();
emit deviceChanged(device);
return Device::DeviceErrorNoError;
}
@ -1522,6 +1520,16 @@ void DeviceManagerImplementation::slotDeviceSettingChanged(const ParamTypeId &pa
emit deviceSettingChanged(device->id(), paramTypeId, value);
}
void DeviceManagerImplementation::slotDeviceNameChanged()
{
Device *device = qobject_cast<Device*>(sender());
if (!device) {
return;
}
storeConfiguredDevices();
emit deviceChanged(device);
}
ParamList DeviceManagerImplementation::buildParams(const ParamTypes &types, const ParamList &first, const ParamList &second)
{
// Merge params from discovered descriptor and additional overrides provided on API call. User provided params have higher priority than discovery params.
@ -1603,6 +1611,7 @@ DeviceSetupInfo* DeviceManagerImplementation::setupDevice(Device *device)
connect(device, &Device::stateValueChanged, this, &DeviceManagerImplementation::slotDeviceStateValueChanged);
connect(device, &Device::settingChanged, this, &DeviceManagerImplementation::slotDeviceSettingChanged);
connect(device, &Device::nameChanged, this, &DeviceManagerImplementation::slotDeviceNameChanged);
DeviceSetupInfo *info = new DeviceSetupInfo(device, this, 30000);

View File

@ -132,6 +132,7 @@ private slots:
// Only connect this to Devices. It will query the sender()
void slotDeviceStateValueChanged(const StateTypeId &stateTypeId, const QVariant &value);
void slotDeviceSettingChanged(const ParamTypeId &paramTypeId, const QVariant &value);
void slotDeviceNameChanged();
private:
// Builds a list of params ready to create a device.