From 4cd7e3e2f1c5cb278c6c4dfa22ed3f00c5cdcbc8 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 10 Aug 2017 17:52:29 +0300
Subject: [PATCH] MAINT-7596 FIXED System information is truncated in JIRA
 issues filed through "Report bug" viewer option

---
 indra/newview/llappviewer.cpp  | 66 +++++++++++++++++++++++++++++++++-
 indra/newview/llappviewer.h    |  1 +
 indra/newview/llviewermenu.cpp |  2 +-
 3 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f72eb48f819..ee4eed347d5 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3382,7 +3382,7 @@ LLSD LLAppViewer::getViewerInfo() const
 
 	info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
 	bool want_fullname = true;
-	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
+	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : "Undefined";
 	if(LLVoiceClient::getInstance()->voiceEnabled())
 	{
 		LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
@@ -3519,6 +3519,70 @@ std::string LLAppViewer::getViewerInfoString() const
 	return support.str();
 }
 
+std::string LLAppViewer::getShortViewerInfoString() const
+{
+	std::ostringstream support;
+	LLSD info(getViewerInfo());
+
+	support << LLTrans::getString("APP_NAME") << " " << info["VIEWER_VERSION_STR"].asString();
+	support << " (" << info["CHANNEL"].asString() << ")";
+	if (info.has("BUILD_CONFIG"))
+	{
+		support << "\n" << "Build Configuration " << info["BUILD_CONFIG"].asString();
+	}
+	if (info.has("REGION"))
+	{
+		support << "\n\n" << "You are at " << ll_vector3_from_sd(info["POSITION_LOCAL"]) << " in " << info["REGION"].asString();
+		support << " located at " << info["HOSTNAME"].asString() << " (" << info["HOSTIP"].asString() << ")";
+		support << "\n" << "SLURL: " << info["SLURL"].asString();
+		support << "\n" << "(Global coordinates " << ll_vector3_from_sd(info["POSITION"]) << ")";
+		support << "\n" << info["SERVER_VERSION"].asString();
+	}
+
+	support << "\n\n" << "CPU: " << info["CPU"].asString();
+	support << "\n" << "Memory: " << info["MEMORY_MB"].asString() << " MB";
+	support << "\n" << "OS: " << info["OS_VERSION"].asString();
+	support << "\n" << "Graphics Card: " << info["GRAPHICS_CARD"].asString() << " (" <<  info["GRAPHICS_CARD_VENDOR"].asString() << ")";
+
+	if (info.has("GRAPHICS_DRIVER_VERSION"))
+	{
+		support << "\n" << "Windows Graphics Driver Version: " << info["GRAPHICS_DRIVER_VERSION"].asString();
+	}
+
+	support << "\n" << "OpenGL Version: " << info["OPENGL_VERSION"].asString();
+
+	support << "\n\n" << "Window size:" << info["WINDOW_WIDTH"].asString() << "x" << info["WINDOW_HEIGHT"].asString();
+	support << "\n" << "Language: " << LLUI::getLanguage();
+	support << "\n" << "Font Size Adjustment: " << info["FONT_SIZE_ADJUSTMENT"].asString() << "pt";
+	support << "\n" << "UI Scaling: " << info["UI_SCALE"].asString();
+	support << "\n" << "Draw distance: " << info["DRAW_DISTANCE"].asString();
+	support << "\n" << "Bandwidth: " << info["NET_BANDWITH"].asString() << "kbit/s";
+	support << "\n" << "LOD factor: " << info["LOD_FACTOR"].asString();
+	support << "\n" << "Render quality: " << info["RENDER_QUALITY"].asString() << " / 7";
+	support << "\n" << "ALM: " << info["GPU_SHADERS"].asString();
+	support << "\n" << "Texture memory: " << info["TEXTURE_MEMORY"].asString() << "MB";
+	support << "\n" << "VFS (cache) creation time: " << info["VFS_TIME"].asString();
+
+	support << "\n\n" << "J2C Decoder: " << info["J2C_VERSION"].asString();
+	support << "\n" << "Audio Driver: " << info["AUDIO_DRIVER_VERSION"].asString();
+	support << "\n" << "LLCEFLib/CEF: " << info["LLCEFLIB_VERSION"].asString();
+	support << "\n" << "LibVLC: " << info["LIBVLC_VERSION"].asString();
+	support << "\n" << "Voice Server: " << info["VOICE_VERSION"].asString();
+
+	if (info.has("PACKETS_IN"))
+	{
+		support << "\n" << "Packets Lost: " << info["PACKETS_LOST"].asInteger() << "/" << info["PACKETS_IN"].asInteger();
+		F32 packets_pct = info["PACKETS_PCT"].asReal();
+		support << " (" << ll_round(packets_pct, 0.001f) << "%)";
+	}
+
+	LLSD substitution;
+	substitution["datetime"] = (S32)time(NULL);
+	support << "\n" << LLTrans::getString("AboutTime", substitution);
+
+	return support.str();
+}
+
 void LLAppViewer::cleanupSavedSettings()
 {
 	gSavedSettings.setBOOL("MouseSun", FALSE);
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 9656deb4e16..c36d8cd9fd1 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -103,6 +103,7 @@ class LLAppViewer : public LLApp
 	void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; }
 	LLSD getViewerInfo() const;
 	std::string getViewerInfoString() const;
+	std::string getShortViewerInfoString() const;
 
 	// Report true if under the control of a debugger. A null-op default.
 	virtual bool beingDebugged() { return false; } 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 0ad3ef2f71a..912b0e0b048 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8017,7 +8017,7 @@ void handle_report_bug(const LLSD& param)
 	LLUIString url(param.asString());
 	
 	LLStringUtil::format_map_t replace;
-	replace["[ENVIRONMENT]"] = LLURI::escape(LLAppViewer::instance()->getViewerInfoString());
+	replace["[ENVIRONMENT]"] = LLURI::escape(LLAppViewer::instance()->getShortViewerInfoString());
 	LLSLURL location_url;
 	LLAgentUI::buildSLURL(location_url);
 	replace["[LOCATION]"] = LLURI::escape(location_url.getSLURLString());
-- 
GitLab