From 5dfc5d020c0497619ae23da61a45f6671903d02c Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 23 Apr 2010 17:44:33 +0300 Subject: Work on task EXT-6722 (Create modified inventory view for "my outfits" tab in top-level appearance sidebar) Code improvements: * Moved Accordion tab + Flat list into separate xml. * Implemented dynamic creation of the accordion tab via xml Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/312/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 38 ++++++++++++++-------- indra/newview/lloutfitslist.h | 8 +++++ .../skins/default/xui/en/outfit_accordion_tab.xml | 18 ++++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/outfit_accordion_tab.xml diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index ad42d80467..cce4f94028 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -168,26 +168,21 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) std::string name = cat->getName(); - // *TODO: create accordion tabs and lists from XML. - LLAccordionCtrlTab::Params params; - params.name(name); - params.title(name); - params.rect(LLRect(0, 0, 315, 20)); - params.display_children(false); - LLAccordionCtrlTab* tab = LLUICtrlFactory::create(params); + static LLXMLNodePtr accordionXmlNode = getAccordionTabXMLNode(); - mAccordion->addCollapsibleCtrl(tab); - - LLFlatListView::Params list_params; - LLWearableItemsList* list = LLUICtrlFactory::create(list_params); + accordionXmlNode->setAttributeString("name", name); + accordionXmlNode->setAttributeString("title", name); + LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder(accordionXmlNode, NULL, NULL); - tab->addChild(list, 0); - tab->setDisplayChildren(false); + // *TODO: LLUICtrlFactory::defaultBuilder does not use "display_children" from xml. Should be investigated. + tab->setDisplayChildren(false); + mAccordion->addCollapsibleCtrl(tab); // Map the new tab with outfit category UUID. mOutfitsMap.insert(LLOutfitsList::outfits_map_value_t(cat_id, tab)); // Start observing the new outfit category. + LLWearableItemsList* list = tab->getChild("wearable_items_list"); mCategoriesObserver->addCategory(cat_id, boost::bind(&LLWearableItemsList::updateList, list, cat_id)); // Fetch the new outfit contents. @@ -262,4 +257,21 @@ void LLOutfitsList::setFilterSubString(const std::string& string) mFilterSubString = string; } + +////////////////////////////////////////////////////////////////////////// +// Private methods +////////////////////////////////////////////////////////////////////////// +LLXMLNodePtr LLOutfitsList::getAccordionTabXMLNode() +{ + LLXMLNodePtr xmlNode = NULL; + bool success = LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode); + if (!success) + { + llwarns << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << llendl; + return NULL; + } + + return xmlNode; +} + // EOF diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 892e0a862a..f1756ce873 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -59,6 +59,14 @@ public: void setFilterSubString(const std::string& string); private: + /** + * Reads xml with accordion tab and Flat list from xml file. + * + * @return LLPointer to XMLNode with accordion tab and flat list. + */ + LLXMLNodePtr getAccordionTabXMLNode(); + + LLInventoryCategoriesObserver* mCategoriesObserver; LLAccordionCtrl* mAccordion; diff --git a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml new file mode 100644 index 0000000000..d00b1bfb7b --- /dev/null +++ b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml @@ -0,0 +1,18 @@ + + + + + + -- cgit v1.2.3