diff options
author | Merov Linden <merov@lindenlab.com> | 2013-04-18 19:46:08 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-04-18 19:46:08 -0700 |
commit | 03ad10d258095487d6ae8f26634932bc832f10df (patch) | |
tree | 83491d98bfaf65cd73dc69b21001b324e8173caf | |
parent | e84c97e86d51b4f890695182c8087288481b6955 (diff) |
CHUI-849 : WIP : Filter limit on time instead of number of items
-rw-r--r-- | indra/llui/llfolderview.cpp | 15 | ||||
-rwxr-xr-x | indra/llui/llfolderviewitem.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.h | 7 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rwxr-xr-x | indra/newview/llconversationmodel.h | 6 | ||||
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llinventoryfilter.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llinventoryfilter.h | 9 |
9 files changed, 86 insertions, 20 deletions
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 @@ -94,6 +94,13 @@ public: virtual void decrementFilterCount() = 0; // +-------------------------------------------------------------------+ + // + Time + // +-------------------------------------------------------------------+ + virtual void resetTime(S32 timeout) = 0; + virtual bool isTimedOut() = 0; + virtual void incrementFilterCount() = 0; // Temp! + + // +-------------------------------------------------------------------+ // + Default // +-------------------------------------------------------------------+ virtual bool isDefault() const = 0; 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 @@ <key>Value</key> <integer>500</integer> </map> + <key>FilterItemsMaxTimePerFrame</key> + <map> + <key>Comment</key> + <string>Max time devoted to items filtering per frame (in milliseconds)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>100</integer> + </map> <key>FindLandArea</key> <map> <key>Comment</key> 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 @@ -222,6 +222,13 @@ public: void decrementFilterCount(); // +-------------------------------------------------------------------+ + // + Time + // +-------------------------------------------------------------------+ + void resetTime(S32 timeout); + bool isTimedOut(); + void incrementFilterCount(); // Temp! + + // +-------------------------------------------------------------------+ // + Default // +-------------------------------------------------------------------+ bool isDefault() const; @@ -271,6 +278,8 @@ private: S32 mFilterCount; EFilterModified mFilterModified; + LLTimer mFilterTime; + std::string mFilterText; std::string mEmptyLookupMessage; }; |