Skip to content
Snippets Groups Projects
Commit 6ca37068 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

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().
parent 730d13a7
No related branches found
No related tags found
No related merge requests found
...@@ -35,21 +35,13 @@ ...@@ -35,21 +35,13 @@
bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<std::string>& default_args) 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; 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) if (!success)
{ {
llerrs << "Couldn't load string table " << xml_filename << llendl; llerrs << "Couldn't load string table " << xml_filename << llendl;
......
...@@ -151,11 +151,12 @@ static LLFastTimer::DeclareTimer FTM_XML_PARSE("XML Reading/Parsing"); ...@@ -151,11 +151,12 @@ static LLFastTimer::DeclareTimer FTM_XML_PARSE("XML Reading/Parsing");
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// getLayeredXMLNode() // 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); LLFastTimer timer(FTM_XML_PARSE);
std::vector<std::string> paths = std::vector<std::string> paths =
gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename); gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename, constraint);
if (paths.empty()) if (paths.empty())
{ {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "llinitparam.h" #include "llinitparam.h"
#include "llregistry.h" #include "llregistry.h"
#include "llxuiparser.h" #include "llxuiparser.h"
#include "lldir.h"
class LLView; class LLView;
...@@ -212,7 +213,8 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> ...@@ -212,7 +213,8 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory>
static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = NULL); 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: private:
//NOTE: both friend declarations are necessary to keep both gcc and msvc happy //NOTE: both friend declarations are necessary to keep both gcc and msvc happy
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment