summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelavatar.cpp
diff options
context:
space:
mode:
authorAndrew Meadows <andrew@lindenlab.com>2011-01-07 15:22:22 -0800
committerAndrew Meadows <andrew@lindenlab.com>2011-01-07 15:22:22 -0800
commitd23f7df822b6c0557f9426b5e1aa660b77aba01e (patch)
tree2e86e4ec60018beabd35a54cc18fdf322a504269 /indra/newview/llpanelavatar.cpp
parentcf64ecb41dbbdcdc3c512510c4a7ebd28c832314 (diff)
parentc132d20a7433e2d09e3521a15497f661fcbd18b8 (diff)
merge
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r--indra/newview/llpanelavatar.cpp93
1 files changed, 66 insertions, 27 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 57180f63b5..94b2340c93 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -34,6 +34,7 @@
#include "llcombobox.h"
#include "lldateutil.h" // ageFromDate()
#include "llimview.h"
+#include "llmenubutton.h"
#include "llnotificationsutil.h"
#include "lltexteditor.h"
#include "lltexturectrl.h"
@@ -340,10 +341,11 @@ LLPanelAvatarNotes::~LLPanelAvatarNotes()
if(getAvatarId().notNull())
{
LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
- }
+ }
+
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
}
@@ -475,11 +477,11 @@ 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);
childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL);
- childSetCommitCallback("overflow_btn", boost::bind(&LLPanelAvatarProfile::onOverflowButtonClicked, this), NULL);
childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL);
childSetCommitCallback("show_on_map_btn", (boost::bind(
&LLPanelAvatarProfile::onMapButtonClick, this)), NULL);
@@ -500,7 +502,8 @@ BOOL LLPanelAvatarProfile::postBuild()
enable.add("Profile.EnableBlock", boost::bind(&LLPanelAvatarProfile::enableBlock, this));
enable.add("Profile.EnableUnblock", boost::bind(&LLPanelAvatarProfile::enableUnblock, this));
- mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ LLToggleableMenu* profile_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ getChild<LLMenuButton>("overflow_btn")->setMenu(profile_menu, LLMenuButton::MP_TOP_RIGHT);
LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
@@ -622,6 +625,35 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g
getChild<LLUICtrl>("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;
+
+ 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<LLUICtrl>("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<LLUICtrl>("display_name_descr_text")->setValue(display_name);
+}
+
void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
{
//remove avatar id from cache to get fresh info
@@ -633,6 +665,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<LLUICtrl>("register_date")->setValue(register_date );
@@ -732,6 +782,11 @@ void LLPanelAvatarProfile::onAddFriendButtonClick()
LLAvatarActions::requestFriendshipDialog(getAvatarId());
}
+void LLPanelAvatarProfile::onSeeProfileBtnClick()
+{
+ LLAvatarActions::showProfile(getAvatarId());
+}
+
void LLPanelAvatarProfile::onIMButtonClick()
{
LLAvatarActions::startIM(getAvatarId());
@@ -752,32 +807,16 @@ void LLPanelAvatarProfile::onShareButtonClick()
//*TODO not implemented
}
-void LLPanelAvatarProfile::onOverflowButtonClicked()
-{
- if (!mProfileMenu->toggleVisibility())
- return;
-
- LLView* btn = getChild<LLView>("overflow_btn");
-
- if (mProfileMenu->getButtonRect().isEmpty())
- {
- mProfileMenu->setButtonRect(btn);
- }
- mProfileMenu->updateParent(LLMenuGL::sMenuContainer);
-
- LLRect rect = btn->getRect();
- LLMenuGL::showPopup(this, mProfileMenu, rect.mRight, rect.mTop);
-}
-
LLPanelAvatarProfile::~LLPanelAvatarProfile()
{
if(getAvatarId().notNull())
{
LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
- }
+ }
+
+ if(LLVoiceClient::instanceExists())
+ {
+ LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
}