From 96286cde379057a0b3c29a23c08490fe86fd0128 Mon Sep 17 00:00:00 2001
From: Lynx Linden <lynx@lindenlab.com>
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 +++++++++++++++-
 indra/newview/llimview.h                           |  5 ++-
 .../skins/default/xui/en/floater_incoming_call.xml | 40 ++++++++++++++--------
 3 files changed, 58 insertions(+), 17 deletions(-)

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)
 {
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index c566b111ca..6269386b44 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -34,6 +34,7 @@
 #define LL_LLIMVIEW_H
 
 #include "lldarray.h"
+#include "lldockablefloater.h"
 #include "llspeakers.h" //for LLIMSpeakerMgr
 #include "llimpanel.h" //for voice channels
 #include "llmodaldialog.h"
@@ -401,12 +402,13 @@ private:
 	LLSD mPendingAgentListUpdates;
 };
 
-class LLIncomingCallDialog : public LLModalDialog
+class LLIncomingCallDialog : public LLDockableFloater
 {
 public:
 	LLIncomingCallDialog(const LLSD& payload);
 
 	/*virtual*/ BOOL postBuild();
+	/*virtual*/ void onOpen(const LLSD& key);
 
 	static void onAccept(void* user_data);
 	static void onReject(void* user_data);
@@ -414,6 +416,7 @@ public:
 
 private:
 	void processCallResponse(S32 response);
+	void getAllowedRect(LLRect& rect);
 
 	LLSD mPayload;
 };
diff --git a/indra/newview/skins/default/xui/en/floater_incoming_call.xml b/indra/newview/skins/default/xui/en/floater_incoming_call.xml
index 16873df310..9c2898945b 100644
--- a/indra/newview/skins/default/xui/en/floater_incoming_call.xml
+++ b/indra/newview/skins/default/xui/en/floater_incoming_call.xml
@@ -4,13 +4,17 @@
  can_close="false"
  can_minimize="false"
  can_tear_off="false"
- height="200"
+ height="125"
  layout="topleft"
  name="incoming call"
  help_topic="incoming_call"
  title="UNKNOWN PERSON IS CALLING"
- width="240">
-     <floater.string
+ width="410">
+    <floater.string
+     name="localchat">
+        Local Voice Chat
+    </floater.string>
+    <floater.string
      name="anonymous">
         anonymous
     </floater.string>
@@ -31,18 +35,26 @@
      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="caller name"
-     read_only="true"
-     top="21"
-     width="163"
+     top="27"
+     width="315"
      word_wrap="true" />
+    <text
+     font="SansSerif"
+     height="50"
+     layout="topleft"
+     left="77"
+     name="question"
+     top="52"
+     width="315"
+     word_wrap="true">
+     Do you want to leave [CURRENT_CHAT] and join this voice chat?
+    </text>
     <button
      height="24"
      label="Accept"
@@ -57,16 +69,14 @@
      label="Reject"
      label_selected="Reject"
      layout="topleft"
-     left_delta="0"
      name="Reject"
-     top_pad="12"
+     left_pad="10"
      width="100" />
     <button
      height="24"
      label="Start IM"
      layout="topleft"
-     left_delta="0"
      name="Start IM"
-     top_pad="12"
+     left_pad="10"
      width="100" />
 </floater>
-- 
cgit v1.2.3