1. simon_linden
  2. viewer-rabbit


nat_linden  committed de0c789

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().

  • Participants
  • Parent commits 42c1f69
  • Branches default

Comments (0)

Files changed (3)

File indra/llui/lltransutil.cpp

View file
  • Ignore whitespace
 bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<std::string>& 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<std::string> 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;

File indra/llui/lluictrlfactory.cpp

View file
  • Ignore whitespace
 // 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<std::string> paths =
-		gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename);
+		gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename, constraint);
 	if (paths.empty())

File indra/llui/lluictrlfactory.h

View file
  • Ignore whitespace
 #include "llinitparam.h"
 #include "llregistry.h"
 #include "llxuiparser.h"
+#include "lldir.h"
 class LLView;
 	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);
 	//NOTE: both friend declarations are necessary to keep both gcc and msvc happy