summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-05-13 12:18:10 -0700
committerJames Cook <james@lindenlab.com>2010-05-13 12:18:10 -0700
commit14f423a23c38bf554e9633752074fbcabd92599c (patch)
treec7d7435dfad057b77e8c07584a21226daed344af /indra/newview
parentb95d1142a0a9c91388d4674951c319fff0785c0c (diff)
DEV-50013 General "name list" support for display name +/- SLID
Added lookups via new name cache system. Added optional short_name parameter to show only display names in the list (don't need this yet). Removed top-level global refresh of all name list controls when legacy name cache receives names -- it was inefficient and we don't need it anymore. Reviewed with Leyla.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llnamelistctrl.cpp51
-rw-r--r--indra/newview/llnamelistctrl.h8
-rw-r--r--indra/newview/llstartup.cpp1
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_general.xml1
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_roles.xml1
5 files changed, 33 insertions, 29 deletions
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index c5706e8345..2a7e84256e 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.getNameAndSLID();
+ }
+ else
+ {
+ // ...schedule a callback
+ LLAvatarNameCache::get(id,
+ boost::bind(&LLNameListCtrl::onAvatarNameCache,
+ this, _1, _2));
}
break;
}
@@ -355,23 +368,25 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
}
}
-// public
-void LLNameListCtrl::refresh(const LLUUID& id, const std::string& full_name, bool is_group)
+void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name)
{
- //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " "
- // << last << "'" << llendl;
+ std::string name;
+ if (mShortNames)
+ name = av_name.mDisplayName;
+ else
+ name = av_name.getNameAndSLID();
- // 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(full_name);
+ cell->setValue(name);
}
}
}
@@ -380,18 +395,6 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& full_name, boo
}
-// static
-void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group)
-{
- LLInstanceTrackerScopedGuard guard;
- LLInstanceTracker<LLNameListCtrl>::instance_iter it;
- for (it = guard.beginInstances(); it != guard.endInstances(); ++it)
- {
- LLNameListCtrl& ctrl = *it;
- ctrl.refresh(id, full_name, is_group);
- }
-}
-
void LLNameListCtrl::updateColumns()
{
LLScrollListCtrl::updateColumns();
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h
index 6d61214712..54237f4305 100644
--- a/indra/newview/llnamelistctrl.h
+++ b/indra/newview/llnamelistctrl.h
@@ -37,6 +37,7 @@
#include "llscrolllistctrl.h"
+class LLAvatarName;
class LLNameListCtrl
: public LLScrollListCtrl, protected LLInstanceTracker<LLNameListCtrl>
@@ -80,6 +81,7 @@ public:
{
Optional<NameColumn> name_column;
Optional<bool> allow_calling_card_drop;
+ Optional<bool> short_names;
Params();
};
@@ -105,10 +107,6 @@ public:
void removeNameItem(const LLUUID& agent_id);
- void refresh(const LLUUID& id, const std::string& full_name, bool is_group);
-
- static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);
-
// LLView interface
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
@@ -123,11 +121,13 @@ public:
/*virtual*/ void mouseOverHighlightNthItem( S32 index );
private:
void showInspector(const LLUUID& avatar_id, bool is_group);
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
private:
S32 mNameColumnIndex;
std::string mNameColumn;
BOOL mAllowCallingCardDrop;
+ bool mShortNames; // display name only, no SLID
};
/**
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 8f53463269..689275421d 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -269,7 +269,6 @@ void transition_back_to_login_panel(const std::string& emsg);
void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group)
{
- LLNameListCtrl::refreshAll(id, full_name, is_group);
LLNameBox::refreshAll(id, full_name, is_group);
LLNameEditor::refreshAll(id, full_name, is_group);
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 9341d433e8..d7a4094d50 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -112,6 +112,7 @@ Hover your mouse over the options for more help.
layout="topleft"
left="0"
name="visible_members"
+ short_names="false"
top_pad="2">
<name_list.columns
label="Member"
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index 0eb5c47f85..0255cf80a1 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -81,6 +81,7 @@ clicking on their names.
right="-1"
multi_select="true"
name="member_list"
+ short_names="false"
top_pad="5">
<name_list.columns
label="Member"