summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r--indra/newview/llpanelavatar.cpp79
1 files changed, 61 insertions, 18 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 85e95ca1d6..4a7cdfc856 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -165,6 +165,8 @@ BOOL LLPanelAvatarNotes::postBuild()
resetControls();
resetData();
+ gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
+
return TRUE;
}
@@ -337,6 +339,8 @@ LLPanelAvatarNotes::~LLPanelAvatarNotes()
if(getAvatarId().notNull())
{
LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+ if(LLVoiceClient::getInstance())
+ LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
}
@@ -346,6 +350,17 @@ void LLPanelAvatarNotes::changed(U32 mask)
childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
}
+// virtual
+void LLPanelAvatarNotes::onChange(EStatusType status, const std::string &channelURI, bool proximal)
+{
+ if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
+ {
+ return;
+ }
+
+ childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
+}
+
void LLPanelAvatarNotes::setAvatarId(const LLUUID& id)
{
if(id.notNull())
@@ -437,7 +452,6 @@ void LLPanelProfileTab::updateButtons()
bool enable_map_btn = is_avatar_online && gAgent.isGodlike() || is_agent_mappable(getAvatarId());
childSetEnabled("show_on_map_btn", enable_map_btn);
- childSetEnabled("call", LLAvatarActions::canCall(getAvatarId()));
}
//////////////////////////////////////////////////////////////////////////
@@ -469,6 +483,7 @@ BOOL LLPanelAvatarProfile::postBuild()
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this));
registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this));
+ registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this));
registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this));
registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this));
registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this));
@@ -476,6 +491,8 @@ BOOL LLPanelAvatarProfile::postBuild()
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable;
enable.add("Profile.EnableGod", boost::bind(&enable_god));
+ enable.add("Profile.CheckItem", boost::bind(&LLPanelAvatarProfile::checkOverflowMenuItem, this, _2));
+ enable.add("Profile.EnableItem", boost::bind(&LLPanelAvatarProfile::enableOverflowMenuItem, this, _2));
mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
@@ -485,6 +502,8 @@ BOOL LLPanelAvatarProfile::postBuild()
pic = getChild<LLTextureCtrl>("real_world_pic");
pic->setFallbackImageName("default_profile_picture.j2c");
+ gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
+
resetControls();
resetData();
@@ -568,8 +587,6 @@ void LLPanelAvatarProfile::processProfileProperties(const LLAvatarData* avatar_d
fillPartnerData(avatar_data);
- fillOnlineStatus(avatar_data);
-
fillAccountStatus(avatar_data);
}
@@ -621,6 +638,9 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
childSetValue("2nd_life_pic", avatar_data->image_id);
childSetValue("real_world_pic", avatar_data->fl_image_id);
childSetValue("homepage_edit", avatar_data->profile_url);
+
+ // Hide home page textbox if no page was set to fix "homepage URL appears clickable without URL - EXT-4734"
+ childSetVisible("homepage_edit", !avatar_data->profile_url.empty());
}
void LLPanelAvatarProfile::fillPartnerData(const LLAvatarData* avatar_data)
@@ -637,21 +657,6 @@ void LLPanelAvatarProfile::fillPartnerData(const LLAvatarData* avatar_data)
}
}
-void LLPanelAvatarProfile::fillOnlineStatus(const LLAvatarData* avatar_data)
-{
- bool online = avatar_data->flags & AVATAR_ONLINE;
- if(LLAvatarActions::isFriend(avatar_data->avatar_id))
- {
- // Online status NO could be because they are hidden
- // If they are a friend, we may know the truth!
- online = LLAvatarTracker::instance().isBuddyOnline(avatar_data->avatar_id);
- }
- childSetValue("online_status", online ?
- "Online" : "Offline");
- childSetColor("online_status", online ?
- LLColor4::green : LLColor4::red);
-}
-
void LLPanelAvatarProfile::fillAccountStatus(const LLAvatarData* avatar_data)
{
LLStringUtil::format_map_t args;
@@ -664,6 +669,26 @@ void LLPanelAvatarProfile::fillAccountStatus(const LLAvatarData* avatar_data)
childSetValue("acc_status_text", caption_text);
}
+bool LLPanelAvatarProfile::checkOverflowMenuItem(const LLSD& param)
+{
+ std::string item = param.asString();
+
+ if (item == "is_blocked")
+ return LLAvatarActions::isBlocked(getAvatarId());
+
+ return false;
+}
+
+bool LLPanelAvatarProfile::enableOverflowMenuItem(const LLSD& param)
+{
+ std::string item = param.asString();
+
+ if (item == "can_block")
+ return LLAvatarActions::canBlock(getAvatarId());
+
+ return false;
+}
+
void LLPanelAvatarProfile::pay()
{
LLAvatarActions::pay(getAvatarId());
@@ -674,6 +699,11 @@ void LLPanelAvatarProfile::share()
LLAvatarActions::share(getAvatarId());
}
+void LLPanelAvatarProfile::toggleBlock()
+{
+ LLAvatarActions::toggleBlock(getAvatarId());
+}
+
void LLPanelAvatarProfile::kick()
{
LLAvatarActions::kick(getAvatarId());
@@ -757,6 +787,8 @@ LLPanelAvatarProfile::~LLPanelAvatarProfile()
if(getAvatarId().notNull())
{
LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+ if(LLVoiceClient::getInstance())
+ LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
}
@@ -766,6 +798,17 @@ void LLPanelAvatarProfile::changed(U32 mask)
childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
}
+// virtual
+void LLPanelAvatarProfile::onChange(EStatusType status, const std::string &channelURI, bool proximal)
+{
+ if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
+ {
+ return;
+ }
+
+ childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
+}
+
void LLPanelAvatarProfile::setAvatarId(const LLUUID& id)
{
if(id.notNull())