Improve initialization of roleNames()
This commit is contained in:
parent
d803f83d0f
commit
1d75ee2656
|
@ -24,18 +24,16 @@ SyncthingDeviceModel::SyncthingDeviceModel(SyncthingConnection &connection, QObj
|
|||
|
||||
QHash<int, QByteArray> SyncthingDeviceModel::roleNames() const
|
||||
{
|
||||
const static auto roles([] {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "name";
|
||||
roles[DeviceStatus] = "status";
|
||||
roles[Qt::DecorationRole] = "statusIcon";
|
||||
roles[DevicePaused] = "paused";
|
||||
roles[DeviceStatusString] = "statusString";
|
||||
roles[DeviceStatusColor] = "statusColor";
|
||||
roles[DeviceId] = "devId";
|
||||
roles[DeviceDetail] = "detail";
|
||||
return roles;
|
||||
}());
|
||||
const static QHash<int, QByteArray> roles{
|
||||
{ Qt::DisplayRole, "name" },
|
||||
{ DeviceStatus, "status" },
|
||||
{ Qt::DecorationRole, "statusIcon" },
|
||||
{ DevicePaused, "paused" },
|
||||
{ DeviceStatusString, "statusString" },
|
||||
{ DeviceStatusColor, "statusColor" },
|
||||
{ DeviceId, "devId" },
|
||||
{ DeviceDetail, "detail" },
|
||||
};
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,20 +26,18 @@ SyncthingDirectoryModel::SyncthingDirectoryModel(SyncthingConnection &connection
|
|||
|
||||
QHash<int, QByteArray> SyncthingDirectoryModel::roleNames() const
|
||||
{
|
||||
const static auto roles([] {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "name";
|
||||
roles[DirectoryStatus] = "status";
|
||||
roles[Qt::DecorationRole] = "statusIcon";
|
||||
roles[DirectoryStatusString] = "statusString";
|
||||
roles[DirectoryStatusColor] = "statusColor";
|
||||
roles[DirectoryPaused] = "paused";
|
||||
roles[DirectoryId] = "dirId";
|
||||
roles[DirectoryPath] = "path";
|
||||
roles[DirectoryPullErrorCount] = "pullErrorCount";
|
||||
roles[DirectoryDetail] = "detail";
|
||||
return roles;
|
||||
}());
|
||||
const static QHash<int, QByteArray> roles{
|
||||
{ Qt::DisplayRole, "name" },
|
||||
{ DirectoryStatus, "status" },
|
||||
{ Qt::DecorationRole, "statusIcon" },
|
||||
{ DirectoryStatusString, "statusString" },
|
||||
{ DirectoryStatusColor, "statusColor" },
|
||||
{ DirectoryPaused, "paused" },
|
||||
{ DirectoryId, "dirId" },
|
||||
{ DirectoryPath, "path" },
|
||||
{ DirectoryPullErrorCount, "pullErrorCount" },
|
||||
{ DirectoryDetail, "detail" },
|
||||
};
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,13 @@ SyncthingDownloadModel::SyncthingDownloadModel(SyncthingConnection &connection,
|
|||
|
||||
QHash<int, QByteArray> SyncthingDownloadModel::roleNames() const
|
||||
{
|
||||
const static auto roles([] {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "name";
|
||||
roles[Qt::DecorationRole] = "fileIcon";
|
||||
roles[ItemPercentage] = "percentage";
|
||||
roles[ItemProgressLabel] = "progressLabel";
|
||||
roles[ItemPath] = "path";
|
||||
return roles;
|
||||
}());
|
||||
const static QHash<int, QByteArray> roles{
|
||||
{ Qt::DisplayRole, "name" },
|
||||
{ Qt::DecorationRole, "fileIcon" },
|
||||
{ ItemPercentage, "percentage" },
|
||||
{ ItemProgressLabel, "progressLabel" },
|
||||
{ ItemPath, "path" },
|
||||
};
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue