From 02d8197019dcecec7aee80a104c4644ddb4807ca Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 20 Aug 2010 10:14:28 -0700 Subject: changed buildPanel/buildFloater to member functions buildFromFile streamlined LLUICtrlFactory's interface --- indra/newview/lloutfitslist.cpp | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index f2207e5c00..d35739d436 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -68,6 +68,29 @@ bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LL return name1 < name2; } +const LLAccordionCtrlTab::Params& get_accordion_tab_params() +{ + static LLAccordionCtrlTab::Params tab_params; + static bool initialized = false; + if (!initialized) + { + initialized = true; + + LLXMLNodePtr xmlNode; + if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode)) + { + LLXUIParser::instance().readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml"); + } + else + { + llwarns << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << llendl; + } + } + + return tab_params; +} + + ////////////////////////////////////////////////////////////////////////// class LLOutfitListGearMenu @@ -442,8 +465,8 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) std::string name = cat->getName(); - static LLXMLNodePtr accordionXmlNode = getAccordionTabXMLNode(); - LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder(accordionXmlNode, NULL, NULL); + LLAccordionCtrlTab::Params tab_params(get_accordion_tab_params()); + LLAccordionCtrlTab* tab = LLUICtrlFactory::create(tab_params); tab->setName(name); tab->setTitle(name); @@ -736,19 +759,6 @@ bool LLOutfitsList::hasItemSelected() ////////////////////////////////////////////////////////////////////////// // 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; -} - void LLOutfitsList::computeDifference( const LLInventoryModel::cat_array_t& vcats, uuid_vec_t& vadded, -- cgit v1.2.3 From 65c9914d23022df6a39db50ce295750f08695893 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 23 Aug 2010 11:03:19 -0700 Subject: made Params parsers not act as singletons --- indra/newview/lloutfitslist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index d35739d436..7429386871 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -79,7 +79,8 @@ const LLAccordionCtrlTab::Params& get_accordion_tab_params() LLXMLNodePtr xmlNode; if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode)) { - LLXUIParser::instance().readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml"); + LLXUIParser parser; + parser.readXUI(xmlNode, tab_params, "outfit_accordion_tab.xml"); } else { -- cgit v1.2.3 From a0b15c827ee7704c1557c9c882ec236d5d67f948 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Aug 2010 16:46:52 -0700 Subject: outfits accordions now have proper contents --- indra/newview/lloutfitslist.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 7429386871..8a2073e661 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -68,9 +68,18 @@ bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LL return name1 < name2; } -const LLAccordionCtrlTab::Params& get_accordion_tab_params() +struct outfit_accordion_tab_params : public LLInitParam::Block { - static LLAccordionCtrlTab::Params tab_params; + Mandatory wearable_list; + + outfit_accordion_tab_params() + : wearable_list("wearable_items_list") + {} +}; + +const outfit_accordion_tab_params& get_accordion_tab_params() +{ + static outfit_accordion_tab_params tab_params; static bool initialized = false; if (!initialized) { @@ -466,8 +475,11 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) std::string name = cat->getName(); - LLAccordionCtrlTab::Params tab_params(get_accordion_tab_params()); + outfit_accordion_tab_params tab_params(get_accordion_tab_params()); LLAccordionCtrlTab* tab = LLUICtrlFactory::create(tab_params); + LLWearableItemsList* wearable_list = LLUICtrlFactory::create(tab_params.wearable_list); + wearable_list->setShape(tab->getLocalRect()); + tab->addChild(wearable_list); tab->setName(name); tab->setTitle(name); -- cgit v1.2.3 From 4495dd26f80936f9af15457f1b11ddd502cc71fe Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 16 Sep 2010 18:25:27 +0300 Subject: STORM-183 FIXED The "Replace Current Outfit" option of the My Outfits gear menu (which is only applicable to outfits) wasn't disabled for selected wearables. --- indra/newview/lloutfitslist.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index cf0b3d94bd..0d27abac17 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -85,7 +85,7 @@ public: registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenu::onAdd, this)); - enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitsList::isActionEnabled, mOutfitList, _2)); + enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenu::onEnable, this, _2)); enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2)); mMenu = LLUICtrlFactory::getInstance()->createFromFile( @@ -209,6 +209,20 @@ private: LLAgentWearables::createWearable(type, true); } + bool onEnable(LLSD::String param) + { + // Handle the "Wear - Replace Current Outfit" menu option specially + // because LLOutfitList::isActionEnabled() checks whether it's allowed + // to wear selected outfit OR selected items, while we're only + // interested in the outfit (STORM-183). + if ("wear" == param) + { + return LLAppearanceMgr::instance().getCanReplaceCOF(mOutfitList->getSelectedOutfitUUID()); + } + + return mOutfitList->isActionEnabled(param); + } + bool onVisible(LLSD::String param) { const LLUUID& selected_outfit_id = getSelectedOutfitID(); -- cgit v1.2.3 From 3641e9cfc897c5f6c4bb46f9e5865db405bcf31c Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 16 Sep 2010 19:42:18 +0300 Subject: STORM-186 FIXED The "Take Off - Remove from current outfit" option of the My Outfits gear menu now ignores item selection, taking aff all wearables. --- indra/newview/lloutfitslist.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index cf0b3d94bd..33b8f950ad 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -155,27 +155,11 @@ private: void onTakeOff() { - // Take off selected items if there are any - if (mOutfitList->hasItemSelected()) - { - uuid_vec_t selected_uuids; - mOutfitList->getSelectedItemsUUIDs(selected_uuids); - - for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it) - { - if (get_is_item_worn(*it)) - { - LLAppearanceMgr::instance().removeItemFromAvatar(*it); - } - } - } - else // or take off the whole selected outfit if no items specified. + // Take off selected outfit. + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.notNull()) { - const LLUUID& selected_outfit_id = getSelectedOutfitID(); - if (selected_outfit_id.notNull()) - { - LLAppearanceMgr::instance().takeOffOutfit(selected_outfit_id); - } + LLAppearanceMgr::instance().takeOffOutfit(selected_outfit_id); } } -- cgit v1.2.3