summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterabout.cpp243
-rw-r--r--indra/newview/skins/default/xui/en/floater_about.xml104
2 files changed, 182 insertions, 165 deletions
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 92ad28a105..c0446d9668 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -61,6 +61,8 @@
#include "lluri.h"
#include "v3dmath.h"
#include "llwindow.h"
+#include "stringize.h"
+#include "llsdutil_math.h"
#if LL_WINDOWS
#include "lldxhardware.h"
@@ -85,6 +87,10 @@ private:
public:
/*virtual*/ BOOL postBuild();
+
+ /// Obtain the data used to fill out the contents string. This is
+ /// separated so that we can programmatically access the same info.
+ static LLSD getInfo();
void onClickCopyToClipboard();
};
@@ -114,25 +120,117 @@ BOOL LLFloaterAbout::postBuild()
getChild<LLUICtrl>("copy_btn")->setCommitCallback(
boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this));
- // Version string
- std::string version = LLTrans::getString("APP_NAME")
- + llformat(" %d.%d.%d (%d) %s %s (%s)\n",
- LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD,
- __DATE__, __TIME__,
- gSavedSettings.getString("VersionChannelName").c_str());
+#if LL_WINDOWS
+ getWindow()->incBusyCount();
+ getWindow()->setCursor(UI_CURSOR_ARROW);
+#endif
+ LLSD info(getInfo());
+#if LL_WINDOWS
+ getWindow()->decBusyCount();
+ getWindow()->setCursor(UI_CURSOR_ARROW);
+#endif
- std::string support;
- support.append(version);
- support.append("[" + get_viewer_release_notes_url() + " " +
- LLTrans::getString("ReleaseNotes") + "]");
- support.append("\n\n");
+ std::ostringstream support;
-#if LL_MSVC
- support.append(llformat("Built with MSVC version %d\n\n", _MSC_VER));
-#endif
+ // Render the LLSD from getInfo() as a format_map_t
+ LLStringUtil::format_map_t args;
+ // For reasons I don't yet understand, [ReleaseNotes] is not part of the
+ // default substitution strings whereas [APP_NAME] is. But it works to
+ // simply copy it into these specific args.
+ args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes");
+ for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
+ ii != iend; ++ii)
+ {
+ if (! ii->second.isArray())
+ {
+ // Scalar value
+ if (ii->second.isUndefined())
+ {
+ args[ii->first] = getString("none");
+ }
+ else
+ {
+ // don't forget to render value asString()
+ args[ii->first] = ii->second.asString();
+ }
+ }
+ else
+ {
+ // array value: build KEY_0, KEY_1 etc. entries
+ for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n)
+ {
+ args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString();
+ }
+ }
+ }
+
+ // Now build the various pieces
+ support << getString("AboutHeader", args);
+ if (info.has("COMPILER"))
+ {
+ support << "\n\n" << getString("AboutCompiler", args);
+ }
+ if (info.has("REGION"))
+ {
+ support << "\n\n" << getString("AboutPosition", args);
+ }
+ support << "\n\n" << getString("AboutSystem", args);
+ if (info.has("GRAPHICS_DRIVER_VERSION"))
+ {
+ support << "\n\n" << getString("AboutDriver", args);
+ }
+ support << "\n\n" << getString("AboutLibs", args);
+ if (info.has("PACKETS_IN"))
+ {
+ support << '\n' << getString("AboutTraffic", args);
+ }
+
+ support_widget->appendText(support.str(),
+ FALSE,
+ LLStyle::Params()
+ .color(LLUIColorTable::instance().getColor("TextFgReadOnlyColor")));
+ support_widget->blockUndo();
-#if LL_GNUC
- support.append(llformat("Built with GCC version %d\n\n", GCC_VERSION));
+ // Fix views
+ support_widget->setCursorPos(0);
+ support_widget->setEnabled(FALSE);
+
+ credits_widget->setCursorPos(0);
+ credits_widget->setEnabled(FALSE);
+
+ return TRUE;
+}
+
+// static
+LLSD LLFloaterAbout::getInfo()
+{
+ // The point of having one method build an LLSD info block and the other
+ // construct the user-visible About string is to ensure that the same info
+ // is available to a getInfo() caller as to the user opening
+ // LLFloaterAbout.
+ LLSD info;
+ LLSD version;
+ version.append(LL_VERSION_MAJOR);
+ version.append(LL_VERSION_MINOR);
+ version.append(LL_VERSION_PATCH);
+ version.append(LL_VERSION_BUILD);
+ info["VIEWER_VERSION"] = version;
+ info["VIEWER_VERSION_STR"] = STRINGIZE(version[0].asInteger() << '.' <<
+ version[1].asInteger() << '.' <<
+ version[2].asInteger() << '.' <<
+ version[3].asInteger());
+ info["BUILD_DATE"] = __DATE__;
+ info["BUILD_TIME"] = __TIME__;
+ info["CHANNEL"] = gSavedSettings.getString("VersionChannelName");
+
+ info["VIEWER_RELEASE_NOTES_URL"] = get_viewer_release_notes_url();
+
+#if LL_MSVC
+ info["COMPILER"] = "MSVC";
+ info["COMPILER_VERSION"] = _MSC_VER;
+#elif LL_GNUC
+ info["COMPILER"] = "GCC";
+ info["COMPILER_VERSION"] = GCC_VERSION;
#endif
// Position
@@ -140,120 +238,49 @@ BOOL LLFloaterAbout::postBuild()
if (region)
{
const LLVector3d &pos = gAgent.getPositionGlobal();
- LLUIString pos_text = getString("you_are_at");
- pos_text.setArg("[POSITION]",
- llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
- support.append(pos_text);
-
- LLUIString region_text = getString ("in_region") + " ";
- region_text.setArg("[REGION]", llformat ("%s", gAgent.getRegion()->getName().c_str()));
- support.append(region_text);
-
- std::string buffer;
- buffer = gAgent.getRegion()->getHost().getHostName();
- support.append(buffer);
- support.append(" (");
- buffer = gAgent.getRegion()->getHost().getString();
- support.append(buffer);
- support.append(")\n");
- support.append(gLastVersionChannel);
- support.append("\n");
- support.append("[" + LLWeb::escapeURL(region->getCapability("ServerReleaseNotes")) +
- " " + LLTrans::getString("ReleaseNotes") + "]");
- support.append("\n\n");
+ info["POSITION"] = ll_sd_from_vector3d(pos);
+ info["REGION"] = gAgent.getRegion()->getName();
+ info["HOSTNAME"] = gAgent.getRegion()->getHost().getHostName();
+ info["HOSTIP"] = gAgent.getRegion()->getHost().getString();
+ info["SERVER_VERSION"] = gLastVersionChannel;
+ info["SERVER_RELEASE_NOTES_URL"] = LLWeb::escapeURL(region->getCapability("ServerReleaseNotes"));
}
- // *NOTE: Do not translate text like GPU, Graphics Card, etc -
- // Most PC users that know what these mean will be used to the english versions,
- // and this info sometimes gets sent to support
-
// CPU
- support.append(getString("CPU") + " ");
- support.append( gSysCPU.getCPUString() );
- support.append("\n");
-
- U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024;
+ info["CPU"] = gSysCPU.getCPUString();
+ info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB() / 1024);
// Moved hack adjustment to Windows memory size into llsys.cpp
-
- LLStringUtil::format_map_t args;
- args["[MEM]"] = llformat ("%u", memory);
- support.append(getString("Memory", args) + "\n");
-
- support.append(getString("OSVersion") + " ");
- support.append( LLAppViewer::instance()->getOSInfo().getOSString() );
- support.append("\n");
-
- support.append(getString("GraphicsCardVendor") + " ");
- support.append( (const char*) glGetString(GL_VENDOR) );
- support.append("\n");
-
- support.append(getString("GraphicsCard") + " ");
- support.append( (const char*) glGetString(GL_RENDERER) );
- support.append("\n");
+ info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString();
+ info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR));
+ info["GRAPHICS_CARD"] = (const char*)(glGetString(GL_RENDERER));
#if LL_WINDOWS
- getWindow()->incBusyCount();
- getWindow()->setCursor(UI_CURSOR_ARROW);
- support.append("Windows Graphics Driver Version: ");
LLSD driver_info = gDXHardware.getDisplayInfo();
if (driver_info.has("DriverVersion"))
{
- support.append(driver_info["DriverVersion"]);
+ info["GRAPHICS_DRIVER_VERSION"] = driver_info["DriverVersion"];
}
- support.append("\n");
- getWindow()->decBusyCount();
- getWindow()->setCursor(UI_CURSOR_ARROW);
#endif
- support.append(getString("OpenGLVersion") + " ");
- support.append( (const char*) glGetString(GL_VERSION) );
- support.append("\n");
-
- support.append("\n");
-
- support.append(getString("LibCurlVersion") + " ");
- support.append( LLCurl::getVersionString() );
- support.append("\n");
-
- support.append(getString("J2CDecoderVersion") + " ");
- support.append( LLImageJ2C::getEngineInfo() );
- support.append("\n");
-
- support.append(getString("AudioDriverVersion") + " ");
+ info["OPENGL_VERSION"] = (const char*)(glGetString(GL_VERSION));
+ info["LIBCURL_VERSION"] = LLCurl::getVersionString();
+ info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
bool want_fullname = true;
- support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : getString("none") );
- support.append("\n");
+ info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
// TODO: Implement media plugin version query
-
- support.append(getString("LLQtWebkitVersion") + " ");
- support.append("\n");
+ info["QT_WEBKIT_VERSION"] = "4.5.2";
if (gPacketsIn > 0)
{
- args["[LOST]"] = llformat ("%.0f", LLViewerStats::getInstance()->mPacketsLostStat.getCurrent());
- args["[IN]"] = llformat ("%.0f", F32(gPacketsIn));
- args["[PCT]"] = llformat ("%.1f", 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) );
- support.append(getString ("PacketsLost", args) + "\n");
+ info["PACKETS_LOST"] = LLViewerStats::getInstance()->mPacketsLostStat.getCurrent();
+ info["PACKETS_IN"] = F32(gPacketsIn);
+ info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal();
}
- support_widget->appendText(support,
- FALSE,
- LLStyle::Params()
- .color(LLUIColorTable::instance().getColor("TextFgReadOnlyColor")));
- support_widget->blockUndo();
-
- // Fix views
- support_widget->setCursorPos(0);
- support_widget->setEnabled(FALSE);
-
- credits_widget->setCursorPos(0);
- credits_widget->setEnabled(FALSE);
-
- return TRUE;
+ return info;
}
-
static std::string get_viewer_release_notes_url()
{
std::ostringstream version;
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index b194b533af..5cd11ba292 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -7,66 +7,56 @@
save_rect="true"
title="About [APP_NAME]"
width="470">
- <floater.string
- name="you_are_at">
- You are at [POSITION]
- </floater.string>
- <floater.string
- name="in_region">
- in [REGION] located at
- </floater.string>
- <floater.string
- name="CPU">
- CPU:
- </floater.string>
- <floater.string
- name="Memory">
- Memory: [MEM] MB
- </floater.string>
- <floater.string
- name="OSVersion">
- OS Version:
- </floater.string>
- <floater.string
- name="GraphicsCardVendor">
- Graphics Card Vendor:
- </floater.string>
- <floater.string
- name="GraphicsCard">
- Graphics Card:
- </floater.string>
- <floater.string
- name="OpenGLVersion">
- OpenGL Version:
- </floater.string>
- <floater.string
- name="LibCurlVersion">
- libcurl Version:
- </floater.string>
- <floater.string
- name="J2CDecoderVersion">
- J2C Decoder Version:
- </floater.string>
- <floater.string
- name="AudioDriverVersion">
- Audio Driver Version:
- </floater.string>
- <floater.string
- name="none">
- (none)
- </floater.string>
- <floater.string
- name="LLMozLibVersion">
- LLMozLib Version:
- </floater.string>
<floater.string
- name="LLQtWebkitVersion">
- Qt Webkit Version: 4.5.2
+ name="AboutHeader">
+[APP_NAME] [VIEWER_VERSION_0].[VIEWER_VERSION_1].[VIEWER_VERSION_2] ([VIEWER_VERSION_3]) [BUILD_DATE] [BUILD_TIME] ([CHANNEL])
+[[VIEWER_RELEASE_NOTES_URL] [ReleaseNotes]]
+
+</floater.string>
+ <floater.string
+ name="AboutCompiler">
+Built with [COMPILER] version [COMPILER_VERSION]
+
+</floater.string>
+ <floater.string
+ name="AboutPosition">
+You are at [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] in [REGION] located at [HOSTNAME] ([HOSTIP])
+[SERVER_VERSION]
+[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]]
+
+</floater.string>
+ <!-- *NOTE: Do not translate text like GPU, Graphics Card, etc -
+ Most PC users who know what these mean will be used to the English versions,
+ and this info sometimes gets sent to support. -->
+ <floater.string
+ name="AboutSystem">
+CPU: [CPU]
+Memory: [MEMORY_MB] MB
+OS Version: [OS_VERSION]
+Graphics Card Vendor: [GRAPHICS_CARD_VENDOR]
+Graphics Card: [GRAPHICS_CARD]
+</floater.string>
+ <floater.string
+ name="AboutDriver">
+Windows Graphics Driver Version: [GRAPHICS_DRIVER_VERSION]
+</floater.string>
+ <floater.string
+ name="AboutLibs">
+OpenGL Version: [OPENGL_VERSION]
+
+libcurl Version: [LIBCURL_VERSION]
+J2C Decoder Version: [J2C_VERSION]
+Audio Driver Version: [AUDIO_DRIVER_VERSION]
+Qt Webkit Version: [QT_WEBKIT_VERSION]
+</floater.string>
+ <floater.string
+ name="none">
+ (none)
</floater.string>
<floater.string
- name="PacketsLost">
- Packets Lost: [LOST]/[IN] ([PCT]%)
- </floater.string>
+ name="AboutTraffic">
+Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)
+</floater.string>
<tab_container
follows="all"
top="25"