diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-02-01 11:44:47 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-04-12 20:57:16 +0200 |
commit | aa70ed2244700dbcc93c1fadb22edc1c1caede37 (patch) | |
tree | 79fc6703e984edc4d631be8c6f40c71400f88aba /gui/InstanceProxyModel.cpp | |
parent | 154d19bb74f4c5fc1519aa40cd9dfd20244273a1 (diff) | |
download | MultiMC-aa70ed2244700dbcc93c1fadb22edc1c1caede37.tar MultiMC-aa70ed2244700dbcc93c1fadb22edc1c1caede37.tar.gz MultiMC-aa70ed2244700dbcc93c1fadb22edc1c1caede37.tar.lz MultiMC-aa70ed2244700dbcc93c1fadb22edc1c1caede37.tar.xz MultiMC-aa70ed2244700dbcc93c1fadb22edc1c1caede37.zip |
SCRATCH move icons over to Env, instance proxy model to gui
Diffstat (limited to 'gui/InstanceProxyModel.cpp')
-rw-r--r-- | gui/InstanceProxyModel.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gui/InstanceProxyModel.cpp b/gui/InstanceProxyModel.cpp new file mode 100644 index 00000000..09d6fd85 --- /dev/null +++ b/gui/InstanceProxyModel.cpp @@ -0,0 +1,23 @@ +#include "InstanceProxyModel.h" +#include "MultiMC.h" +#include <logic/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; + } +} |