diff options
author | Paul Guslisty <pguslisty@productengine.com> | 2009-12-14 19:53:54 +0200 |
---|---|---|
committer | Paul Guslisty <pguslisty@productengine.com> | 2009-12-14 19:53:54 +0200 |
commit | fe0da9bf7b81d24a9614f95d9f91012796eabf77 (patch) | |
tree | b15ffe19dcd8ebee73bb500200af5d90f1577126 | |
parent | 37b039b9fd5d970b297715b9187b60a241e36a3a (diff) |
Fixed low bug EXT - 3255 (Call button is enabled in the People & Profile panels while voice is disabled)
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llavataractions.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llavataractions.h | 5 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelpeoplemenus.cpp | 18 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_people_nearby.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml | 3 |
8 files changed, 74 insertions, 2 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 5f90a7627f..33dc7ee2c8 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -61,6 +61,7 @@ #include "llviewerregion.h" #include "llimfloater.h" #include "lltrans.h" +#include "llcallingcard.h" // static void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name) @@ -265,6 +266,24 @@ bool LLAvatarActions::isCalling(const LLUUID &id) return (LLIMModel::getInstance()->findIMSession(session_id) != NULL); } +//static +bool LLAvatarActions::canCall(const LLUUID &id) +{ + if(isFriend(id)) + { + return LLAvatarTracker::instance().isBuddyOnline(id) && LLVoiceClient::voiceEnabled(); + } + else + { + // don't need to check online/offline status because "usual resident" (resident that is not a friend) + // can be only ONLINE. There is no way to see "usual resident" in OFFLINE status. If we see "usual + // resident" it automatically means that the resident is ONLINE. So to make a call to the "usual resident" + // we need to check only that "our" voice is enabled. + return LLVoiceClient::voiceEnabled(); + } + +} + // static void LLAvatarActions::startConference(const std::vector<LLUUID>& ids) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 2dd2a4c4b1..01c18d4228 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -129,6 +129,11 @@ public: static bool isCalling(const LLUUID &id); /** + * @return true if call to the resident can be made (resident is online and voice is enabled) + */ + + static bool canCall(const LLUUID &id); + /** * Invite avatar to a group. */ static void inviteToGroup(const LLUUID& id); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index b9f422ca6f..ffe7f57167 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -396,7 +396,7 @@ void LLPanelProfileTab::updateButtons() && gAgent.isGodlike() || is_agent_mappable(getAvatarId()); childSetEnabled("show_on_map_btn", enable_map_btn); - childSetEnabled("call", LLVoiceClient::voiceEnabled()); + childSetEnabled("call", LLAvatarActions::canCall(getAvatarId())); } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 79a593a8c9..e134840153 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -776,7 +776,7 @@ void LLPanelPeople::updateButtons() buttonSetEnabled("teleport_btn", friends_tab_active && item_selected && isFriendOnline(selected_uuids.front())); buttonSetEnabled("view_profile_btn", item_selected); buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection - buttonSetEnabled("call_btn", multiple_selected && LLVoiceClient::voiceEnabled()); + buttonSetEnabled("call_btn", multiple_selected && canCall()); buttonSetEnabled("share_btn", item_selected); // not implemented yet bool none_group_selected = item_selected && selected_id.isNull(); @@ -784,6 +784,29 @@ void LLPanelPeople::updateButtons() buttonSetEnabled("chat_btn", !none_group_selected); } +bool LLPanelPeople::canCall() +{ + std::vector<LLUUID> selected_uuids; + getCurrentItemIDs(selected_uuids); + + bool result = false; + + std::vector<LLUUID>::const_iterator + id = selected_uuids.begin(), + uuids_end = selected_uuids.end(); + + for (;id != uuids_end; ++id) + { + if (LLAvatarActions::canCall(*id)) + { + result = true; + break; + } + } + + return result; +} + std::string LLPanelPeople::getActiveTabName() const { return mTabContainer->getCurrentPanel()->getName(); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 750d3b573f..f5cdc0935c 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -73,6 +73,7 @@ private: bool isFriendOnline(const LLUUID& id); bool isItemsFreeOfFriends(const std::vector<LLUUID>& uuids); + bool canCall(); void updateButtons(); std::string getActiveTabName() const; diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 573de1e51c..0314642d9e 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -181,7 +181,25 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) const LLUUID& id = mUUIDs.front(); return LLAvatarActions::isFriend(id); } + else if (item == std::string("can_call")) + { + bool result = false; + int size = mUUIDs.size(); + std::cout << size << std::endl; + std::vector<LLUUID>::const_iterator + id = mUUIDs.begin(), + uuids_end = mUUIDs.end(); + for (;id != uuids_end; ++id) + { + if (LLAvatarActions::canCall(*id)) + { + result = true; + break; + } + } + return result; + } return false; } diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml index 39469f7101..5f2e6e0f6c 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml @@ -32,6 +32,9 @@ name="Call"> <menu_item_call.on_click function="Avatar.Call" /> + <menu_item_call.on_enable + function="Avatar.EnableItem" + parameter="can_call" /> </menu_item_call> <menu_item_call label="Share" diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml index df74d2dcd4..0d3dd3366d 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml @@ -27,6 +27,9 @@ name="Call"> <on_click function="Avatar.Call" /> + <on_enable + function="Avatar.EnableItem" + parameter="can_call" /> </menu_item_call> <menu_item_call enabled="false" |