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

Comments (0)

Files changed (3)

indra/llui/lltransutil.cpp

 
 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;

indra/llui/lluictrlfactory.cpp

 //-----------------------------------------------------------------------------
 // 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())
 	{

indra/llui/lluictrlfactory.h

 #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);
 
 private:
 	//NOTE: both friend declarations are necessary to keep both gcc and msvc happy
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.