From d533a33f4229244405ed0b247fce410513b6c3e9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Apr 2013 18:59:21 -0700 Subject: CHUI-912 : WIP : Add traces to various aspects of the inventory filtering, sorting and arranging (to be deleted) --- indra/llui/llfolderview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui/llfolderview.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 8feaf654f0..c6868c9538 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -323,6 +323,7 @@ static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { + //llinfos << "Merov : LLFolderView::filter (fast timed)" << llendl; LLFastTimer t2(FTM_FILTER); filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); @@ -1615,6 +1616,7 @@ void LLFolderView::update() { getFolderViewModel()->getFilter().clearModified(); } + llinfos << "Merov : LLFolderView::update: modified = " << getFolderViewModel()->getFilter().isModified() << ", default = " << getFolderViewModel()->getFilter().isNotDefault() << ", count = " << getFolderViewModel()->getFilter().getFilterCount() << llendl; // automatically show matching items, and select first one if we had a selection if (mNeedsAutoSelect) -- cgit v1.3 From b05bf882dbf5cdcb4683b4c6201ea50a38491a7b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 11 Apr 2013 19:02:16 -0700 Subject: CHUI-912 : WIP : Fix resize test when folder is empty, add more traces (to be deleted) --- indra/llui/llfolderview.cpp | 4 ++-- indra/llui/llfolderviewitem.cpp | 6 ++++++ indra/newview/llinventorypanel.cpp | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/llui/llfolderview.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index c6868c9538..5bca589bc4 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -662,7 +662,7 @@ void LLFolderView::draw() // get preferable text height... S32 pixel_height = mStatusTextBox->getTextPixelHeight(); - bool height_changed = local_rect.getHeight() != pixel_height; + bool height_changed = (local_rect.getHeight() < pixel_height); if (height_changed) { // ... if it does not match current height, lets rearrange current view. @@ -1616,7 +1616,7 @@ void LLFolderView::update() { getFolderViewModel()->getFilter().clearModified(); } - llinfos << "Merov : LLFolderView::update: modified = " << getFolderViewModel()->getFilter().isModified() << ", default = " << getFolderViewModel()->getFilter().isNotDefault() << ", count = " << getFolderViewModel()->getFilter().getFilterCount() << llendl; + llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", modified = " << getFolderViewModel()->getFilter().isModified() << ", not default = " << getFolderViewModel()->getFilter().isNotDefault() << ", count = " << getFolderViewModel()->getFilter().getFilterCount() << llendl; // automatically show matching items, and select first one if we had a selection if (mNeedsAutoSelect) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 3693920e05..43267b428e 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -795,6 +795,12 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y void LLFolderViewItem::draw() { + LLFolderViewModelItem& vmi = *getViewModelItem(); + if (vmi.getSearchableName() == "A NOUNOURS") + { + llinfos << "Merov : LLFolderViewItem::draw : Special NOUNOURS, draw it!" << llendl; + } + const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 1430d9fe3a..17dd3024ea 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -194,7 +194,9 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) p.show_item_link_overlays = mShowItemLinkOverlays; 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(p); } @@ -403,6 +405,8 @@ 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; -- cgit v1.3 From 0ecbbe9571be298284c2410ea441877b611bd875 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 15 Apr 2013 11:16:57 -0700 Subject: CHUI-912 : WIP : Try to change the return value of filter() so to trigger arrange on the fly. --- indra/llui/llfolderview.cpp | 13 ++++++++++++- indra/llui/llfolderviewitem.h | 1 - indra/newview/llfolderviewmodelinventory.cpp | 27 ++++++++++++--------------- indra/newview/llinventoryfilter.cpp | 4 ---- indra/newview/llpanelobjectinventory.cpp | 1 + 5 files changed, 25 insertions(+), 21 deletions(-) (limited to 'indra/llui/llfolderview.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 5bca589bc4..3ca549ae72 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -327,7 +327,13 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) LLFastTimer t2(FTM_FILTER); filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - getViewModelItem()->filter(filter); + bool filtered_items = getViewModelItem()->filter(filter); + //if (getViewModelItem()->descendantsPassedFilter(filter.getCurrentGeneration())) + if (filtered_items) + { + llinfos << "Merov : LLFolderView::filter, request arrange, new elements passed the filter" << llendl; + requestArrange(); + } } void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -1665,9 +1671,14 @@ void LLFolderView::update() { S32 height = 0; S32 width = 0; + llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", is been arranged, last arrange = " << mLastArrangeGeneration << ", root arrange = " << getRoot()->getArrangeGeneration() << llendl; S32 total_height = arrange( &width, &height ); notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); } + else + { + llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", doesn't need arranging, last arrange = " << mLastArrangeGeneration << ", root arrange = " << getRoot()->getArrangeGeneration() << llendl; + } } // during filtering process, try to pin selected item's location on screen diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index ca31931e19..a9b0201236 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -316,7 +316,6 @@ protected: F32 mAutoOpenCountdown; S32 mLastArrangeGeneration; S32 mLastCalculatedWidth; - S32 mMostFilteredDescendantGeneration; bool mNeedsSort; public: diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 5ad94bfaba..49b72485e0 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -71,7 +71,7 @@ bool LLFolderViewModelInventory::startDrag(std::vector& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LLFastTimer _(FTM_INVENTORY_SORT); - llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << llendl; + llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << ", folder = " << folder->getName() << llendl; if (!needsSort(folder->getViewModelItem())) return; @@ -155,11 +155,12 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { S32 filter_generation = filter.getCurrentGeneration(); - bool continue_filtering = true; +// bool continue_filtering = true; + bool new_filtered_item = false; if (item->getLastFilterGeneration() < filter_generation) { // recursive application of the filter for child items - continue_filtering = item->filter( filter ); + new_filtered_item = item->filter( filter ); } // track latest generation to pass any child items, for each folder up to root @@ -174,7 +175,7 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } } - return continue_filtering; + return new_filtered_item; } bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) @@ -186,10 +187,6 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { 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; } - else - { - llinfos << "Merov : LLFolderViewModelItemInventory::filter : filter count = " << filter.getFilterCount() << llendl; - } if (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation @@ -199,12 +196,14 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) // go ahead and flag this item as done setPassedFilter(false, filter_generation); setPassedFolderFilter(false, filter_generation); - return true; + return false; } const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true; setPassedFolderFilter(passed_filter_folder, filter_generation); + bool new_filtered_item = false; + if (!mChildren.empty() && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement @@ -214,7 +213,8 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) iter != end_iter && filter.getFilterCount() > 0; ++iter) { - if (!filterChildItem((*iter), filter)) + new_filtered_item |= filterChildItem((*iter), filter); + if (filter.getFilterCount() <= 0) { break; } @@ -230,12 +230,9 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); - return true; - } - else - { - return false; + new_filtered_item |= passed_filter; } + return new_filtered_item; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index eef0adda52..d3f5d68708 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -104,10 +104,6 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { llinfos << "Merov : LLInventoryFilter::check : Here we go with our special NOUNOURS case, checked for string '" << mFilterSubString << "', passed = " << passed << ", name = " << listener->getSearchableName() << llendl; } - else - { - llinfos << "Merov : LLInventoryFilter::check : checked for string '" << mFilterSubString << "', passed = " << passed << ", name = " << listener->getSearchableName() << llendl; - } return passed; } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 7555ac7b2c..4d8fa07336 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1492,6 +1492,7 @@ 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)); -- cgit v1.3 From e84c97e86d51b4f890695182c8087288481b6955 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 16 Apr 2013 19:24:47 -0700 Subject: CHUI-912, CHUI-849 : Propagate arrange request correctly, limit sort, improve filter perf, clear traces, add comments. --- indra/llui/llfolderview.cpp | 34 +++++++++------------- indra/llui/llfolderviewitem.cpp | 42 +++++++++++---------------- indra/llui/llfolderviewmodel.h | 22 +++++++------- indra/newview/llfolderviewmodelinventory.cpp | 43 ++++++++++++++-------------- indra/newview/llfolderviewmodelinventory.h | 3 -- indra/newview/llinventoryfilter.cpp | 26 ++++------------- indra/newview/llinventoryfilter.h | 4 ++- indra/newview/llinventorypanel.cpp | 8 +----- indra/newview/llpanelobjectinventory.cpp | 1 - 9 files changed, 74 insertions(+), 109 deletions(-) (limited to 'indra/llui/llfolderview.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 3ca549ae72..c9e88ab72f 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -323,17 +323,11 @@ static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { - //llinfos << "Merov : LLFolderView::filter (fast timed)" << llendl; + // Entry point of inventory filtering (CHUI-849) LLFastTimer t2(FTM_FILTER); filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - - bool filtered_items = getViewModelItem()->filter(filter); - //if (getViewModelItem()->descendantsPassedFilter(filter.getCurrentGeneration())) - if (filtered_items) - { - llinfos << "Merov : LLFolderView::filter, request arrange, new elements passed the filter" << llendl; - requestArrange(); - } + // Note: we filter the model, not the view + getViewModelItem()->filter(filter); } void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -1614,16 +1608,17 @@ void LLFolderView::update() { mNeedsAutoSelect = TRUE; } - // filter to determine visibility before arranging + + // Filter to determine visibility before arranging filter(getFolderViewModel()->getFilter()); + // Clear the modified setting on the filter only if the filter count is non-zero after running the filter process - // Note: if the filter count is zero, then the filter most likely halted before completing the entire set of items + // Note: if the filter count is zero, that means the filter exhausted its count per frame and halted before completing the entire set of items if (getFolderViewModel()->getFilter().isModified() && (getFolderViewModel()->getFilter().getFilterCount() > 0)) { getFolderViewModel()->getFilter().clearModified(); } - llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", modified = " << getFolderViewModel()->getFilter().isModified() << ", not default = " << getFolderViewModel()->getFilter().isNotDefault() << ", count = " << getFolderViewModel()->getFilter().getFilterCount() << llendl; - + // automatically show matching items, and select first one if we had a selection if (mNeedsAutoSelect) { @@ -1663,22 +1658,19 @@ void LLFolderView::update() BOOL is_visible = isInVisibleChain(); - //Puts folders/items in proper positions - if ( is_visible ) + // Puts folders/items in proper positions + // arrange() takes the model filter flag into account and call sort() if necessary (CHUI-849) + // It also handles the open/close folder animation + if (is_visible) { sanitizeSelection(); - if( needsArrange() ) + if (needsArrange()) { S32 height = 0; S32 width = 0; - llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", is been arranged, last arrange = " << mLastArrangeGeneration << ", root arrange = " << getRoot()->getArrangeGeneration() << llendl; S32 total_height = arrange( &width, &height ); notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); } - else - { - llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", doesn't need arranging, last arrange = " << mLastArrangeGeneration << ", root arrange = " << getRoot()->getArrangeGeneration() << llendl; - } } // during filtering process, try to pin selected item's location on screen diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 43267b428e..96961e7a4f 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -274,11 +274,7 @@ void LLFolderViewItem::refresh() } mLabelWidthDirty = true; - // Merov ?? - if (vmi.getSearchableName() == "A NOUNOURS") - { - llinfos << "Merov : LLFolderViewItem::refresh : Dirty filter for NOUNOURS" << llendl; - } + // Dirty the filter flag of the model from the view (CHUI-849) vmi.dirtyFilter(); } @@ -795,12 +791,6 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y void LLFolderViewItem::draw() { - LLFolderViewModelItem& vmi = *getViewModelItem(); - if (vmi.getSearchableName() == "A NOUNOURS") - { - llinfos << "Merov : LLFolderViewItem::draw : Special NOUNOURS, draw it!" << llendl; - } - const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled @@ -954,15 +944,20 @@ void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); -// Finds width and height of this object and its children. Also -// makes sure that this view and its children are the right size. +// Make everything right and in the right place ready for drawing (CHUI-849) +// * Sort everything correctly if necessary +// * Turn widgets visible/invisible according to their model filtering state +// * Takes animation state into account for opening/closing of folders (this makes widgets visible/invisible) +// * Reposition visible widgets so that they line up correctly with no gap +// * Compute the width and height of the cuurent folder and its children +// * Makes sure that this view and its children are the right size S32 LLFolderViewFolder::arrange( S32* width, S32* height ) { - // sort before laying out contents + // Sort before laying out contents + // Note that we sort from the root (CHUI-849) getRoot()->getFolderViewModel()->sort(this); LLFastTimer t2(FTM_ARRANGE); - llinfos << "Merov : LLFolderViewFolder::arrange" << llendl; // evaluate mHasVisibleChildren mHasVisibleChildren = false; @@ -1625,16 +1620,13 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) } void LLFolderViewFolder::requestArrange() -{ - if ( mLastArrangeGeneration != -1) - { - mLastArrangeGeneration = -1; - // flag all items up to root - if (mParentFolder) - { - mParentFolder->requestArrange(); - } - } +{ + mLastArrangeGeneration = -1; + // flag all items up to root + if (mParentFolder) + { + mParentFolder->requestArrange(); + } } void LLFolderViewFolder::toggleOpen() diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 1b61212c0e..dbcbb0edeb 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -308,26 +308,28 @@ public: virtual bool potentiallyVisible() { return passedFilter() // we've passed the filter - || getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration() // or we don't know yet + || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet || descendantsPassedFilter(); } virtual bool passedFilter(S32 filter_generation = -1) { - if (filter_generation < 0) + if (filter_generation < 0) + { filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - - bool passed_folder_filter = mPassedFolderFilter && mLastFolderFilterGeneration >= filter_generation; - bool passed_filter = mPassedFilter && mLastFilterGeneration >= filter_generation; - return passed_folder_filter - && (descendantsPassedFilter(filter_generation) - || passed_filter); + } + bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); + bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); + return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); } virtual bool descendantsPassedFilter(S32 filter_generation = -1) { - if (filter_generation < 0) filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - return mMostFilteredDescendantGeneration >= filter_generation; + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + return mMostFilteredDescendantGeneration >= filter_generation; } 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& items) @@ -71,7 +70,6 @@ bool LLFolderViewModelInventory::startDrag(std::vector& 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(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)); -- cgit v1.3 From 03ad10d258095487d6ae8f26634932bc832f10df Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 18 Apr 2013 19:46:08 -0700 Subject: CHUI-849 : WIP : Filter limit on time instead of number of items --- indra/llui/llfolderview.cpp | 15 +++++++++++-- indra/llui/llfolderviewitem.cpp | 2 +- indra/llui/llfolderviewmodel.cpp | 3 ++- indra/llui/llfolderviewmodel.h | 7 ++++++ indra/newview/app_settings/settings.xml | 11 ++++++++++ indra/newview/llconversationmodel.h | 6 ++++- indra/newview/llfolderviewmodelinventory.cpp | 33 +++++++++++++++------------- indra/newview/llinventoryfilter.cpp | 20 +++++++++++++++++ indra/newview/llinventoryfilter.h | 9 ++++++++ 9 files changed, 86 insertions(+), 20 deletions(-) (limited to 'indra/llui/llfolderview.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index c9e88ab72f..f3da71fc15 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -325,9 +325,19 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) { // Entry point of inventory filtering (CHUI-849) LLFastTimer t2(FTM_FILTER); - filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + //filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrame"), 1, 1000)); // Note: we filter the model, not the view getViewModelItem()->filter(filter); + // Test the filter state + if (filter.isTimedOut()) + { + llinfos << "Merov : filter of " << mParentPanel->getName() << " not finished, count = " << filter.getFilterCount() << llendl; + } + else if (filter.getFilterCount() != 0) + { + llinfos << "Merov : last filter of " << mParentPanel->getName() << " done! count = " << filter.getFilterCount() << llendl; + } } void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -1614,7 +1624,8 @@ void LLFolderView::update() // Clear the modified setting on the filter only if the filter count is non-zero after running the filter process // Note: if the filter count is zero, that means the filter exhausted its count per frame and halted before completing the entire set of items - if (getFolderViewModel()->getFilter().isModified() && (getFolderViewModel()->getFilter().getFilterCount() > 0)) + //if (getFolderViewModel()->getFilter().isModified() && (getFolderViewModel()->getFilter().getFilterCount() > 0)) + if (getFolderViewModel()->getFilter().isModified() && (!getFolderViewModel()->getFilter().isTimedOut())) { getFolderViewModel()->getFilter().clearModified(); } diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 96961e7a4f..6c147ccc12 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -949,7 +949,7 @@ static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); // * Turn widgets visible/invisible according to their model filtering state // * Takes animation state into account for opening/closing of folders (this makes widgets visible/invisible) // * Reposition visible widgets so that they line up correctly with no gap -// * Compute the width and height of the cuurent folder and its children +// * Compute the width and height of the current folder and its children // * Makes sure that this view and its children are the right size S32 LLFolderViewFolder::arrange( S32* width, S32* height ) { diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3593804554..b5622756fe 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -48,7 +48,8 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - getFilter().setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + //getFilter().setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrame"), 1, 1000)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index dbcbb0edeb..64c00c782e 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -93,6 +93,13 @@ public: virtual S32 getFilterCount() const = 0; virtual void decrementFilterCount() = 0; + // +-------------------------------------------------------------------+ + // + Time + // +-------------------------------------------------------------------+ + virtual void resetTime(S32 timeout) = 0; + virtual bool isTimedOut() = 0; + virtual void incrementFilterCount() = 0; // Temp! + // +-------------------------------------------------------------------+ // + Default // +-------------------------------------------------------------------+ diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4c305e1d60..a28c6366c0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3402,6 +3402,17 @@ Value 500 + FilterItemsMaxTimePerFrame + + Comment + Max time devoted to items filtering per frame (in milliseconds) + Persist + 1 + Type + S32 + Value + 100 + FindLandArea Comment diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 8766585049..5c942b1c40 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -256,7 +256,11 @@ public: void setFilterCount(S32 count) { } S32 getFilterCount() const { return 0; } void decrementFilterCount() { } - + + void resetTime(S32 timeout) { } + bool isTimedOut() { return false; } + void incrementFilterCount() { } // Temp! + bool isDefault() const { return true; } bool isNotDefault() const { return false; } void markDefault() { } diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 1894314513..ce957edcbd 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -153,11 +153,11 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { S32 filter_generation = filter.getCurrentGeneration(); - bool new_filtered_item = false; + bool continue_filtering = true; if (item->getLastFilterGeneration() < filter_generation) { // Recursive application of the filter for child items (CHUI-849) - new_filtered_item = item->filter( filter ); + continue_filtering = item->filter( filter ); } // Update latest generation to pass filter in parent and propagate up to root @@ -172,14 +172,13 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } } - return new_filtered_item; + return continue_filtering; } 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 (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation @@ -189,9 +188,11 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) // go ahead and flag this item as not pass setPassedFilter(false, filter_generation); setPassedFolderFilter(false, filter_generation); - return false; + return true; } + /* + const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration(); if (getLastFilterGeneration() >= sufficient_pass_generation && getLastFolderFilterGeneration() >= sufficient_pass_generation && passedFilter(sufficient_pass_generation)) @@ -202,23 +203,23 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) 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); - bool new_filtered_item = false; + bool continue_filtering = true; if (!mChildren.empty() && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement { // now query children - for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); - iter != end_iter && filter.getFilterCount() > 0; - ++iter) + for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; ++iter) { - new_filtered_item |= filterChildItem((*iter), filter); - if (filter.getFilterCount() <= 0) + continue_filtering = filterChildItem((*iter), filter); + //if (filter.getFilterCount() <= 0) + if (!continue_filtering) { break; } @@ -226,15 +227,17 @@ 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 (filter.getFilterCount() > 0) + //if (filter.getFilterCount() > 0) + if (continue_filtering) { // This is where filter count is hit and filter check on the item done (CHUI-849) - filter.decrementFilterCount(); + //filter.decrementFilterCount(); + filter.incrementFilterCount(); // Temp const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); - new_filtered_item |= passed_filter; + continue_filtering = !filter.isTimedOut(); } - return new_filtered_item; + return continue_filtering; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index b0c75cb176..3b712925e1 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -1026,6 +1026,26 @@ void LLInventoryFilter::decrementFilterCount() mFilterCount--; } +void LLInventoryFilter::incrementFilterCount() +{ + mFilterCount++; +} + +bool LLInventoryFilter::isTimedOut() +{ + return mFilterTime.hasExpired(); +} + +void LLInventoryFilter::resetTime(S32 timeout) +{ + mFilterCount = 0; + mFilterTime.reset(); + F32 time_in_sec = (F32)(timeout)/1000.0; + mFilterTime.setTimerExpirySec(time_in_sec); +} + + + S32 LLInventoryFilter::getCurrentGeneration() const { return mCurrentGeneration; diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index ac6be196ef..034fcf4a62 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -221,6 +221,13 @@ public: S32 getFilterCount() const; void decrementFilterCount(); + // +-------------------------------------------------------------------+ + // + Time + // +-------------------------------------------------------------------+ + void resetTime(S32 timeout); + bool isTimedOut(); + void incrementFilterCount(); // Temp! + // +-------------------------------------------------------------------+ // + Default // +-------------------------------------------------------------------+ @@ -271,6 +278,8 @@ private: S32 mFilterCount; EFilterModified mFilterModified; + LLTimer mFilterTime; + std::string mFilterText; std::string mEmptyLookupMessage; }; -- cgit v1.3 From 2cc1fb250f78df3a4b8f33b13b30defef7efb78a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 19 Apr 2013 16:51:44 -0700 Subject: CHUI-849 : Use a time limit for filtering instead of number limit, use a different limit for visible and unvisible lists --- indra/llui/llfolderview.cpp | 18 ++++-------------- indra/llui/llfolderviewmodel.cpp | 3 +-- indra/llui/llfolderviewmodel.h | 8 -------- indra/newview/app_settings/settings.xml | 24 ++++++++++++------------ indra/newview/llconversationmodel.h | 5 ----- indra/newview/llfolderviewmodelinventory.cpp | 9 +++------ indra/newview/llinventoryfilter.cpp | 27 ++------------------------- indra/newview/llinventoryfilter.h | 10 ---------- 8 files changed, 22 insertions(+), 82 deletions(-) (limited to 'indra/llui/llfolderview.cpp') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index f3da71fc15..bf4d5ae1f9 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -325,19 +325,10 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) { // Entry point of inventory filtering (CHUI-849) LLFastTimer t2(FTM_FILTER); - //filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrame"), 1, 1000)); + filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); + // Note: we filter the model, not the view getViewModelItem()->filter(filter); - // Test the filter state - if (filter.isTimedOut()) - { - llinfos << "Merov : filter of " << mParentPanel->getName() << " not finished, count = " << filter.getFilterCount() << llendl; - } - else if (filter.getFilterCount() != 0) - { - llinfos << "Merov : last filter of " << mParentPanel->getName() << " done! count = " << filter.getFilterCount() << llendl; - } } void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -1622,9 +1613,8 @@ void LLFolderView::update() // Filter to determine visibility before arranging filter(getFolderViewModel()->getFilter()); - // Clear the modified setting on the filter only if the filter count is non-zero after running the filter process - // Note: if the filter count is zero, that means the filter exhausted its count per frame and halted before completing the entire set of items - //if (getFolderViewModel()->getFilter().isModified() && (getFolderViewModel()->getFilter().getFilterCount() > 0)) + // Clear the modified setting on the filter only if the filter finished after running the filter process + // Note: if the filter count has timed out, that means the filter halted before completing the entire set of items if (getFolderViewModel()->getFilter().isModified() && (!getFolderViewModel()->getFilter().isTimedOut())) { getFolderViewModel()->getFilter().clearModified(); diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index b5622756fe..3363dc5316 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -48,8 +48,7 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - //getFilter().setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrame"), 1, 1000)); + getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 64c00c782e..b1bcc8bbb4 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -86,19 +86,11 @@ public: //RN: this is public to allow system to externally force a global refilter virtual void setModified(EFilterModified behavior = FILTER_RESTART) = 0; - // +-------------------------------------------------------------------+ - // + Count - // +-------------------------------------------------------------------+ - virtual void setFilterCount(S32 count) = 0; - virtual S32 getFilterCount() const = 0; - virtual void decrementFilterCount() = 0; - // +-------------------------------------------------------------------+ // + Time // +-------------------------------------------------------------------+ virtual void resetTime(S32 timeout) = 0; virtual bool isTimedOut() = 0; - virtual void incrementFilterCount() = 0; // Temp! // +-------------------------------------------------------------------+ // + Default diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a28c6366c0..cd2b15ef2b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3391,27 +3391,27 @@ Value 10.0 - FilterItemsPerFrame + FilterItemsMaxTimePerFrameVisible - Comment - Maximum number of inventory items to match against search filter every frame (lower to increase framerate while searching, higher to improve search speed) - Persist - 1 - Type - S32 - Value - 500 + Comment + Max time devoted to items filtering per frame for visible inventory listings (in milliseconds) + Persist + 1 + Type + S32 + Value + 10 - FilterItemsMaxTimePerFrame + FilterItemsMaxTimePerFrameUnvisible Comment - Max time devoted to items filtering per frame (in milliseconds) + Max time devoted to items filtering per frame for non visible inventory listings (in milliseconds) Persist 1 Type S32 Value - 100 + 1 FindLandArea diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 5c942b1c40..d8cdcdfc97 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -252,14 +252,9 @@ public: const std::string& getName() const { return mEmpty; } const std::string& getFilterText() { return mEmpty; } void setModified(EFilterModified behavior = FILTER_RESTART) { } - - void setFilterCount(S32 count) { } - S32 getFilterCount() const { return 0; } - void decrementFilterCount() { } void resetTime(S32 timeout) { } bool isTimedOut() { return false; } - void incrementFilterCount() { } // Temp! bool isDefault() const { return true; } bool isNotDefault() const { return false; } diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index ce957edcbd..4a51d26693 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -191,6 +191,7 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) return true; } + // *TODO : Revise the logic for fast pass on less restrictive filter case /* const S32 sufficient_pass_generation = filter.getFirstSuccessGeneration(); if (getLastFilterGeneration() >= sufficient_pass_generation @@ -218,7 +219,6 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); iter != end_iter; ++iter) { continue_filtering = filterChildItem((*iter), filter); - //if (filter.getFilterCount() <= 0) if (!continue_filtering) { break; @@ -226,13 +226,10 @@ 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 (filter.getFilterCount() > 0) + // If we didn't use all the filter time that means we filtered all of our descendants so we can filter ourselves now if (continue_filtering) { - // This is where filter count is hit and filter check on the item done (CHUI-849) - //filter.decrementFilterCount(); - filter.incrementFilterCount(); // Temp + // This is where filter check on the item done (CHUI-849) const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); continue_filtering = !filter.isTimedOut(); diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 3b712925e1..3c6974cf6d 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -70,8 +70,7 @@ LLInventoryFilter::LLInventoryFilter(const Params& p) mFilterSubString(p.substring), mCurrentGeneration(0), mFirstRequiredGeneration(0), - mFirstSuccessGeneration(0), - mFilterCount(0) + mFirstSuccessGeneration(0) { // copy mFilterOps into mDefaultFilterOps markDefault(); @@ -1012,25 +1011,6 @@ LLInventoryFilter::EFolderShow LLInventoryFilter::getShowFolderState() const return mFilterOps.mShowFolderState; } -void LLInventoryFilter::setFilterCount(S32 count) -{ - mFilterCount = count; -} -S32 LLInventoryFilter::getFilterCount() const -{ - return mFilterCount; -} - -void LLInventoryFilter::decrementFilterCount() -{ - mFilterCount--; -} - -void LLInventoryFilter::incrementFilterCount() -{ - mFilterCount++; -} - bool LLInventoryFilter::isTimedOut() { return mFilterTime.hasExpired(); @@ -1038,15 +1018,12 @@ bool LLInventoryFilter::isTimedOut() void LLInventoryFilter::resetTime(S32 timeout) { - mFilterCount = 0; mFilterTime.reset(); F32 time_in_sec = (F32)(timeout)/1000.0; mFilterTime.setTimerExpirySec(time_in_sec); } - - -S32 LLInventoryFilter::getCurrentGeneration() const +S32 LLInventoryFilter::getCurrentGeneration() const { return mCurrentGeneration; } diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 034fcf4a62..ce516af0b9 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -214,19 +214,11 @@ public: //RN: this is public to allow system to externally force a global refilter void setModified(EFilterModified behavior = FILTER_RESTART); - // +-------------------------------------------------------------------+ - // + Count - // +-------------------------------------------------------------------+ - void setFilterCount(S32 count); - S32 getFilterCount() const; - void decrementFilterCount(); - // +-------------------------------------------------------------------+ // + Time // +-------------------------------------------------------------------+ void resetTime(S32 timeout); bool isTimedOut(); - void incrementFilterCount(); // Temp! // +-------------------------------------------------------------------+ // + Default @@ -275,9 +267,7 @@ private: S32 mFirstRequiredGeneration; S32 mFirstSuccessGeneration; - S32 mFilterCount; EFilterModified mFilterModified; - LLTimer mFilterTime; std::string mFilterText; -- cgit v1.3