summaryrefslogtreecommitdiffstats
path: root/application/InstanceProxyModel.cpp
blob: 2048252c373a9467987c9bc96008725df372f384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "InstanceProxyModel.h"
#include "MultiMC.h"
#include <BaseInstance.h>

InstanceProxyModel::InstanceProxyModel(QObject *parent) : GroupedProxyModel(parent)
{
}

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