diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 12 | ||||
-rw-r--r-- | indra/llmessage/llavatarnamecache.h | 5 | ||||
-rw-r--r-- | indra/newview/llavatarlist.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llavatarlist.h | 6 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 1 | ||||
-rw-r--r-- | indra/newview/llcallfloater.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llcallfloater.h | 1 |
8 files changed, 68 insertions, 8 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 8158c17974..2f2d9099a3 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -41,6 +41,8 @@ namespace LLAvatarNameCache { + use_display_name_signal_t mUseDisplayNamesSignal; + // Manual override for display names - can disable even if the region // supports it. bool sUseDisplayNames = true; @@ -691,6 +693,8 @@ void LLAvatarNameCache::setUseDisplayNames(bool use) sUseDisplayNames = use; // flush our cache sCache.clear(); + + mUseDisplayNamesSignal(); } } @@ -751,6 +755,13 @@ bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires) return false; } + +void LLAvatarNameCache::addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb) +{ + mUseDisplayNamesSignal.connect(cb); +} + + static const std::string MAX_AGE("max-age"); static const boost::char_separator<char> EQUALS_SEPARATOR("="); static const boost::char_separator<char> COMMA_SEPARATOR(","); @@ -809,4 +820,3 @@ bool max_age_from_cache_control(const std::string& cache_control, S32 *max_age) return false; } - diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 6d199fd09a..8f21ace96a 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -37,6 +37,9 @@ class LLUUID; namespace LLAvatarNameCache { + + typedef boost::signals2::signal<void (void)> use_display_name_signal_t; + // Until the cache is set running, immediate lookups will fail and // async lookups will be queued. This allows us to block requests // until we know if the first region supports display names. @@ -88,6 +91,8 @@ namespace LLAvatarNameCache // Compute name expiration time from HTTP Cache-Control header, // or return default value, in seconds from epoch. F64 nameExpirationFromHeaders(LLSD headers); + + void addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb); } // Parse a cache-control header to get the max-age delta-seconds. diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 24596e5723..9b1e7c3f45 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -117,6 +117,7 @@ LLAvatarList::LLAvatarList(const Params& p) , mShowLastInteractionTime(p.show_last_interaction_time) , mContextMenu(NULL) , mDirty(true) // to force initial update +, mNeedUpdateNames(false) , mLITUpdateTimer(NULL) , mShowIcons(true) , mShowInfoBtn(p.show_info_btn) @@ -134,8 +135,17 @@ LLAvatarList::LLAvatarList(const Params& p) mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update mLITUpdateTimer->start(); } + + LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this)); +} + + +void LLAvatarList::handleDisplayNamesOptionChanged() +{ + mNeedUpdateNames = true; } + LLAvatarList::~LLAvatarList() { delete mLITUpdateTimer; @@ -155,6 +165,11 @@ void LLAvatarList::draw() LLFlatListViewEx::draw(); + if (mNeedUpdateNames) + { + updateAvatarNames(); + } + if (mDirty) refresh(); @@ -218,7 +233,6 @@ void LLAvatarList::addAvalineItem(const LLUUID& item_id, const LLUUID& session_i ////////////////////////////////////////////////////////////////////////// // PROTECTED SECTION ////////////////////////////////////////////////////////////////////////// - void LLAvatarList::refresh() { bool have_names = TRUE; @@ -329,6 +343,20 @@ void LLAvatarList::refresh() onCommit(); } +void LLAvatarList::updateAvatarNames() +{ + std::vector<LLPanel*> items; + getItems(items); + + for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++) + { + LLAvatarListItem* item = static_cast<LLAvatarListItem*>(*it); + item->updateAvatarName(); + } + mNeedUpdateNames = false; +} + + bool LLAvatarList::filterHasMatches() { uuid_vec_t values = getIDs(); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 48bc76828e..0d34dce6d8 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -93,6 +93,7 @@ public: virtual S32 notifyParent(const LLSD& info); void addAvalineItem(const LLUUID& item_id, const LLUUID& session_id, const std::string& item_name); + void handleDisplayNamesOptionChanged(); protected: void refresh(); @@ -102,14 +103,17 @@ protected: const uuid_vec_t& vnew, uuid_vec_t& vadded, uuid_vec_t& vremoved); - void updateLastInteractionTimes(); + void updateLastInteractionTimes(); + void rebuildNames(); void onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask); + void updateAvatarNames(); private: bool mIgnoreOnlineStatus; bool mShowLastInteractionTime; bool mDirty; + bool mNeedUpdateNames; bool mShowIcons; bool mShowInfoBtn; bool mShowProfileBtn; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 51444569c1..d08943f825 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -334,6 +334,12 @@ std::string LLAvatarListItem::getAvatarToolTip() const return mAvatarName->getToolTip(); } +void LLAvatarListItem::updateAvatarName() +{ + LLAvatarNameCache::get(getAvatarId(), + boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2)); +} + //== PRIVATE SECITON ========================================================== void LLAvatarListItem::setNameInternal(const std::string& name, const std::string& highlight) diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 7bba6fdbd0..812b7dbe7d 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -86,6 +86,7 @@ public: virtual void changed(U32 mask); // from LLFriendObserver void setOnline(bool online); + void updateAvatarName(); // re-query the name cache void setAvatarName(const std::string& name); void setAvatarToolTip(const std::string& tooltip); void setHighlight(const std::string& highlight); diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index c0babc6851..bf976f6b66 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -114,6 +114,9 @@ LLCallFloater::LLCallFloater(const LLSD& key) // force docked state since this floater doesn't save it between recreations setDocked(true); + + // update the agent's name if display name setting change + LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLCallFloater::updateAgentModeratorState, this)); } LLCallFloater::~LLCallFloater() @@ -460,15 +463,12 @@ void LLCallFloater::setModeratorMutedVoice(bool moderator_muted) mSpeakingIndicator->setIsMuted(moderator_muted); } -void LLCallFloater::updateAgentModeratorState() +void LLCallFloater::onModeratorNameCache(const LLAvatarName& av_name) { std::string name; - // Just use display name, because it's you - LLAvatarName av_name; - LLAvatarNameCache::get(gAgentID, &av_name); name = av_name.mDisplayName; - if(gAgent.isInGroup(mSpeakerManager->getSessionID())) + if(mSpeakerManager && gAgent.isInGroup(mSpeakerManager->getSessionID())) { // This method can be called when LLVoiceChannel.mState == STATE_NO_CHANNEL_INFO // in this case there are not any speakers yet. @@ -486,6 +486,11 @@ void LLCallFloater::updateAgentModeratorState() mAgentPanel->getChild<LLUICtrl>("user_text")->setValue(name); } +void LLCallFloater::updateAgentModeratorState() +{ + LLAvatarNameCache::get(gAgentID, boost::bind(&LLCallFloater::onModeratorNameCache, this, _2)); +} + static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids) { // Get a list of participants from VoiceClient diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index cb4d175eb9..3bc7043353 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -126,6 +126,7 @@ private: void initAgentData(); void setModeratorMutedVoice(bool moderator_muted); void updateAgentModeratorState(); + void onModeratorNameCache(const LLAvatarName& av_name); /** * Sets initial participants voice states in avatar list (Invited, Joined, Has Left). |