-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device List: add "Remove disconnected devices" button #480
Conversation
I tested this by:
|
5e446a6
to
a337eb6
Compare
This will allow the aggregate model to identify devices uniquely, in the case where a device of the same service may appear in multiple device models. For example, an inverter/charger may appear in both Global.veBusDevices.model and Global.acInputs.model.
a337eb6
to
33c5251
Compare
33c5251
to
f06e10d
Compare
Fixed build issue on cerbo. |
src/aggregatedevicemodel.cpp
Outdated
int index = indexOf(DeviceInfo::infoId(device, sourceModel)); | ||
if (index >= 0) { | ||
// The device is already in the list, i.e. it was disconnected then reconnected. | ||
QList<int> roles = QList<int>() << ConnectedRole; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe: QList roles(ConnectedRole);
here and elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or roles { ConnectedRole };
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
src/aggregatedevicemodel.cpp
Outdated
m_deviceInfos[index].device->disconnect(this); | ||
} | ||
m_deviceInfos[index].device.clear(); | ||
static const QList<int> roles = QList<int>() << ConnectedRole << DeviceRole; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe: static const QList roles(ConnectedRole, DeviceRole);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or roles { ConnectedRole, DeviceRole };
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, nits
The Device List should show devices that have been disconnected, i.e. those that have been removed from the source models as they are no longer valid. So, instead of automatically syncing the aggregate model when a source model removes a device, keep the device in the aggregate model, and remove it when the removeDisconnectedDevices() functionality is triggered. When a device is disconnected: - Show a cached copy of the device description, so that the list item text does not disappear. - Show "Not connected" as the secondary text; when the device is reconnected, the device status text should revert to whatever is appropriate for that device.
f06e10d
to
d0b5a34
Compare
The Device List should show devices that have been disconnected, i.e. those that have been removed from the source models as they are no longer valid.
So, instead of automatically syncing the aggregate model when a source model removes a device, keep the device in the aggregate model, and remove it when the removeDisconnectedDevices() functionality is triggered.
When a device is disconnected: