mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Added the option to sort instances by total playtime (#5701)
Signed-off-by: Anceph <yucehasan31@gmail.com>
This commit is contained in:
parent
f654ce8212
commit
a607373ced
3 changed files with 26 additions and 1 deletions
|
|
@ -62,6 +62,12 @@ bool InstanceProxyModel::subSortLessThan(const QModelIndex& left, const QModelIn
|
|||
QString sortMode = APPLICATION->settings()->get("InstSortMode").toString();
|
||||
if (sortMode == "LastLaunch") {
|
||||
return pdataLeft->lastLaunch() > pdataRight->lastLaunch();
|
||||
} else if (sortMode == "Playtime") {
|
||||
if (pdataLeft->totalTimePlayed() == pdataRight->totalTimePlayed()) {
|
||||
// fallback to name sorting if playtime is equal
|
||||
return m_naturalSort.compare(pdataLeft->name(), pdataRight->name()) < 0;
|
||||
}
|
||||
return pdataLeft->totalTimePlayed() > pdataRight->totalTimePlayed();
|
||||
} else {
|
||||
return m_naturalSort.compare(pdataLeft->name(), pdataRight->name()) < 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue