diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llnotify.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/linden/indra/newview/llnotify.cpp b/linden/indra/newview/llnotify.cpp index a84341d..e2626b4 100644 --- a/linden/indra/newview/llnotify.cpp +++ b/linden/indra/newview/llnotify.cpp | |||
@@ -89,6 +89,13 @@ void LLNotifyBox::showXml( const LLString& xml_desc, const LLString::format_map_ | |||
89 | gNotifyBoxView->addChild(notify); | 89 | gNotifyBoxView->addChild(notify); |
90 | } | 90 | } |
91 | 91 | ||
92 | LLPointer<LLNotifyBoxTemplate> LLNotifyBox::sDefaultTemplate; | ||
93 | |||
94 | void LLNotifyBox::cleanup() | ||
95 | { | ||
96 | sDefaultTemplate = NULL; | ||
97 | } | ||
98 | |||
92 | //--------------------------------------------------------------------------- | 99 | //--------------------------------------------------------------------------- |
93 | 100 | ||
94 | LLNotifyBox::LLNotifyBox(const LLString& xml_desc, const LLString::format_map_t& args, | 101 | LLNotifyBox::LLNotifyBox(const LLString& xml_desc, const LLString::format_map_t& args, |
@@ -118,8 +125,12 @@ LLNotifyBox::LLNotifyBox(const LLString& xml_desc, const LLString::format_map_t& | |||
118 | 125 | ||
119 | // get template | 126 | // get template |
120 | 127 | ||
121 | static LLNotifyBoxTemplate default_template; | 128 | if (!sDefaultTemplate) |
122 | LLNotifyBoxTemplate* xml_template; | 129 | { |
130 | sDefaultTemplate = new LLNotifyBoxTemplate; | ||
131 | } | ||
132 | |||
133 | LLPointer<LLNotifyBoxTemplate> xml_template; | ||
123 | template_map_t::iterator iter = sNotifyTemplates.find(xml_desc); | 134 | template_map_t::iterator iter = sNotifyTemplates.find(xml_desc); |
124 | if (iter != sNotifyTemplates.end()) | 135 | if (iter != sNotifyTemplates.end()) |
125 | { | 136 | { |
@@ -128,8 +139,8 @@ LLNotifyBox::LLNotifyBox(const LLString& xml_desc, const LLString::format_map_t& | |||
128 | else | 139 | else |
129 | { | 140 | { |
130 | LLString tmsg = "[Notification template not found:\n " + xml_desc + " ]"; | 141 | LLString tmsg = "[Notification template not found:\n " + xml_desc + " ]"; |
131 | default_template.setMessage(tmsg); | 142 | sDefaultTemplate->setMessage(tmsg); |
132 | xml_template = &default_template; | 143 | xml_template = sDefaultTemplate; |
133 | } | 144 | } |
134 | 145 | ||
135 | // setup paramaters | 146 | // setup paramaters |
@@ -630,31 +641,24 @@ bool LLNotifyBox::parseNotify(const LLString& xml_filename) | |||
630 | continue; | 641 | continue; |
631 | } | 642 | } |
632 | 643 | ||
633 | LLNotifyBoxTemplate* xml_template = new LLNotifyBoxTemplate; | 644 | LLPointer<LLNotifyBoxTemplate> xml_template = new LLNotifyBoxTemplate; |
634 | 645 | ||
635 | // label= | 646 | // label= |
636 | LLString notify_name; | 647 | LLString notify_name; |
637 | if (notify->getAttributeString("name", notify_name)) | 648 | if (notify->getAttributeString("name", notify_name)) |
638 | { | 649 | { |
639 | if (xml_template) | 650 | xml_template->mLabel = notify_name; |
640 | { | ||
641 | xml_template->mLabel = notify_name; | ||
642 | } | ||
643 | } | 651 | } |
644 | else | 652 | else |
645 | { | 653 | { |
646 | llwarns << "Unable to parse notify with no name" << llendl; | 654 | llwarns << "Unable to parse notify with no name" << llendl; |
647 | delete xml_template; | ||
648 | continue; | 655 | continue; |
649 | } | 656 | } |
650 | // modal= | 657 | // modal= |
651 | BOOL tip; | 658 | BOOL tip; |
652 | if (notify->getAttributeBOOL("tip", tip)) | 659 | if (notify->getAttributeBOOL("tip", tip)) |
653 | { | 660 | { |
654 | if (xml_template) | 661 | xml_template->mIsTip = tip; |
655 | { | ||
656 | xml_template->mIsTip = tip; | ||
657 | } | ||
658 | } | 662 | } |
659 | 663 | ||
660 | S32 btn_idx = 0; | 664 | S32 btn_idx = 0; |
@@ -664,10 +668,7 @@ bool LLNotifyBox::parseNotify(const LLString& xml_filename) | |||
664 | // <message> | 668 | // <message> |
665 | if (child->hasName("message")) | 669 | if (child->hasName("message")) |
666 | { | 670 | { |
667 | if (xml_template) | 671 | xml_template->mMessage = child->getTextContents(); |
668 | { | ||
669 | xml_template->mMessage = child->getTextContents(); | ||
670 | } | ||
671 | } | 672 | } |
672 | 673 | ||
673 | // <option> | 674 | // <option> |
@@ -681,10 +682,7 @@ bool LLNotifyBox::parseNotify(const LLString& xml_filename) | |||
681 | { | 682 | { |
682 | ignore_text = label; | 683 | ignore_text = label; |
683 | } | 684 | } |
684 | if (xml_template) | 685 | xml_template->addOption(label, is_default); |
685 | { | ||
686 | xml_template->addOption(label, is_default); | ||
687 | } | ||
688 | btn_idx++; | 686 | btn_idx++; |
689 | } | 687 | } |
690 | } | 688 | } |
@@ -694,10 +692,7 @@ bool LLNotifyBox::parseNotify(const LLString& xml_filename) | |||
694 | { | 692 | { |
695 | xml_template->addOption("OK", FALSE); | 693 | xml_template->addOption("OK", FALSE); |
696 | } | 694 | } |
697 | if (xml_template) | 695 | sNotifyTemplates[xml_template->mLabel] = xml_template; |
698 | { | ||
699 | sNotifyTemplates[xml_template->mLabel] = xml_template; | ||
700 | } | ||
701 | } | 696 | } |
702 | return true; | 697 | return true; |
703 | } | 698 | } |