From 6ca37068080e3b26e5cb163dfd874bc0e2f4c837 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 12 Oct 2012 08:42:18 -0400 Subject: LLUICtrlFactory::getLayeredXMLNode() gets LLDir::ESkinConstraint. At this point, LLUICtrlFactory::getLayeredXMLNode() is a pretty thin wrapper around LLDir::findSkinnedFilenames() and LLXMLNode::getLayeredXMLNode(). Until now, LLUICtrlFactory::getLayeredXMLNode() passed (by default) LLDir::CURRENT_SKIN to LLDir::findSkinnedFilenames(). But that meant that a caller such as LLTransUtil::parseStrings() that wants almost the same functionality, but with LLDir::ALL_SKINS instead, had to clone the logic from LLUICtrlFactory::getLayeredXMLNode(). Allowing its caller to pass the desired LLDir::ESkinConstraint enum value eliminates the need to clone its logic. Remove cloned logic from LLTransUtil::parseStrings(). --- indra/llui/lltransutil.cpp | 20 ++++++-------------- indra/llui/lluictrlfactory.cpp | 5 +++-- indra/llui/lluictrlfactory.h | 4 +++- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 3b7e737dea..80d079cbc8 100644 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp @@ -35,21 +35,13 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set& default_args) { - // LLUICtrlFactory::getLayeredXMLNode() just calls - // gDirUtilp->findSkinnedFilenames(constraint=LLDir::CURRENT_SKIN) and - // then passes the resulting paths to LLXMLNode::getLayeredXMLNode(). - // Bypass that and call LLXMLNode::getLayeredXMLNode() directly: we want - // constraint=LLDir::ALL_SKINS. - std::vector paths = - gDirUtilp->findSkinnedFilenames(LLDir::XUI, xml_filename, LLDir::ALL_SKINS); - if (paths.empty()) - { - // xml_filename not found at all in any skin -- check whether entire - // path was passed (but I hope we no longer have callers who do that) - paths.push_back(xml_filename); - } LLXMLNodePtr root; - bool success = LLXMLNode::getLayeredXMLNode(root, paths); + // Pass LLDir::ALL_SKINS to load a composite of all the individual string + // definitions in the default skin and the current skin. This means an + // individual skin can provide an xml_filename that overrides only a + // subset of the available string definitions; any string definition not + // overridden by that skin will be sought in the default skin. + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root, LLDir::ALL_SKINS); if (!success) { llerrs << "Couldn't load string table " << xml_filename << llendl; diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 2b317b46e3..f7307cd076 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -151,11 +151,12 @@ static LLFastTimer::DeclareTimer FTM_XML_PARSE("XML Reading/Parsing"); //----------------------------------------------------------------------------- // getLayeredXMLNode() //----------------------------------------------------------------------------- -bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root) +bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root, + LLDir::ESkinConstraint constraint) { LLFastTimer timer(FTM_XML_PARSE); std::vector paths = - gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename); + gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename, constraint); if (paths.empty()) { diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 56e5f3eb7b..1acfd24112 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -31,6 +31,7 @@ #include "llinitparam.h" #include "llregistry.h" #include "llxuiparser.h" +#include "lldir.h" class LLView; @@ -212,7 +213,8 @@ fail: static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = NULL); - static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root); + static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root, + LLDir::ESkinConstraint constraint=LLDir::CURRENT_SKIN); private: //NOTE: both friend declarations are necessary to keep both gcc and msvc happy -- cgit v1.2.3