diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-08-04 16:45:49 +0300 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-08-04 16:45:49 +0300 |
commit | f94a19e09ebcf51e3e6cd3437fe364b60755406f (patch) | |
tree | fa4f585008c6f5aa7850b2f5128a681b0065fcdc /indra/newview/llfolderviewmodelinventory.cpp | |
parent | d04a3b6d4e67dafa0b6dd8e88b752c5a929de5b0 (diff) | |
parent | 310ec101dfd2c69ecc1a51d0a3a8ea12d5fdaf7a (diff) |
Merge downstream code and become version 3.8.3
Diffstat (limited to 'indra/newview/llfolderviewmodelinventory.cpp')
-rwxr-xr-x | indra/newview/llfolderviewmodelinventory.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 5fad76eeec..e9f80b795a 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llfolderviewmodelinventory.h" #include "llinventorymodelbackgroundfetch.h" +#include "llinventoryfunctions.h" #include "llinventorypanel.h" #include "lltooldraganddrop.h" #include "llfavoritesbar.h" @@ -300,7 +301,7 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, // We sort by name if we aren't sorting by date // OR if these are folders and we are sorting folders by name. - bool by_name = (!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))); + bool by_name = ((!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))) && !mFoldersByWeight); if (a->getSortGroup() != b->getSortGroup()) { @@ -332,6 +333,31 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, return (compare < 0); } } + else if (mFoldersByWeight) + { + S32 weight_a = compute_stock_count(a->getUUID()); + S32 weight_b = compute_stock_count(b->getUUID()); + if (weight_a == weight_b) + { + // Equal weight -> use alphabetical order + return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0); + } + else if (weight_a == COMPUTE_STOCK_INFINITE) + { + // No stock -> move a at the end of the list + return false; + } + else if (weight_b == COMPUTE_STOCK_INFINITE) + { + // No stock -> move b at the end of the list + return true; + } + else + { + // Lighter is first (sorted in increasing order of weight) + return (weight_a < weight_b); + } + } else { time_t first_create = a->getCreationDate(); |