Display the device model section

This way we can differentiate between the different states
This commit is contained in:
Aleix Pol 2015-06-19 07:14:02 +02:00
parent 4654a61a5f
commit 46b57003cd
2 changed files with 21 additions and 1 deletions

View file

@ -40,6 +40,25 @@ ApplicationWindow
Layout.fillHeight: true
ListView {
id: devicesView
section {
property: "status"
delegate: Label {
text: switch (parseInt(section))
{
case DevicesModel.StatusUnknown:
return i18n("Unknown")
case DevicesModel.StatusPaired:
return i18n("Paired")
case DevicesModel.StatusReachable:
return i18n("Reachable")
case (DevicesModel.StatusReachable | DevicesModel.StatusPaired):
return i18n("Paired & Reachable")
}
}
}
spacing: 5
model: DevicesSortProxyModel {
sourceModel: DevicesModel {
@ -49,7 +68,7 @@ ApplicationWindow
}
delegate: DeviceDelegate {
width: parent.width
onClicked: {
onClicked: {
var data = {
item: deviceViewComponent,
properties: {currentDevice: device}

View file

@ -63,6 +63,7 @@ QHash< int, QByteArray > DevicesModel::roleNames() const
names.insert(IdModelRole, "deviceId");
names.insert(IconNameRole, "iconName");
names.insert(DeviceRole, "device");
names.insert(StatusModelRole, "status");
return names;
}