SL-17851 Highlight matching notifications when using Search Box in Preference

meow-7.2.2
Mnikolenko Productengine 2022-08-02 14:59:04 +03:00
parent 302bab87e6
commit 3f3735c1f8
5 changed files with 64 additions and 1 deletions

View File

@ -3307,3 +3307,42 @@ boost::signals2::connection LLScrollListCtrl::setIsFriendCallback(const is_frien
}
return mIsFriendSignal->connect(cb);
}
bool LLScrollListCtrl::highlightMatchingItems(const std::string& filter_str)
{
if (filter_str == "" || filter_str == " ")
{
clearHighlightedItems();
return false;
}
bool res = false;
setHighlightedColor(LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red));
std::string filter_str_lc(filter_str);
LLStringUtil::toLower(filter_str_lc);
std::vector<LLScrollListItem*> data = getAllData();
std::vector<LLScrollListItem*>::iterator iter = data.begin();
while (iter != data.end())
{
LLScrollListCell* cell = (*iter)->getColumn(0);
if (cell)
{
std::string value = cell->getValue().asString();
LLStringUtil::toLower(value);
if (value.find(filter_str_lc) == std::string::npos)
{
(*iter)->setHighlighted(false);
}
else
{
(*iter)->setHighlighted(true);
res = true;
}
}
iter++;
}
return res;
}

View File

@ -410,6 +410,8 @@ public:
void setNeedsSort(bool val = true) { mSorted = !val; }
void dirtyColumns(); // some operation has potentially affected column layout or ordering
bool highlightMatchingItems(const std::string& filter_str);
boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb )
{
if (!mSortCallback) mSortCallback = new sort_signal_t();

View File

@ -1512,6 +1512,10 @@ void LLFloaterPreference::onClickEnablePopup()
}
buildPopupLists();
if (!mFilterEdit->getText().empty())
{
filterIgnorableNotifications();
}
}
void LLFloaterPreference::onClickDisablePopup()
@ -1527,6 +1531,10 @@ void LLFloaterPreference::onClickDisablePopup()
}
buildPopupLists();
if (!mFilterEdit->getText().empty())
{
filterIgnorableNotifications();
}
}
void LLFloaterPreference::resetAllIgnored()
@ -3547,11 +3555,24 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force)
return;
mSearchData->mRootTab->hightlightAndHide( seachValue );
filterIgnorableNotifications();
LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
if( pRoot )
pRoot->selectFirstTab();
}
void LLFloaterPreference::filterIgnorableNotifications()
{
bool visible = getChildRef<LLScrollListCtrl>("enabled_popups").highlightMatchingItems(mFilterEdit->getValue());
visible |= getChildRef<LLScrollListCtrl>("disabled_popups").highlightMatchingItems(mFilterEdit->getValue());
if (visible)
{
getChildRef<LLTabContainer>("pref core").setTabVisibility( getChild<LLPanel>("msgs"), true );
}
}
void collectChildren( LLView const *aView, ll::prefs::PanelDataPtr aParentPanel, ll::prefs::TabContainerDataPtr aParentTabContainer )
{
if( !aView )

View File

@ -227,6 +227,7 @@ private:
void onUpdateFilterTerm( bool force = false );
void collectSearchableItems();
void filterIgnorableNotifications();
std::map<std::string, bool> mIgnorableNotifs;
};

View File

@ -9628,7 +9628,7 @@ Do you wish to continue?
The selected object affects the navmesh. Changing it to a Flexible Path will remove it from the navmesh.
<tag>confirm</tag>
<usetemplate
ignoretext="The selected object affects the navmesh. Changing it to a Flexible Path will remove it from the navmesh."
ignoretext="The selected object affects the navmesh. Changing it to a Flexible Path will remove it from the navmesh."
name="okcancelignore"
notext="Cancel"
yestext="OK"/>