diff options
author | Richard Linden <none@none> | 2011-03-09 00:21:57 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2011-03-09 00:21:57 -0800 |
commit | 8886460a22a6cc6307dd0909219b4dd442c55f8d (patch) | |
tree | d99260fc9f97eced6f76667e11a618ed40f3db23 /indra/llui | |
parent | bc22d31caee8479a89366155062df45302021bba (diff) |
SOCIAL-654 WIP Items purchased on Marketplace.secondlife.com while logged into Minimal skin are declined and not present in inventory
made notification text skinnable
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llnotifications.cpp | 44 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 11 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.cpp | 22 |
3 files changed, 51 insertions, 26 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 89614e6d12..578de4376c 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1266,7 +1266,6 @@ LLNotificationChannelPtr LLNotifications::getChannel(const std::string& channelN void LLNotifications::initSingleton() { loadTemplates(); - loadVisibilityRules(); createDefaultChannels(); } @@ -1310,17 +1309,6 @@ void LLNotifications::createDefaultChannels() connectFailedFilter(&visibilityRuleMached); } -bool LLNotifications::addTemplate(const std::string &name, - LLNotificationTemplatePtr theTemplate) -{ - if (mTemplates.count(name)) - { - llwarns << "LLNotifications -- attempted to add template '" << name << "' twice." << llendl; - return false; - } - mTemplates[name] = theTemplate; - return true; -} LLNotificationTemplatePtr LLNotifications::getTemplate(const std::string& name) { @@ -1417,27 +1405,45 @@ void replaceFormText(LLNotificationForm::Params& form, const std::string& patter } } +void addPathIfExists(std::string& new_path, std::vector<std::string>& paths) +{ + if (gDirUtilp->fileExists(new_path)) + { + paths.push_back(new_path); + } +} + bool LLNotifications::loadTemplates() { - const std::string xml_filename = "notifications.xml"; - std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getXUIPaths().front(), xml_filename); + 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); + std::string base_filename = search_paths.front(); LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + BOOL success = LLXMLNode::getLayeredXMLNode(root, search_paths); if (!success || root.isNull() || !root->hasName( "notifications" )) { - llerrs << "Problem reading UI Notifications file: " << full_filename << llendl; + llerrs << "Problem reading UI Notifications file: " << base_filename << llendl; return false; } LLNotificationTemplate::Notifications params; LLXUIParser parser; - parser.readXUI(root, params, full_filename); + parser.readXUI(root, params, base_filename); if(!params.validateBlock()) { - llerrs << "Problem reading UI Notifications file: " << full_filename << llendl; + llerrs << "Problem reading UI Notifications file: " << base_filename << llendl; return false; } @@ -1484,7 +1490,7 @@ bool LLNotifications::loadTemplates() replaceFormText(it->form_ref.form, "$ignoretext", it->form_ref.form_template.ignore_text); } } - addTemplate(it->name, LLNotificationTemplatePtr(new LLNotificationTemplate(*it))); + mTemplates[it->name] = LLNotificationTemplatePtr(new LLNotificationTemplate(*it)); } return true; diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 34d3537781..0c4d4fc897 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -863,10 +863,11 @@ class LLNotifications : friend class LLSingleton<LLNotifications>; public: - // load notification descriptions from file; - // OK to call more than once because it will reload - bool loadTemplates(); - + // load all notification descriptions from file + // calling more than once will overwrite existing templates + // but never delete a template + bool loadTemplates(); + // load visibility rules from file; // OK to call more than once because it will reload bool loadVisibilityRules(); @@ -950,8 +951,6 @@ private: LLNotificationChannelPtr pHistoryChannel; LLNotificationChannelPtr pExpirationChannel; - // put your template in - bool addTemplate(const std::string& name, LLNotificationTemplatePtr theTemplate); TemplateMap mTemplates; VisibilityRuleList mVisibilityRules; diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 55b32fc8b1..25e7a31e90 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -152,7 +152,27 @@ static LLFastTimer::DeclareTimer FTM_XML_PARSE("XML Reading/Parsing"); bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root) { LLFastTimer timer(FTM_XML_PARSE); - return LLXMLNode::getLayeredXMLNode(xui_filename, root, LLUI::getXUIPaths()); + + 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); + } + + if (paths.empty()) + { + // sometimes whole path is passed in as filename + paths.push_back(xui_filename); + } + + return LLXMLNode::getLayeredXMLNode(root, paths); } |