summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-04-16 19:24:47 -0700
committerMerov Linden <merov@lindenlab.com>2013-04-16 19:24:47 -0700
commite84c97e86d51b4f890695182c8087288481b6955 (patch)
treed580d47e40ea313ff87a2d481d7d2b5e04ab4967 /indra/newview
parent0ecbbe9571be298284c2410ea441877b611bd875 (diff)
CHUI-912, CHUI-849 : Propagate arrange request correctly, limit sort, improve filter perf, clear traces, add comments.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp43
-rw-r--r--indra/newview/llfolderviewmodelinventory.h3
-rw-r--r--indra/newview/llinventoryfilter.cpp26
-rw-r--r--indra/newview/llinventoryfilter.h4
-rw-r--r--indra/newview/llinventorypanel.cpp8
-rw-r--r--indra/newview/llpanelobjectinventory.cpp1
6 files changed, 32 insertions, 53 deletions
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 49b72485e0..1894314513 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -40,7 +40,6 @@ static S32 sModelInstance = 0;
LLFolderViewModelInventory::LLFolderViewModelInventory()
{
mModelInstance = sModelInstance++;
- llinfos << "Merov : LLFolderViewModelInventory::LLFolderViewModelInventory, instance = " << mModelInstance << llendl;
}
bool LLFolderViewModelInventory::startDrag(std::vector<LLFolderViewModelItem*>& items)
@@ -71,7 +70,6 @@ bool LLFolderViewModelInventory::startDrag(std::vector<LLFolderViewModelItem*>&
void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder )
{
LLFastTimer _(FTM_INVENTORY_SORT);
- llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << ", folder = " << folder->getName() << llendl;
if (!needsSort(folder->getViewModelItem())) return;
@@ -82,6 +80,7 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder )
it != end_it;
++it)
{
+ // Recursive call to sort() on child (CHUI-849)
LLFolderViewFolder* child_folderp = *it;
sort(child_folderp);
@@ -136,13 +135,12 @@ void LLFolderViewModelItemInventory::requestSort()
void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size)
{
+ bool before = passedFilter();
LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size);
- bool passed_filter_before = mPrevPassedAllFilters;
- mPrevPassedAllFilters = passedFilter(filter_generation);
-
- if (passed_filter_before != mPrevPassedAllFilters)
+ if (before != passed)
{
+ // Need to rearrange the folder if the filtered state of the item changed
LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder();
if (parent_folder)
{
@@ -155,15 +153,14 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite
{
S32 filter_generation = filter.getCurrentGeneration();
-// bool continue_filtering = true;
bool new_filtered_item = false;
if (item->getLastFilterGeneration() < filter_generation)
{
- // recursive application of the filter for child items
+ // Recursive application of the filter for child items (CHUI-849)
new_filtered_item = item->filter( filter );
}
- // track latest generation to pass any child items, for each folder up to root
+ // Update latest generation to pass filter in parent and propagate up to root
if (item->passedFilter())
{
LLFolderViewModelItemInventory* view_model = this;
@@ -182,23 +179,30 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
{
const S32 filter_generation = filter.getCurrentGeneration();
const S32 must_pass_generation = filter.getFirstRequiredGeneration();
+ const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration();
- if (getSearchableName() == "A NOUNOURS")
- {
- llinfos << "Merov : LLFolderViewModelItemInventory::filter : special NOUNOURS case, filter count = " << filter.getFilterCount() << ", must pass = " << must_pass_generation << ", current = " << filter_generation << ", item last = " << getLastFilterGeneration() << ", folder last = " << getLastFolderFilterGeneration() << llendl;
- }
-
if (getLastFilterGeneration() >= must_pass_generation
&& getLastFolderFilterGeneration() >= must_pass_generation
&& !passedFilter(must_pass_generation))
{
// failed to pass an earlier filter that was a subset of the current one
- // go ahead and flag this item as done
+ // go ahead and flag this item as not pass
setPassedFilter(false, filter_generation);
setPassedFolderFilter(false, filter_generation);
return false;
}
+ if (getLastFilterGeneration() >= sufficient_pass_generation
+ && getLastFolderFilterGeneration() >= sufficient_pass_generation
+ && passedFilter(sufficient_pass_generation))
+ {
+ // passed an earlier filter that was a superset of the current one
+ // go ahead and flag this item as pass
+ setPassedFilter(true, filter_generation);
+ setPassedFolderFilter(true, filter_generation);
+ return true;
+ }
+
const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true;
setPassedFolderFilter(passed_filter_folder, filter_generation);
@@ -221,13 +225,11 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
}
}
- // if we didn't use all filter iterations
- // that means we filtered all of our descendants
- // so filter ourselves now
+ // If we didn't use all filter iterations that means we filtered all of our descendants so filter ourselves now
if (filter.getFilterCount() > 0)
{
+ // This is where filter count is hit and filter check on the item done (CHUI-849)
filter.decrementFilterCount();
-
const bool passed_filter = filter.check(this);
setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize());
new_filtered_item |= passed_filter;
@@ -320,7 +322,6 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a,
}
LLFolderViewModelItemInventory::LLFolderViewModelItemInventory( class LLFolderViewModelInventory& root_view_model )
- : LLFolderViewModelItemCommon(root_view_model),
- mPrevPassedAllFilters(false)
+ : LLFolderViewModelItemCommon(root_view_model)
{
}
diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h
index 3201acf91e..540a87354d 100644
--- a/indra/newview/llfolderviewmodelinventory.h
+++ b/indra/newview/llfolderviewmodelinventory.h
@@ -59,9 +59,6 @@ public:
virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
virtual LLToolDragAndDrop::ESource getDragSource() const = 0;
-
-protected:
- bool mPrevPassedAllFilters;
};
class LLInventorySort
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index d3f5d68708..b0c75cb176 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -73,8 +73,6 @@ LLInventoryFilter::LLInventoryFilter(const Params& p)
mFirstSuccessGeneration(0),
mFilterCount(0)
{
- mNextFilterGeneration = mCurrentGeneration + 1;
-
// copy mFilterOps into mDefaultFilterOps
markDefault();
}
@@ -92,35 +90,23 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item)
return passed_clipboard;
}
- std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos;
-
- BOOL passed = (mFilterSubString.size() == 0 || string_offset != std::string::npos);
+ bool passed = (mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) != std::string::npos : true);
passed = passed && checkAgainstFilterType(listener);
passed = passed && checkAgainstPermissions(listener);
passed = passed && checkAgainstFilterLinks(listener);
passed = passed && passed_clipboard;
- if (listener->getSearchableName() == "A NOUNOURS")
- {
- llinfos << "Merov : LLInventoryFilter::check : Here we go with our special NOUNOURS case, checked for string '" << mFilterSubString << "', passed = " << passed << ", name = " << listener->getSearchableName() << llendl;
- }
-
return passed;
}
bool LLInventoryFilter::check(const LLInventoryItem* item)
{
- std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos;
-
+ const bool passed_string = (mFilterSubString.size() ? item->getName().find(mFilterSubString) != std::string::npos : true);
const bool passed_filtertype = checkAgainstFilterType(item);
const bool passed_permissions = checkAgainstPermissions(item);
- const BOOL passed_clipboard = checkAgainstClipboard(item->getUUID());
- const bool passed = (passed_filtertype
- && passed_permissions
- && passed_clipboard
- && (mFilterSubString.size() == 0 || string_offset != std::string::npos));
+ const bool passed_clipboard = checkAgainstClipboard(item->getUUID());
- return passed;
+ return passed_filtertype && passed_permissions && passed_clipboard && passed_string;
}
bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const
@@ -444,7 +430,7 @@ void LLInventoryFilter::updateFilterTypes(U64 types, U64& current_types)
current_types = types;
if (more_bits_set && fewer_bits_set)
{
- // neither less or more restrive, both simultaneously
+ // neither less or more restrictive, both simultaneously
// so we need to filter from scratch
setModified(FILTER_RESTART);
}
@@ -719,7 +705,7 @@ void LLInventoryFilter::resetDefault()
void LLInventoryFilter::setModified(EFilterModified behavior)
{
mFilterText.clear();
- mCurrentGeneration = mNextFilterGeneration++;
+ mCurrentGeneration++;
if (mFilterModified == FILTER_NONE)
{
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index 4912b5ca91..ac6be196ef 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -262,9 +262,11 @@ private:
const std::string mName;
S32 mCurrentGeneration;
+ // The following makes checking for pass/no pass possible even if the item is not checked against the current generation
+ // Any item that *did not pass* the "required generation" will *not pass* the current one
+ // Any item that *passes* the "success generation" will *pass* the current one
S32 mFirstRequiredGeneration;
S32 mFirstSuccessGeneration;
- S32 mNextFilterGeneration;
S32 mFilterCount;
EFilterModified mFilterModified;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 17dd3024ea..db8370e994 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -148,8 +148,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
mViewsInitialized(false),
mInvFVBridgeBuilder(NULL)
{
- llinfos << "Merov : LLInventoryPanel::LLInventoryPanel, name = " << getName() << ", label = " << getLabel() << llendl;
-
mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER;
if (!sColorSetInitialized)
@@ -195,8 +193,6 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
p.root = NULL;
p.options_menu = "menu_inventory.xml";
- llinfos << "Merov : LLInventoryPanel::createFolderRoot, name = " << getName() << ", label = " << getLabel() << ", root id = " << root_id << llendl;
-
return LLUICtrlFactory::create<LLFolderView>(p);
}
@@ -400,13 +396,12 @@ LLInventoryFilter::EFolderShow LLInventoryPanel::getShowFolderState()
return getFilter().getShowFolderState();
}
+// Called when something changed in the global model (new item, item coming through the wire, rename, move, etc...) (CHUI-849)
void LLInventoryPanel::modelChanged(U32 mask)
{
static LLFastTimer::DeclareTimer FTM_REFRESH("Inventory Refresh");
LLFastTimer t2(FTM_REFRESH);
- llinfos << "Merov : LLInventoryPanel::modelChanged, mask = " << mask << ", name = " << getName() << ", label = " << getLabel() << llendl;
-
bool handled = false;
if (!mViewsInitialized) return;
@@ -482,7 +477,6 @@ void LLInventoryPanel::modelChanged(U32 mask)
{
if (view_item)
{
- // Merov??
view_item->refresh();
}
}
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 4d8fa07336..7555ac7b2c 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1492,7 +1492,6 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par
mIsInventoryEmpty(TRUE),
mInventoryNeedsUpdate(FALSE)
{
- llinfos << "Merov : LLPanelObjectInventory::LLPanelObjectInventory, name = " << getName() << ", label = " << getLabel() << llendl;
// Setup context menu callbacks
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelObjectInventory::doToSelected, this, _2));
mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));