diff options
| author | Tannin <devnull@localhost> | 2015-02-25 18:02:39 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-02-25 18:02:39 +0100 |
| commit | d87661a66fe76d8b268cbfe81f3eb6292a55d66b (patch) | |
| tree | 7f82f271448796f39aa1aac7497513940686c855 /src/modlistsortproxy.cpp | |
| parent | 3c030a28e9313e9d69ab086adda69797d3833a33 (diff) | |
sorting by content now produces a more useful list
Diffstat (limited to 'src/modlistsortproxy.cpp')
| -rw-r--r-- | src/modlistsortproxy.cpp | 19 |
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);
|
