Skip to content
Snippets Groups Projects
Commit 9f5279ba authored by Oz Linden's avatar Oz Linden
Browse files

merge changes for storm-1611

parents 2b42a6f0 6c729db7
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,22 @@ extern U32 gPacketsIn;
static std::string get_viewer_release_notes_url();
///----------------------------------------------------------------------------
/// Class LLServerReleaseNotesURLFetcher
///----------------------------------------------------------------------------
class LLServerReleaseNotesURLFetcher : public LLHTTPClient::Responder
{
LOG_CLASS(LLServerReleaseNotesURLFetcher);
public:
static void startFetch();
/*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content);
/*virtual*/ void completedRaw(
U32 status,
const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer);
};
///----------------------------------------------------------------------------
/// Class LLFloaterAbout
......@@ -89,6 +105,11 @@ class LLFloaterAbout
/// separated so that we can programmatically access the same info.
static LLSD getInfo();
void onClickCopyToClipboard();
void updateServerReleaseNotesURL(const std::string& url);
private:
void setSupportText(const std::string& server_release_notes_url);
};
......@@ -122,76 +143,17 @@ BOOL LLFloaterAbout::postBuild()
getChild<LLUICtrl>("copy_btn")->setCommitCallback(
boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this));
#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::ostringstream support;
// Render the LLSD from getInfo() as a format_map_t
LLStringUtil::format_map_t args;
// allow the "Release Notes" URL label to be localized
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("REGION"))
{
support << "\n\n" << getString("AboutPosition", args);
}
support << "\n\n" << getString("AboutSystem", args);
support << "\n";
if (info.has("GRAPHICS_DRIVER_VERSION"))
{
support << "\n" << getString("AboutDriver", args);
}
support << "\n" << getString("AboutLibs", args);
if (info.has("COMPILER"))
if (gAgent.getRegion())
{
support << "\n" << getString("AboutCompiler", args);
// start fetching server release notes URL
setSupportText(LLTrans::getString("RetrievingData"));
LLServerReleaseNotesURLFetcher::startFetch();
}
if (info.has("PACKETS_IN"))
else // not logged in
{
support << '\n' << getString("AboutTraffic", args);
setSupportText(LLStringUtil::null);
}
support_widget->appendText(support.str(),
FALSE,
LLStyle::Params()
.color(LLUIColorTable::instance().getColor("TextFgReadOnlyColor")));
support_widget->blockUndo();
// Fix views
......@@ -294,7 +256,6 @@ LLSD LLFloaterAbout::getInfo()
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"));
}
// CPU
......@@ -389,6 +350,95 @@ void LLFloaterAbout::onClickCopyToClipboard()
support_widget->deselect();
}
void LLFloaterAbout::updateServerReleaseNotesURL(const std::string& url)
{
setSupportText(url);
}
void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url)
{
#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
if (LLStringUtil::startsWith(server_release_notes_url, "http")) // it's an URL
{
info["SERVER_RELEASE_NOTES_URL"] = "[" + LLWeb::escapeURL(server_release_notes_url) + " " + LLTrans::getString("ReleaseNotes") + "]";
}
else
{
info["SERVER_RELEASE_NOTES_URL"] = server_release_notes_url;
}
LLViewerTextEditor *support_widget =
getChild<LLViewerTextEditor>("support_editor", true);
std::ostringstream support;
// Render the LLSD from getInfo() as a format_map_t
LLStringUtil::format_map_t args;
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("REGION"))
{
support << "\n\n" << getString("AboutPosition", args);
}
support << "\n\n" << getString("AboutSystem", args);
support << "\n";
if (info.has("GRAPHICS_DRIVER_VERSION"))
{
support << "\n" << getString("AboutDriver", args);
}
support << "\n" << getString("AboutLibs", args);
if (info.has("COMPILER"))
{
support << "\n" << getString("AboutCompiler", args);
}
if (info.has("PACKETS_IN"))
{
support << '\n' << getString("AboutTraffic", args);
}
support_widget->clear();
support_widget->appendText(support.str(),
FALSE,
LLStyle::Params()
.color(LLUIColorTable::instance().getColor("TextFgReadOnlyColor")));
}
///----------------------------------------------------------------------------
/// LLFloaterAboutUtil
///----------------------------------------------------------------------------
......@@ -398,3 +448,52 @@ void LLFloaterAboutUtil::registerFloater()
&LLFloaterReg::build<LLFloaterAbout>);
}
///----------------------------------------------------------------------------
/// Class LLServerReleaseNotesURLFetcher implementation
///----------------------------------------------------------------------------
// static
void LLServerReleaseNotesURLFetcher::startFetch()
{
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
// We cannot display the URL returned by the ServerReleaseNotes capability
// because opening it in an external browser will trigger a warning about untrusted
// SSL certificate.
// So we query the URL ourselves, expecting to find
// an URL suitable for external browsers in the "Location:" HTTP header.
std::string cap_url = region->getCapability("ServerReleaseNotes");
LLHTTPClient::get(cap_url, new LLServerReleaseNotesURLFetcher);
}
// virtual
void LLServerReleaseNotesURLFetcher::completedHeader(U32 status, const std::string& reason, const LLSD& content)
{
lldebugs << "Status: " << status << llendl;
lldebugs << "Reason: " << reason << llendl;
lldebugs << "Headers: " << content << llendl;
LLFloaterAbout* floater_about = LLFloaterReg::getTypedInstance<LLFloaterAbout>("sl_about");
if (floater_about)
{
std::string location = content["location"].asString();
if (location.empty())
{
location = floater_about->getString("ErrorFetchingServerReleaseNotesURL");
}
floater_about->updateServerReleaseNotesURL(location);
}
}
// virtual
void LLServerReleaseNotesURLFetcher::completedRaw(
U32 status,
const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
{
// Do nothing.
// We're overriding just because the base implementation tries to
// deserialize LLSD which triggers warnings.
}
......@@ -23,7 +23,7 @@ Built with [COMPILER] version [COMPILER_VERSION]
name="AboutPosition">
You are at [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1] in [REGION] located at &lt;nolink&gt;[HOSTNAME]&lt;/nolink&gt; ([HOSTIP])
[SERVER_VERSION]
[[SERVER_RELEASE_NOTES_URL] [ReleaseNotes]]
[SERVER_RELEASE_NOTES_URL]
</floater.string>
<!-- *NOTE: Do not translate text like GPU, Graphics Card, etc -
......@@ -58,6 +58,10 @@ Voice Server Version: [VOICE_VERSION]
<floater.string
name="AboutTraffic">
Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)
</floater.string>
<floater.string
name="ErrorFetchingServerReleaseNotesURL">
Error fetching server release notes URL.
</floater.string>
<tab_container
follows="all"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment