summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp18
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/llui/llfloaterreg.cpp2
-rw-r--r--indra/llui/llnotifications.cpp25
-rw-r--r--indra/llui/llpanel.cpp18
-rw-r--r--indra/llui/llpanel.h2
-rw-r--r--indra/llui/llui.cpp87
-rw-r--r--indra/llui/llui.h5
-rw-r--r--indra/llui/lluicolortable.cpp17
-rw-r--r--indra/llui/lluictrlfactory.cpp46
-rw-r--r--indra/llui/lluictrlfactory.h17
11 files changed, 59 insertions, 180 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 8ca1e685a9..33295f882d 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -3229,24 +3229,14 @@ bool LLFloater::isVisible(const LLFloater* floater)
static LLFastTimer::DeclareTimer FTM_BUILD_FLOATERS("Build Floaters");
-bool LLFloater::buildFromFile(const std::string& filename, LLXMLNodePtr output_node)
+bool LLFloater::buildFromFile(const std::string& filename)
{
LLFastTimer timer(FTM_BUILD_FLOATERS);
LLXMLNodePtr root;
- //if exporting, only load the language being exported,
- //instead of layering localized version on top of english
- if (output_node)
- {
- if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root))
- {
- llwarns << "Couldn't parse floater from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
- return false;
- }
- }
- else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
+ if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
- llwarns << "Couldn't parse floater from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
+ llwarns << "Couldn't find (or parse) floater from: " << filename << llendl;
return false;
}
@@ -3271,7 +3261,7 @@ bool LLFloater::buildFromFile(const std::string& filename, LLXMLNodePtr output_n
getCommitCallbackRegistrar().pushScope();
getEnableCallbackRegistrar().pushScope();
- res = initFloaterXML(root, getParent(), filename, output_node);
+ res = initFloaterXML(root, getParent(), filename, NULL);
setXMLFilename(filename);
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 64d6dcea04..e64b6d04d3 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -202,7 +202,7 @@ public:
// Don't export top/left for rect, only height/width
static void setupParamsForExport(Params& p, LLView* parent);
- bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL);
+ bool buildFromFile(const std::string &filename);
boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setOpenCallback( const commit_signal_t::slot_type& cb );
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 9115eb7174..306caf2b91 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -154,7 +154,7 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
llwarns << "Failed to build floater type: '" << name << "'." << llendl;
return NULL;
}
- bool success = res->buildFromFile(xui_file, NULL);
+ bool success = res->buildFromFile(xui_file);
if (!success)
{
llwarns << "Failed to build floater type: '" << name << "'." << llendl;
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 629eef2c3b..4fbee8cd80 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1424,25 +1424,18 @@ void addPathIfExists(const std::string& new_path, std::vector<std::string>& path
bool LLNotifications::loadTemplates()
{
llinfos << "Reading notifications template" << llendl;
- std::vector<std::string> search_paths;
-
- std::string skin_relative_path = gDirUtilp->getDirDelimiter() + LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + "notifications.xml";
- std::string localized_skin_relative_path = gDirUtilp->getDirDelimiter() + LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + "notifications.xml";
-
- addPathIfExists(gDirUtilp->getDefaultSkinDir() + skin_relative_path, search_paths);
- addPathIfExists(gDirUtilp->getDefaultSkinDir() + localized_skin_relative_path, search_paths);
- addPathIfExists(gDirUtilp->getSkinDir() + skin_relative_path, search_paths);
- addPathIfExists(gDirUtilp->getSkinDir() + localized_skin_relative_path, search_paths);
- addPathIfExists(gDirUtilp->getUserSkinDir() + skin_relative_path, search_paths);
- addPathIfExists(gDirUtilp->getUserSkinDir() + localized_skin_relative_path, search_paths);
+ // Passing findSkinnedFilenames(merge=true) makes it output all relevant
+ // pathnames instead of just the ones from the most specific skin.
+ std::vector<std::string> search_paths =
+ gDirUtilp->findSkinnedFilenames(LLDir::XUI, "notifications.xml", true);
std::string base_filename = search_paths.front();
LLXMLNodePtr root;
BOOL success = LLXMLNode::getLayeredXMLNode(root, search_paths);
-
+
if (!success || root.isNull() || !root->hasName( "notifications" ))
{
- llerrs << "Problem reading UI Notifications file: " << base_filename << llendl;
+ llerrs << "Problem reading XML from UI Notifications file: " << base_filename << llendl;
return false;
}
@@ -1452,7 +1445,7 @@ bool LLNotifications::loadTemplates()
if(!params.validateBlock())
{
- llerrs << "Problem reading UI Notifications file: " << base_filename << llendl;
+ llerrs << "Problem reading XUI from UI Notifications file: " << base_filename << llendl;
return false;
}
@@ -1508,7 +1501,9 @@ bool LLNotifications::loadTemplates()
bool LLNotifications::loadVisibilityRules()
{
const std::string xml_filename = "notification_visibility.xml";
- std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getXUIPaths().front(), xml_filename);
+ // Note that here we're looking for the "en" version, the default
+ // language, rather than the most localized version of this file.
+ std::string full_filename = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, xml_filename);
LLNotificationVisibilityRule::Rules params;
LLSimpleXUIParser parser;
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 00318cec6b..67472ad166 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -968,25 +968,15 @@ static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels");
//-----------------------------------------------------------------------------
// buildPanel()
//-----------------------------------------------------------------------------
-BOOL LLPanel::buildFromFile(const std::string& filename, LLXMLNodePtr output_node, const LLPanel::Params& default_params)
+BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params)
{
LLFastTimer timer(FTM_BUILD_PANELS);
BOOL didPost = FALSE;
LLXMLNodePtr root;
- //if exporting, only load the language being exported,
- //instead of layering localized version on top of english
- if (output_node)
- {
- if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root))
- {
- llwarns << "Couldn't parse panel from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
- return didPost;
- }
- }
- else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
+ if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
- llwarns << "Couldn't parse panel from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
+ llwarns << "Couldn't parse panel from: " << filename << llendl;
return didPost;
}
@@ -1010,7 +1000,7 @@ BOOL LLPanel::buildFromFile(const std::string& filename, LLXMLNodePtr output_nod
getCommitCallbackRegistrar().pushScope();
getEnableCallbackRegistrar().pushScope();
- didPost = initPanelXML(root, NULL, output_node, default_params);
+ didPost = initPanelXML(root, NULL, NULL, default_params);
getCommitCallbackRegistrar().popScope();
getEnableCallbackRegistrar().popScope();
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index f620201020..e63b41f97c 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -105,7 +105,7 @@ protected:
LLPanel(const LLPanel::Params& params = getDefaultParams());
public:
- BOOL buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL, const LLPanel::Params&default_params = getDefaultParams());
+ BOOL buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams());
static LLPanel* createFactoryPanel(const std::string& name);
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 87bf518aa1..507ced9172 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1836,88 +1836,39 @@ struct Paths : public LLInitParam::Block<Paths>
{}
};
-//static
-void LLUI::setupPaths()
-{
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml");
-
- LLXMLNodePtr root;
- BOOL success = LLXMLNode::parseFile(filename, root, NULL);
- Paths paths;
-
- if(success)
- {
- LLXUIParser parser;
- parser.readXUI(root, paths, filename);
- }
- sXUIPaths.clear();
-
- if (success && paths.validateBlock())
- {
- LLStringUtil::format_map_t path_args;
- path_args["[LANGUAGE]"] = LLUI::getLanguage();
-
- for (LLInitParam::ParamIterator<Directory>::const_iterator it = paths.directories.begin(),
- end_it = paths.directories.end();
- it != end_it;
- ++it)
- {
- std::string path_val_ui;
- for (LLInitParam::ParamIterator<SubDir>::const_iterator subdir_it = it->subdirs.begin(),
- subdir_end_it = it->subdirs.end();
- subdir_it != subdir_end_it;)
- {
- path_val_ui += subdir_it->value();
- if (++subdir_it != subdir_end_it)
- path_val_ui += gDirUtilp->getDirDelimiter();
- }
- LLStringUtil::format(path_val_ui, path_args);
- if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui) == sXUIPaths.end())
- {
- sXUIPaths.push_back(path_val_ui);
- }
-
- }
- }
- else // parsing failed
- {
- std::string slash = gDirUtilp->getDirDelimiter();
- std::string dir = "xui" + slash + "en";
- llwarns << "XUI::config file unable to open: " << filename << llendl;
- sXUIPaths.push_back(dir);
- }
-}
-
//static
std::string LLUI::locateSkin(const std::string& filename)
{
- std::string slash = gDirUtilp->getDirDelimiter();
std::string found_file = filename;
- if (!gDirUtilp->fileExists(found_file))
+ if (gDirUtilp->fileExists(found_file))
{
- found_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename); // Should be CUSTOM_SKINS?
+ return found_file;
}
- if (sSettingGroups["config"] && sSettingGroups["config"]->controlExists("Language"))
+
+ found_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename); // Should be CUSTOM_SKINS?
+ if (gDirUtilp->fileExists(found_file))
{
- if (!gDirUtilp->fileExists(found_file))
- {
- std::string localization = getLanguage();
- std::string local_skin = "xui" + slash + localization + slash + filename;
- found_file = gDirUtilp->findSkinnedFilename(local_skin);
- }
+ return found_file;
}
- if (!gDirUtilp->fileExists(found_file))
+
+ found_file = gDirUtilp->findSkinnedFilename(LLDir::XUI, filename);
+ if (! found_file.empty())
{
- std::string local_skin = "xui" + slash + "en" + slash + filename;
- found_file = gDirUtilp->findSkinnedFilename(local_skin);
+ return found_file;
}
- if (!gDirUtilp->fileExists(found_file))
+
+ found_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, filename);
+/*==========================================================================*|
+ // Hmm, if we got this far, previous implementation of this method would
+ // return this last found_file value whether or not it actually exists.
+ if (gDirUtilp->fileExists(found_file))
{
- found_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, filename);
+ return found_file;
}
+|*==========================================================================*/
return found_file;
-}
+}
//static
LLVector2 LLUI::getWindowSize()
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 28e84fa444..c5a12d2b31 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -292,11 +292,6 @@ public:
// Return the ISO639 language name ("en", "ko", etc.) for the viewer UI.
// http://www.loc.gov/standards/iso639-2/php/code_list.php
static std::string getLanguage();
-
- static void setupPaths();
- static const std::vector<std::string>& getXUIPaths() { return sXUIPaths; }
- static std::string getSkinPath() { return sXUIPaths.front(); }
- static std::string getLocalizedSkinPath() { return sXUIPaths.back(); } //all files may not exist at the localized path
//helper functions (should probably move free standing rendering helper functions here)
static LLView* getRootView() { return sRootView; }
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 9455d09cc0..2717445396 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -32,6 +32,7 @@
#include "llui.h"
#include "lluicolortable.h"
#include "lluictrlfactory.h"
+#include <boost/foreach.hpp>
LLUIColorTable::ColorParams::ColorParams()
: value("value"),
@@ -206,19 +207,11 @@ bool LLUIColorTable::loadFromSettings()
{
bool result = false;
- std::string default_filename = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "colors.xml");
- result |= loadFromFilename(default_filename, mLoadedColors);
-
- std::string current_filename = gDirUtilp->getExpandedFilename(LL_PATH_TOP_SKIN, "colors.xml");
- if(current_filename != default_filename)
- {
- result |= loadFromFilename(current_filename, mLoadedColors);
- }
-
- current_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
- if(current_filename != default_filename)
+ // pass merge=true because we want colors.xml from every skin dir
+ BOOST_FOREACH(std::string colors_path,
+ gDirUtilp->findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", true))
{
- result |= loadFromFilename(current_filename, mLoadedColors);
+ result |= loadFromFilename(colors_path, mLoadedColors);
}
std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 25e7a31e90..2b317b46e3 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -90,10 +90,12 @@ LLUICtrlFactory::~LLUICtrlFactory()
void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitParam::BaseBlock& block)
{
- std::string filename = std::string("widgets") + gDirUtilp->getDirDelimiter() + widget_tag + ".xml";
+ std::string filename = gDirUtilp->add("widgets", widget_tag + ".xml");
LLXMLNodePtr root_node;
- std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getXUIPaths().front(), filename);
+ // Here we're looking for the "en" version, the default-language version
+ // of the file, rather than the localized version.
+ std::string full_filename = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, filename);
if (!full_filename.empty())
{
LLUICtrlFactory::instance().pushFileName(full_filename);
@@ -152,19 +154,8 @@ static LLFastTimer::DeclareTimer FTM_XML_PARSE("XML Reading/Parsing");
bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root)
{
LLFastTimer timer(FTM_XML_PARSE);
-
- std::vector<std::string> paths;
- std::string path = gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), xui_filename);
- if (!path.empty())
- {
- paths.push_back(path);
- }
-
- std::string localize_path = gDirUtilp->findSkinnedFilename(LLUI::getLocalizedSkinPath(), xui_filename);
- if (!localize_path.empty() && localize_path != path)
- {
- paths.push_back(localize_path);
- }
+ std::vector<std::string> paths =
+ gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename);
if (paths.empty())
{
@@ -177,23 +168,6 @@ bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNo
//-----------------------------------------------------------------------------
-// getLocalizedXMLNode()
-//-----------------------------------------------------------------------------
-bool LLUICtrlFactory::getLocalizedXMLNode(const std::string &xui_filename, LLXMLNodePtr& root)
-{
- LLFastTimer timer(FTM_XML_PARSE);
- std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getLocalizedSkinPath(), xui_filename);
- if (!LLXMLNode::parseFile(full_filename, root, NULL))
- {
- return false;
- }
- else
- {
- return true;
- }
-}
-
-//-----------------------------------------------------------------------------
// saveToXML()
//-----------------------------------------------------------------------------
S32 LLUICtrlFactory::saveToXML(LLView* viewp, const std::string& filename)
@@ -239,8 +213,10 @@ std::string LLUICtrlFactory::getCurFileName()
void LLUICtrlFactory::pushFileName(const std::string& name)
-{
- mFileNames.push_back(gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), name));
+{
+ // Here we seem to be looking for the default language file ("en") rather
+ // than the localized one, if any.
+ mFileNames.push_back(gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, name));
}
void LLUICtrlFactory::popFileName()
@@ -260,7 +236,7 @@ void LLUICtrlFactory::setCtrlParent(LLView* view, LLView* parent, S32 tab_group)
//static
std::string LLUICtrlFactory::findSkinnedFilename(const std::string& filename)
{
- return gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), filename);
+ return gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, filename);
}
//static
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index d612ad5005..56e5f3eb7b 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -169,7 +169,7 @@ public:
LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node );
template<typename T>
- static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry, LLXMLNodePtr output_node = NULL)
+ static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry)
{
T* widget = NULL;
@@ -178,23 +178,13 @@ public:
{
LLXMLNodePtr root_node;
- //if exporting, only load the language being exported,
- //instead of layering localized version on top of english
- if (output_node)
- {
- if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root_node))
- {
- llwarns << "Couldn't parse XUI file: " << filename << llendl;
- goto fail;
- }
- }
- else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node))
+ if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node))
{
llwarns << "Couldn't parse XUI file: " << skinned_filename << llendl;
goto fail;
}
- LLView* view = getInstance()->createFromXML(root_node, parent, filename, registry, output_node);
+ LLView* view = getInstance()->createFromXML(root_node, parent, filename, registry, NULL);
if (view)
{
widget = dynamic_cast<T*>(view);
@@ -223,7 +213,6 @@ 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 getLocalizedXMLNode(const std::string &xui_filename, LLXMLNodePtr& root);
private:
//NOTE: both friend declarations are necessary to keep both gcc and msvc happy