diff options
author | Howard Stearns <howard.stearns@gmail.com> | 2021-12-30 09:45:47 -0800 |
---|---|---|
committer | Howard Stearns <howard.stearns@gmail.com> | 2021-12-30 09:45:47 -0800 |
commit | b2d4238ab5d4903a27428f4669cf78822c60b984 (patch) | |
tree | 319042f844da12028fc0514e185164fd57c23491 /indra | |
parent | 96e0c823412cc0419a730714992b4fc25316deb0 (diff) |
Get rid of new lllicenseinfo. We do not need it.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterabout.cpp | 36 | ||||
-rw-r--r-- | indra/newview/lllicenseinfo.cpp | 84 | ||||
-rw-r--r-- | indra/newview/lllicenseinfo.h | 67 |
4 files changed, 20 insertions, 169 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 67ada9cc2e..5a06106de3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -385,7 +385,6 @@ set(viewer_SOURCE_FILES lllandmarkactions.cpp lllandmarklist.cpp lllegacyatmospherics.cpp - lllicenseinfo.cpp lllistbrowser.cpp lllistcontextmenu.cpp lllistview.cpp @@ -1026,7 +1025,6 @@ set(viewer_HEADER_FILES llkeyconflict.h lllandmarkactions.h lllandmarklist.h - lllicenseinfo.h lllightconstants.h lllistbrowser.h lllistcontextmenu.h diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 60c7a737b2..1fbd198019 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -44,7 +44,6 @@ #include "llviewerstats.h" #include "llviewerregion.h" #include "llversioninfo.h" -#include "lllicenseinfo.h" #include "llweb.h" // Linden library includes @@ -179,21 +178,26 @@ BOOL LLFloaterAbout::postBuild() contrib_names_widget->setEnabled(FALSE); contrib_names_widget->startOfDoc(); - auto& license_info(LLLicenseInfo::instance()); - if (!license_info.empty()) - { - // Although the iteration is fine if empty(), we only want to clear if not empty(). - // That then uses the (out of date) hard coded value from the XUI. - licenses_widget->clear(); - for (const auto& library : license_info) - { - const std::string& name = library.first; - const LLLicenseInfo::LibraryData& data = library.second; - std::string license_line = name + ": " + data.version + "\n" + data.copyrights + "\n\n"; - licenses_widget->appendText(license_line, FALSE, - LLStyle::Params() .color(about_color)); - } - } + // Get the Versions and Copyrights, created at build time + std::string licenses_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"packages-info.txt"); + llifstream licenses_file; + licenses_file.open(licenses_path.c_str()); /* Flawfinder: ignore */ + if (licenses_file.is_open()) + { + std::string license_line; + licenses_widget->clear(); + while ( std::getline(licenses_file, license_line) ) + { + licenses_widget->appendText(license_line+"\n", FALSE, + LLStyle::Params() .color(about_color)); + } + licenses_file.close(); + } + else + { + // this case will use the (out of date) hard coded value from the XUI + LL_INFOS("AboutInit") << "Could not read licenses file at " << licenses_path << LL_ENDL; + } licenses_widget->setEnabled(FALSE); licenses_widget->startOfDoc(); diff --git a/indra/newview/lllicenseinfo.cpp b/indra/newview/lllicenseinfo.cpp deleted file mode 100644 index e68b661763..0000000000 --- a/indra/newview/lllicenseinfo.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file lllicenseinfo.cpp - * @brief Routines to access library version and license information - * @author Aech Linden - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2021, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "lllicenseinfo.h" -#include <boost/algorithm/string.hpp> -#include "lldir.h" - -LLLicenseInfo::LLLicenseInfo() -{ - LL_DEBUGS("LicenseInfo") << "instantiating license info" << LL_ENDL; -} - -void LLLicenseInfo::initSingleton() -{ - // Get the the map with name => {version, cpyrights}, from file created at build time - std::string licenses_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "packages-info.txt"); - llifstream licenses_file; - licenses_file.open(licenses_path.c_str()); /* Flawfinder: ignore */ - if (!licenses_file.is_open()) { - LL_INFOS("LicenseInfo") << "Could not read licenses file at " << licenses_path << LL_ENDL; - return; - } - - LL_DEBUGS("LicenseInfo") << "Reading licenses file at " << licenses_path << LL_ENDL; - std::string license_line; - std::string name{}, version{}, copyright{}; - while ( std::getline(licenses_file, license_line) ) - { - if (license_line.empty()) // blank line starts a new library/version/copyright - { - if (!name.empty()) { // Add what we have accumulated. - mLibraries.insert({name, {version, copyright}}); - } - else - { - LL_WARNS("LicenseInfo") << "new line with no current data" << LL_ENDL; - } - name.clear(); - version.clear(); - copyright.clear(); - } - else - { - if (name.empty()) { // No name yet. Parse this line into name and version. - auto name_termination_index = license_line.find(':'); - if (name_termination_index == std::string::npos) // First line has no colon. - { - name_termination_index = license_line.find_last_of(' '); - } - name = license_line.substr(0, name_termination_index); - version = license_line.substr(name_termination_index + 1); - boost::algorithm::trim(version); - } else { - copyright += license_line; - } - } - } - licenses_file.close(); -} diff --git a/indra/newview/lllicenseinfo.h b/indra/newview/lllicenseinfo.h deleted file mode 100644 index ff889285b8..0000000000 --- a/indra/newview/lllicenseinfo.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file llicenseinfo.h - * @brief Routines to access library versions and license information - * @author Aech Linden - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2021, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLLICENSEINFO_H -#define LL_LLLICENSEINFO_H - -#include "stdtypes.h" -#include "llsingleton.h" -#include <string> - -/// -/// This API provides license information for the viewer. -/// The singleton is initialized once (from package-info.txt), after which -/// it acts like a map of name => {version, copyrights} for each library. -/// -class LLLicenseInfo: public LLSingleton<LLLicenseInfo> -{ - LLSINGLETON(LLLicenseInfo); - -public: - struct LibraryData - { - std::string version; - std::string copyrights; - }; - typedef std::map<std::string, LibraryData> LibraryMap; - - /// return the version as a string of the requested library, like "2.0.0.200030" - const std::string& getVersion(const std::string& library_name) const { return mLibraries.at(library_name).version; } - - /// return an indication of whether any library data was found (e.g., false if packages-info.txt is missing) - bool empty() const noexcept { return mLibraries.empty(); }; - - LibraryMap::const_iterator begin() const noexcept { return mLibraries.begin(); }; - LibraryMap::const_iterator end() const noexcept { return mLibraries.end(); }; - -protected: - virtual void initSingleton();; -private: - LibraryMap mLibraries{}; -}; - -#endif |