summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-02-25 18:02:39 +0100
committerTannin <devnull@localhost>2015-02-25 18:02:39 +0100
commitd87661a66fe76d8b268cbfe81f3eb6292a55d66b (patch)
tree7f82f271448796f39aa1aac7497513940686c855 /src
parent3c030a28e9313e9d69ab086adda69797d3833a33 (diff)
sorting by content now produces a more useful list
Diffstat (limited to 'src')
-rw-r--r--src/modlistsortproxy.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index 9eeb3439..d62fe00a 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -135,11 +135,22 @@ bool ModListSortProxy::lessThan(const QModelIndex &left,
lt = leftMod->getFlags().size() < rightMod->getFlags().size();
} break;
case ModList::COL_CONTENT: {
- int lLen = leftMod->getContents().size();
- int rLen = rightMod->getContents().size();
- if (lLen != rLen) {
- lt = lLen < rLen;
+ std::vector<ModInfo::EContent> lContent = leftMod->getContents();
+ std::vector<ModInfo::EContent> rContent = rightMod->getContents();
+ if (lContent.size() != rContent.size()) {
+ lt = lContent.size() < rContent.size();
}
+
+ int lValue = 0;
+ int rValue = 0;
+ for (ModInfo::EContent content : lContent) {
+ lValue += 2 << (unsigned int)content;
+ }
+ for (ModInfo::EContent content : rContent) {
+ rValue += 2 << (unsigned int)content;
+ }
+
+ lt = lValue < rValue;
} break;
case ModList::COL_NAME: {
int comp = QString::compare(leftMod->name(), rightMod->name(), Qt::CaseInsensitive);