diff options
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 109 |
1 files changed, 80 insertions, 29 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 85e95ca1d6..86f101e012 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; } @@ -194,10 +196,9 @@ void LLPanelAvatarNotes::fillRightsData() childSetValue("map_check",LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); childSetValue("objects_check",LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); - childSetEnabled("status_check",TRUE); - childSetEnabled("map_check",TRUE); - childSetEnabled("objects_check",TRUE); } + + enableCheckboxes(NULL != relation); } void LLPanelAvatarNotes::onCommitNotes() @@ -248,6 +249,17 @@ void LLPanelAvatarNotes::confirmModifyRights(bool grant, S32 rights) void LLPanelAvatarNotes::onCommitRights() { + const LLRelationship* buddy_relationship = + LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + + if (NULL == buddy_relationship) + { + // Lets have a warning log message instead of having a crash. EXT-4947. + llwarns << "Trying to modify rights for non-friend avatar. Skipped." << llendl; + return; + } + + S32 rights = 0; if(childGetValue("status_check").asBoolean()) @@ -257,8 +269,6 @@ void LLPanelAvatarNotes::onCommitRights() if(childGetValue("objects_check").asBoolean()) rights |= LLRelationship::GRANT_MODIFY_OBJECTS; - const LLRelationship* buddy_relationship = - LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); bool allow_modify_objects = childGetValue("objects_check").asBoolean(); // if modify objects checkbox clicked @@ -302,9 +312,7 @@ void LLPanelAvatarNotes::resetControls() //Disable "Add Friend" button for friends. childSetEnabled("add_friend", TRUE); - childSetEnabled("status_check",FALSE); - childSetEnabled("map_check",FALSE); - childSetEnabled("objects_check",FALSE); + enableCheckboxes(false); } void LLPanelAvatarNotes::onAddFriendButtonClick() @@ -332,11 +340,20 @@ void LLPanelAvatarNotes::onShareButtonClick() //*TODO not implemented. } +void LLPanelAvatarNotes::enableCheckboxes(bool enable) +{ + childSetEnabled("status_check", enable); + childSetEnabled("map_check", enable); + childSetEnabled("objects_check", enable); +} + LLPanelAvatarNotes::~LLPanelAvatarNotes() { if(getAvatarId().notNull()) { LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); + if(LLVoiceClient::getInstance()) + LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); } } @@ -344,6 +361,20 @@ LLPanelAvatarNotes::~LLPanelAvatarNotes() void LLPanelAvatarNotes::changed(U32 mask) { childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId())); + + // update rights to avoid have checkboxes enabled when friendship is terminated. EXT-4947. + fillRightsData(); +} + +// 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) @@ -424,20 +455,21 @@ void LLPanelProfileTab::onMapButtonClick() void LLPanelProfileTab::updateButtons() { - bool is_avatar_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); + bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); if(LLAvatarActions::isFriend(getAvatarId())) { - childSetEnabled("teleport", is_avatar_online); + childSetEnabled("teleport", is_buddy_online); } else { childSetEnabled("teleport", true); } - bool enable_map_btn = is_avatar_online && gAgent.isGodlike() || is_agent_mappable(getAvatarId()); + bool enable_map_btn = (is_buddy_online && + is_agent_mappable(getAvatarId())) + || gAgent.isGodlike(); childSetEnabled("show_on_map_btn", enable_map_btn); - childSetEnabled("call", LLAvatarActions::canCall(getAvatarId())); } ////////////////////////////////////////////////////////////////////////// @@ -469,6 +501,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 +509,8 @@ BOOL LLPanelAvatarProfile::postBuild() LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; enable.add("Profile.EnableGod", boost::bind(&enable_god)); + 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()); @@ -485,6 +520,8 @@ BOOL LLPanelAvatarProfile::postBuild() pic = getChild<LLTextureCtrl>("real_world_pic"); pic->setFallbackImageName("default_profile_picture.j2c"); + gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this); + resetControls(); resetData(); @@ -568,8 +605,6 @@ void LLPanelAvatarProfile::processProfileProperties(const LLAvatarData* avatar_d fillPartnerData(avatar_data); - fillOnlineStatus(avatar_data); - fillAccountStatus(avatar_data); } @@ -621,6 +656,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 +675,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; @@ -674,6 +697,21 @@ void LLPanelAvatarProfile::share() LLAvatarActions::share(getAvatarId()); } +void LLPanelAvatarProfile::toggleBlock() +{ + LLAvatarActions::toggleBlock(getAvatarId()); +} + +bool LLPanelAvatarProfile::enableBlock() +{ + return LLAvatarActions::canBlock(getAvatarId()) && !LLAvatarActions::isBlocked(getAvatarId()); +} + +bool LLPanelAvatarProfile::enableUnblock() +{ + return LLAvatarActions::isBlocked(getAvatarId()); +} + void LLPanelAvatarProfile::kick() { LLAvatarActions::kick(getAvatarId()); @@ -757,6 +795,8 @@ LLPanelAvatarProfile::~LLPanelAvatarProfile() if(getAvatarId().notNull()) { LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); + if(LLVoiceClient::getInstance()) + LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); } } @@ -766,6 +806,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()) |