| 114 | }; |
| 115 | |
| 116 | bool ResourceSorterModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const |
| 117 | { |
| 118 | if(m_Sort == SortType::Creation) |
| 119 | { |
| 120 | return source_left.data(ResourceIdRole).value<ResourceId>() < |
| 121 | source_right.data(ResourceIdRole).value<ResourceId>(); |
| 122 | } |
| 123 | else if(m_Sort == SortType::LastAccess) |
| 124 | { |
| 125 | uint a = source_left.data(LastAccessSortRole).toUInt(); |
| 126 | uint b = source_right.data(LastAccessSortRole).toUInt(); |
| 127 | |
| 128 | // if they're different, sort by access. Otherwise fall through to alphabetical |
| 129 | // we invert the reason, so that high values (recent access) are first |
| 130 | if(a != b) |
| 131 | return a > b; |
| 132 | |
| 133 | return QCollatorSortFilterProxyModel::lessThan(source_left, source_right); |
| 134 | } |
| 135 | |
| 136 | return QCollatorSortFilterProxyModel::lessThan(source_left, source_right); |
| 137 | } |
| 138 | |
| 139 | ResourceInspector::ResourceInspector(ICaptureContext &ctx, QWidget *parent) |
| 140 | : QFrame(parent), ui(new Ui::ResourceInspector), m_Ctx(ctx) |