From 0d01300762a8413c3b137e433ee4c02070798792 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 11 Nov 2009 16:59:49 +0000 Subject: sketch-out the outgoing call dialog code. WIP. --- indra/newview/llimview.cpp | 141 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 14f94d5a88..33bd483367 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1099,6 +1099,147 @@ LLIMMgr::onConfirmForceCloseError( } +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLOutgoingCallDialog +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) : + LLModalDialog(payload), + mPayload(payload) +{ +} + +BOOL LLOutgoingCallDialog::postBuild() +{ + LLSD caller_id = mPayload["caller_id"]; + EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + + std::string call_type = getString("VoiceInviteP2P"); + std::string caller_name = mPayload["caller_name"].asString(); + if (caller_name == "anonymous") + { + caller_name = getString("anonymous"); + } + + setTitle(caller_name + " " + call_type); + + // If it is not a P2P invite, then it's an AdHoc invite + if ( type != IM_SESSION_P2P_INVITE ) + { + call_type = getString("VoiceInviteAdHoc"); + } + + LLUICtrl* caller_name_widget = getChild("caller name"); + caller_name_widget->setValue(caller_name + " " + call_type); + LLAvatarIconCtrl* icon = getChild("avatar_icon"); + icon->setValue(caller_id); + + //childSetAction("Reject", onReject, this); + + return TRUE; +} + +void LLOutgoingCallDialog::processCallResponse(S32 response) +{ + 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); + } + + 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"); + + LLSD data; + data["method"] = "decline invitation"; + data["session-id"] = session_id; + LLHTTPClient::post( + url, + data, + NULL); + } + } + + gIMMgr->clearPendingAgentListUpdates(session_id); + gIMMgr->clearPendingInvitation(session_id); + } +} + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIncomingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From cc864d86ce91cd26edc3796acbd9580de4fafbc8 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 11 Nov 2009 18:06:44 +0000 Subject: outgoing call dialog. doesn't do anything and is ugly/wrong, but it exists. WIP. --- indra/newview/llimview.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 33bd483367..bd3ee51c15 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1103,39 +1103,35 @@ LLIMMgr::onConfirmForceCloseError( // Class LLOutgoingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) : - LLModalDialog(payload), + LLDockableFloater(NULL, payload), mPayload(payload) { } BOOL LLOutgoingCallDialog::postBuild() { - LLSD caller_id = mPayload["caller_id"]; - EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + BOOL success = LLFloater::postBuild(); - std::string call_type = getString("VoiceInviteP2P"); - std::string caller_name = mPayload["caller_name"].asString(); - if (caller_name == "anonymous") + LLSD callee_id = mPayload["session_id"];//mPayload["caller_id"]; + + std::string calling_str = getString("calling"); + std::string callee_name = mPayload["session_name"].asString();//mPayload["caller_name"].asString(); + if (callee_name == "anonymous") { - caller_name = getString("anonymous"); + callee_name = getString("anonymous"); } - setTitle(caller_name + " " + call_type); - - // If it is not a P2P invite, then it's an AdHoc invite - if ( type != IM_SESSION_P2P_INVITE ) - { - call_type = getString("VoiceInviteAdHoc"); - } + setTitle(callee_name); - LLUICtrl* caller_name_widget = getChild("caller name"); - caller_name_widget->setValue(caller_name + " " + call_type); + LLUICtrl* callee_name_widget = getChild("callee name"); + // *TODO: substitute callee name properly + callee_name_widget->setValue(calling_str + " " + callee_name); LLAvatarIconCtrl* icon = getChild("avatar_icon"); - icon->setValue(caller_id); + icon->setValue(callee_id); //childSetAction("Reject", onReject, this); - return TRUE; + return success; } void LLOutgoingCallDialog::processCallResponse(S32 response) -- cgit v1.2.3 From 96286cde379057a0b3c29a23c08490fe86fd0128 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Thu, 12 Nov 2009 09:53:34 +0000 Subject: DEV-41324: Updated the Incoming Call floater. This is now a dockable floater with a dock tongue. It currently floats over the sys well, where other system messages appear. The appearance now matches the voice spec more closely. It also tells you which voice channel you would be leaving if you accept the call. --- indra/newview/llimview.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 14f94d5a88..3214d7c8fa 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -46,6 +46,7 @@ #include "llagent.h" #include "llavatariconctrl.h" +#include "llbottomtray.h" #include "llcallingcard.h" #include "llchat.h" #include "llresmgr.h" @@ -73,6 +74,7 @@ #include "llvoicechannel.h" #include "lltrans.h" #include "llrecentpeople.h" +#include "llsyswellwindow.h" #include "llfirstuse.h" #include "llagentui.h" @@ -1103,13 +1105,15 @@ LLIMMgr::onConfirmForceCloseError( // Class LLIncomingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) : - LLModalDialog(payload), + LLDockableFloater(NULL, false, payload), mPayload(payload) { } BOOL LLIncomingCallDialog::postBuild() { + LLDockableFloater::postBuild(); + LLSD caller_id = mPayload["caller_id"]; EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); @@ -1141,6 +1145,30 @@ BOOL LLIncomingCallDialog::postBuild() return TRUE; } +void LLIncomingCallDialog::getAllowedRect(LLRect& rect) +{ + rect = gViewerWindow->getWorldViewRectRaw(); +} + +void LLIncomingCallDialog::onOpen(const LLSD& key) +{ + // tell the user which voice channel they would be leaving + LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel(); + if (voice && !voice->getSessionName().empty()) + { + childSetTextArg("question", "[CURRENT_CHAT]", voice->getSessionName()); + } + else + { + childSetTextArg("question", "[CURRENT_CHAT]", getString("localchat")); + } + + // dock the dialog to the sys well, where other sys messages appear + setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(), + this, getDockTongue(), LLDockControl::TOP, + boost::bind(&LLIncomingCallDialog::getAllowedRect, this, _1))); +} + //static void LLIncomingCallDialog::onAccept(void* user_data) { -- cgit v1.2.3 From 095a3d4372bd755c2fbe6bccf1bc25255d59b5ca Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 12 Nov 2009 13:33:54 +0000 Subject: more mimicking of the good parts of the incoming_floater! --- indra/newview/llimview.cpp | 117 ++++++--------------------------------------- 1 file changed, 15 insertions(+), 102 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 23767d119d..969e887a89 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1096,14 +1096,27 @@ LLIMMgr::onConfirmForceCloseError( // Class LLOutgoingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) : - LLDockableFloater(NULL, payload), + LLDockableFloater(NULL, false, payload), mPayload(payload) { } +void LLOutgoingCallDialog::getAllowedRect(LLRect& rect) +{ + rect = gViewerWindow->getWorldViewRectRaw(); +} + +void LLOutgoingCallDialog::onOpen(const LLSD& key) +{ + // 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))); +} + BOOL LLOutgoingCallDialog::postBuild() { - BOOL success = LLFloater::postBuild(); + BOOL success = LLDockableFloater::postBuild(); LLSD callee_id = mPayload["session_id"];//mPayload["caller_id"]; @@ -1127,106 +1140,6 @@ BOOL LLOutgoingCallDialog::postBuild() return success; } -void LLOutgoingCallDialog::processCallResponse(S32 response) -{ - 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); - } - - 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"); - - LLSD data; - data["method"] = "decline invitation"; - data["session-id"] = session_id; - LLHTTPClient::post( - url, - data, - NULL); - } - } - - gIMMgr->clearPendingAgentListUpdates(session_id); - gIMMgr->clearPendingInvitation(session_id); - } -} - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 7cf3008da7c44c592af14de7498cf4270afcec31 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 12 Nov 2009 14:15:19 +0000 Subject: more work on the outgoing call popup... --- indra/newview/llimview.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 969e887a89..9c8365930c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1108,6 +1108,17 @@ void LLOutgoingCallDialog::getAllowedRect(LLRect& rect) void LLOutgoingCallDialog::onOpen(const LLSD& key) { + // prepare to tell the user which voice channel they would be leaving + LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel(); + if (voice && !voice->getSessionName().empty()) + { + childSetTextArg("leaving", "[CURRENT_CHAT]", voice->getSessionName()); + } + else + { + childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat")); + } + // dock the dialog to the sys well, where other sys messages appear setDockControl(new LLDockControl(LLBottomTray::getInstance()->getSysWell(), this, getDockTongue(), LLDockControl::TOP, @@ -1118,10 +1129,9 @@ BOOL LLOutgoingCallDialog::postBuild() { BOOL success = LLDockableFloater::postBuild(); - LLSD callee_id = mPayload["session_id"];//mPayload["caller_id"]; + LLSD callee_id = mPayload["other_user_id"]; - 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"); @@ -1129,9 +1139,7 @@ BOOL LLOutgoingCallDialog::postBuild() setTitle(callee_name); - LLUICtrl* callee_name_widget = getChild("callee name"); - // *TODO: substitute callee name properly - callee_name_widget->setValue(calling_str + " " + callee_name); + childSetTextArg("calling", "[CALLEE_NAME]", callee_name); LLAvatarIconCtrl* icon = getChild("avatar_icon"); icon->setValue(callee_id); -- cgit v1.2.3 From c2b227c93973edc786c3f42772e06cd1760b610e Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 12 Nov 2009 14:28:57 +0000 Subject: more inching towards outgoing call popup goodness... --- indra/newview/llimview.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9c8365930c..9175d0c91c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1119,18 +1119,6 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key) childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat")); } - // 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))); -} - -BOOL LLOutgoingCallDialog::postBuild() -{ - BOOL success = LLDockableFloater::postBuild(); - - LLSD callee_id = mPayload["other_user_id"]; - std::string callee_name = mPayload["session_name"].asString(); if (callee_name == "anonymous") { @@ -1139,10 +1127,21 @@ BOOL LLOutgoingCallDialog::postBuild() setTitle(callee_name); + LLSD callee_id = mPayload["other_user_id"]; childSetTextArg("calling", "[CALLEE_NAME]", callee_name); LLAvatarIconCtrl* icon = getChild("avatar_icon"); icon->setValue(callee_id); + // 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))); +} + +BOOL LLOutgoingCallDialog::postBuild() +{ + BOOL success = LLDockableFloater::postBuild(); + //childSetAction("Reject", onReject, this); return success; -- cgit v1.2.3 From 64c1146213a1f1313bd061229a962e4d827cb16d Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 12 Nov 2009 15:35:08 +0000 Subject: add Cancel button to outgoing call dialog, make it work (perhaps), make the name of the departing voice session more accurate (perhaps). WIP. --- indra/newview/llimview.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9175d0c91c..a94254e17e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1108,11 +1108,10 @@ void LLOutgoingCallDialog::getAllowedRect(LLRect& rect) void LLOutgoingCallDialog::onOpen(const LLSD& key) { - // prepare to tell the user which voice channel they would be leaving - LLVoiceChannel *voice = LLVoiceChannel::getCurrentVoiceChannel(); - if (voice && !voice->getSessionName().empty()) + // tell the user which voice channel they are leaving + if (!mPayload["old_channel_name"].asString().empty()) { - childSetTextArg("leaving", "[CURRENT_CHAT]", voice->getSessionName()); + childSetTextArg("leaving", "[CURRENT_CHAT]", mPayload["old_channel_name"].asString()); } else { @@ -1138,11 +1137,27 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key) boost::bind(&LLOutgoingCallDialog::getAllowedRect, this, _1))); } + +//static +void LLOutgoingCallDialog::onCancel(void* user_data) +{ + LLOutgoingCallDialog* self = (LLOutgoingCallDialog*)user_data; + + if (!gIMMgr) + return; + + LLUUID session_id = self->mPayload["session_id"].asUUID(); + gIMMgr->endCall(session_id); + + self->closeFloater(); +} + + BOOL LLOutgoingCallDialog::postBuild() { BOOL success = LLDockableFloater::postBuild(); - //childSetAction("Reject", onReject, this); + childSetAction("Cancel", onCancel, this); return success; } -- cgit v1.2.3