GameList: Treat disc sets and discs equally when sorting

This commit is contained in:
Stenzek 2024-05-23 12:42:50 +10:00
parent 8709624751
commit dd98b630ea
No known key found for this signature in database
3 changed files with 10 additions and 5 deletions

View file

@ -6085,8 +6085,10 @@ void FullscreenUI::PopulateGameListEntryList()
{
case 0: // Type
{
if (lhs->type != rhs->type)
return reverse ? (lhs->type > rhs->type) : (lhs->type < rhs->type);
const GameList::EntryType lst = lhs->GetSortType();
const GameList::EntryType rst = rhs->GetSortType();
if (lst != rst)
return reverse ? (lst > rst) : (lst < rst);
}
break;

View file

@ -66,6 +66,7 @@ struct Entry
ALWAYS_INLINE bool IsDisc() const { return (type == EntryType::Disc); }
ALWAYS_INLINE bool IsDiscSet() const { return (type == EntryType::DiscSet); }
ALWAYS_INLINE EntryType GetSortType() const { return (type == EntryType::DiscSet) ? EntryType::Disc : type; }
};
const char* GetEntryTypeName(EntryType type);

View file

@ -351,7 +351,7 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
switch (index.column())
{
case Column_Type:
return static_cast<int>(ge->type);
return static_cast<int>(ge->GetSortType());
case Column_Serial:
return QString::fromStdString(ge->serial);
@ -494,10 +494,12 @@ bool GameListModel::lessThan(const QModelIndex& left_index, const QModelIndex& r
{
case Column_Type:
{
if (left->type == right->type)
const GameList::EntryType lst = left->GetSortType();
const GameList::EntryType rst = right->GetSortType();
if (lst == rst)
return titlesLessThan(left_row, right_row);
return (static_cast<int>(left->type) < static_cast<int>(right->type));
return (static_cast<int>(lst) < static_cast<int>(rst));
}
case Column_Serial: