From 29737cb9c00cc46059e3a77bce06d45e45fe4d9f Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Wed, 30 May 2012 17:07:17 -0400
Subject: [PATCH] STORM-1812 First pass at adding teleport started signal

---
 indra/newview/llvieweraudio.cpp   |  8 ++++++++
 indra/newview/llvieweraudio.h     |  3 ++-
 indra/newview/llviewermessage.cpp |  5 +++++
 indra/newview/llviewermessage.h   | 12 ++++++++++--
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 2ef159ff318..7ac0d3aeaab 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -41,6 +41,7 @@
 #include "llstartup.h"
 #include "llviewerparcelmgr.h"
 #include "llparcel.h"
+#include "llviewermessage.h"
 
 /////////////////////////////////////////////////////////
 
@@ -56,6 +57,8 @@ LLViewerAudio::LLViewerAudio() :
 		setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this));
 	mTeleportFinishedConnection = LLViewerParcelMgr::getInstance()->
 		setTeleportFinishedCallback(boost::bind(&LLViewerAudio::onTeleportFinished, this, _1, _2));
+	mTeleportStartedConnection = LLViewerMessage::getInstance()->
+		setTeleportStartedCallback(boost::bind(&LLViewerAudio::onTeleportStarted, this));
 }
 
 LLViewerAudio::~LLViewerAudio()
@@ -249,6 +252,11 @@ F32 LLViewerAudio::getFadeVolume()
 	return fade_volume;
 }
 
+void LLViewerAudio::onTeleportStarted()
+{
+llwarns << "DBG teleport started" << llendl;
+}
+
 void LLViewerAudio::onTeleportFailed()
 {
 	// Calling audio_update_volume makes sure that the music stream is properly set to be restored to
diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h
index 38c977c605a..8c302c65492 100644
--- a/indra/newview/llvieweraudio.h
+++ b/indra/newview/llvieweraudio.h
@@ -80,13 +80,14 @@ class LLViewerAudio : public LLSingleton<LLViewerAudio>
 	bool mWasPlaying;
 	boost::signals2::connection	mTeleportFailedConnection;
 	boost::signals2::connection	mTeleportFinishedConnection;
+	boost::signals2::connection mTeleportStartedConnection;
 
 	void registerIdleListener();
 	void deregisterIdleListener() { mIdleListnerActive = false; };
 	void startFading();
 	void onTeleportFailed();
 	void onTeleportFinished(const LLVector3d& pos, const bool& local);
-
+	void onTeleportStarted();
 };
 
 #endif //LL_VIEWER_H
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3c6770df43f..33ce8a79e11 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3441,6 +3441,11 @@ void process_teleport_start(LLMessageSystem *msg, void**)
 	}
 }
 
+boost::signals2::connection LLViewerMessage::setTeleportStartedCallback(teleport_started_callback_t cb)
+{
+	return mTeleportStartedSignal.connect(cb);
+}
+
 void process_teleport_progress(LLMessageSystem* msg, void**)
 {
 	LLUUID agent_id;
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index d8acd999538..e4fc77c06df 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -204,6 +204,16 @@ bool highlight_offered_object(const LLUUID& obj_id);
 void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid);
 void set_dad_inbox_object(const LLUUID& object_id);
 
+class LLViewerMessage : public  LLSingleton<LLViewerMessage>
+{
+public:
+	typedef boost::function<void()> teleport_started_callback_t;
+	typedef boost::signals2::signal<void()> teleport_started_signal_t;
+	boost::signals2::connection setTeleportStartedCallback(teleport_started_callback_t cb);
+
+protected:
+	teleport_started_signal_t	mTeleportStartedSignal;
+};
 
 class LLOfferInfo : public LLNotificationResponderInterface
 {
@@ -252,5 +262,3 @@ class LLOfferInfo : public LLNotificationResponderInterface
 void process_feature_disabled_message(LLMessageSystem* msg, void**);
 
 #endif
-
-
-- 
GitLab