diff options
Diffstat (limited to 'indra/newview')
-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 |
6 files changed, 52 insertions, 7 deletions
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). |