From f41b7bb8dff075d8c32ea03be407d20fe11e71f3 Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Mon, 3 Dec 2007 19:44:04 +0000
Subject: [PATCH] -74901 (back out premature commit to release)

---
 doc/contributions.txt               |  1 -
 indra/llui/lluictrlfactory.cpp      |  7 ++-----
 indra/newview/llagent.cpp           | 26 +-------------------------
 indra/newview/llagent.h             |  9 ++-------
 indra/newview/llfloaternamedesc.cpp | 15 ++++++++++++++-
 indra/newview/llfloaterreporter.cpp |  8 ++++++--
 indra/newview/llfloaterworldmap.cpp |  7 ++++---
 indra/newview/llgesturemgr.cpp      | 10 ++--------
 indra/newview/llpanellogin.cpp      |  2 +-
 indra/newview/llpreviewgesture.cpp  |  9 ++-------
 indra/newview/llurldispatcher.cpp   | 12 ++----------
 indra/newview/llurldispatcher.h     |  2 --
 indra/newview/llviewermenu.cpp      |  1 +
 indra/newview/llviewermenufile.cpp  | 10 ++++++++--
 indra/newview/llviewermessage.cpp   | 13 ++++---------
 indra/newview/llviewerstats.cpp     | 12 ++++++++++--
 indra/newview/llviewerstats.h       |  2 +-
 17 files changed, 60 insertions(+), 86 deletions(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 62210f08f4d..897977cb9ab 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -215,7 +215,6 @@ Nicholaz Beresford
 	VWR-1861
 	VWR-1872
 	VWR-1968
-	VWR-2046
 	VWR-2152
 Nounouch Hapmouche
 	VWR-238
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 88e4e89a2b7..4b4c4636d56 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -282,11 +282,8 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr&
 	
 	if (!LLXMLNode::parseFile(mXUIPaths.front() + filename, root, NULL))
 	{	
-		if (!LLXMLNode::parseFile(filename, root, NULL))
-		{
-			llwarns << "Problem reading UI description file: " << mXUIPaths.front() + filename << llendl;
-			return FALSE;
-		}
+		llwarns << "Problem reading UI description file: " << mXUIPaths.front() + filename << llendl;
+		return FALSE;
 	}
 
 	LLXMLNodePtr updateRoot;
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 5aaf9d00973..39d4a3fc158 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -102,7 +102,6 @@
 #include "lltoolpie.h"
 #include "lltoolview.h"
 #include "llui.h"			// for make_ui_sound
-#include "llurldispatcher.h"
 #include "llviewercamera.h"
 #include "llviewerinventory.h"
 #include "llviewermenu.h"
@@ -905,24 +904,6 @@ const LLHost& LLAgent::getRegionHost() const
 	}
 }
 
-//-----------------------------------------------------------------------------
-// getSLURL()
-// returns empty() if getRegion() == NULL
-//-----------------------------------------------------------------------------
-std::string LLAgent::getSLURL() const
-{
-	std::string slurl;
-	LLViewerRegion *regionp = getRegion();
-	if (regionp)
-	{
-		LLVector3d agentPos = getPositionGlobal();
-		S32 x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
-		S32 y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
-		S32 z = llround( (F32)agentPos.mdV[VZ] );
-		slurl = LLURLDispatcher::buildSLURL(regionp->getName(), x, y, z);
-	}
-	return slurl;
-}
 
 //-----------------------------------------------------------------------------
 // inPrelude()
@@ -1040,7 +1021,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at)
 //-----------------------------------------------------------------------------
 // getPositionGlobal()
 //-----------------------------------------------------------------------------
-const LLVector3d &LLAgent::getPositionGlobal() const
+const LLVector3d &LLAgent::getPositionGlobal() 
 {
 	if (!mAvatarObject.isNull() && !mAvatarObject->mDrawable.isNull())
 	{
@@ -5802,11 +5783,6 @@ void LLAgent::setTeleportState(ETeleportState state)
 	{
 		LLFloaterSnapshot::hide(0);
 	}
-	if (mTeleportState == TELEPORT_MOVING)
-	{
-		// We're outa here. Save "back" slurl.
-		mTeleportSourceSLURL = getSLURL();
-	}
 }
 
 void LLAgent::fidget()
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 4e9b8822500..c6de97fede4 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -169,8 +169,7 @@ class LLAgent : public LLObservable
 	void			setRegion(LLViewerRegion *regionp);
 	LLViewerRegion	*getRegion() const;
 	const LLHost&	getRegionHost() const;
-	std::string		getSLURL() const;
-	
+
 	void			updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y);		// call once per frame to update position, angles radians
 	void			updateLookAt(const S32 mouse_x, const S32 mouse_y);
 
@@ -307,7 +306,7 @@ class LLAgent : public LLObservable
 	LLVector3			getVelocity()	const;
 	F32					getVelocityZ()	const	{ return getVelocity().mV[VZ]; }	// a hack
 
-	const LLVector3d	&getPositionGlobal() const;
+	const LLVector3d	&getPositionGlobal();
 	const LLVector3		&getPositionAgent();
 	S32					getRegionsVisited() const;
 	F64					getDistanceTraveled() const;
@@ -464,8 +463,6 @@ class LLAgent : public LLObservable
 	void 			setTargetVelocity(const LLVector3 &vel);
 	const LLVector3	&getTargetVelocity() const;
 
-	const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
-
 
 	// Setting the ability for this avatar to proxy for another avatar.
 	//static void processAddModifyAbility(LLMessageSystem* msg, void**);
@@ -720,8 +717,6 @@ class LLAgent : public LLObservable
 	LLVector3d		mAgentOriginGlobal;				// Origin of agent coords from global coords
 	mutable LLVector3d mPositionGlobal;
 
-	std::string		mTeleportSourceSLURL;			// SLURL where last TP began.
-
 	std::set<U64>	mRegionsVisited;				// stat - what distinct regions has the avatar been to?
 	F64				mDistanceTraveled;				// stat - how far has the avatar moved?
 	LLVector3d		mLastPositionGlobal;			// Used to calculate travel distance
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index d4c9478fdfb..392696dc9cc 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -140,6 +140,13 @@ BOOL LLFloaterNameDesc::postBuild()
 
 	y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
 
+	if (mIsAudio)
+	{
+		LLSD bitrate = gSavedSettings.getS32("AudioDefaultBitrate");
+		
+		childSetValue("bitrate", bitrate);
+	}
+
 	// Cancel button
 	childSetAction("cancel_btn", onBtnCancel, this);
 
@@ -199,10 +206,16 @@ void LLFloaterNameDesc::onBtnOK( void* userdata )
 
 	fp->childDisable("ok_btn"); // don't allow inadvertent extra uploads
 	
+	S32 bitrate = 0;
+
+	if (fp->mIsAudio)
+	{
+		bitrate = fp->childGetValue("bitrate").asInteger();
+	}
 	upload_new_resource(fp->mFilenameAndPath, // file
 		fp->childGetValue("name_form").asString(), 
 		fp->childGetValue("description_form").asString(), 
-		0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE);
+		bitrate, LLAssetType::AT_NONE, LLInventoryType::IT_NONE);
 	fp->close(false);
 }
 
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 9170e70ccdd..bd5438e10f5 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -131,7 +131,12 @@ LLFloaterReporter::LLFloaterReporter(
 		gUICtrlFactory->buildFloater(this, "floater_report_abuse.xml");
 	}
 
-	childSetText("abuse_location_edit", gAgent.getSLURL() );
+	LLViewerRegion *regionp = gAgent.getRegion();
+	if (regionp)
+	{
+		childSetText("sim_field", regionp->getName() );
+		childSetText("abuse_location_edit", regionp->getName() );
+	}
 
 	LLButton* pick_btn = LLUICtrlFactory::getButtonByName(this, "pick_btn");
 	if (pick_btn)
@@ -158,7 +163,6 @@ LLFloaterReporter::LLFloaterReporter(
 
 	// convert the position to a string
 	LLVector3d pos = gAgent.getPositionGlobal();
-	LLViewerRegion *regionp = gAgent.getRegion();
 	if (regionp)
 	{
 		pos -= regionp->getOriginGlobal();
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 353020d9c4b..53b43effece 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -76,7 +76,6 @@
 #include "lltracker.h"
 #include "llui.h"
 #include "lluiconstants.h"
-#include "llurldispatcher.h"
 #include "llviewercamera.h"
 #include "llviewermenu.h"
 #include "llviewerregion.h"
@@ -713,7 +712,8 @@ void LLFloaterWorldMap::updateLocation()
 				childSetValue("spin z", LLSD(agent_z) );
 
 				// Set the current SLURL
-				mSLURL = LLURLDispatcher::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
+				mSLURL = LLWeb::escapeURL( llformat("http://slurl.com/secondlife/%s/%d/%d/%d", 
+								agent_sim_name.c_str(), agent_x, agent_y, agent_z) );
 			}
 		}
 
@@ -750,7 +750,8 @@ void LLFloaterWorldMap::updateLocation()
 		// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
 		if ( gotSimName )
 		{
-			mSLURL = LLURLDispatcher::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]));
+			mSLURL = LLWeb::escapeURL(llformat("http://slurl.com/secondlife/%s/%d/%d/%d", 
+										sim_name.c_str(), llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])));
 		}
 		else
 		{	// Empty SLURL will disable the "Copy SLURL to clipboard" button
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 32c712d926d..537cadf1d19 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -1006,20 +1006,14 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
 			gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
 		}
 
-		// Get missing gesture's name. Use UUID if name can't be found.
-		LLStringBase<char>::format_map_t args;
-		LLInventoryItem *item = gInventory.getItem( item_id );
-		args["[NAME]"] = item ? item->getName() : LLString( item_id.asString() );
-
-
 		if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
 			LL_ERR_FILE_EMPTY == status)
 		{
-			LLNotifyBox::showXml("GestureMissing", args);
+			LLNotifyBox::showXml("GestureMissing");
 		}
 		else
 		{
-			LLNotifyBox::showXml("UnableToLoadGesture", args);
+			LLNotifyBox::showXml("UnableToLoadGesture");
 		}
 
 		llwarns << "Problem loading gesture: " << status << llendl;
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 7f846c2791f..8ebdb14e15c 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -71,7 +71,7 @@
 #include "llweb.h"
 #include "llwebbrowserctrl.h"
 
-#include "llfloaterhtml.h"
+#include "llfloaterhtmlhelp.h"
 #include "llfloatertos.h"
 
 #include "llglheaders.h"
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 9fa364a339d..051e328a6bc 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -955,11 +955,6 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs,
 		}
 		else
 		{
-			// Get missing gesture's name. Use UUID if name can't be found.
-			LLStringBase<char>::format_map_t args;
-			LLInventoryItem *item = gInventory.getItem( *item_idp );
-			args["[NAME]"] = item ? item->getName() : LLString( item_idp->asString() );
-
 			if( gViewerStats )
 			{
 				gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
@@ -968,11 +963,11 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs,
 			if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
 				LL_ERR_FILE_EMPTY == status)
 			{
-				LLNotifyBox::showXml("GestureMissing", args);
+				LLNotifyBox::showXml("GestureMissing");
 			}
 			else
 			{
-				LLNotifyBox::showXml("UnableToLoadGesture", args);
+				LLNotifyBox::showXml("UnableToLoadGesture");
 			}
 
 			llwarns << "Problem loading gesture: " << status << llendl;
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index f8ebced8b9b..51b9505980f 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -37,12 +37,12 @@
 #include "llcommandhandler.h"
 #include "llfloaterurldisplay.h"
 #include "llfloaterdirectory.h"
-#include "llfloaterhtml.h"
+#include "llfloaterhtmlhelp.h"
+//#include "llfloaterworldmap.h"
 #include "llpanellogin.h"
 #include "llstartup.h"			// gStartupState
 #include "llurlsimstring.h"
 #include "llviewerwindow.h"		// alertXml()
-#include "llweb.h"
 #include "llworldmap.h"
 
 // library includes
@@ -340,11 +340,3 @@ bool LLURLDispatcher::dispatchRightClick(const std::string& url)
 {
 	return LLURLDispatcherImpl::dispatchRightClick(url);
 }
-
-// static
-std::string LLURLDispatcher::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
-{
-	std::string slurl = SLURL_SLURL_PREFIX + regionname + llformat("/%d/%d/%d",x,y,z); 
-	slurl = LLWeb::escapeURL( slurl );
-	return slurl;
-}
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index bcd19ee691c..74b7f875b24 100644
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -50,8 +50,6 @@ class LLURLDispatcher
 		// Returns true if someone handled the URL.
 	static bool dispatchRightClick(const std::string& url);
 
-		//   builds: http://slurl.com/secondlife/RegionName/x/y/z/
-	static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
 };
 
 #endif
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index b5f53e5d88a..a6fb7fa0b75 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -105,6 +105,7 @@
 #include "llfloatergroupinvite.h"
 #include "llfloatergroups.h"
 #include "llfloaterhtml.h"
+#include "llfloaterhtmlhelp.h"
 #include "llfloaterinspect.h"
 #include "llfloaterlagmeter.h"
 #include "llfloaterland.h"
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 291e3da13df..13ff55ce1c1 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -596,9 +596,15 @@ void upload_new_resource(const LLString& src_filename, std::string name,
 		asset_type = LLAssetType::AT_SOUND;  // tag it as audio
 		S32 encode_result = 0;
 
-		llinfos << "Attempting to encode wav as an ogg file" << llendl;
+		S32 bitrate = 128;
 
-		encode_result = encode_vorbis_file(src_filename.c_str(), filename.c_str());
+		if (compression_info)
+		{
+			bitrate = compression_info;
+		}
+		llinfos << "Attempting to encode wav as an ogg file at " << bitrate << "kbps" << llendl;
+
+		encode_result = encode_vorbis_file_at(src_filename.c_str(), filename.c_str(), bitrate*1000);
 		
 		if (LLVORBISENC_NOERR != encode_result)
 		{
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index f109ea417b8..7f349fe65b5 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2732,9 +2732,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	gViewerThrottle.sendToSim();
 	gViewerWindow->sendShapeToSim();
 
-	bool is_teleport = gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING;
+	bool is_teleport = false;
 
-	if( is_teleport )
+	if( gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING )
 	{
 		// Force the camera back onto the agent, don't animate. JC
 		gAgent.setFocusOnAvatar(TRUE, FALSE);
@@ -2749,20 +2749,15 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 
 		if (avatarp)
 		{
-			// Chat the "back" SLURL. (DEV-4907)
-			LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL());
-			chat.mSourceType = CHAT_SOURCE_SYSTEM;
- 			LLFloaterChat::addChatHistory(chat);
-
-			// Set the new position
 			avatarp->setPositionAgent(agent_pos);
 			avatarp->clearChat();
 			avatarp->slamPosition();
 		}
+
+		is_teleport = true;
 	}
 	else
 	{
-		// This is likely just the initial logging in phase.
 		gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
 	}
 
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 9d5b301d26d..81c10d161cc 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -51,7 +51,7 @@
 #include "lldebugview.h"
 #include "llfasttimerview.h"
 #include "llviewerregion.h"
-#include "llfloaterhtml.h"
+#include "llfloaterhtmlhelp.h"
 #include "llworld.h"
 #include "llfeaturemanager.h"
 #if LL_WINDOWS && LL_LCD_COMPILE
@@ -186,7 +186,7 @@ const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] =
 	// ST_CROSSING_MAX
 	StatAttributes("CROSSING_MAX", FALSE, FALSE),
 	// ST_LIBXUL_WIDGET_USED
-	StatAttributes("LibXUL Widget used", FALSE, FALSE), // Unused
+	StatAttributes("LibXUL Widget used", FALSE, FALSE),
 	// ST_WINDOW_WIDTH
 	StatAttributes("Window width", FALSE, FALSE),
 	// ST_WINDOW_HEIGHT
@@ -574,6 +574,14 @@ void update_statistics(U32 frame_count)
 	
 	gViewerStats->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets);
 
+	// log when the LibXUL (aka Mozilla) widget is used and opened so we can monitor framerate changes
+	#if LL_LIBXUL_ENABLED
+	{
+		BOOL result = gViewerHtmlHelp.getFloaterOpened();
+		gViewerStats->setStat(LLViewerStats::ST_LIBXUL_WIDGET_USED, (F64)result);
+	}
+	#endif
+
 	{
 		static F32 visible_avatar_frames = 0.f;
 		static F32 avg_visible_avatars = 0;
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 4c2a7412442..735da591502 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -154,7 +154,7 @@ class LLViewerStats
 		ST_RENDER_SECS = 50,
 		ST_CROSSING_AVG = 51,
 		ST_CROSSING_MAX = 52,
-		ST_LIBXUL_WIDGET_USED = 53, // Unused
+		ST_LIBXUL_WIDGET_USED = 53,
 		ST_WINDOW_WIDTH = 54,
 		ST_WINDOW_HEIGHT = 55,
 		ST_TEX_BAKES = 56,
-- 
GitLab