From 253781f87c1653ee203ba3e7bf340747b894140d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 10 Apr 2014 18:55:07 -0700 Subject: DD-16 : Implement sort by stock count in merketplace --- indra/newview/llfolderviewmodelinventory.cpp | 32 +++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index aac3a41b9e..c31b40b179 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" @@ -269,7 +270,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()) { @@ -301,6 +302,35 @@ 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 != -1) || (weight_b != -1)) + { + llinfos << "Merov : sort by weight, a = " << a->getName() << ", " << weight_a << ", b = " << b->getName() << ", " << weight_b << llendl; + } + if (weight_a == weight_b) + { + // Equal weight -> use alphabetical order + return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0); + } + else if (weight_a == -1) + { + // No weight -> move a at the end of the list + return false; + } + else if (weight_b == -1) + { + // No weight -> 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(); -- cgit v1.2.3 From fd426bafb6616491b8929ee357a5b2d40e123607 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sat, 31 May 2014 19:19:20 -0700 Subject: DD-92 : Clear llinfos compilation warning and similar --- indra/newview/llfolderviewmodelinventory.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index f911b12b55..263e6655f6 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -306,10 +306,6 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, { S32 weight_a = compute_stock_count(a->getUUID()); S32 weight_b = compute_stock_count(b->getUUID()); - if ((weight_a != -1) || (weight_b != -1)) - { - llinfos << "Merov : sort by weight, a = " << a->getName() << ", " << weight_a << ", b = " << b->getName() << ", " << weight_b << llendl; - } if (weight_a == weight_b) { // Equal weight -> use alphabetical order -- cgit v1.2.3 From 637e096d5718d0a174b5383aa29e3480edd734ea Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 13 Apr 2015 15:29:56 -0700 Subject: DD-388 : More resilient way of reacting to not evaluated stock count throughout marketplace handling --- indra/newview/llfolderviewmodelinventory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfolderviewmodelinventory.cpp') diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 8c360befc3..44eda4d6c0 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -319,14 +319,14 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, // Equal weight -> use alphabetical order return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0); } - else if (weight_a == -1) + else if (weight_a == COMPUTE_STOCK_INFINITE) { - // No weight -> move a at the end of the list + // No stock -> move a at the end of the list return false; } - else if (weight_b == -1) + else if (weight_b == COMPUTE_STOCK_INFINITE) { - // No weight -> move b at the end of the list + // No stock -> move b at the end of the list return true; } else -- cgit v1.2.3