diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-09-03 17:41:39 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-09-03 17:41:39 +0100 |
commit | ffae589843c2977ae7f70de78d84c936e2a91291 (patch) | |
tree | 497660a88fe55382639dea1b2f3499241127470d /indra/newview/llnamelistctrl.cpp | |
parent | 63f2ddf377fa0fc6a666cdc1001289335d86258b (diff) | |
parent | 25c29d59cf658acec5901c6f06775add10cf0bfd (diff) |
Post-convert merge by convert_monolith.py from /Users/Aimee/Documents/Work/Linden-Lab/Development/viewer/convert/viewer-identity-evolution
Diffstat (limited to 'indra/newview/llnamelistctrl.cpp')
-rw-r--r-- | indra/newview/llnamelistctrl.cpp | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index e7e60f544c..dfab5c7634 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -30,6 +30,7 @@ #include <boost/tokenizer.hpp> +#include "llavatarnamecache.h" #include "llcachename.h" #include "llfloaterreg.h" #include "llinventory.h" @@ -38,6 +39,7 @@ #include "llscrolllistcolumn.h" #include "llsdparam.h" #include "lltooltip.h" +#include "lltrans.h" static LLDefaultChildRegistry::Register<LLNameListCtrl> r("name_list"); @@ -52,7 +54,8 @@ void LLNameListCtrl::NameTypeNames::declareValues() LLNameListCtrl::Params::Params() : name_column(""), - allow_calling_card_drop("allow_calling_card_drop", false) + allow_calling_card_drop("allow_calling_card_drop", false), + short_names("short_names", false) { name = "name_list"; } @@ -61,7 +64,8 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) : LLScrollListCtrl(p), mNameColumnIndex(p.name_column.column_index), mNameColumn(p.name_column.column_name), - mAllowCallingCardDrop(p.allow_calling_card_drop) + mAllowCallingCardDrop(p.allow_calling_card_drop), + mShortNames(p.short_names) {} // public @@ -291,10 +295,24 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( break; case INDIVIDUAL: { - std::string name; - if (gCacheName->getFullName(id, name)) + LLAvatarName av_name; + if (id.isNull()) { - fullname = name; + fullname = LLTrans::getString("AvatarNameNobody"); + } + else if (LLAvatarNameCache::get(id, &av_name)) + { + if (mShortNames) + fullname = av_name.mDisplayName; + else + fullname = av_name.getCompleteName(); + } + else + { + // ...schedule a callback + LLAvatarNameCache::get(id, + boost::bind(&LLNameListCtrl::onAvatarNameCache, + this, _1, _2)); } break; } @@ -349,34 +367,25 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) } } -// public -void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, - const std::string& last, BOOL is_group) +void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, + const LLAvatarName& av_name) { - //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " - // << last << "'" << llendl; - - std::string fullname; - if (!is_group) - { - fullname = first + " " + last; - } + std::string name; + if (mShortNames) + name = av_name.mDisplayName; else - { - fullname = first; - } + name = av_name.getCompleteName(); - // TODO: scan items for that ID, fix if necessary item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) { LLScrollListItem* item = *iter; - if (item->getUUID() == id) + if (item->getUUID() == agent_id) { LLScrollListCell* cell = item->getColumn(mNameColumnIndex); if (cell) { - cell->setValue(fullname); + cell->setValue(name); } } } @@ -385,19 +394,6 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, } -// static -void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& first, - const std::string& last, BOOL is_group) -{ - LLInstanceTrackerScopedGuard guard; - LLInstanceTracker<LLNameListCtrl>::instance_iter it; - for (it = guard.beginInstances(); it != guard.endInstances(); ++it) - { - LLNameListCtrl& ctrl = *it; - ctrl.refresh(id, first, last, is_group); - } -} - void LLNameListCtrl::updateColumns() { LLScrollListCtrl::updateColumns(); |