diff options
-rw-r--r-- | indra/newview/llimview.cpp | 139 | ||||
-rw-r--r-- | indra/newview/llimview.h | 5 | ||||
-rw-r--r-- | indra/newview/llvoicechannel.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llvoicechannel.h | 1 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_outgoing_call.xml | 67 |
6 files changed, 89 insertions, 149 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ac21c5f4b0..d48aaf8461 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1096,19 +1096,29 @@ LLIMMgr::onConfirmForceCloseError( // Class LLOutgoingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) : - LLDockableFloater(NULL, payload), + LLDockableFloater(NULL, false, payload), mPayload(payload) { } -BOOL LLOutgoingCallDialog::postBuild() +void LLOutgoingCallDialog::getAllowedRect(LLRect& rect) { - BOOL success = LLFloater::postBuild(); + rect = gViewerWindow->getWorldViewRectRaw(); +} - LLSD callee_id = mPayload["session_id"];//mPayload["caller_id"]; +void LLOutgoingCallDialog::onOpen(const LLSD& key) +{ + // tell the user which voice channel they are leaving + if (!mPayload["old_channel_name"].asString().empty()) + { + childSetTextArg("leaving", "[CURRENT_CHAT]", mPayload["old_channel_name"].asString()); + } + else + { + childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat")); + } - std::string calling_str = getString("calling"); - std::string callee_name = mPayload["session_name"].asString();//mPayload["caller_name"].asString(); + std::string callee_name = mPayload["session_name"].asString(); if (callee_name == "anonymous") { callee_name = getString("anonymous"); @@ -1116,115 +1126,40 @@ BOOL LLOutgoingCallDialog::postBuild() setTitle(callee_name); - LLUICtrl* callee_name_widget = getChild<LLUICtrl>("callee name"); - // *TODO: substitute callee name properly - callee_name_widget->setValue(calling_str + " " + callee_name); + LLSD callee_id = mPayload["other_user_id"]; + childSetTextArg("calling", "[CALLEE_NAME]", callee_name); LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon"); icon->setValue(callee_id); - //childSetAction("Reject", onReject, this); - - return success; + // dock the dialog to the sys well, where other sys messages appear + setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(), + this, getDockTongue(), LLDockControl::TOP, + boost::bind(&LLOutgoingCallDialog::getAllowedRect, this, _1))); } -void LLOutgoingCallDialog::processCallResponse(S32 response) + +//static +void LLOutgoingCallDialog::onCancel(void* user_data) { + LLOutgoingCallDialog* self = (LLOutgoingCallDialog*)user_data; + if (!gIMMgr) return; - LLUUID session_id = mPayload["session_id"].asUUID(); - EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); - LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger(); - bool voice = true; - switch(response) - { - case 2: // start IM: just don't start the voice chat - { - voice = false; - /* FALLTHROUGH */ - } - case 0: // accept - { - if (type == IM_SESSION_P2P_INVITE) - { - // create a normal IM session - session_id = gIMMgr->addP2PSession( - mPayload["session_name"].asString(), - mPayload["caller_id"].asUUID(), - mPayload["session_handle"].asString()); - - if (voice) - { - if (gIMMgr->startCall(session_id)) - { - // always open IM window when connecting to voice - LLIMFloater::show(session_id); - } - } - - gIMMgr->clearPendingAgentListUpdates(session_id); - gIMMgr->clearPendingInvitation(session_id); - } - else - { - LLUUID session_id = gIMMgr->addSession( - mPayload["session_name"].asString(), - type, - session_id); - if (session_id != LLUUID::null) - { - LLIMFloater::show(session_id); - } + LLUUID session_id = self->mPayload["session_id"].asUUID(); + gIMMgr->endCall(session_id); + + self->closeFloater(); +} - std::string url = gAgent.getRegion()->getCapability( - "ChatSessionRequest"); - if (voice) - { - LLSD data; - data["method"] = "accept invitation"; - data["session-id"] = session_id; - LLHTTPClient::post( - url, - data, - new LLViewerChatterBoxInvitationAcceptResponder( - session_id, - inv_type)); - } - } - if (voice) - { - break; - } - } - case 1: // decline - { - if (type == IM_SESSION_P2P_INVITE) - { - if(gVoiceClient) - { - std::string s = mPayload["session_handle"].asString(); - gVoiceClient->declineInvite(s); - } - } - else - { - std::string url = gAgent.getRegion()->getCapability( - "ChatSessionRequest"); +BOOL LLOutgoingCallDialog::postBuild() +{ + BOOL success = LLDockableFloater::postBuild(); - LLSD data; - data["method"] = "decline invitation"; - data["session-id"] = session_id; - LLHTTPClient::post( - url, - data, - NULL); - } - } + childSetAction("Cancel", onCancel, this); - gIMMgr->clearPendingAgentListUpdates(session_id); - gIMMgr->clearPendingInvitation(session_id); - } + return success; } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index b6e0c87dcf..62a54bc081 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -428,9 +428,12 @@ public: LLOutgoingCallDialog(const LLSD& payload); /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + + static void onCancel(void* user_data); private: - void processCallResponse(S32 response); + void getAllowedRect(LLRect& rect); LLSD mPayload; }; diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index b0ea07946c..d93913b944 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -306,8 +306,10 @@ void LLVoiceChannel::activate() // activating the proximal channel between IM calls LLVoiceChannel* old_channel = sCurrentVoiceChannel; sCurrentVoiceChannel = this; + mCallDialogPayload["old_channel_name"] = ""; if (old_channel) { + mCallDialogPayload["old_channel_name"] = old_channel->getSessionName(); old_channel->deactivate(); } } @@ -378,18 +380,9 @@ void LLVoiceChannel::setURI(std::string uri) void LLVoiceChannel::setState(EState state) { - LLSD payload; - payload["session_id"] = mSessionID; - payload["session_name"] = mSessionName; - switch(state) { case STATE_RINGING: - llinfos << "RINGINGGGGGGGG " << mSessionName << llendl; - if (!mSessionName.empty()) - { - LLFloaterReg::showInstance("outgoing_call", payload, TRUE); - } gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs); break; case STATE_CONNECTED: @@ -879,6 +872,19 @@ void LLVoiceChannelP2P::setState(EState state) { // HACK: Open/close the call window if needed. toggleCallWindowIfNeeded(state); + + // *HACK: open outgoing call floater if needed, might be better done elsewhere. + mCallDialogPayload["session_id"] = mSessionID; + mCallDialogPayload["session_name"] = mSessionName; + mCallDialogPayload["other_user_id"] = mOtherUserID; + if (!mReceivedCall && state == STATE_RINGING) + { + llinfos << "RINGINGGGGGGGG " << mSessionName << llendl; + if (!mSessionName.empty()) + { + LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE); + } + } // you only "answer" voice invites in p2p mode // so provide a special purpose message here diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index 20b6157b48..639585de55 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -109,6 +109,7 @@ protected: EState mState; std::string mSessionName; LLSD mNotifyArgs; + LLSD mCallDialogPayload; BOOL mIgnoreNextSessionLeave; LLHandle<LLPanel> mLoginNotificationHandle; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index e50ff99205..5fedfc943b 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -4273,7 +4273,7 @@ void LLVoiceClient::mediaStreamUpdatedEvent( if(incoming) { // Send the voice chat invite to the GUI layer - // TODO: Question: Should we correlate with the mute list here? + // *TODO: Question: Should we correlate with the mute list here? session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID); session->mVoiceInvitePending = true; if(session->mName.empty()) diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml index fd936232c9..6713700372 100644 --- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml +++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml @@ -4,19 +4,23 @@ can_close="false" can_minimize="false" can_tear_off="false" - height="200" + height="125" layout="topleft" name="outgoing call" help_topic="outgoing_call" title="CALLING" - width="240"> - <floater.string + width="410"> + <floater.string + name="localchat"> + Local Voice Chat + </floater.string> + <floater.string name="anonymous"> anonymous </floater.string> <floater.string - name="calling"> - Calling [CALLEE] + name="VoiceInviteP2P"> + is calling. </floater.string> <floater.string name="VoiceInviteAdHoc"> @@ -31,42 +35,33 @@ left_delta="19" top="35" width="36" /> - <text_editor - font="SansSerif" - height="64" - border_visible="false" + <text + font="SansSerifLarge" + height="20" layout="topleft" left="77" - max_length="2147483647" - name="callee name" - read_only="true" - top="21" - width="163" - word_wrap="true" /> - <button - height="24" - label="Bar" - label_selected="Bar" - layout="topleft" - left="70" - name="Bar" - top="92" - width="100" /> - <button - height="24" - label="Foo" - label_selected="Foo" + name="calling" + top="27" + width="315" + word_wrap="true"> +Calling [CALLEE_NAME] + </text> + <text + font="SansSerif" + height="50" layout="topleft" - left_delta="0" - name="Foo" - top_pad="12" - width="100" /> + left="77" + name="leaving" + top="52" + width="315" + word_wrap="true"> +Leaving [CURRENT_CHAT]. + </text> <button height="24" - label="Baz" + label="Cancel" layout="topleft" - left_delta="0" - name="Baz" - top_pad="12" + name="Cancel" + left_pad="10" width="100" /> </floater> |