From 59433e3132b057003afcc1ba230ff16ffe62f92c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 30 Apr 2020 16:28:40 +0300 Subject: SL-13119 Made control settings cached and fixed potential filtering issue --- indra/llui/llfolderview.cpp | 4 +++- indra/llui/llfolderviewitem.cpp | 13 ++++++------- indra/llui/llfolderviewitem.h | 2 +- indra/llui/llfolderviewmodel.cpp | 3 ++- indra/newview/llconversationview.cpp | 12 ++++++++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index e718fcec46..0c1dcc301b 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -342,7 +342,9 @@ static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { LL_RECORD_BLOCK_TIME(FTM_FILTER); - filter.resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); + static LLCachedControl filter_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10); + static LLCachedControl filter_hidden(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameUnvisible", 1); + filter.resetTime(llclamp(mParentPanel.get()->getVisible() ? filter_visible() : filter_hidden(), 1, 100)); // Note: we filter the model, not the view getViewModelItem()->filter(filter); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9754192b06..863a72b6c0 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -183,10 +183,13 @@ LLFolderViewItem::~LLFolderViewItem() BOOL LLFolderViewItem::postBuild() { LLFolderViewModelItem& vmi = *getViewModelItem(); - mLabel = vmi.getDisplayName(); // slightly expensive, but only first time + // getDisplayName() is slightly expensive and requires a filter reset + mLabel = vmi.getDisplayName(); setToolTip(vmi.getName()); // Dirty the filter flag of the model from the view (CHUI-849) + vmi.dirtyFilter(); + mLabelNeedsRefresh = true; mLabelWidthDirty = true; return TRUE; @@ -288,10 +291,6 @@ void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); - // getDisplayName() is slightly expensive on first run - mLabel = vmi.getDisplayName(); - setToolTip(vmi.getName()); - // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() mIcon = vmi.getIcon(); @@ -306,8 +305,6 @@ void LLFolderViewItem::refresh() mLabelSuffix = vmi.getLabelSuffix(); } - // Dirty the filter flag of the model from the view (CHUI-849) - vmi.dirtyFilter(); mLabelWidthDirty = true; mLabelNeedsRefresh = false; } @@ -362,6 +359,8 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height ) { if (mLabelNeedsRefresh) { + // Expensive. But despite refreshing label, + // it is purely visual, so it is fine to do at our laisure refresh(); } mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight; diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index f37125adb3..8693e1e0f9 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -268,7 +268,7 @@ public: virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); // refresh information from the object being viewed. - // refreshes, label, sufixes and sets icons. Expensive! + // refreshes sufixes and sets icons. Expensive! virtual void refresh(); // LLView functionality diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3b45fb53a2..ea106b5fae 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -48,7 +48,8 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - getFilter().resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); + static LLCachedControl filter_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10); + getFilter().resetTime(llclamp(filter_visible(), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index a4affe8006..fda5267041 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -430,7 +430,11 @@ void LLConversationViewSession::refresh() // Refresh the session view from its model data LLConversationItem* vmi = dynamic_cast(getViewModelItem()); vmi->resetRefresh(); - + + mLabel = vmi->getDisplayName(); // needs a filter reset + setToolTip(vmi->getName()); + vmi->dirtyFilter(); + if (mSessionTitle) { mSessionTitle->setText(vmi->getDisplayName()); @@ -621,7 +625,11 @@ void LLConversationViewParticipant::refresh() // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); - + + mLabel = participant_model->getDisplayName(); // needs a filter reset + setToolTip(participant_model->getName()); + participant_model->dirtyFilter(); + // Do the regular upstream refresh LLFolderViewItem::refresh(); } -- cgit v1.2.3