Implement instance sorting options.

This commit is contained in:
Petr Mrázek
2013-11-04 00:11:20 +01:00
parent 4466929074
commit d6e4fb2971
5 changed files with 52 additions and 9 deletions

View File

@ -422,7 +422,13 @@ bool InstanceProxyModel::subSortLessThan(const QModelIndex &left,
{
BaseInstance *pdataLeft = static_cast<BaseInstance *>(left.internalPointer());
BaseInstance *pdataRight = static_cast<BaseInstance *>(right.internalPointer());
// kDebug() << *pdataLeft << *pdataRight;
return QString::localeAwareCompare(pdataLeft->name(), pdataRight->name()) < 0;
// return pdataLeft->name() < pdataRight->name();
QString sortMode = MMC->settings()->get("InstSortMode").toString();
if(sortMode == "LastLaunch")
{
return pdataLeft->lastLaunch() > pdataRight->lastLaunch();
}
else
{
return QString::localeAwareCompare(pdataLeft->name(), pdataRight->name()) < 0;
}
}