aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lluictrlfactory.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:59 -0500
committerJacek Antonelli2008-08-15 23:45:59 -0500
commit6e91a9cc3d5a610198cf526a76e2ab642f10ecd7 (patch)
treeb023869f9daa7f61ea3ab27112d37524bdd88de4 /linden/indra/llui/lluictrlfactory.cpp
parentSecond Life viewer sources 1.20.12 (diff)
downloadmeta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.zip
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.gz
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.bz2
meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.xz
Second Life viewer sources 1.20.13
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/lluictrlfactory.cpp57
1 files changed, 37 insertions, 20 deletions
diff --git a/linden/indra/llui/lluictrlfactory.cpp b/linden/indra/llui/lluictrlfactory.cpp
index 7df6ebe..212c1c5 100644
--- a/linden/indra/llui/lluictrlfactory.cpp
+++ b/linden/indra/llui/lluictrlfactory.cpp
@@ -76,7 +76,7 @@ const S32 VPAD = 4;
76const S32 FLOATER_H_MARGIN = 15; 76const S32 FLOATER_H_MARGIN = 15;
77const S32 MIN_WIDGET_HEIGHT = 10; 77const S32 MIN_WIDGET_HEIGHT = 10;
78 78
79std::vector<LLString> LLUICtrlFactory::mXUIPaths; 79std::vector<LLString> LLUICtrlFactory::sXUIPaths;
80 80
81// UI Ctrl class for padding 81// UI Ctrl class for padding
82class LLUICtrlLocate : public LLUICtrl 82class LLUICtrlLocate : public LLUICtrl
@@ -121,12 +121,11 @@ void LLUICtrlFactory::setupPaths()
121 121
122 LLXMLNodePtr root; 122 LLXMLNodePtr root;
123 BOOL success = LLXMLNode::parseFile(filename, root, NULL); 123 BOOL success = LLXMLNode::parseFile(filename, root, NULL);
124 mXUIPaths.clear(); 124 sXUIPaths.clear();
125 125
126 if (success) 126 if (success)
127 { 127 {
128 LLXMLNodePtr path; 128 LLXMLNodePtr path;
129 LLString app_dir = gDirUtilp->getAppRODataDir();
130 129
131 for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling()) 130 for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling())
132 { 131 {
@@ -140,21 +139,20 @@ void LLUICtrlFactory::setupPaths()
140 language = LLUI::sConfigGroup->getString("SystemLanguage"); 139 language = LLUI::sConfigGroup->getString("SystemLanguage");
141 } 140 }
142 } 141 }
143 path_val_ui.setArg("[Language]", language); 142 path_val_ui.setArg("[LANGUAGE]", language);
144 LLString fullpath = app_dir + path_val_ui.getString();
145 143
146 if (std::find(mXUIPaths.begin(), mXUIPaths.end(), fullpath) == mXUIPaths.end()) 144 if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui.getString()) == sXUIPaths.end())
147 { 145 {
148 mXUIPaths.push_back(app_dir + path_val_ui.getString()); 146 sXUIPaths.push_back(path_val_ui.getString());
149 } 147 }
150 } 148 }
151 } 149 }
152 else // parsing failed 150 else // parsing failed
153 { 151 {
154 LLString slash = gDirUtilp->getDirDelimiter(); 152 LLString slash = gDirUtilp->getDirDelimiter();
155 LLString dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash; 153 LLString dir = "xui" + slash + "en-us";
156 llwarns << "XUI::config file unable to open." << llendl; 154 llwarns << "XUI::config file unable to open: " << filename << llendl;
157 mXUIPaths.push_back(dir); 155 sXUIPaths.push_back(dir);
158 } 156 }
159} 157}
160 158
@@ -163,14 +161,22 @@ void LLUICtrlFactory::setupPaths()
163//----------------------------------------------------------------------------- 161//-----------------------------------------------------------------------------
164// getLayeredXMLNode() 162// getLayeredXMLNode()
165//----------------------------------------------------------------------------- 163//-----------------------------------------------------------------------------
166bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root) 164bool LLUICtrlFactory::getLayeredXMLNode(const LLString &xui_filename, LLXMLNodePtr& root)
167{ 165{
168 if (!LLXMLNode::parseFile(mXUIPaths.front() + filename, root, NULL)) 166 std::string full_filename = gDirUtilp->findSkinnedFilename(sXUIPaths.front(), xui_filename);
169 { 167 if (full_filename.empty())
170 if (!LLXMLNode::parseFile(filename, root, NULL)) 168 {
169 llwarns << "Couldn't find UI description file: " << sXUIPaths.front() + gDirUtilp->getDirDelimiter() + xui_filename << llendl;
170 return false;
171 }
172
173 if (!LLXMLNode::parseFile(full_filename, root, NULL))
174 {
175 // try filename as passed in since sometimes we load an xml file from a user-supplied path
176 if (!LLXMLNode::parseFile(xui_filename, root, NULL))
171 { 177 {
172 llwarns << "Problem reading UI description file: " << mXUIPaths.front() + filename << llendl; 178 llwarns << "Problem reading UI description file: " << xui_filename << llendl;
173 return FALSE; 179 return false;
174 } 180 }
175 } 181 }
176 182
@@ -178,13 +184,24 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr&
178 184
179 std::vector<LLString>::const_iterator itor; 185 std::vector<LLString>::const_iterator itor;
180 186
181 for (itor = mXUIPaths.begin(), ++itor; itor != mXUIPaths.end(); ++itor) 187 for (itor = sXUIPaths.begin(), ++itor; itor != sXUIPaths.end(); ++itor)
182 { 188 {
183 LLString nodeName; 189 LLString nodeName;
184 LLString updateName; 190 LLString updateName;
185 191
186 LLXMLNode::parseFile((*itor) + filename, updateRoot, NULL); 192 std::string layer_filename = gDirUtilp->findSkinnedFilename((*itor), xui_filename);
187 193 if(layer_filename.empty())
194 {
195 // no localized version of this file, that's ok, keep looking
196 continue;
197 }
198
199 if (!LLXMLNode::parseFile(layer_filename, updateRoot, NULL))
200 {
201 llwarns << "Problem reading localized UI description file: " << (*itor) + gDirUtilp->getDirDelimiter() + xui_filename << llendl;
202 return false;
203 }
204
188 updateRoot->getAttributeString("name", updateName); 205 updateRoot->getAttributeString("name", updateName);
189 root->getAttributeString("name", nodeName); 206 root->getAttributeString("name", nodeName);
190 207
@@ -194,7 +211,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr&
194 } 211 }
195 } 212 }
196 213
197 return TRUE; 214 return true;
198} 215}
199 216
200 217