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 /indra/newview | |
parent | e84c97e86d51b4f890695182c8087288481b6955 (diff) |
CHUI-849 : WIP : Filter limit on time instead of number of items
Diffstat (limited to 'indra/newview')
-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 |
5 files changed, 63 insertions, 16 deletions
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; }; |