From ed3ea14984e322462ed466805e47b29a6f658279 Mon Sep 17 00:00:00 2001 From: callum Date: Wed, 5 Jan 2011 15:49:57 -0800 Subject: SOCIAL-304 FIX Modify side panel to reflect Profiles changes --- indra/newview/llpanelavatar.cpp | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'indra/newview/llpanelavatar.cpp') diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index a9bcdef47c..54e1fd8fbf 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -477,6 +477,7 @@ LLPanelAvatarProfile::LLPanelAvatarProfile() BOOL LLPanelAvatarProfile::postBuild() { + childSetCommitCallback("see_profile_btn",(boost::bind(&LLPanelAvatarProfile::onSeeProfileBtnClick,this)),NULL); childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL); childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL); childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL); @@ -624,6 +625,24 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g getChild("sl_groups")->setValue(groups); } +void LLPanelAvatarProfile::got_full_name_callback( const LLUUID& id, const std::string& full_name, bool is_group ) +{ + LLStringUtil::format_map_t args; + args["[NAME]"] = full_name; + + std::string linden_name = getString("name_text_args", args); + getChild("name_descr_text")->setValue(linden_name); +} + +void LLPanelAvatarProfile::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + LLStringUtil::format_map_t args; + args["[DISPLAY_NAME]"] = av_name.mDisplayName; + + std::string display_name = getString("display_name_text_args", args); + getChild("display_name_descr_text")->setValue(display_name); +} + void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data) { //remove avatar id from cache to get fresh info @@ -635,6 +654,24 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data) LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch())); args["[REG_DATE]"] = birth_date; } + + // ask (asynchronously) for the avatar name + std::string full_name; + if (gCacheName->getFullName(avatar_data->agent_id, full_name)) + { + // name in cache, call callback directly + got_full_name_callback( avatar_data->agent_id, full_name, false ); + } + else + { + // not in cache, lookup name + gCacheName->get(avatar_data->agent_id, false, boost::bind( &LLPanelAvatarProfile::got_full_name_callback, this, _1, _2, _3 )); + } + + // get display name + LLAvatarNameCache::get(avatar_data->avatar_id, + boost::bind(&LLPanelAvatarProfile::onNameCache, this, _1, _2)); + args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now()); std::string register_date = getString("RegisterDateFormat", args); getChild("register_date")->setValue(register_date ); @@ -734,6 +771,11 @@ void LLPanelAvatarProfile::onAddFriendButtonClick() LLAvatarActions::requestFriendshipDialog(getAvatarId()); } +void LLPanelAvatarProfile::onSeeProfileBtnClick() +{ + LLAvatarActions::showProfile(getAvatarId()); +} + void LLPanelAvatarProfile::onIMButtonClick() { LLAvatarActions::startIM(getAvatarId()); -- cgit v1.2.3 From cf8a16366ab764ceb02bfe013a40f731812e727c Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 6 Jan 2011 13:41:04 -0800 Subject: SOCIAL-423 FIX Display name and username are wrong in My Profile tab --- indra/newview/llpanelavatar.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelavatar.cpp') diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 54e1fd8fbf..94b2340c93 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -628,7 +628,18 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g void LLPanelAvatarProfile::got_full_name_callback( const LLUUID& id, const std::string& full_name, bool is_group ) { LLStringUtil::format_map_t args; - args["[NAME]"] = full_name; + + std::string name; + if (LLAvatarNameCache::useDisplayNames()) + { + name = LLCacheName::buildUsername(full_name); + } + else + { + name = full_name; + } + + args["[NAME]"] = name; std::string linden_name = getString("name_text_args", args); getChild("name_descr_text")->setValue(linden_name); -- cgit v1.2.3