diff options
author | Mike Antipov <mantipov@productengine.com> | 2010-04-23 17:44:33 +0300 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2010-04-23 17:44:33 +0300 |
commit | 5dfc5d020c0497619ae23da61a45f6671903d02c (patch) | |
tree | 879a2486c9418e30086eb7a0b71823ae7c1dceaf /indra/newview | |
parent | 07b463722e3e87aaea608981a1020f1b482781ba (diff) |
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
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 38 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.h | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/outfit_accordion_tab.xml | 18 |
3 files changed, 51 insertions, 13 deletions
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<LLAccordionCtrlTab>(params); + static LLXMLNodePtr accordionXmlNode = getAccordionTabXMLNode(); - mAccordion->addCollapsibleCtrl(tab); - - LLFlatListView::Params list_params; - LLWearableItemsList* list = LLUICtrlFactory::create<LLWearableItemsList>(list_params); + accordionXmlNode->setAttributeString("name", name); + accordionXmlNode->setAttributeString("title", name); + LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder<LLAccordionCtrlTab>(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<LLWearableItemsList>("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 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- *NOTE: mantipov: this xml is intended to be used inside panel_outfits_list.xml for each outfit folder--> +<!-- All accordion tabs in the My Appearance/My Outfits panel will be created from this one at runtume--> +<accordion_tab + display_children="false" + follows="all" + height="40" + layout="topleft" + name="Mockup Tab" + title="Mockup Tab" + width="0"> + <wearable_items_list + allow_select="true" + follows="all" + keep_one_selected="true" + name="wearable_items_list" + /> +</accordion_tab> |