From 378e4fae94c9c16b0b9070d7c7d3f63cba8aee94 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 30 May 2019 16:35:45 -0400 Subject: SL-11216: Introduce LLVersionInfo::getReleaseNotes() method. The default string returned by getReleaseNotes() is empty. It must be set by posting the relevant release-notes URL string to a new LLEventMailDrop instance named "relnotes". Add unique_ptr and unique_ptr> to LLVersionInfo -- using unique_ptr to leave those classes opaque to header-file consumers. Introduce an out-of-line destructor to handle the unique_ptr idiom. Initialize the LLEventMailDrop with the desired name; initialize the LLStoreListener with that LLEventMailDrop and the data member returned by getReleaseNotes(). --- indra/newview/llversioninfo.cpp | 24 +++++++++++++++++++----- indra/newview/llversioninfo.h | 21 ++++++++++++++++++++- 2 files changed, 39 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp index f4b1f2566d..4720a989b0 100644 --- a/indra/newview/llversioninfo.cpp +++ b/indra/newview/llversioninfo.cpp @@ -26,8 +26,8 @@ */ #include "llviewerprecompiledheaders.h" -#include -#include +#include "llevents.h" +#include "lleventfilter.h" #include "llversioninfo.h" #include "stringize.h" #include @@ -45,14 +45,19 @@ // LLVersionInfo::LLVersionInfo(): + short_version(STRINGIZE(LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH)), // LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The // macro expands to the string name of the channel, but without quotes. We // need to turn it into a quoted string. LL_TO_STRING() does that. mWorkingChannelName(LL_TO_STRING(LL_VIEWER_CHANNEL)), build_configuration(LLBUILD_CONFIG), // set in indra/cmake/BuildVersion.cmake - short_version(STRINGIZE(LL_VIEWER_VERSION_MAJOR << "." - << LL_VIEWER_VERSION_MINOR << "." - << LL_VIEWER_VERSION_PATCH)) + // instantiate an LLEventMailDrop with canonical name to listen for news + // from SLVersionChecker + mPump{new LLEventMailDrop("relnotes")}, + // immediately listen on mPump, store arriving URL into mReleaseNotes + mStore{new LLStoreListener(*mPump, mReleaseNotes)} { } @@ -67,6 +72,10 @@ void LLVersionInfo::initSingleton() version = STRINGIZE(getShortVersion() << "." << getBuild()); } +LLVersionInfo::~LLVersionInfo() +{ +} + S32 LLVersionInfo::getMajor() { return LL_VIEWER_VERSION_MAJOR; @@ -161,3 +170,8 @@ std::string LLVersionInfo::getBuildConfig() { return build_configuration; } + +std::string LLVersionInfo::getReleaseNotes() +{ + return mReleaseNotes; +} diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h index 7857468697..02ff0c094a 100644 --- a/indra/newview/llversioninfo.h +++ b/indra/newview/llversioninfo.h @@ -28,9 +28,14 @@ #ifndef LL_LLVERSIONINFO_H #define LL_LLVERSIONINFO_H -#include #include "stdtypes.h" #include "llsingleton.h" +#include +#include + +class LLEventMailDrop; +template +class LLStoreListener; /// /// This API provides version information for the viewer. This @@ -44,6 +49,8 @@ class LLVersionInfo: public LLSingleton LLSINGLETON(LLVersionInfo); void initSingleton(); public: + ~LLVersionInfo(); + /// return the major version number as an integer S32 getMajor(); @@ -87,6 +94,10 @@ public: } ViewerMaturity; ViewerMaturity getViewerMaturity(); + /// get the release-notes URL, once it becomes available -- until then, + /// return empty string + std::string getReleaseNotes(); + private: std::string version; std::string short_version; @@ -98,6 +109,14 @@ private: // This will get reset too. std::string mVersionChannel; std::string build_configuration; + std::string mReleaseNotes; + // Store unique_ptrs to the next couple things so we don't have to explain + // to every consumer of this header file all the details of each. + // mPump is the LLEventMailDrop on which we listen for SLVersionChecker to + // post the release-notes URL from the Viewer Version Manager. + std::unique_ptr mPump; + // mStore is an adapter that stores the release-notes URL in mReleaseNotes. + std::unique_ptr> mStore; }; #endif -- cgit v1.2.3