diff options
Diffstat (limited to 'indra/newview/llavatarlist.cpp')
-rw-r--r-- | indra/newview/llavatarlist.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index c7a5691d70..3275d784a3 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -32,18 +32,22 @@ #include "llviewerprecompiledheaders.h" +#include "llavatarlist.h" + // common #include "lltrans.h" +#include "llcommonutils.h" -#include "llavatarlist.h" -#include "llagentdata.h" // for comparator +// llui +#include "lltextutil.h" // newview +#include "llagentdata.h" // for comparator #include "llavatariconctrl.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llcachename.h" +#include "lllistcontextmenu.h" #include "llrecentpeople.h" -#include "lltextutil.h" #include "lluuid.h" #include "llvoiceclient.h" #include "llviewercontrol.h" // for gSavedSettings @@ -113,7 +117,7 @@ LLAvatarList::Params::Params() } LLAvatarList::LLAvatarList(const Params& p) -: LLFlatListView(p) +: LLFlatListViewEx(p) , mIgnoreOnlineStatus(p.ignore_online_status) , mShowLastInteractionTime(p.show_last_interaction_time) , mContextMenu(NULL) @@ -154,7 +158,7 @@ void LLAvatarList::draw() // *NOTE dzaporozhan // Call refresh() after draw() to avoid flickering of avatar list items. - LLFlatListView::draw(); + LLFlatListViewEx::draw(); if (mDirty) refresh(); @@ -171,14 +175,20 @@ void LLAvatarList::clear() { getIDs().clear(); setDirty(true); - LLFlatListView::clear(); + LLFlatListViewEx::clear(); } void LLAvatarList::setNameFilter(const std::string& filter) { - if (mNameFilter != filter) + std::string filter_upper = filter; + LLStringUtil::toUpper(filter_upper); + if (mNameFilter != filter_upper) { - mNameFilter = filter; + mNameFilter = filter_upper; + + // update message for empty state here instead of refresh() to avoid blinking when switch + // between tabs. + updateNoItemsMessage(filter); setDirty(); } } @@ -309,9 +319,7 @@ void LLAvatarList::refresh() } // Send refresh_complete signal. - std::vector<LLSD> cur_values; - getValues(cur_values); - mRefreshCompleteSignal(this, LLSD((S32)cur_values.size())); + mRefreshCompleteSignal(this, LLSD((S32)size(false))); } // Commit if we've added/removed items. @@ -360,7 +368,7 @@ S32 LLAvatarList::notifyParent(const LLSD& info) sort(); return 1; } - return LLFlatListView::notifyParent(info); + return LLFlatListViewEx::notifyParent(info); } void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) @@ -394,13 +402,21 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask) return handled; } +void LLAvatarList::setVisible(BOOL visible) +{ + if ( visible == FALSE && mContextMenu ) + { + mContextMenu->hide(); + } + LLFlatListViewEx::setVisible(visible); +} + void LLAvatarList::computeDifference( const uuid_vec_t& vnew_unsorted, uuid_vec_t& vadded, uuid_vec_t& vremoved) { uuid_vec_t vcur; - uuid_vec_t vnew = vnew_unsorted; // Convert LLSDs to LLUUIDs. { @@ -411,21 +427,7 @@ void LLAvatarList::computeDifference( vcur.push_back(vcur_values[i].asUUID()); } - std::sort(vcur.begin(), vcur.end()); - std::sort(vnew.begin(), vnew.end()); - - uuid_vec_t::iterator it; - size_t maxsize = llmax(vcur.size(), vnew.size()); - vadded.resize(maxsize); - vremoved.resize(maxsize); - - // what to remove - it = set_difference(vcur.begin(), vcur.end(), vnew.begin(), vnew.end(), vremoved.begin()); - vremoved.erase(it, vremoved.end()); - - // what to add - it = set_difference(vnew.begin(), vnew.end(), vcur.begin(), vcur.end(), vadded.begin()); - vadded.erase(it, vadded.end()); + LLCommonUtils::computeDifference(vnew_unsorted, vcur, vadded, vremoved); } // Refresh shown time of our last interaction with all listed avatars. |