diff options
author | Lynx Linden <lynx@lindenlab.com> | 2009-12-07 20:05:52 +0000 |
---|---|---|
committer | Lynx Linden <lynx@lindenlab.com> | 2009-12-07 20:05:52 +0000 |
commit | de2f8212f0c8a42d02e636ecd0744d3ddfd0dce9 (patch) | |
tree | af6922e5ee3d022317924d35f60c6f4ea436d75a /indra/newview | |
parent | 37c7e4059cab2a7152e730ca5d68530f14f8f51e (diff) |
DEV-43439: Added calls to query the viewer version.
Rather than copy/paste the same version string formatting pattern
again, I added new string-based version routines:
/// return the full viewer version as a string like "2.0.0.200030"
const std::string &llGetViewerVersion();
/// return the viewer version as a string like "2.0.0"
const std::string &llGetViewerShortVersion();
/// return the viewer build version as a string, e.g., "200130"
const std::string &llGetViewerBuildVersion();
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 5 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterabout.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterreporter.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llpanellogin.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llviewerhelputil.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewerhome.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 4 | ||||
-rw-r--r-- | indra/newview/tests/llviewerhelputil_test.cpp | 7 |
9 files changed, 31 insertions, 57 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3a1a318669..f0bbd343d3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -451,8 +451,9 @@ set(viewer_SOURCE_FILES llviewerassetstorage.cpp llviewerassettype.cpp llvieweraudio.cpp + llviewerbuild.cpp llviewercamera.cpp - llviewerchat.cpp + llviewerchat.cpp llviewercontrol.cpp llviewercontrollistener.cpp llviewerdisplay.cpp @@ -956,7 +957,7 @@ set(viewer_HEADER_FILES llvieweraudio.h llviewerbuild.h llviewercamera.h - llviewerchat.h + llviewerchat.h llviewercontrol.h llviewercontrollistener.h llviewerdisplay.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ddc818172d..e5be17dec6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -36,6 +36,7 @@ // Viewer includes #include "llversionviewer.h" +#include "llviewerbuild.h" #include "llfeaturemanager.h" #include "lluictrlfactory.h" #include "lltexteditor.h" @@ -647,12 +648,9 @@ bool LLAppViewer::init() writeSystemInfo(); // Build a string representing the current version number. - gCurrentVersion = llformat("%s %d.%d.%d.%d", - gSavedSettings.getString("VersionChannelName").c_str(), - LL_VERSION_MAJOR, - LL_VERSION_MINOR, - LL_VERSION_PATCH, - LL_VERSION_BUILD ); + gCurrentVersion = llformat("%s %s", + gSavedSettings.getString("VersionChannelName").c_str(), + llGetViewerVersion().c_str()); ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -2521,8 +2519,7 @@ void LLAppViewer::writeSystemInfo() // Dump some debugging info LL_INFOS("SystemInfo") << LLTrans::getString("APP_NAME") - << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH - << LL_ENDL; + << " version " << llGetViewerShortVersion() << LL_ENDL; // Dump the local time and time zone time_t now; diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 68fc69b4f7..5efaf6c58d 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -217,10 +217,7 @@ LLSD LLFloaterAbout::getInfo() 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["VIEWER_VERSION_STR"] = llGetViewerVersion(); info["BUILD_DATE"] = __DATE__; info["BUILD_TIME"] = __TIME__; info["CHANNEL"] = gSavedSettings.getString("VersionChannelName"); @@ -286,15 +283,9 @@ LLSD LLFloaterAbout::getInfo() static std::string get_viewer_release_notes_url() { - std::ostringstream version; - version << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; - LLSD query; query["channel"] = gSavedSettings.getString("VersionChannelName"); - query["version"] = version.str(); + query["version"] = llGetViewerVersion(); std::ostringstream url; url << LLTrans::getString("RELEASE_NOTES_BASE_URL") << LLURI::mapToQueryString(query); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 1f3bd50d5b..ec2815dd5a 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -45,7 +45,7 @@ #include "llnotificationsutil.h" #include "llstring.h" #include "llsys.h" -#include "llversionviewer.h" +#include "llviewerbuild.h" #include "message.h" #include "v3math.h" @@ -609,10 +609,7 @@ LLSD LLFloaterReporter::gatherReport() std::ostringstream details; - details << "V" << LL_VERSION_MAJOR << "." // client version moved to body of email for abuse reports - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VIEWER_BUILD << std::endl << std::endl; + details << "V" << llGetViewerVersion() << std::endl << std::endl; // client version moved to body of email for abuse reports std::string object_name = childGetText("object_name"); if (!object_name.empty() && !mOwnerName.empty()) @@ -629,10 +626,8 @@ LLSD LLFloaterReporter::gatherReport() std::string version_string; version_string = llformat( - "%d.%d.%d %s %s %s %s", - LL_VERSION_MAJOR, - LL_VERSION_MINOR, - LL_VERSION_PATCH, + "%s %s %s %s %s", + llGetViewerShortVersion().c_str(), platform, gSysCPU.getFamily().c_str(), gGLManager.mGLRenderer.c_str(), diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4bae6af12e..a72b7a9d7a 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -248,11 +248,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, getChild<LLPanel>("login_widgets")->setDefaultBtn("connect_btn"); std::string channel = gSavedSettings.getString("VersionChannelName"); - std::string version = llformat("%d.%d.%d (%d)", - LL_VERSION_MAJOR, - LL_VERSION_MINOR, - LL_VERSION_PATCH, - LL_VIEWER_BUILD ); + std::string version = llformat("%s (%s)", llGetViewerShortVersion().c_str(), + llGetViewerBuildVersion().c_str()); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); @@ -741,8 +738,8 @@ void LLPanelLogin::loadLoginPage() } // Channel and Version - std::string version = llformat("%d.%d.%d (%d)", - LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); + std::string version = llformat("%s (%s)", llGetViewerShortVersion().c_str(), + llGetViewerBuildVersion().c_str()); char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0); char* curl_version = curl_escape(version.c_str(), 0); diff --git a/indra/newview/llviewerhelputil.cpp b/indra/newview/llviewerhelputil.cpp index c1555eacdc..2d98765175 100644 --- a/indra/newview/llviewerhelputil.cpp +++ b/indra/newview/llviewerhelputil.cpp @@ -34,6 +34,7 @@ #include "llviewerprecompiledheaders.h" #include "llversionviewer.h" +#include "llviewerbuild.h" //#include "llfloaterhelpbrowser.h" //#include "llfloaterreg.h" @@ -86,14 +87,7 @@ std::string LLViewerHelpUtil::buildHelpURL( const std::string &topic, substitution["CHANNEL"] = helpURLEncode(savedSettings.getString("VersionChannelName")); - // *TODO: We should put this version pattern in a central place; this and near - // equivalents are replicated in other code - what's a good location? - std::ostringstream version; - version << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; - substitution["VERSION"] = helpURLEncode(version.str()); + substitution["VERSION"] = helpURLEncode(llGetViewerVersion()); substitution["VERSION_MAJOR"] = buildHelpVersion(LL_VERSION_MAJOR); substitution["VERSION_MINOR"] = buildHelpVersion(LL_VERSION_MINOR); substitution["VERSION_PATCH"] = buildHelpVersion(LL_VERSION_PATCH); diff --git a/indra/newview/llviewerhome.cpp b/indra/newview/llviewerhome.cpp index 64fe4f4fca..57e828525d 100644 --- a/indra/newview/llviewerhome.cpp +++ b/indra/newview/llviewerhome.cpp @@ -38,7 +38,7 @@ #include "llui.h" #include "lluri.h" #include "llsd.h" -#include "llversionviewer.h" +#include "llviewerbuild.h" #include "llviewercontrol.h" //static @@ -47,16 +47,8 @@ std::string LLViewerHome::getHomeURL() // Return the URL to display in the Home side tray. We read // this value from settings.xml and support various substitutions - // *TODO: We should put this version pattern in a central place; this and near - // equivalents are replicated in other code - what's a good location? - std::ostringstream version; - version << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; - LLSD substitution; - substitution["VERSION"] = version.str(); + substitution["VERSION"] = llGetViewerVersion(); substitution["CHANNEL"] = LLURI::escape(gSavedSettings.getString("VersionChannelName")); substitution["LANGUAGE"] = LLUI::getLanguage(); substitution["AUTH_KEY"] = LLURI::escape(getAuthKey()); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index f6db661489..25a809d697 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -41,7 +41,7 @@ #include "llviewertexture.h" #include "llviewerparcelmedia.h" #include "llviewerparcelmgr.h" -#include "llversionviewer.h" +#include "llviewerbuild.h" #include "llviewertexturelist.h" #include "llvovolume.h" #include "llpluginclassmedia.h" @@ -446,7 +446,7 @@ std::string LLViewerMedia::getCurrentUserAgent() // http://www.mozilla.org/build/revised-user-agent-strings.html std::ostringstream codec; codec << "SecondLife/"; - codec << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD; + codec << llGetViewerVersion(); codec << " (" << channel << "; " << skin_name << " skin)"; llinfos << codec.str() << llendl; diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index 988d28c301..87304cfcff 100644 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -36,6 +36,7 @@ #include "../test/lltut.h" #include "../llviewerhelputil.h" +#include "../llviewerbuild.h" #include "llcontrol.h" #include "llsys.h" @@ -75,6 +76,12 @@ std::string LLControlGroup::getString(const std::string& name) return test_stringvec[name]; } +const std::string &llGetViewerVersion() +{ + static std::string version = "2.0.0.200099"; + return version; +} + //---------------------------------------------------------------------------- namespace tut |