From 146e9d5e4d9a9a4f33d9ccd47a901980972b7ab9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 17:06:18 -0800 Subject: Support returning full_name (and SLID) for LLCacheName::get() calls Changed callback signature to full_name instead of first_name,last_name Eliminated all calls to legacy (non-signal/non-boost-bind) lookup mechanism Change Pay dialog names to SLURL links Tweaked layout of Pay Resident and Pay via Object floaters to make SLURLs fit Consolidate name first + " " + last concatenation in LLCacheName::buildFullName() Reviewed with Kelly --- indra/newview/llnamelistctrl.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'indra/newview/llnamelistctrl.cpp') diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 6375362ae2..c9fbf35033 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -314,22 +314,11 @@ 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::refresh(const LLUUID& id, const std::string& full_name, bool is_group) { //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " // << last << "'" << llendl; - std::string fullname; - if (!is_group) - { - fullname = first + " " + last; - } - else - { - fullname = first; - } - // TODO: scan items for that ID, fix if necessary item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) @@ -341,7 +330,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, cell = item->getColumn(mNameColumnIndex); if (cell) { - cell->setValue(fullname); + cell->setValue(full_name); } } } @@ -351,14 +340,13 @@ 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) +void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group) { LLInstanceTracker::instance_iter it; for (it = beginInstances(); it != endInstances(); ++it) { LLNameListCtrl& ctrl = *it; - ctrl.refresh(id, first, last, is_group); + ctrl.refresh(id, full_name, is_group); } } -- cgit v1.2.3 From 14f423a23c38bf554e9633752074fbcabd92599c Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 13 May 2010 12:18:10 -0700 Subject: 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. --- indra/newview/llnamelistctrl.cpp | 51 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'indra/newview/llnamelistctrl.cpp') 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 +#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::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(); -- cgit v1.2.3 From d674d11f895b8f3d578cded931cdc1c430379c95 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 21 May 2010 17:11:31 -0700 Subject: Rename LLAvatarName::getNameAndSLID() to getCompleteName() Discussed with Leyla/Richard --- indra/newview/llnamelistctrl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llnamelistctrl.cpp') diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 2a7e84256e..a2450fcdd2 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -306,7 +306,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( if (mShortNames) fullname = av_name.mDisplayName; else - fullname = av_name.getNameAndSLID(); + fullname = av_name.getCompleteName(); } else { @@ -375,7 +375,7 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, if (mShortNames) name = av_name.mDisplayName; else - name = av_name.getNameAndSLID(); + name = av_name.getCompleteName(); item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) -- cgit v1.2.3 From 9b5004a72d9726a0f7372faf16218f2edadc875d Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 21 Jul 2010 16:59:18 -0700 Subject: DEV-50468 ??? (???) shown in create group window under members by default --- indra/newview/llnamelistctrl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llnamelistctrl.cpp') diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 3d15f8288f..fd0359368d 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -45,6 +45,7 @@ #include "llscrolllistcolumn.h" #include "llsdparam.h" #include "lltooltip.h" +#include "lltrans.h" static LLDefaultChildRegistry::Register r("name_list"); @@ -301,7 +302,11 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( case INDIVIDUAL: { LLAvatarName av_name; - if (LLAvatarNameCache::get(id, &av_name)) + if (id.isNull()) + { + fullname = LLTrans::getString("AvatarNameNobody"); + } + else if (LLAvatarNameCache::get(id, &av_name)) { if (mShortNames) fullname = av_name.mDisplayName; -- cgit v1.2.3