summaryrefslogtreecommitdiff
path: root/indra/newview/llnamelistctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnamelistctrl.cpp')
-rw-r--r--indra/newview/llnamelistctrl.cpp61
1 files changed, 26 insertions, 35 deletions
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index d605d4430e..a2450fcdd2 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -36,6 +36,7 @@
#include <boost/tokenizer.hpp>
+#include "llavatarnamecache.h"
#include "llcachename.h"
#include "llfloaterreg.h"
#include "llinventory.h"
@@ -58,7 +59,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";
}
@@ -67,7 +69,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
@@ -297,10 +300,20 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(
break;
case INDIVIDUAL:
{
- std::string name;
- if (gCacheName->getFullName(id, name))
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(id, &av_name))
{
- fullname = 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;
}
@@ -355,34 +368,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);
}
}
}
@@ -391,19 +395,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();