diff options
-rw-r--r-- | indra/newview/llavataractions.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llavataractions.h | 10 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 32 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_notes.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_people.xml | 210 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_profile.xml | 1 |
8 files changed, 149 insertions, 173 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 3fc37aa3d5..dae4296a82 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -186,6 +186,38 @@ void LLAvatarActions::startIM(const LLUUID& id) } // static +void LLAvatarActions::startCall(const LLUUID& id) +{ + if (id.isNull() || isCalling(id)) + { + return; + } + + std::string name; + gCacheName->getFullName(id, name); + LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id); + if (session_id != LLUUID::null) + { + // always open IM window when connecting to voice + LLIMFloater::show(session_id); + gIMMgr->startCall(session_id); + } + make_ui_sound("UISndStartIM"); +} + +// static +bool LLAvatarActions::isCalling(const LLUUID &id) +{ + if (id.isNull()) + { + return false; + } + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + return (LLIMModel::getInstance()->findIMSession(session_id) != NULL); +} + +// static void LLAvatarActions::startConference(const std::vector<LLUUID>& ids) { // *HACK: Copy into dynamic array diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 512f673b43..0ec20ae357 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -67,6 +67,11 @@ public: static void startIM(const LLUUID& id); /** + * Start an avatar-to-avatar voice call with another user + */ + static void startCall(const LLUUID& id); + + /** * Start conference chat with the given avatars. */ static void startConference(const std::vector<LLUUID>& ids); @@ -97,6 +102,11 @@ public: static bool isBlocked(const LLUUID& id); /** + * Return true if the avatar is in a P2P voice call with a given user + */ + static bool isCalling(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 6413d939f0..3b54f1546e 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -255,7 +255,7 @@ void LLPanelAvatarNotes::onTeleportButtonClick() void LLPanelAvatarNotes::onCallButtonClick() { - //*TODO not implemented. + LLAvatarActions::startCall(getAvatarId()); } void LLPanelAvatarNotes::onShareButtonClick() @@ -544,7 +544,7 @@ void LLPanelAvatarProfile::onTeleportButtonClick() void LLPanelAvatarProfile::onCallButtonClick() { - //*TODO not implemented + LLAvatarActions::startCall(getAvatarId()); } void LLPanelAvatarProfile::onShareButtonClick() diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index bb6cdd2f78..0c66e7155c 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -588,14 +588,9 @@ void LLPanelPeople::updateRecentList() void LLPanelPeople::buttonSetVisible(std::string btn_name, BOOL visible) { - // Currently all bottom buttons are wrapped with layout panels. - // Hiding a button has no effect: the panel still occupies its space. - // So we have to hide the whole panel (along with its button) - // to free some space up. - LLButton* btn = getChild<LLView>("button_bar")->getChild<LLButton>(btn_name); - LLPanel* btn_parent = dynamic_cast<LLPanel*>(btn->getParent()); - if (btn_parent) - btn_parent->setVisible(visible); + // To make sure we're referencing the right widget (a child of the button bar). + LLButton* button = getChild<LLView>("button_bar")->getChild<LLButton>(btn_name); + button->setVisible(visible); } void LLPanelPeople::buttonSetEnabled(const std::string& btn_name, bool enabled) @@ -624,14 +619,16 @@ void LLPanelPeople::updateButtons() std::vector<LLUUID> selected_uuids; getCurrentItemIDs(selected_uuids); bool item_selected = (selected_uuids.size() == 1); + bool multiple_selected = (selected_uuids.size() >= 1); buttonSetVisible("group_info_btn", group_tab_active); buttonSetVisible("chat_btn", group_tab_active); buttonSetVisible("add_friend_btn", nearby_tab_active || recent_tab_active); buttonSetVisible("view_profile_btn", !group_tab_active); buttonSetVisible("im_btn", !group_tab_active); + buttonSetVisible("call_btn", !group_tab_active); buttonSetVisible("teleport_btn", friends_tab_active); - buttonSetVisible("share_btn", !recent_tab_active && false); // not implemented yet + buttonSetVisible("share_btn", nearby_tab_active || friends_tab_active); if (group_tab_active) { @@ -664,8 +661,8 @@ void LLPanelPeople::updateButtons() buttonSetEnabled("teleport_btn", friends_tab_active && item_selected); buttonSetEnabled("view_profile_btn", item_selected); - buttonSetEnabled("im_btn", (selected_uuids.size() >= 1)); // allow starting the friends conference for multiple selection - buttonSetEnabled("call_btn", item_selected && false); // not implemented yet + buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection + buttonSetEnabled("call_btn", item_selected); buttonSetEnabled("share_btn", item_selected && false); // not implemented yet bool none_group_selected = item_selected && selected_id.isNull(); @@ -1071,7 +1068,18 @@ bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata) void LLPanelPeople::onCallButtonClicked() { - // *TODO: not implemented yet + std::vector<LLUUID> selected_uuids; + getCurrentItemIDs(selected_uuids); + + if (selected_uuids.size() == 1) + { + // initiate a P2P voice chat with the selected user + LLAvatarActions::startCall(getCurrentItemID()); + } + else if (selected_uuids.size() > 1) + { + // *NOTE: ad-hoc voice chat not implemented yet + } } void LLPanelPeople::onTeleportButtonClicked() diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4d4ad1c022..cb1be5fabc 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6252,25 +6252,20 @@ class LLAvatarSendIM : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(avatar) { - std::string name("IM"); - LLNameValue *first = avatar->getNVPair("FirstName"); - LLNameValue *last = avatar->getNVPair("LastName"); - if (first && last) - { - name.assign( first->getString() ); - name.append(" "); - name.append( last->getString() ); - } + LLAvatarActions::startIM(avatar->getID()); + } + return true; + } +}; - //EInstantMessage type = have_agent_callingcard(gLastHitObjectID) - // ? IM_SESSION_ADD : IM_SESSION_CARDLESS_START; - LLUUID session_id = gIMMgr->addSession(name, - IM_NOTHING_SPECIAL, - avatar->getID()); - if (session_id != LLUUID::null) - { - LLIMFloater::show(session_id); - } +class LLAvatarCall : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); + if(avatar) + { + LLAvatarActions::startCall(avatar->getID()); } return true; } @@ -7941,6 +7936,7 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarGiveCard(), "Avatar.GiveCard"); commit.add("Avatar.Eject", boost::bind(&handle_avatar_eject, LLSD())); view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM"); + view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call"); view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); diff --git a/indra/newview/skins/default/xui/en/panel_notes.xml b/indra/newview/skins/default/xui/en/panel_notes.xml index b9c9100ebc..c02dabed2c 100644 --- a/indra/newview/skins/default/xui/en/panel_notes.xml +++ b/indra/newview/skins/default/xui/en/panel_notes.xml @@ -132,7 +132,6 @@ left_pad="5" width="40" /> <button - enabled="false" follows="bottom|left" height="19" label="Call" diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index d6e2aa64fa..15fdd73bdc 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -329,156 +329,88 @@ background_visible="true" </panel> </panel> </tab_container> - <layout_stack - animate="false" - border_size="0" - follows="left|right|bottom" + <panel + follows="bottom|left" height="25" layout="topleft" left="10" name="button_bar" - orientation="horizontal" width="313"> - <layout_panel - default_tab_group="1" - follows="left|top" - height="25" - layout="topleft" + <button + follows="bottom|left" + font="SansSerifSmall" + top="4" left="0" - name="view_profile_btn_panel" - top="-25" - width="100"> - <button - follows="top|left" - font="SansSerifSmall" - height="19" - label="Profile" - layout="topleft" - name="view_profile_btn" - tool_tip="Show picture, groups, and other residents information" - width="100" /> - </layout_panel> - <layout_panel - default_tab_group="1" - follows="left|top" height="19" + label="Profile" layout="topleft" - left="0" - min_width="80" - name="group_info_btn_panel" - width="100"> - <button - follows="top|left" - font="SansSerifSmall" - height="19" - label="Group Profile" - layout="topleft" - name="group_info_btn" - tool_tip="Show group information" - width="100" /> - </layout_panel> - <layout_panel - default_tab_group="1" - follows="left|top" - height="25" - layout="topleft" - left_pad="5" - min_width="45" - name="chat_btn_panel" - top_delta="0" - width="100"> - <button - follows="top|left" - font="SansSerifSmall" - height="19" - label="Group Chat" - layout="topleft" - name="chat_btn" - tool_tip="Open chat session" - width="100" /> - </layout_panel> - <layout_panel - default_tab_group="1" - follows="left|top|" - height="25" + name="view_profile_btn" + tool_tip="Show picture, groups, and other residents information" + width="70" /> + <button + follows="bottom|left" + font="SansSerifSmall" + top="4" + left_pad="2" + height="19" + label="IM" layout="topleft" - left_pad="5" - min_width="35" - name="im_btn_panel" - top_delta="0" - width="50"> - <button - follows="top|left" - font="SansSerifSmall" - height="19" - label="IM" - layout="topleft" - name="im_btn" - tool_tip="Open instant message session" - width="50" /> - </layout_panel> - <layout_panel - default_tab_group="1" - follows="left|top|right" - height="25" + name="im_btn" + tool_tip="Open instant message session" + width="45" /> + <button + follows="bottom|left" + font="SansSerifSmall" + top="4" + left_pad="2" + height="19" + label="Call" layout="topleft" - left_pad="5" - min_width="40" - name="call_btn_panel" - top_delta="0" - visible="false" - width="40"> - <button - enabled="false" - follows="top|left" - font="SansSerifSmall" - height="19" - label="Call" - layout="topleft" - name="call_btn" - width="50" /> - </layout_panel> - <layout_panel - default_tab_group="1" + name="call_btn" + tool_tip="Call this resident" + width="50" /> + <button follows="left|top" - height="25" + font="SansSerifSmall" + top="4" + left_pad="2" + height="19" + label="Share" layout="topleft" - left_pad="5" - min_width="65" - name="teleport_btn_panel" - top_delta="0" - width="100"> - <button - follows="left|top" - font="SansSerifSmall" - height="19" - label="Teleport" - layout="topleft" - name="teleport_btn" - tool_tip="Offer teleport" - width="100" /> - </layout_panel> - <layout_panel - default_tab_group="1" - enabled="false" - follows="left|top" - height="25" + name="share_btn" + width="60" /> + <button + follows="bottom|left" + font="SansSerifSmall" + top="4" + left_pad="2" + height="19" + label="Teleport" layout="topleft" - left_pad="5" - min_width="50" - name="share_btn_panel" - top_delta="0" - visible="false" - width="80"> - <button - enabled="false" - follows="top|left" - font="SansSerifSmall" - height="19" - label="Share" - layout="topleft" - name="share_btn" - width="80" /> - </layout_panel> - </layout_stack> + name="teleport_btn" + tool_tip="Offer teleport" + width="75" /> + <button + follows="bottom|left" + font="SansSerifSmall" + top="4" + left="0" + height="19" + label="Group Profile" + layout="topleft" + name="group_info_btn" + tool_tip="Show group information" + width="110" /> + <button + follows="bottom|left" + font="SansSerifSmall" + top="4" + left_pad="2" + height="19" + label="Group Chat" + layout="topleft" + name="chat_btn" + tool_tip="Open chat session" + width="110" /> + </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml index a0055383b1..0f5e96416d 100644 --- a/indra/newview/skins/default/xui/en/panel_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -294,7 +294,6 @@ left_pad="5" width="45" /> <button - enabled="false" follows="bottom|left" height="19" label="Call" |