From a9680462828d99cb482cdb235f14d6bd3c87bc9c Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 13 May 2010 19:31:50 +0300 Subject: EXT-7158 FIXED Implemented filter in "My Outfits" tab. - Added accordion tab title highlighting setter and title getter. - Added filtered tabs title highlighting. - Tabs which don't pass filter are hidden. - Added applying filter on list refresh event to avoid refreshing list on every filter change. - Moved part of LLTextUtil to llui/lluitextutil to reuse code in llaccordionctrltab. - Fixed passing list size to mRefreshCompleteSignal. - Added list refresh callback to LLInventoryItemsList for checking tab visibility without re-applying filter sub-string. Committed to proceed with dependent tasks. If there are any comments/suggestions related to text utils this part of code may be changed without requiring much effort. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/363/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 131 +++++++++++++++++++++++++++++++--------- 1 file changed, 103 insertions(+), 28 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 18bd610dd9..12d5203429 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -169,6 +169,9 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Setting list commit callback to monitor currently selected wearable item. list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1)); + // Setting list refresh callback to apply filter on list change. + list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onWearableItemsListRefresh, this, _1)); + // Fetch the new outfit contents. cat->fetch(); @@ -244,35 +247,9 @@ void LLOutfitsList::performAction(std::string action) void LLOutfitsList::setFilterSubString(const std::string& string) { - mFilterSubString = string; + applyFilter(string); - for (outfits_map_t::iterator - iter = mOutfitsMap.begin(), - iter_end = mOutfitsMap.end(); - iter != iter_end; ++iter) - { - LLAccordionCtrlTab* tab = iter->second; - if (tab) - { - LLWearableItemsList* list = dynamic_cast (tab->getAccordionView()); - if (list) - { - list->setFilterSubString(mFilterSubString); - } - - if(!mFilterSubString.empty()) - { - //store accordion tab state when filter is not empty - tab->notifyChildren(LLSD().with("action","store_state")); - tab->setDisplayChildren(true); - } - else - { - //restore accordion state after all those accodrion tab manipulations - tab->notifyChildren(LLSD().with("action","restore_state")); - } - } - } + mFilterSubString = string; } ////////////////////////////////////////////////////////////////////////// @@ -350,4 +327,102 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI mSelectedOutfitUUID = category_id; } +void LLOutfitsList::onWearableItemsListRefresh(LLUICtrl* ctrl) +{ + if (!ctrl || mFilterSubString.empty()) + return; + + for (outfits_map_t::iterator + iter = mOutfitsMap.begin(), + iter_end = mOutfitsMap.end(); + iter != iter_end; ++iter) + { + LLAccordionCtrlTab* tab = iter->second; + if (tab) continue; + + LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); + if (list != ctrl) continue; + + std::string title = tab->getTitle(); + LLStringUtil::toUpper(title); + + std::string cur_filter = mFilterSubString; + LLStringUtil::toUpper(cur_filter); + + if (std::string::npos == title.find(cur_filter)) + { + // hide tab if its title doesn't pass filter + // and it has no visible items + tab->setVisible(list->size() != 0); + } + else + { + tab->setTitle(tab->getTitle(), cur_filter); + } + } +} + +void LLOutfitsList::applyFilter(const std::string& new_filter_substring) +{ + for (outfits_map_t::iterator + iter = mOutfitsMap.begin(), + iter_end = mOutfitsMap.end(); + iter != iter_end; ++iter) + { + LLAccordionCtrlTab* tab = iter->second; + if (!tab) continue; + + bool more_restrictive = mFilterSubString.size() < new_filter_substring.size() && !new_filter_substring.substr(0, mFilterSubString.size()).compare(mFilterSubString); + + // Restore tab visibility in case of less restrictive filter + // to compare it with updated string if it was previously hidden. + if (!more_restrictive) + { + tab->setVisible(TRUE); + } + + LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); + if (list) + { + list->setFilterSubString(new_filter_substring); + } + + if(mFilterSubString.empty() && !new_filter_substring.empty()) + { + //store accordion tab state when filter is not empty + tab->notifyChildren(LLSD().with("action","store_state")); + } + + if (!new_filter_substring.empty()) + { + tab->setDisplayChildren(true); + + std::string title = tab->getTitle(); + LLStringUtil::toUpper(title); + + std::string cur_filter = new_filter_substring; + LLStringUtil::toUpper(cur_filter); + + if (std::string::npos == title.find(cur_filter)) + { + // hide tab if its title doesn't pass filter + // and it has no visible items + tab->setVisible(list->size() != 0); + } + else + { + tab->setTitle(tab->getTitle(), cur_filter); + } + } + else + { + // restore tab title when filter is empty + tab->setTitle(tab->getTitle()); + + //restore accordion state after all those accodrion tab manipulations + tab->notifyChildren(LLSD().with("action","restore_state")); + } + } +} + // EOF -- cgit v1.2.3 From d8b989a87b94fd851404b42094e88c0a0c213ac8 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Mon, 17 May 2010 18:57:03 +0300 Subject: EXT-7158 ADDITIONAL FIX Optimization and implementation fix - Fixed issue with filter not applied to outfit newly added while filtering is active. - Optimization of refreshing outfit list when filter is applied - list is not refreshed on every list visibility change. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/394/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 12d5203429..43b7e15977 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -170,7 +170,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1)); // Setting list refresh callback to apply filter on list change. - list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onWearableItemsListRefresh, this, _1)); + list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onFilteredWearableItemsListRefresh, this, _1)); // Fetch the new outfit contents. cat->fetch(); @@ -178,6 +178,21 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Refresh the list of outfit items after fetch(). // Further list updates will be triggered by the category observer. list->updateList(cat_id); + + // If filter is currently applied we store the initial tab state and + // open it to show matched items if any. + if (!mFilterSubString.empty()) + { + tab->notifyChildren(LLSD().with("action","store_state")); + tab->setDisplayChildren(true); + + // Setting mForceRefresh flag will make the list refresh its contents + // even if it is not currently visible. This is required to apply the + // filter to the newly added list. + list->setForceRefresh(true); + + list->setFilterSubString(mFilterSubString); + } } // Handle removed tabs. @@ -327,7 +342,7 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI mSelectedOutfitUUID = category_id; } -void LLOutfitsList::onWearableItemsListRefresh(LLUICtrl* ctrl) +void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) { if (!ctrl || mFilterSubString.empty()) return; @@ -338,7 +353,7 @@ void LLOutfitsList::onWearableItemsListRefresh(LLUICtrl* ctrl) iter != iter_end; ++iter) { LLAccordionCtrlTab* tab = iter->second; - if (tab) continue; + if (!tab) continue; LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); if (list != ctrl) continue; @@ -395,8 +410,6 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) if (!new_filter_substring.empty()) { - tab->setDisplayChildren(true); - std::string title = tab->getTitle(); LLStringUtil::toUpper(title); @@ -413,6 +426,18 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) { tab->setTitle(tab->getTitle(), cur_filter); } + + if (tab->getVisible()) + { + // Open tab if it has passed the filter. + tab->setDisplayChildren(true); + } + else + { + // Set force refresh flag to refresh not visible list + // when some changes occur in it. + list->setForceRefresh(true); + } } else { -- cgit v1.2.3 From e041b67501ef2c24991ee25dd759e6d69e36ed75 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Tue, 18 May 2010 23:37:37 +0300 Subject: Removed duplicated include. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 43b7e15977..7ebbddca25 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -36,9 +36,6 @@ // llcommon #include "llcommonutils.h" -// llcommon -#include "llcommonutils.h" - #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llappearancemgr.h" -- cgit v1.2.3 From d634239bac4ee94d96a17b4ba68015c9f90b727a Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 20 May 2010 14:54:34 +0300 Subject: EXT-6726 WIP Added stubs for most of Appearance SP context/gear menus. Shared code with avatar lists context menus. Reviewed by Mike Antipov and Nyx at https://codereview.productengine.com/secondlife/r/415/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 7ebbddca25..36832c9d16 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -41,8 +41,26 @@ #include "llappearancemgr.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" +#include "lllistcontextmenu.h" +#include "lltransutil.h" +#include "llviewermenu.h" +#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llwearableitemslist.h" +////////////////////////////////////////////////////////////////////////// + +class OutfitContextMenu : public LLListContextMenu +{ +protected: + /* virtual */ LLContextMenu* createMenu() + { + return createFromFile("menu_outfit_tab.xml"); + } +}; + +////////////////////////////////////////////////////////////////////////// + static LLRegisterPanelClassWrapper t_outfits_list("outfits_list"); LLOutfitsList::LLOutfitsList() @@ -55,10 +73,14 @@ LLOutfitsList::LLOutfitsList() gInventory.addObserver(mCategoriesObserver); gInventory.addObserver(this); + + mOutfitMenu = new OutfitContextMenu(); } LLOutfitsList::~LLOutfitsList() { + delete mOutfitMenu; + if (gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -140,6 +162,8 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) static LLXMLNodePtr accordionXmlNode = getAccordionTabXMLNode(); LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder(accordionXmlNode, NULL, NULL); + tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this, + _1, _2, _3, cat_id)); tab->setName(name); tab->setTitle(name); @@ -447,4 +471,19 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) } } +void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) +{ + LLAccordionCtrlTab* tab = dynamic_cast(ctrl); + if(mOutfitMenu && tab && tab->getHeaderVisible() && cat_id.notNull()) + { + S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight(); + if(y >= header_bottom) + { + uuid_vec_t selected_uuids; + selected_uuids.push_back(cat_id); + mOutfitMenu->show(ctrl, selected_uuids, x, y); + } + } +} + // EOF -- cgit v1.2.3 From cb0589715265dc1568626fe238aac7417b44ef89 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 25 May 2010 14:17:11 +0300 Subject: EXT-6726 WIP Added handlers for most of Appearance SP context/gear menus. Reviewed by Mike Antipov and Nyx at https://codereview.productengine.com/secondlife/r/428/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 36832c9d16..17a2db7a43 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -38,6 +38,7 @@ #include "llaccordionctrl.h" #include "llaccordionctrltab.h" +#include "llagentwearables.h" #include "llappearancemgr.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" @@ -55,6 +56,20 @@ class OutfitContextMenu : public LLListContextMenu protected: /* virtual */ LLContextMenu* createMenu() { + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + LLUUID selected_id = mUUIDs.front(); + + registrar.add("Outfit.WearReplace", + boost::bind(&LLAppearanceMgr::replaceCurrentOutfit, &LLAppearanceMgr::instance(), selected_id)); + registrar.add("Outfit.WearAdd", + boost::bind(&LLAppearanceMgr::addCategoryToCurrentOutfit, &LLAppearanceMgr::instance(), selected_id)); + registrar.add("Outfit.TakeOff", + boost::bind(&LLAppearanceMgr::takeOffOutfit, &LLAppearanceMgr::instance(), selected_id)); + // *TODO: implement this + // registrar.add("Outfit.Rename", boost::bind()); + // registrar.add("Outfit.Delete", boost::bind()); + return createFromFile("menu_outfit_tab.xml"); } }; -- cgit v1.2.3 From 40b476dbb2aee494d57dce81427b74ac19b1428d Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Sat, 29 May 2010 00:06:34 +0300 Subject: EXT-7198, EXT-7491 FIXED Added mutli-selection support for outfit items and outfit tabs selection support. - Added selecting multiple items from more than one accordion tab. - Integrated context menus from Vadim's patch for EXT-6726 Appearance SP menus (WIP tier 2). - Added selection to accordion control to use it instead of accordion tab focus in cases when focus is lost and outfit tab should stay selected. - Changed "Wear" button behavior: "Wear" puts on currently selected outfit (as the tooltip reads "Wear selected outfit"). There is always an outfit selected when the accordion is focused so for now there are no cases when only some items are selected. Separate items can be worn from context menu. - Added moving accordion tab selection with right click. Fixed (EXT-7491) Right click on an accordion title should move selection to it. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/437/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 78 +++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 14 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 17a2db7a43..8f189a1e9f 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -82,7 +82,6 @@ LLOutfitsList::LLOutfitsList() : LLPanel() , mAccordion(NULL) , mListCommands(NULL) - , mSelectedList(NULL) { mCategoriesObserver = new LLInventoryCategoriesObserver(); gInventory.addObserver(mCategoriesObserver); @@ -208,6 +207,8 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Setting list refresh callback to apply filter on list change. list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onFilteredWearableItemsListRefresh, this, _1)); + list->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onWearableItemsListRightClick, this, _1, _2, _3)); + // Fetch the new outfit contents. cat->fetch(); @@ -237,23 +238,27 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) outfits_map_t::iterator outfits_iter = mOutfitsMap.find((*iter)); if (outfits_iter != mOutfitsMap.end()) { - // An outfit is removed from the list. Do the following: - // 1. Remove outfit accordion tab from accordion. - mAccordion->removeCollapsibleCtrl(outfits_iter->second); - const LLUUID& outfit_id = outfits_iter->first; + LLAccordionCtrlTab* tab = outfits_iter->second; - // 2. Remove outfit category from observer to stop monitoring its changes. + // An outfit is removed from the list. Do the following: + // 1. Remove outfit category from observer to stop monitoring its changes. mCategoriesObserver->removeCategory(outfit_id); - // 3. Reset selection if selected outfit is being removed. - if (mSelectedOutfitUUID == outfit_id) + // 2. Remove selected lists map entry. + mSelectedListsMap.erase(outfit_id); + + // 3. Reset currently selected outfit id if it is being removed. + if (outfit_id == mSelectedOutfitUUID) { - changeOutfitSelection(NULL, LLUUID()); + mSelectedOutfitUUID = LLUUID(); } // 4. Remove category UUID to accordion tab mapping. mOutfitsMap.erase(outfits_iter); + + // 5. Remove outfit tab from accordion. + mAccordion->removeCollapsibleCtrl(tab); } } @@ -283,6 +288,8 @@ void LLOutfitsList::onSelectionChange(LLUICtrl* ctrl) void LLOutfitsList::performAction(std::string action) { + if (mSelectedOutfitUUID.isNull()) return; + LLViewerInventoryCategory* cat = gInventory.getCategory(mSelectedOutfitUUID); if (!cat) return; @@ -367,14 +374,28 @@ void LLOutfitsList::updateOutfitTab(const LLUUID& category_id) void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id) { - // Reset selection in previously selected tab - // if a new one is selected. - if (list && mSelectedList && mSelectedList != list) + MASK mask = gKeyboard->currentMask(TRUE); + + // Reset selection in all previously selected tabs except for the current + // if new selection is started. + if (list && !(mask & MASK_CONTROL)) { - mSelectedList->resetSelection(); + for (wearables_lists_map_t::iterator iter = mSelectedListsMap.begin(); + iter != mSelectedListsMap.end(); + ++iter) + { + LLWearableItemsList* selected_list = (*iter).second; + if (selected_list != list) + { + selected_list->resetSelection(); + } + } + + // Clear current selection. + mSelectedListsMap.clear(); } - mSelectedList = list; + mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list)); mSelectedOutfitUUID = category_id; } @@ -494,6 +515,13 @@ void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight(); if(y >= header_bottom) { + // Focus tab header to trigger tab selection change. + LLUICtrl* header = tab->findChild("dd_header"); + if (header) + { + header->setFocus(TRUE); + } + uuid_vec_t selected_uuids; selected_uuids.push_back(cat_id); mOutfitMenu->show(ctrl, selected_uuids, x, y); @@ -501,4 +529,26 @@ void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const } } +void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) +{ + LLWearableItemsList* list = dynamic_cast(ctrl); + if (!list) return; + + uuid_vec_t selected_uuids; + + // Collect seleted items from all selected lists. + for (wearables_lists_map_t::iterator iter = mSelectedListsMap.begin(); + iter != mSelectedListsMap.end(); + ++iter) + { + uuid_vec_t uuids; + (*iter).second->getSelectedUUIDs(uuids); + + S32 prev_size = selected_uuids.size(); + selected_uuids.resize(prev_size + uuids.size()); + std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); + } + + LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y); +} // EOF -- cgit v1.2.3 From b678d2888c5da04cf4d778b29a60a78c8c1aff5f Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 2 Jun 2010 16:16:26 +0300 Subject: EXT-7239 FIXED Added wearing double-clicked item or uutfit. - Added outfit list item with double click support. - Added wearing/detaching single item on double click. - Added replacing current outfit with an outfit from double clicked accordion tab. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/493/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 52 +++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 8f189a1e9f..66002d4044 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -49,6 +49,8 @@ #include "llvoavatarself.h" #include "llwearableitemslist.h" +static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y); + ////////////////////////////////////////////////////////////////////////// class OutfitContextMenu : public LLListContextMenu @@ -176,8 +178,6 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) static LLXMLNodePtr accordionXmlNode = getAccordionTabXMLNode(); LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder(accordionXmlNode, NULL, NULL); - tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this, - _1, _2, _3, cat_id)); tab->setName(name); tab->setTitle(name); @@ -198,6 +198,12 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Map the new tab with outfit category UUID. mOutfitsMap.insert(LLOutfitsList::outfits_map_value_t(cat_id, tab)); + tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this, + _1, _2, _3, cat_id)); + + tab->setDoubleClickCallback(boost::bind(&LLOutfitsList::onAccordionTabDoubleClick, this, + _1, _2, _3, cat_id)); + // Setting tab focus callback to monitor currently selected outfit. tab->setFocusReceivedCallback(boost::bind(&LLOutfitsList::changeOutfitSelection, this, list, cat_id)); @@ -510,22 +516,30 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) { LLAccordionCtrlTab* tab = dynamic_cast(ctrl); - if(mOutfitMenu && tab && tab->getHeaderVisible() && cat_id.notNull()) + if(mOutfitMenu && is_tab_header_clicked(tab, y) && cat_id.notNull()) { - S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight(); - if(y >= header_bottom) + // Focus tab header to trigger tab selection change. + LLUICtrl* header = tab->findChild("dd_header"); + if (header) { - // Focus tab header to trigger tab selection change. - LLUICtrl* header = tab->findChild("dd_header"); - if (header) - { - header->setFocus(TRUE); - } - - uuid_vec_t selected_uuids; - selected_uuids.push_back(cat_id); - mOutfitMenu->show(ctrl, selected_uuids, x, y); + header->setFocus(TRUE); } + + uuid_vec_t selected_uuids; + selected_uuids.push_back(cat_id); + mOutfitMenu->show(ctrl, selected_uuids, x, y); + } +} + +void LLOutfitsList::onAccordionTabDoubleClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) +{ + LLAccordionCtrlTab* tab = dynamic_cast(ctrl); + if(is_tab_header_clicked(tab, y) && cat_id.notNull()) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + if (!cat) return; + + LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, FALSE ); } } @@ -551,4 +565,12 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y); } + +bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y) +{ + if(!tab || !tab->getHeaderVisible()) return false; + + S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight(); + return y >= header_bottom; +} // EOF -- cgit v1.2.3 From 4896da3598d00095f573fddde21a84b05661aa79 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Wed, 2 Jun 2010 16:16:29 +0300 Subject: EXT-7587 FIXED Fixed applying filter highlighting to outfit titles. Reviewed by Neal Orman and Mike Antipov at https://codereview.productengine.com/secondlife/r/496/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 66002d4044..98ec272e96 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -432,6 +432,10 @@ void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) // hide tab if its title doesn't pass filter // and it has no visible items tab->setVisible(list->size() != 0); + + // remove title highlighting because it might + // have been previously highlighted by less restrictive filter + tab->setTitle(tab->getTitle()); } else { @@ -484,6 +488,10 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) // hide tab if its title doesn't pass filter // and it has no visible items tab->setVisible(list->size() != 0); + + // remove title highlighting because it might + // have been previously highlighted by less restrictive filter + tab->setTitle(tab->getTitle()); } else { -- cgit v1.2.3 From 671625695fc44adc430a7ddf3be158ce26a61cc6 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Wed, 2 Jun 2010 20:46:16 +0300 Subject: EXT-6726 WIP Added more menus to the Appearance SP. Done: - Implemented creating new wearables via My Outfits gear menu. - Implemented renaming/removing/editing an outfit via My Outfits context menu. - Implemented "Attach to..." / "Attach to HUD..." context submenus. - Now disabling (instead of hiding) irrelevant wearable context menu items. - Added "Take Off / Detach" context menu item that's shown for clothes and attachments. Useful if you selected a bunch of items and want to take them all off. - Fixed taking off an outfit (not all wearables were taken off because of a wrong inventory collector). - Fixed crash when editing a skirt (reference to a missing string). - In LLWearableItemsList::ContextMenu::updateItemsVisibility renamed variables and introduced MASK_UNKNOWN per Nyx's request. Known issues: - "Attach to..." context menus may be displayed partially off-screen (there is the same bug in the inventory panel). - The way we invoke wearable editing panel after the wearable gets created is currently a hack. TODO: - Wear / take off / rename / delete an outfit via My Outfits gear menu (currently not implemented because of missing selection support in My Outfits). - Add "Create new..." to body part / clothing context menu in Edit Outfit. - Add "Create new..." submenus to the Edit Outfit gear menu. Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/466/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 142 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 3 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 98ec272e96..5c8b3d1894 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -43,6 +43,8 @@ #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "lllistcontextmenu.h" +#include "llnotificationsutil.h" +#include "llsidetray.h" #include "lltransutil.h" #include "llviewermenu.h" #include "llvoavatar.h" @@ -53,6 +55,28 @@ static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y); ////////////////////////////////////////////////////////////////////////// +// Collect non-removable folders and items. +class LLFindNonRemovableObjects : public LLInventoryCollectFunctor +{ +public: + virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) + { + if (item) + { + return !get_is_item_removable(&gInventory, item->getUUID()); + } + if (cat) + { + return !get_is_category_removable(&gInventory, cat->getUUID()); + } + + llwarns << "Not a category and not an item?" << llendl; + return false; + } +}; + +////////////////////////////////////////////////////////////////////////// + class OutfitContextMenu : public LLListContextMenu { protected: @@ -68,12 +92,124 @@ protected: boost::bind(&LLAppearanceMgr::addCategoryToCurrentOutfit, &LLAppearanceMgr::instance(), selected_id)); registrar.add("Outfit.TakeOff", boost::bind(&LLAppearanceMgr::takeOffOutfit, &LLAppearanceMgr::instance(), selected_id)); - // *TODO: implement this - // registrar.add("Outfit.Rename", boost::bind()); - // registrar.add("Outfit.Delete", boost::bind()); + registrar.add("Outfit.Edit", boost::bind(editOutfit)); + registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id)); + registrar.add("Outfit.Delete", boost::bind(deleteOutfit, selected_id)); + + enable_registrar.add("Outfit.OnEnable", boost::bind(&OutfitContextMenu::onEnable, this, _2)); return createFromFile("menu_outfit_tab.xml"); } + + bool onEnable(const LLSD& data) + { + std::string param = data.asString(); + LLUUID outfit_cat_id = mUUIDs.back(); + bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == outfit_cat_id; + + if ("wear_replace" == param) + { + return !is_worn; + } + else if ("wear_add" == param) + { + return !is_worn; + } + else if ("take_off" == param) + { + return is_worn; + } + else if ("edit" == param) + { + return is_worn; + } + else if ("rename" == param) + { + return get_is_category_renameable(&gInventory, outfit_cat_id); + } + else if ("delete" == param) + { + return canDeleteOutfit(outfit_cat_id); + } + + return true; + } + + static void editOutfit() + { + LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + } + + static void renameOutfit(const LLUUID& outfit_cat_id) + { + LLViewerInventoryCategory* outfit_cat = gInventory.getCategory(outfit_cat_id); + llassert(outfit_cat); + if (!outfit_cat) return; + + LLSD args; + args["NAME"] = outfit_cat->getName(); + + LLSD payload; + payload["cat_id"] = outfit_cat_id; + + LLNotificationsUtil::add("RenameOutfit", args, payload, boost::bind(onRename, _1, _2)); + } + + // User typed new outfit name. + static void onRename(const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) return; // canceled + + std::string outfit_name = response["new_name"].asString(); + LLStringUtil::trim(outfit_name); + if (!outfit_name.empty()) + { + LLUUID cat_id = notification["payload"]["cat_id"].asUUID(); + rename_category(&gInventory, cat_id, outfit_name); + } + } + + static bool canDeleteOutfit(const LLUUID& outfit_cat_id) + { + // Disallow removing the base outfit. + if (outfit_cat_id == LLAppearanceMgr::instance().getBaseOutfitUUID()) + { + return false; + } + + // Check if the outfit folder itself is removable. + if (!get_is_category_removable(&gInventory, outfit_cat_id)) + { + return false; + } + + // Check if the folder contains worn items. + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLFindWorn filter_worn; + gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_worn); + if (!items.empty()) + { + return false; + } + + // Check for the folder's non-removable descendants. + LLFindNonRemovableObjects filter_non_removable; + LLInventoryModel::item_array_t::const_iterator it; + gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_non_removable); + if (!cats.empty() || !items.empty()) + { + return false; + } + + return true; + } + + static void deleteOutfit(const LLUUID& outfit_cat_id) + { + remove_category(&gInventory, outfit_cat_id); + } }; ////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 142a6c3b8fa9e286c0336236d1eccd9a6725f06a Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Wed, 2 Jun 2010 20:46:16 +0300 Subject: EXT-6726 WIP Added missing menu items to the Appearance SP. - Hooked up Wear / Take off / Rename / Delete items in the My Outfits gear menu. - Added "Create new..." to body part / clothing context menu in Edit Outfit. - Added "Create new..." submenus to the Edit Outfit gear menu. - Disabling the "Take Off" menu item of the clothing context menu in the Edit Outfit panel when it's irrelevant. Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/494/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 92 ++++------------------------------------- 1 file changed, 7 insertions(+), 85 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 5c8b3d1894..94bf2f4c7a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -55,28 +55,6 @@ static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y); ////////////////////////////////////////////////////////////////////////// -// Collect non-removable folders and items. -class LLFindNonRemovableObjects : public LLInventoryCollectFunctor -{ -public: - virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) - { - if (item) - { - return !get_is_item_removable(&gInventory, item->getUUID()); - } - if (cat) - { - return !get_is_category_removable(&gInventory, cat->getUUID()); - } - - llwarns << "Not a category and not an item?" << llendl; - return false; - } -}; - -////////////////////////////////////////////////////////////////////////// - class OutfitContextMenu : public LLListContextMenu { protected: @@ -129,7 +107,7 @@ protected: } else if ("delete" == param) { - return canDeleteOutfit(outfit_cat_id); + return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id); } return true; @@ -142,68 +120,7 @@ protected: static void renameOutfit(const LLUUID& outfit_cat_id) { - LLViewerInventoryCategory* outfit_cat = gInventory.getCategory(outfit_cat_id); - llassert(outfit_cat); - if (!outfit_cat) return; - - LLSD args; - args["NAME"] = outfit_cat->getName(); - - LLSD payload; - payload["cat_id"] = outfit_cat_id; - - LLNotificationsUtil::add("RenameOutfit", args, payload, boost::bind(onRename, _1, _2)); - } - - // User typed new outfit name. - static void onRename(const LLSD& notification, const LLSD& response) - { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return; // canceled - - std::string outfit_name = response["new_name"].asString(); - LLStringUtil::trim(outfit_name); - if (!outfit_name.empty()) - { - LLUUID cat_id = notification["payload"]["cat_id"].asUUID(); - rename_category(&gInventory, cat_id, outfit_name); - } - } - - static bool canDeleteOutfit(const LLUUID& outfit_cat_id) - { - // Disallow removing the base outfit. - if (outfit_cat_id == LLAppearanceMgr::instance().getBaseOutfitUUID()) - { - return false; - } - - // Check if the outfit folder itself is removable. - if (!get_is_category_removable(&gInventory, outfit_cat_id)) - { - return false; - } - - // Check if the folder contains worn items. - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLFindWorn filter_worn; - gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_worn); - if (!items.empty()) - { - return false; - } - - // Check for the folder's non-removable descendants. - LLFindNonRemovableObjects filter_non_removable; - LLInventoryModel::item_array_t::const_iterator it; - gInventory.collectDescendentsIf(outfit_cat_id, cats, items, false, filter_non_removable); - if (!cats.empty() || !items.empty()) - { - return false; - } - - return true; + LLAppearanceMgr::instance().renameOutfit(outfit_cat_id); } static void deleteOutfit(const LLUUID& outfit_cat_id) @@ -443,6 +360,10 @@ void LLOutfitsList::performAction(std::string action) { LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, TRUE ); } + else if ("rename_outfit" == action) + { + LLAppearanceMgr::instance().renameOutfit(mSelectedOutfitUUID); + } } void LLOutfitsList::setFilterSubString(const std::string& string) @@ -717,4 +638,5 @@ bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y) S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight(); return y >= header_bottom; } + // EOF -- cgit v1.2.3 From 86c230e4902ec06bb65e81b638d60e6b80b51613 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 3 Jun 2010 11:26:38 +0300 Subject: EXT-7503 WIP Made first inventory fetch in My Outfits panel only on first panel opening. * LLOutfitsList is not Inventory Observer anymore * Content is fetched in onOpen now * Added call of the LLOutfitsList::onOpen when "My Outfits" tab is switched on in My Appearance panel Reviewed by Brad Payne at https://codereview.productengine.com/secondlife/r/456/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 55 +++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 98ec272e96..7bf41b0f92 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -84,11 +84,9 @@ LLOutfitsList::LLOutfitsList() : LLPanel() , mAccordion(NULL) , mListCommands(NULL) + , mIsInitialized(false) { mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - - gInventory.addObserver(this); mOutfitMenu = new OutfitContextMenu(); } @@ -102,11 +100,6 @@ LLOutfitsList::~LLOutfitsList() gInventory.removeObserver(mCategoriesObserver); delete mCategoriesObserver; } - - if (gInventory.containsObserver(this)) - { - gInventory.removeObserver(this); - } } BOOL LLOutfitsList::postBuild() @@ -117,32 +110,36 @@ BOOL LLOutfitsList::postBuild() } //virtual -void LLOutfitsList::changed(U32 mask) +void LLOutfitsList::onOpen(const LLSD& /*info*/) { - if (!gInventory.isInventoryUsable()) - return; + if (!mIsInitialized) + { + // *TODO: I'm not sure is this check necessary but it never match while developing. + if (!gInventory.isInventoryUsable()) + return; - const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - LLViewerInventoryCategory* category = gInventory.getCategory(outfits); - if (!category) - return; + const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + + // *TODO: I'm not sure is this check necessary but it never match while developing. + LLViewerInventoryCategory* category = gInventory.getCategory(outfits); + if (!category) + return; + + gInventory.addObserver(mCategoriesObserver); - // Start observing changes in "My Outfits" category. - mCategoriesObserver->addCategory(outfits, + // Start observing changes in "My Outfits" category. + mCategoriesObserver->addCategory(outfits, boost::bind(&LLOutfitsList::refreshList, this, outfits)); - // Fetch "My Outfits" contents and refresh the list to display - // initially fetched items. If not all items are fetched now - // the observer will refresh the list as soon as the new items - // arrive. - category->fetch(); - refreshList(outfits); - - // This observer is used to start the initial outfits fetch - // when inventory becomes usable. It is no longer needed because - // "My Outfits" category is now observed by - // LLInventoryCategoriesObserver. - gInventory.removeObserver(this); + // Fetch "My Outfits" contents and refresh the list to display + // initially fetched items. If not all items are fetched now + // the observer will refresh the list as soon as the new items + // arrive. + category->fetch(); + refreshList(outfits); + + mIsInitialized = true; + } } void LLOutfitsList::refreshList(const LLUUID& category_id) -- cgit v1.2.3 From e1189d0e2ee47539edc68c3532e0a5ce64d5dcd1 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Jun 2010 13:29:25 +0300 Subject: EXT-7368 FIXED Implemented new "empty_accordion_text" textbox to show help text when there are no visible tabs in accordion. * Textbox always fit whole accordion. * This text is updated with search_term (in link to open Search floater) when new filter substring is passed to accordion. * Accordion is notified by its tabs when their visibility is changed. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/486/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 77db280487..a4ae957c76 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -500,6 +500,8 @@ void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) void LLOutfitsList::applyFilter(const std::string& new_filter_substring) { + mAccordion->setFilterSubString(new_filter_substring); + for (outfits_map_t::iterator iter = mOutfitsMap.begin(), iter_end = mOutfitsMap.end(); -- cgit v1.2.3 From d1751df1cc5d9bf853f29555de94faec1912e19f Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Fri, 4 Jun 2010 21:52:38 +0300 Subject: EXT-7610 FIXED Added sorting outfit tabs by name (case insensitive). Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/523/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index a4ae957c76..e20b2e26be 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -53,6 +53,20 @@ static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y); +static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR; + +/*virtual*/ +bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const +{ + std::string name1 = tab1->getTitle(); + std::string name2 = tab2->getTitle(); + + LLStringUtil::toUpper(name1); + LLStringUtil::toUpper(name2); + + return name1 < name2; +} + ////////////////////////////////////////////////////////////////////////// class OutfitContextMenu : public LLListContextMenu @@ -158,6 +172,7 @@ LLOutfitsList::~LLOutfitsList() BOOL LLOutfitsList::postBuild() { mAccordion = getChild("outfits_accordion"); + mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR); return TRUE; } @@ -328,7 +343,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) updateOutfitTab(*items_iter); } - mAccordion->arrange(); + mAccordion->sort(); } void LLOutfitsList::onSelectionChange(LLUICtrl* ctrl) -- cgit v1.2.3 From 0480e29597a354279119c28839710b54bc030bc7 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 10 Jun 2010 15:42:23 +0300 Subject: EXT-7609 FIXED Added worn items indication in Appearance panel. - Added (worn) suffix to indicate worn item of LLPanelInventoryListItemBase type (all flat list items in Appearance panel). - Used LLOutfitObserver for updating (worn) suffix when user wears an item from My Outfits list. - Added updating only items and links to items with specific UUIDs in LLWearableItemsList. Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/551/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index e20b2e26be..160e516a65 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -44,6 +44,7 @@ #include "llinventorymodel.h" #include "lllistcontextmenu.h" #include "llnotificationsutil.h" +#include "lloutfitobserver.h" #include "llsidetray.h" #include "lltransutil.h" #include "llviewermenu.h" @@ -199,6 +200,9 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/) mCategoriesObserver->addCategory(outfits, boost::bind(&LLOutfitsList::refreshList, this, outfits)); + // Start observing changes in Current Outfit to update items worn state. + LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLOutfitsList::onCOFChanged, this)); + // Fetch "My Outfits" contents and refresh the list to display // initially fetched items. If not all items are fetched now // the observer will refresh the list as soon as the new items @@ -645,6 +649,43 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y); } +void LLOutfitsList::onCOFChanged() +{ + LLInventoryModel::changed_items_t changed_linked_items; + + const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs(); + for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin(); + iter != changed_items.end(); + ++iter) + { + LLViewerInventoryItem* item = gInventory.getItem(*iter); + if (item) + { + // From gInventory we get the UUIDs of new links added to COF + // or removed from COF. These links UUIDs are not the same UUIDs + // that we have in each wearable items list. So we collect base items + // UUIDs to find all items or links that point to same base items in wearable + // items lists and update their worn state there. + changed_linked_items.insert(item->getLinkedUUID()); + } + } + + for (outfits_map_t::iterator iter = mOutfitsMap.begin(); + iter != mOutfitsMap.end(); + ++iter) + { + LLAccordionCtrlTab* tab = iter->second; + if (!tab) continue; + + LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); + if (!list) continue; + + // Every list updates the labels of changed items or + // the links that point to these items. + list->updateChangedItems(changed_linked_items); + } +} + bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y) { if(!tab || !tab->getHeaderVisible()) return false; -- cgit v1.2.3 From 63c21d120fe1eb940bf959b8465a47a441bcef77 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 10 Jun 2010 15:34:44 +0300 Subject: EXT-7615 FIXED Fixed the trash button in My Outfits. - Now it's enabled when the "Delete Outfit" context menu item is enabled. - It actually deletes the selected outfits. Known out-of-scope issues: - The trash button is sometimes enabled when the WEARING tab is active. - The check whether an outfit can be removed is probably wrong. There is a separate ticket (EXT-7716) for that. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/550/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 160e516a65..bca292fa4a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -326,7 +326,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // 3. Reset currently selected outfit id if it is being removed. if (outfit_id == mSelectedOutfitUUID) { - mSelectedOutfitUUID = LLUUID(); + setSelectedOutfitUUID(LLUUID()); } // 4. Remove category UUID to accordion tab mapping. @@ -389,6 +389,11 @@ void LLOutfitsList::setFilterSubString(const std::string& string) mFilterSubString = string; } +boost::signals2::connection LLOutfitsList::addSelectionChangeCallback(selection_change_callback_t cb) +{ + return mSelectionChangeSignal.connect(cb); +} + ////////////////////////////////////////////////////////////////////////// // Private methods ////////////////////////////////////////////////////////////////////////// @@ -475,7 +480,12 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI } mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list)); - mSelectedOutfitUUID = category_id; + setSelectedOutfitUUID(category_id); +} + +void LLOutfitsList::setSelectedOutfitUUID(const LLUUID& category_id) +{ + mSelectionChangeSignal(mSelectedOutfitUUID = category_id); } void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) -- cgit v1.2.3 From ad048d4b6a114c11848ecf3147f1be93db00abe2 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 11 Jun 2010 17:25:56 +0300 Subject: EXT-7807 FIXED Hide inappropriate outfit context menu items. Hide the following outfit context menu items instead of disabling them: * Wear - Replace Current Outfit * Wear - Add to Current Outfit" * Take Off - Remove from Current Outfit * Edit Outfit * Delete Outfit Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/565/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index bca292fa4a..03df2d2b20 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -90,17 +90,33 @@ protected: registrar.add("Outfit.Delete", boost::bind(deleteOutfit, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&OutfitContextMenu::onEnable, this, _2)); + enable_registrar.add("Outfit.OnVisible", boost::bind(&OutfitContextMenu::onVisible, this, _2)); return createFromFile("menu_outfit_tab.xml"); } - bool onEnable(const LLSD& data) + bool onEnable(LLSD::String param) + { + LLUUID outfit_cat_id = mUUIDs.back(); + + if ("rename" == param) + { + return get_is_category_renameable(&gInventory, outfit_cat_id); + } + + return true; + } + + bool onVisible(LLSD::String param) { - std::string param = data.asString(); LLUUID outfit_cat_id = mUUIDs.back(); bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == outfit_cat_id; - if ("wear_replace" == param) + if ("edit" == param) + { + return is_worn; + } + else if ("wear_replace" == param) { return !is_worn; } @@ -112,14 +128,6 @@ protected: { return is_worn; } - else if ("edit" == param) - { - return is_worn; - } - else if ("rename" == param) - { - return get_is_category_renameable(&gInventory, outfit_cat_id); - } else if ("delete" == param) { return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id); -- cgit v1.2.3 From 9669923a7c370d43136cfc04b34247689aad1d3a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Jun 2010 14:59:24 -0700 Subject: EXT-7239 - Double-click on outfit title should wear outfit, Double-click on item should wear item decision was to remove double click behavior --- indra/newview/lloutfitslist.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index e20b2e26be..caa29db9d3 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -266,9 +266,6 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this, _1, _2, _3, cat_id)); - tab->setDoubleClickCallback(boost::bind(&LLOutfitsList::onAccordionTabDoubleClick, this, - _1, _2, _3, cat_id)); - // Setting tab focus callback to monitor currently selected outfit. tab->setFocusReceivedCallback(boost::bind(&LLOutfitsList::changeOutfitSelection, this, list, cat_id)); @@ -610,18 +607,6 @@ void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const } } -void LLOutfitsList::onAccordionTabDoubleClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) -{ - LLAccordionCtrlTab* tab = dynamic_cast(ctrl); - if(is_tab_header_clicked(tab, y) && cat_id.notNull()) - { - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (!cat) return; - - LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, FALSE ); - } -} - void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) { LLWearableItemsList* list = dynamic_cast(ctrl); -- cgit v1.2.3 From 8d2ddff47e973c1692b42081e74dba3ad7745fdd Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 17 Jun 2010 17:42:09 +0300 Subject: EXT-7609 FIXED Added worn items indication with bold text. Fixed updating worn items indication. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/551/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index de074d6aaf..8c6189353e 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -44,7 +44,6 @@ #include "llinventorymodel.h" #include "lllistcontextmenu.h" #include "llnotificationsutil.h" -#include "lloutfitobserver.h" #include "llsidetray.h" #include "lltransutil.h" #include "llviewermenu.h" @@ -208,8 +207,10 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/) mCategoriesObserver->addCategory(outfits, boost::bind(&LLOutfitsList::refreshList, this, outfits)); - // Start observing changes in Current Outfit to update items worn state. - LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLOutfitsList::onCOFChanged, this)); + const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); + + // Start observing changes in Current Outfit category. + mCategoriesObserver->addCategory(cof, boost::bind(&LLOutfitsList::onCOFChanged, this)); // Fetch "My Outfits" contents and refresh the list to display // initially fetched items. If not all items are fetched now -- cgit v1.2.3 From 9f996443604a902e03de87d2d14545b4adffa69c Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 17 Jun 2010 19:03:57 +0300 Subject: EXT-7722 Fixed "Add to COF" and "Remove from COF" outfit context menu items to be enabled when appropriate and work properly. Work on "Take Off - Remove from Current Outfit" and "Wear - Add to Current Outfit" menu options: - The menu items of the outfit context menu and the My Outfits gear menu are now disabled when inappropriate instead of being hidden. - The menu items get enabled/disabled depending on whether you can wear (take off) anything from the selected outfit. (was: depending on whether you're wearing the outfit) - Changed the way the options work: they now only operate on clothes and attachments. "Add to COF" now only adds those body parts that are missing in COF; "Remove from COF" doesn't touch body parts at all. Without this change both "Add" and "Remove" options would be available simultaneously, because any valid outfit contains body parts. I think that would be confusing. And you don't expect you body parts to be replaced when doing "Add to COF'. (that's addition, not replacement) Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/585/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 8c6189353e..73c850e1fb 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -102,6 +102,14 @@ protected: { return get_is_category_renameable(&gInventory, outfit_cat_id); } + else if ("wear_add" == param) + { + return LLAppearanceMgr::getCanAddToCOF(outfit_cat_id); + } + else if ("take_off" == param) + { + return LLAppearanceMgr::getCanRemoveFromCOF(outfit_cat_id); + } return true; } @@ -119,14 +127,6 @@ protected: { return !is_worn; } - else if ("wear_add" == param) - { - return !is_worn; - } - else if ("take_off" == param) - { - return is_worn; - } else if ("delete" == param) { return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id); -- cgit v1.2.3 From c75c247bc9a434e4a9e3166145e665d7811da7dc Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 17 Jun 2010 19:35:29 +0300 Subject: EXT-7620 FIXED Save outfit selection when applying filter and restore it after filter has been reset. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/603/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 117 +++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 50 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 73c850e1fb..927ea19d98 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -326,19 +326,13 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // 1. Remove outfit category from observer to stop monitoring its changes. mCategoriesObserver->removeCategory(outfit_id); - // 2. Remove selected lists map entry. - mSelectedListsMap.erase(outfit_id); + // 2. Remove the outfit from selection. + deselectOutfit(outfit_id); - // 3. Reset currently selected outfit id if it is being removed. - if (outfit_id == mSelectedOutfitUUID) - { - setSelectedOutfitUUID(LLUUID()); - } - - // 4. Remove category UUID to accordion tab mapping. + // 3. Remove category UUID to accordion tab mapping. mOutfitsMap.erase(outfits_iter); - // 5. Remove outfit tab from accordion. + // 4. Remove outfit tab from accordion. mAccordion->removeCollapsibleCtrl(tab); } } @@ -494,6 +488,27 @@ void LLOutfitsList::setSelectedOutfitUUID(const LLUUID& category_id) mSelectionChangeSignal(mSelectedOutfitUUID = category_id); } +void LLOutfitsList::deselectOutfit(const LLUUID& category_id) +{ + // Remove selected lists map entry. + mSelectedListsMap.erase(category_id); + + // Reset selection if the outfit is selected. + if (category_id == mSelectedOutfitUUID) + { + setSelectedOutfitUUID(LLUUID::null); + } +} + +void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id) +{ + // Try restoring outfit selection after filtering. + if (mAccordion->getSelectedTab() == tab) + { + setSelectedOutfitUUID(category_id); + } +} + void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) { if (!ctrl || mFilterSubString.empty()) @@ -510,26 +525,7 @@ void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); if (list != ctrl) continue; - std::string title = tab->getTitle(); - LLStringUtil::toUpper(title); - - std::string cur_filter = mFilterSubString; - LLStringUtil::toUpper(cur_filter); - - if (std::string::npos == title.find(cur_filter)) - { - // hide tab if its title doesn't pass filter - // and it has no visible items - tab->setVisible(list->size() != 0); - - // remove title highlighting because it might - // have been previously highlighted by less restrictive filter - tab->setTitle(tab->getTitle()); - } - else - { - tab->setTitle(tab->getTitle(), cur_filter); - } + applyFilterToTab(iter->first, tab, mFilterSubString); } } @@ -568,26 +564,7 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) if (!new_filter_substring.empty()) { - std::string title = tab->getTitle(); - LLStringUtil::toUpper(title); - - std::string cur_filter = new_filter_substring; - LLStringUtil::toUpper(cur_filter); - - if (std::string::npos == title.find(cur_filter)) - { - // hide tab if its title doesn't pass filter - // and it has no visible items - tab->setVisible(list->size() != 0); - - // remove title highlighting because it might - // have been previously highlighted by less restrictive filter - tab->setTitle(tab->getTitle()); - } - else - { - tab->setTitle(tab->getTitle(), cur_filter); - } + applyFilterToTab(iter->first, tab, new_filter_substring); if (tab->getVisible()) { @@ -608,10 +585,50 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) //restore accordion state after all those accodrion tab manipulations tab->notifyChildren(LLSD().with("action","restore_state")); + + // Try restoring the tab selection. + restoreOutfitSelection(tab, iter->first); } } } +void LLOutfitsList::applyFilterToTab( + const LLUUID& category_id, + LLAccordionCtrlTab* tab, + const std::string& filter_substring) +{ + if (!tab) return; + LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); + if (!list) return; + + std::string title = tab->getTitle(); + LLStringUtil::toUpper(title); + + std::string cur_filter = filter_substring; + LLStringUtil::toUpper(cur_filter); + + tab->setTitle(tab->getTitle(), cur_filter); + + if (std::string::npos == title.find(cur_filter)) + { + // hide tab if its title doesn't pass filter + // and it has no visible items + tab->setVisible(!list->empty()); + + // remove title highlighting because it might + // have been previously highlighted by less restrictive filter + tab->setTitle(tab->getTitle()); + + // Remove the tab from selection. + deselectOutfit(category_id); + } + else + { + // Try restoring the tab selection. + restoreOutfitSelection(tab, category_id); + } +} + void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) { LLAccordionCtrlTab* tab = dynamic_cast(ctrl); -- cgit v1.2.3 From 9a5c3a293908c3a3de362e7b3ea792e559033adf Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 17 Jun 2010 20:54:33 +0300 Subject: Fixed build. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 927ea19d98..e4079c709a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -613,7 +613,7 @@ void LLOutfitsList::applyFilterToTab( { // hide tab if its title doesn't pass filter // and it has no visible items - tab->setVisible(!list->empty()); + tab->setVisible(list->size() > 0); // remove title highlighting because it might // have been previously highlighted by less restrictive filter -- cgit v1.2.3 From 7b64357562ceee47d9910f08f4e4fbc1dc108f91 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Fri, 18 Jun 2010 12:22:02 +0300 Subject: EXT-7754 FIXED Implemented marking of worn outfit accordion header text with bold - Added method to LLAccordionCtrlTabHeader which allows to change style of its textbox - Added method to LLOutfitsList which marks accordion header of currently selected otfit and tied it up to BOF callbacks Reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/609/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index e4079c709a..8dd849f947 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -44,6 +44,7 @@ #include "llinventorymodel.h" #include "lllistcontextmenu.h" #include "llnotificationsutil.h" +#include "lloutfitobserver.h" #include "llsidetray.h" #include "lltransutil.h" #include "llviewermenu.h" @@ -212,12 +213,16 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/) // Start observing changes in Current Outfit category. mCategoriesObserver->addCategory(cof, boost::bind(&LLOutfitsList::onCOFChanged, this)); + LLOutfitObserver::instance().addBOFChangedCallback(boost::bind(&LLOutfitsList::highlightBaseOutfit, this)); + LLOutfitObserver::instance().addBOFReplacedCallback(boost::bind(&LLOutfitsList::highlightBaseOutfit, this)); + // Fetch "My Outfits" contents and refresh the list to display // initially fetched items. If not all items are fetched now // the observer will refresh the list as soon as the new items // arrive. category->fetch(); refreshList(outfits); + highlightBaseOutfit(); mIsInitialized = true; } @@ -350,6 +355,25 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) mAccordion->sort(); } +void LLOutfitsList::highlightBaseOutfit() +{ + // id of base outfit + LLUUID base_id = LLAppearanceMgr::getInstance()->getBaseOutfitUUID(); + if (base_id != mHighlightedOutfitUUID) + { + if (mOutfitsMap[mHighlightedOutfitUUID]) + { + mOutfitsMap[mHighlightedOutfitUUID]->setTitleFontStyle("NORMAL"); + } + + mHighlightedOutfitUUID = base_id; + } + if (mOutfitsMap[base_id]) + { + mOutfitsMap[base_id]->setTitleFontStyle("BOLD"); + } +} + void LLOutfitsList::onSelectionChange(LLUICtrl* ctrl) { LLWearableItemsList* list = dynamic_cast(ctrl); -- cgit v1.2.3 From 9aa710945685a2cae8cfc622f3dc3d900c1ab4c9 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Fri, 18 Jun 2010 12:56:02 +0300 Subject: EXT-7847 FIXED Disabled "trash" button if an item is selected inside selected outfit. - Added bool mItemSelected variable and getter for it to determine if the selection inside outfit exists, and used it when determining whether to enable "Trash" button in My Outfits. Reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/600/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 8dd849f947..c5043e1c3d 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -161,6 +161,7 @@ LLOutfitsList::LLOutfitsList() , mAccordion(NULL) , mListCommands(NULL) , mIsInitialized(false) + , mItemSelected(false) { mCategoriesObserver = new LLInventoryCategoriesObserver(); @@ -418,6 +419,11 @@ boost::signals2::connection LLOutfitsList::addSelectionChangeCallback(selection_ return mSelectionChangeSignal.connect(cb); } +bool LLOutfitsList::hasItemSelected() +{ + return mItemSelected; +} + ////////////////////////////////////////////////////////////////////////// // Private methods ////////////////////////////////////////////////////////////////////////// @@ -503,6 +509,8 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI mSelectedListsMap.clear(); } + mItemSelected = list && (list->getSelectedItem() != NULL); + mSelectedListsMap.insert(wearables_lists_map_value_t(category_id, list)); setSelectedOutfitUUID(category_id); } -- cgit v1.2.3 From f4c20d43bc4408002206b7ec7620113cef0b8256 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Tue, 22 Jun 2010 15:00:22 +0300 Subject: EXT-7875 FIXED Implemented resetting of selection inside outfit on accordion collapse/expand. - Added method which resets selection and tied it up to DropDownStateChangedCallback. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/628/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index c5043e1c3d..6542afc366 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -288,6 +288,9 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Setting tab focus callback to monitor currently selected outfit. tab->setFocusReceivedCallback(boost::bind(&LLOutfitsList::changeOutfitSelection, this, list, cat_id)); + // Setting callback to reset items selection inside outfit on accordion collapsing and expanding (EXT-7875) + tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::resetItemSelection, this, list, cat_id)); + // Setting list commit callback to monitor currently selected wearable item. list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1)); @@ -486,6 +489,13 @@ void LLOutfitsList::updateOutfitTab(const LLUUID& category_id) } } +void LLOutfitsList::resetItemSelection(LLWearableItemsList* list, const LLUUID& category_id) +{ + list->resetSelection(); + mItemSelected = false; + setSelectedOutfitUUID(category_id); +} + void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id) { MASK mask = gKeyboard->currentMask(TRUE); -- cgit v1.2.3 From 08381a276dbf0544692c44236b40f57ec111aefc Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 23 Jun 2010 15:30:48 +0300 Subject: EXT-7755 ADDITIONAL FIX Fixed issues with wrong title after an outfit from the Inventory is worn, "Wear..." menu items state is made consistent with "Wear" button. * Empty string is replaced with "Changing outfits" while changing COF; * Fixed title to show "No Outfit" after an outfit from the Inventory is worn; * Fixed bug with visible indicator after an empty folder is DnD from the Inventory "Clothing" * Updated context and Gear "Wear..." menu items to take into account "isCOFChangeInProgress" state in on_enable callbacks Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/625/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 6542afc366..b3d39f2a4a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -103,8 +103,13 @@ protected: { return get_is_category_renameable(&gInventory, outfit_cat_id); } + else if ("wear_replace" == param) + { + return !gAgentWearables.isCOFChangeInProgress(); + } else if ("wear_add" == param) { + if (gAgentWearables.isCOFChangeInProgress()) return false; return LLAppearanceMgr::getCanAddToCOF(outfit_cat_id); } else if ("take_off" == param) -- cgit v1.2.3 From 887b2858d4d180d3679f1eb39fd37be5a551615e Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Fri, 11 Jun 2010 20:02:42 +0300 Subject: EXT-7779 FIXED Changed wearing panel from inventory panel to a flat list similar to My Outfits view. - Added common interface for My Outfits and Wearing tabs. - Changed LLPanelOutfitsInventory to use common interface for My Outfits and Wearing tabs. - Removed dependency on outfits side panel from inventory bridge context menus. - Removed unused LLShowCreatedOutfit class from llagentwearables.cpp. - Restored opening newly created outfit in My Outfits tab. - Fixed worn items indication for Wearing tab items. Revieved by Neal Orman at https://codereview.productengine.com/secondlife/r/604/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 78 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 9 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index b3d39f2a4a..a285926a8b 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -162,7 +162,7 @@ protected: static LLRegisterPanelClassWrapper t_outfits_list("outfits_list"); LLOutfitsList::LLOutfitsList() - : LLPanel() + : LLPanelAppearanceTab() , mAccordion(NULL) , mListCommands(NULL) , mIsInitialized(false) @@ -313,7 +313,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // If filter is currently applied we store the initial tab state and // open it to show matched items if any. - if (!mFilterSubString.empty()) + if (!sFilterSubString.empty()) { tab->notifyChildren(LLSD().with("action","store_state")); tab->setDisplayChildren(true); @@ -323,7 +323,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // filter to the newly added list. list->setForceRefresh(true); - list->setFilterSubString(mFilterSubString); + list->setFilterSubString(sFilterSubString); } } @@ -415,14 +415,74 @@ void LLOutfitsList::performAction(std::string action) } } +void LLOutfitsList::removeSelected() +{ + if (mSelectedOutfitUUID.notNull()) + { + remove_category(&gInventory, mSelectedOutfitUUID); + } +} + +void LLOutfitsList::setSelectedOutfitByUUID(const LLUUID& outfit_uuid) +{ + for (outfits_map_t::iterator iter = mOutfitsMap.begin(); + iter != mOutfitsMap.end(); + ++iter) + { + if (outfit_uuid == iter->first) + { + LLAccordionCtrlTab* tab = iter->second; + if (!tab) continue; + + LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); + if (!list) continue; + + tab->setFocus(TRUE); + changeOutfitSelection(list, outfit_uuid); + + tab->setDisplayChildren(true); + } + } +} + +// virtual void LLOutfitsList::setFilterSubString(const std::string& string) { applyFilter(string); - mFilterSubString = string; + sFilterSubString = string; +} + +bool LLOutfitsList::isActionEnabled(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + if (command_name == "delete") + { + return !mItemSelected && LLAppearanceMgr::instance().getCanRemoveOutfit(mSelectedOutfitUUID); + } + if (command_name == "rename") + { + return get_is_category_renameable(&gInventory, mSelectedOutfitUUID); + } + if (command_name == "save_outfit") + { + bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked(); + bool outfit_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + // allow save only if outfit isn't locked and is dirty + return !outfit_locked && outfit_dirty; + } + if (command_name == "wear") + { + return mSelectedOutfitUUID.notNull(); + } + if (command_name == "take_off") + { + return LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID; + } + return false; } -boost::signals2::connection LLOutfitsList::addSelectionChangeCallback(selection_change_callback_t cb) +boost::signals2::connection LLOutfitsList::setSelectionChangeCallback(selection_change_callback_t cb) { return mSelectionChangeSignal.connect(cb); } @@ -558,7 +618,7 @@ void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) { - if (!ctrl || mFilterSubString.empty()) + if (!ctrl || sFilterSubString.empty()) return; for (outfits_map_t::iterator @@ -572,7 +632,7 @@ void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl) LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); if (list != ctrl) continue; - applyFilterToTab(iter->first, tab, mFilterSubString); + applyFilterToTab(iter->first, tab, sFilterSubString); } } @@ -588,7 +648,7 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) LLAccordionCtrlTab* tab = iter->second; if (!tab) continue; - bool more_restrictive = mFilterSubString.size() < new_filter_substring.size() && !new_filter_substring.substr(0, mFilterSubString.size()).compare(mFilterSubString); + bool more_restrictive = sFilterSubString.size() < new_filter_substring.size() && !new_filter_substring.substr(0, sFilterSubString.size()).compare(sFilterSubString); // Restore tab visibility in case of less restrictive filter // to compare it with updated string if it was previously hidden. @@ -603,7 +663,7 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) list->setFilterSubString(new_filter_substring); } - if(mFilterSubString.empty() && !new_filter_substring.empty()) + if(sFilterSubString.empty() && !new_filter_substring.empty()) { //store accordion tab state when filter is not empty tab->notifyChildren(LLSD().with("action","store_state")); -- cgit v1.2.3 From 2583a4d6ea60aeefa1d21f578d6fbf1f2f68c72a Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Tue, 22 Jun 2010 16:34:27 +0300 Subject: EXT-4295 FIXED Added gear and context menus for Wearing tab. - Moved My Outfits gear menu from llpaneloutfitsinventory.cpp to lloutfitslist.cpp Revieved by Neal Orman and Mike Antipov at https://codereview.productengine.com/secondlife/r/604/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 165 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 159 insertions(+), 6 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index a285926a8b..b8489d450b 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -70,7 +70,148 @@ bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LL ////////////////////////////////////////////////////////////////////////// -class OutfitContextMenu : public LLListContextMenu +class LLOutfitListGearMenu +{ +public: + LLOutfitListGearMenu(LLOutfitsList* olist) + : mOutfitList(olist), + mMenu(NULL) + { + llassert_always(mOutfitList); + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + + registrar.add("Gear.Wear", boost::bind(&LLOutfitListGearMenu::onWear, this)); + registrar.add("Gear.TakeOff", boost::bind(&LLOutfitListGearMenu::onTakeOff, this)); + registrar.add("Gear.Rename", boost::bind(&LLOutfitListGearMenu::onRename, this)); + registrar.add("Gear.Delete", boost::bind(&LLOutfitListGearMenu::onDelete, this)); + registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2)); + + enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitsList::isActionEnabled, mOutfitList, _2)); + enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2)); + + mMenu = LLUICtrlFactory::getInstance()->createFromFile( + "menu_outfit_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + llassert(mMenu); + } + + void show(LLView* spawning_view) + { + if (!mMenu) return; + + updateItemsVisibility(); + mMenu->buildDrawLabels(); + mMenu->updateParent(LLMenuGL::sMenuContainer); + S32 menu_x = 0; + S32 menu_y = spawning_view->getRect().getHeight() + mMenu->getRect().getHeight(); + LLMenuGL::showPopup(spawning_view, mMenu, menu_x, menu_y); + } + + void updateItemsVisibility() + { + if (!mMenu) return; + + bool have_selection = getSelectedOutfitID().notNull(); + mMenu->setItemVisible("sepatator1", have_selection); + mMenu->setItemVisible("sepatator2", have_selection); + mMenu->arrangeAndClear(); // update menu height + } + +private: + const LLUUID& getSelectedOutfitID() + { + return mOutfitList->getSelectedOutfitUUID(); + } + + LLViewerInventoryCategory* getSelectedOutfit() + { + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.isNull()) + { + return NULL; + } + + LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id); + return cat; + } + + void onWear() + { + LLViewerInventoryCategory* selected_outfit = getSelectedOutfit(); + if (selected_outfit) + { + LLAppearanceMgr::instance().wearInventoryCategory( + selected_outfit, /*copy=*/ FALSE, /*append=*/ FALSE); + } + } + + void onTakeOff() + { + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.notNull()) + { + LLAppearanceMgr::instance().takeOffOutfit(selected_outfit_id); + } + } + + void onRename() + { + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.notNull()) + { + LLAppearanceMgr::instance().renameOutfit(selected_outfit_id); + } + } + + void onDelete() + { + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.notNull()) + { + remove_category(&gInventory, selected_outfit_id); + } + } + + void onCreate(const LLSD& data) + { + LLWearableType::EType type = LLWearableType::typeNameToType(data.asString()); + if (type == LLWearableType::WT_NONE) + { + llwarns << "Invalid wearable type" << llendl; + return; + } + + LLAgentWearables::createWearable(type, true); + } + + bool onVisible(LLSD::String param) + { + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.isNull()) // no selection or invalid outfit selected + { + return false; + } + + // *TODO This condition leads to menu item behavior inconsistent with + // "Wear" button behavior and should be modified or removed. + bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == selected_outfit_id; + + if ("wear" == param) + { + return !is_worn; + } + + return true; + } + + LLOutfitsList* mOutfitList; + LLMenuGL* mMenu; +}; + +////////////////////////////////////////////////////////////////////////// + +class LLOutfitContextMenu : public LLListContextMenu { protected: /* virtual */ LLContextMenu* createMenu() @@ -89,8 +230,8 @@ protected: registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id)); registrar.add("Outfit.Delete", boost::bind(deleteOutfit, selected_id)); - enable_registrar.add("Outfit.OnEnable", boost::bind(&OutfitContextMenu::onEnable, this, _2)); - enable_registrar.add("Outfit.OnVisible", boost::bind(&OutfitContextMenu::onVisible, this, _2)); + enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2)); + enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitContextMenu::onVisible, this, _2)); return createFromFile("menu_outfit_tab.xml"); } @@ -170,11 +311,13 @@ LLOutfitsList::LLOutfitsList() { mCategoriesObserver = new LLInventoryCategoriesObserver(); - mOutfitMenu = new OutfitContextMenu(); + mGearMenu = new LLOutfitListGearMenu(this); + mOutfitMenu = new LLOutfitContextMenu(); } LLOutfitsList::~LLOutfitsList() { + delete mGearMenu; delete mOutfitMenu; if (gInventory.containsObserver(mCategoriesObserver)) @@ -453,8 +596,11 @@ void LLOutfitsList::setFilterSubString(const std::string& string) sFilterSubString = string; } +// virtual bool LLOutfitsList::isActionEnabled(const LLSD& userdata) { + if (mSelectedOutfitUUID.isNull()) return false; + const std::string command_name = userdata.asString(); if (command_name == "delete") { @@ -473,7 +619,7 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } if (command_name == "wear") { - return mSelectedOutfitUUID.notNull(); + return !gAgentWearables.isCOFChangeInProgress(); } if (command_name == "take_off") { @@ -482,6 +628,13 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) return false; } +// virtual +void LLOutfitsList::showGearMenu(LLView* spawning_view) +{ + if (!mGearMenu) return; + mGearMenu->show(spawning_view); +} + boost::signals2::connection LLOutfitsList::setSelectionChangeCallback(selection_change_callback_t cb) { return mSelectionChangeSignal.connect(cb); @@ -761,7 +914,7 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) uuid_vec_t selected_uuids; - // Collect seleted items from all selected lists. + // Collect selected items from all selected lists. for (wearables_lists_map_t::iterator iter = mSelectedListsMap.begin(); iter != mSelectedListsMap.end(); ++iter) -- cgit v1.2.3 From 9aad53a4370b7647e4f907be7c3dc908906491b9 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 24 Jun 2010 01:52:26 +0300 Subject: EXT-7158 FIXED Implemented showing of full outfit content if its name or any item(s) inside it match current filter. - Added availability to force showing unmatched items to LLFlatListViewEx - Applied it to wearable items lists in LLOutfitsList - Changed condition for outfit accordion tab showing (because now all items are visible, so checking their number doesn't help). Used here check for a flag added in this fix, which tells whether last applied filter found any matches in the list. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/648/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index b8489d450b..67442dd573 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -439,6 +439,9 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Setting callback to reset items selection inside outfit on accordion collapsing and expanding (EXT-7875) tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::resetItemSelection, this, list, cat_id)); + // force showing list items that don't match current filter(EXT-7158) + list->setForceShowingUnmatchedItems(true); + // Setting list commit callback to monitor currently selected wearable item. list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1)); @@ -850,6 +853,8 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) restoreOutfitSelection(tab, iter->first); } } + + mAccordion->arrange(); } void LLOutfitsList::applyFilterToTab( @@ -873,7 +878,7 @@ void LLOutfitsList::applyFilterToTab( { // hide tab if its title doesn't pass filter // and it has no visible items - tab->setVisible(list->size() > 0); + tab->setVisible(list->wasLasFilterSuccessfull()); // remove title highlighting because it might // have been previously highlighted by less restrictive filter -- cgit v1.2.3 From f5f43b5d3aba3071009d9caa63de1426699e19ec Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 24 Jun 2010 15:39:09 +0300 Subject: EXT-8014 FIXED Enabled "Take off" in My Outfits gear menu only if a worn item or base outfit is selected. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 71 +++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 17 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 67442dd573..d9c31b4d1c 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -148,10 +148,27 @@ private: void onTakeOff() { - const LLUUID& selected_outfit_id = getSelectedOutfitID(); - if (selected_outfit_id.notNull()) + // Take off selected items if there are any + if (mOutfitList->hasItemSelected()) { - LLAppearanceMgr::instance().takeOffOutfit(selected_outfit_id); + 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. + { + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.notNull()) + { + LLAppearanceMgr::instance().takeOffOutfit(selected_outfit_id); + } } } @@ -474,7 +491,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) } // Handle removed tabs. - for (uuid_vec_t::const_iterator iter=vremoved.begin(); iter != vremoved.end(); iter++) + for (uuid_vec_t::const_iterator iter=vremoved.begin(); iter != vremoved.end(); ++iter) { outfits_map_t::iterator outfits_iter = mOutfitsMap.find((*iter)); if (outfits_iter != mOutfitsMap.end()) @@ -626,7 +643,10 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } if (command_name == "take_off") { - return LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID; + // Enable "Take Off" only if a worn item or base outfit is selected. + return ( !hasItemSelected() + && LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID ) + || hasWornItemSelected(); } return false; } @@ -638,6 +658,22 @@ void LLOutfitsList::showGearMenu(LLView* spawning_view) mGearMenu->show(spawning_view); } +void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const +{ + // Collect selected items from all selected lists. + for (wearables_lists_map_t::const_iterator iter = mSelectedListsMap.begin(); + iter != mSelectedListsMap.end(); + ++iter) + { + uuid_vec_t uuids; + (*iter).second->getSelectedUUIDs(uuids); + + S32 prev_size = selected_uuids.size(); + selected_uuids.resize(prev_size + uuids.size()); + std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); + } +} + boost::signals2::connection LLOutfitsList::setSelectionChangeCallback(selection_change_callback_t cb) { return mSelectionChangeSignal.connect(cb); @@ -894,6 +930,18 @@ void LLOutfitsList::applyFilterToTab( } } +bool LLOutfitsList::hasWornItemSelected() +{ + uuid_vec_t selected_uuids; + getSelectedItemsUUIDs(selected_uuids); + + for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it) + { + if (get_is_item_worn(*it)) return true; + } + return false; +} + void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) { LLAccordionCtrlTab* tab = dynamic_cast(ctrl); @@ -919,18 +967,7 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) uuid_vec_t selected_uuids; - // Collect selected items from all selected lists. - for (wearables_lists_map_t::iterator iter = mSelectedListsMap.begin(); - iter != mSelectedListsMap.end(); - ++iter) - { - uuid_vec_t uuids; - (*iter).second->getSelectedUUIDs(uuids); - - S32 prev_size = selected_uuids.size(); - selected_uuids.resize(prev_size + uuids.size()); - std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); - } + getSelectedItemsUUIDs(selected_uuids); LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y); } -- cgit v1.2.3 From cb801fafb2cce28d2eecd87f011bc50eae686f1b Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 24 Jun 2010 16:51:15 +0300 Subject: Comments: EXT-7158 ADDITIONAL FIX Slight changes to fix according to review Added additional check to avoid deselcting of items when filter is applied and made a couple of renames according to Mike's comments in review at https://codereview.productengine.com/secondlife/r/648/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index d9c31b4d1c..ec7fb06c8e 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -914,7 +914,7 @@ void LLOutfitsList::applyFilterToTab( { // hide tab if its title doesn't pass filter // and it has no visible items - tab->setVisible(list->wasLasFilterSuccessfull()); + tab->setVisible(list->hasMatchedItems()); // remove title highlighting because it might // have been previously highlighted by less restrictive filter -- cgit v1.2.3 From a209e339ee96095e884e4de51ea5c88e51825d62 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 24 Jun 2010 18:00:09 +0300 Subject: EXT-7793 FIXED Implemented wearing separate wearables instead of whole outfit when individual items are selected in list. - Added wearSelectedItems() method to LLOutfitsList which wears all items selected in outfit lists (if possible- adds, else replaces). It is called when clicking wear if there is selection of individual items(LLOutfitsList::hasItemSelected() returns true). Otherwise whole outfit is worn. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/638 --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index ec7fb06c8e..6c2566813f 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -960,6 +960,26 @@ void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const } } +void LLOutfitsList::wearSelectedItems() +{ + uuid_vec_t selected_uuids; + getSelectedItemsUUIDs(selected_uuids); + + if(selected_uuids.empty()) + { + return; + } + + uuid_vec_t::const_iterator it; + // Wear items from all selected lists(if possible- add, else replace) + for (it = selected_uuids.begin(); it != selected_uuids.end()-1; ++it) + { + LLAppearanceMgr::getInstance()->wearItemOnAvatar(*it, false, false); + } + // call update only when wearing last item + LLAppearanceMgr::getInstance()->wearItemOnAvatar(*it, true, false); +} + void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) { LLWearableItemsList* list = dynamic_cast(ctrl); -- cgit v1.2.3 From 9bc4e69c913225aa57b6f2009dd1f7cb65afddbc Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Fri, 25 Jun 2010 17:00:45 +0300 Subject: EXT-7972 FIXED (My Outfits: Add \"Add to current outfit\" menu item into gear menu) - Added menu item 'Wear - Add to Current Outfit' (menu_outfit_gear.xml). - Added menu item handler onAdd(). Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/657/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 6c2566813f..075cfa0543 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -88,6 +88,8 @@ public: registrar.add("Gear.Delete", boost::bind(&LLOutfitListGearMenu::onDelete, this)); registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2)); + registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenu::onAdd, this)); + enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitsList::isActionEnabled, mOutfitList, _2)); enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2)); @@ -146,6 +148,16 @@ private: } } + void onAdd() + { + const LLUUID& selected_id = getSelectedOutfitID(); + + if (selected_id.notNull()) + { + LLAppearanceMgr::getInstance()->addCategoryToCurrentOutfit(selected_id); + } + } + void onTakeOff() { // Take off selected items if there are any @@ -648,6 +660,17 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) && LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID ) || hasWornItemSelected(); } + + if (command_name == "wear_add") + { + if (gAgentWearables.isCOFChangeInProgress()) + { + return false; + } + + return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID); + } + return false; } -- cgit v1.2.3 From 1a3b463af3b3b0668505f406162a7e2d3b557ee7 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Wed, 30 Jun 2010 20:02:51 +0300 Subject: EXT-7737 ADDITIONAL FIX Added changing of color to emphasis for selected outfit accordion header. - Added method to accordion which allows to set color of its header's title and used it when highliting selected outfit. - Set alias for emphasis color in colors.xml to let selected outfit color be easily changed via xml in case such decision is made(because leaving it green doesn't seem a very good idea). - Also added alias for accordion header text color to avoid breaking of this fix if in header_text_color from accordion_tab.xml. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 075cfa0543..23c7e64cce 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -548,6 +548,7 @@ void LLOutfitsList::highlightBaseOutfit() if (mOutfitsMap[mHighlightedOutfitUUID]) { mOutfitsMap[mHighlightedOutfitUUID]->setTitleFontStyle("NORMAL"); + mOutfitsMap[mHighlightedOutfitUUID]->setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); } mHighlightedOutfitUUID = base_id; @@ -555,6 +556,7 @@ void LLOutfitsList::highlightBaseOutfit() if (mOutfitsMap[base_id]) { mOutfitsMap[base_id]->setTitleFontStyle("BOLD"); + mOutfitsMap[base_id]->setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor")); } } -- cgit v1.2.3 From 4081f6f5844d4846162727682206440859fd4dc4 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Tue, 29 Jun 2010 21:55:37 +0300 Subject: EXT-8014 FIXED Enabled "Take off" in My Outfits gear menu if any of selected items can be taken off or selected outfit contains items that can be taken off. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/649/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 23c7e64cce..dddfd9106f 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -657,10 +657,10 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } if (command_name == "take_off") { - // Enable "Take Off" only if a worn item or base outfit is selected. - return ( !hasItemSelected() - && LLAppearanceMgr::getInstance()->getBaseOutfitUUID() == mSelectedOutfitUUID ) - || hasWornItemSelected(); + // Enable "Take Off" if any of selected items can be taken off + // or the selected outfit contains items that can be taken off. + return ( hasItemSelected() && canTakeOffSelected() ) + || ( !hasItemSelected() && LLAppearanceMgr::getCanRemoveFromCOF(mSelectedOutfitUUID) ); } if (command_name == "wear_add") @@ -955,14 +955,19 @@ void LLOutfitsList::applyFilterToTab( } } -bool LLOutfitsList::hasWornItemSelected() +bool LLOutfitsList::canTakeOffSelected() { uuid_vec_t selected_uuids; getSelectedItemsUUIDs(selected_uuids); + LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false); + for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it) { - if (get_is_item_worn(*it)) return true; + LLViewerInventoryItem* item = gInventory.getItem(*it); + if (!item) continue; + + if (is_worn(NULL, item)) return true; } return false; } -- cgit v1.2.3 From a03e1231486bd5c02e27b7020f53dfd2b397c215 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 6 Jul 2010 17:00:39 +0300 Subject: EXT-8082 FIXED Fixed viewer crash in outfit list accordion. Details: 1 Avoided memory leak of LLAccordionCtrlTab in LLOutfitsList::refreshList method. 2 Provided resetting selection in LLAccordionCtrl::removeCollapsibleCtrl method. reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/701/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index dddfd9106f..aba019356d 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -453,6 +453,12 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) { // Remove accordion tab if category could not be added to observer. mAccordion->removeCollapsibleCtrl(tab); + + // kill removed tab + if (tab != NULL) + { + tab->die(); + } continue; } @@ -523,6 +529,12 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // 4. Remove outfit tab from accordion. mAccordion->removeCollapsibleCtrl(tab); + + // kill removed tab + if (tab != NULL) + { + tab->die(); + } } } -- cgit v1.2.3 From cf675389d06556ec041bfa6f4e3474c835e79c1c Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Tue, 6 Jul 2010 17:24:14 +0300 Subject: EXT-8036 FIXED Fixed opening accordion tabs if they match filter after list refresh. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/697/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index aba019356d..63ffb80ff2 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -901,18 +901,6 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) if (!new_filter_substring.empty()) { applyFilterToTab(iter->first, tab, new_filter_substring); - - if (tab->getVisible()) - { - // Open tab if it has passed the filter. - tab->setDisplayChildren(true); - } - else - { - // Set force refresh flag to refresh not visible list - // when some changes occur in it. - list->setForceRefresh(true); - } } else { @@ -965,6 +953,18 @@ void LLOutfitsList::applyFilterToTab( // Try restoring the tab selection. restoreOutfitSelection(tab, category_id); } + + if (tab->getVisible()) + { + // Open tab if it has passed the filter. + tab->setDisplayChildren(true); + } + else + { + // Set force refresh flag to refresh not visible list + // when some changes occur in it. + list->setForceRefresh(true); + } } bool LLOutfitsList::canTakeOffSelected() -- cgit v1.2.3 From de81d9d8a7d2b12626c3929817a8ccdf20ba16c7 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 23 Jul 2010 18:06:49 +0300 Subject: EXT-8481 FIXED Wear button in My Outfits being enabled when worn item is selected. - Fixed condition for enabling the Wear button in My Outfits. - The button was always enabled when when COF change completes, I fixed that as well. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/800/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 49 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 63ffb80ff2..146684288b 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -665,7 +665,18 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } if (command_name == "wear") { - return !gAgentWearables.isCOFChangeInProgress(); + if (gAgentWearables.isCOFChangeInProgress()) + { + return false; + } + + if (hasItemSelected()) + { + return canWearSelected(); + } + + // outfit selected + return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID); } if (command_name == "take_off") { @@ -677,6 +688,7 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) if (command_name == "wear_add") { + // *TODO: do we ever get here? if (gAgentWearables.isCOFChangeInProgress()) { return false; @@ -984,6 +996,41 @@ bool LLOutfitsList::canTakeOffSelected() return false; } +bool LLOutfitsList::canWearSelected() +{ + uuid_vec_t selected_items; + getSelectedItemsUUIDs(selected_items); + + for (uuid_vec_t::const_iterator it = selected_items.begin(); it != selected_items.end(); ++it) + { + const LLUUID& id = *it; + + // Find links to the current item in COF. + // *TODO: share this? + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLLinkedItemIDMatches find_links(gInventory.getLinkedItemID(id)); + gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + find_links); + if (!items.empty()) + { + return false; + } + + // Check whether the item is worn. + if (!get_can_item_be_worn(id)) + { + return false; + } + } + + // All selected items can be worn. + return true; +} + void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) { LLAccordionCtrlTab* tab = dynamic_cast(ctrl); -- cgit v1.2.3 From 2e9671a8a8ec0a8897945c96aa62c77ad245abac Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Mon, 26 Jul 2010 10:33:43 +0300 Subject: EXT-8329 FIXED Provided disabling 'Wear Item' button after item was worn. Details: 1 Updated condition is item can be worn considering situation when item is copied in COF but is not worn. 2 Avoided code duplication in method LLOutfitsList::canWearSelected() reviewed by Vadim Savchuk and Neal Orman at https://codereview.productengine.com/secondlife/r/785/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 146684288b..c3eee1d1ad 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -1005,17 +1005,7 @@ bool LLOutfitsList::canWearSelected() { const LLUUID& id = *it; - // Find links to the current item in COF. - // *TODO: share this? - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLLinkedItemIDMatches find_links(gInventory.getLinkedItemID(id)); - gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - find_links); - if (!items.empty()) + if (LLAppearanceMgr::isLinkInCOF(id)) { return false; } -- cgit v1.2.3 From 75980159451eb4f80c1ac03ec4b9d8d488279840 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 27 Jul 2010 22:34:34 +0300 Subject: EXT-8491 FIXED Crash in LLAppearanceMgr::addCOFItemLink(). Reason: When you click on a clothing link in COF, LLAppearanceMgr::wearItemOnAvatar() removes all COF links of the clicked wearable type -- thus invalidating all previously obtained LLViewerInventoryItems for those links -- and then passes such an invalid item (item_to_wear) to addCOFItemLink() which of course crashes. Fix: 1. Handle this case in wearItemOnAvatar(): don't try wearing COF items. 2. Disable the Wear button in the inventory SP when a COF item is selected. 3. Fixed get_can_item_be_worn() to return FALSE for items which are in COF or have links in COF. Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/811/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index c3eee1d1ad..8147a97317 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -1005,11 +1005,6 @@ bool LLOutfitsList::canWearSelected() { const LLUUID& id = *it; - if (LLAppearanceMgr::isLinkInCOF(id)) - { - return false; - } - // Check whether the item is worn. if (!get_can_item_be_worn(id)) { -- cgit v1.2.3 From 4b00b988445ae562b2bc203479d7fd42ce5891d8 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 3 Aug 2010 23:28:51 +0300 Subject: EXT-8534 FIXED Fixed the 'Wear' in My Outfits being disabled for outfits consisting of body parts only. Changed the condition to enable the "Wear" button in My Outfits and the corresponding item in the outfit context menu. They now get enabled for any outfit that isn't the base outfit and contains non-worn wearables. By the way, did a minor cleanup: moved an LLAgentWearables.isCOFChangeInProgress() call to LLAppearanceMgr::getCanAddToCOF() to avoid code duplication. Reviewed by Sergey Litovchuk at https://codereview.productengine.com/secondlife/r/832/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 8147a97317..f921bca623 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -275,11 +275,10 @@ protected: } else if ("wear_replace" == param) { - return !gAgentWearables.isCOFChangeInProgress(); + return LLAppearanceMgr::instance().getCanReplaceCOF(outfit_cat_id); } else if ("wear_add" == param) { - if (gAgentWearables.isCOFChangeInProgress()) return false; return LLAppearanceMgr::getCanAddToCOF(outfit_cat_id); } else if ("take_off" == param) @@ -676,7 +675,7 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } // outfit selected - return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID); + return LLAppearanceMgr::instance().getCanReplaceCOF(mSelectedOutfitUUID); } if (command_name == "take_off") { @@ -689,11 +688,6 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) if (command_name == "wear_add") { // *TODO: do we ever get here? - if (gAgentWearables.isCOFChangeInProgress()) - { - return false; - } - return LLAppearanceMgr::getCanAddToCOF(mSelectedOutfitUUID); } -- cgit v1.2.3 From 7bce6580dc2849b99ae6eedd5c373b653ab5186d Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Mon, 9 Aug 2010 15:23:00 +0300 Subject: EXT-7593 FIXED Added passing focus to the selected outfit tab when My Outfits tab is open. - Removed "tab_stop" from outfit tabs to prevent passing focus to a tab chosen by default from LLUICtrl::focusFirstItem(). Besides the order of passing focus between outfit tabs by pressing "Tab" was undetermined. - Had to remove const from the return of LLAccordionCtrl::getSelectedTab() to use the returned pointer for setting focus. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/846/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index f921bca623..8422b97b3a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -403,6 +403,12 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/) mIsInitialized = true; } + + LLAccordionCtrlTab* selected_tab = mAccordion->getSelectedTab(); + if (!selected_tab) return; + + // Pass focus to the selected outfit tab. + selected_tab->showAndFocusHeader(); } void LLOutfitsList::refreshList(const LLUUID& category_id) -- cgit v1.2.3 From 863e380fb61121c977a6101b47accdb813c328af Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 10 Aug 2010 22:38:29 +0300 Subject: EXT-8576 FIXED Only attachments are worn if multi-select items on 'My Outfits' tab and press 'Wear' button. Reason: avatar appearance was not updated if the last selected item was an attachment. Fix: make sure appearance is updated afterwards, regardless of items types. Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/848/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index f921bca623..2b6c80bac8 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -1038,14 +1038,7 @@ void LLOutfitsList::wearSelectedItems() return; } - uuid_vec_t::const_iterator it; - // Wear items from all selected lists(if possible- add, else replace) - for (it = selected_uuids.begin(); it != selected_uuids.end()-1; ++it) - { - LLAppearanceMgr::getInstance()->wearItemOnAvatar(*it, false, false); - } - // call update only when wearing last item - LLAppearanceMgr::getInstance()->wearItemOnAvatar(*it, true, false); + wear_multiple(selected_uuids, false); } void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) -- cgit v1.2.3 From 06b0d72efa96b6a0ed665f7cd46f358c48929e7b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 13 Aug 2010 07:24:57 -0400 Subject: Change license from GPL to LGPL (version 2.1) --- indra/newview/lloutfitslist.cpp | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 2b6c80bac8..3eda077b87 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -2,30 +2,25 @@ * @file lloutfitslist.cpp * @brief List of agent's outfits for My Appearance side panel. * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2010, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From ef46496775bca913f00747558e780aa0449d92bc Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Mon, 16 Aug 2010 23:23:48 +0300 Subject: EXT-8636 FIXED updating wearables (worn) prefix in 'My Outfits' list. - Fixed LLOutfitsList COF changes handler to update worn status of items removed from COF. Now they are updated based on the differences in original items' ids in COF. - Fixed 'My Outfits' items worn status check to update depending on whether the item is linked in COF or not. This is a kind of workaround to fix updating attachments' worn status because LLAppearanceMgr::updateAppearanceFromCOF is triggered erlier than new attachment links are fetched. When dumpItemArray(obj_items,"asset_dump: obj_item") is called from LLAppearanceMgr::updateAppearanceFromCOF, all attachment links have empty asset ids. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/859/. --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 48 +++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 2b6c80bac8..a471158c3d 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -1055,25 +1055,37 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) void LLOutfitsList::onCOFChanged() { - LLInventoryModel::changed_items_t changed_linked_items; + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; - const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs(); - for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin(); - iter != changed_items.end(); - ++iter) + // Collect current COF items + gInventory.collectDescendents( + LLAppearanceMgr::instance().getCOF(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH); + + uuid_vec_t vnew; + uuid_vec_t vadded; + uuid_vec_t vremoved; + + // From gInventory we get the UUIDs of links that are currently in COF. + // These links UUIDs are not the same UUIDs that we have in each wearable items list. + // So we collect base items' UUIDs to find them or links that point to them in wearable + // items lists and update their worn state there. + for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); + iter != item_array.end(); + ++iter) { - LLViewerInventoryItem* item = gInventory.getItem(*iter); - if (item) - { - // From gInventory we get the UUIDs of new links added to COF - // or removed from COF. These links UUIDs are not the same UUIDs - // that we have in each wearable items list. So we collect base items - // UUIDs to find all items or links that point to same base items in wearable - // items lists and update their worn state there. - changed_linked_items.insert(item->getLinkedUUID()); - } + vnew.push_back((*iter)->getLinkedUUID()); } + // We need to update only items that were added or removed from COF. + LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved); + + // Store the ids of items currently linked from COF. + mCOFLinkedItems = vnew; + for (outfits_map_t::iterator iter = mOutfitsMap.begin(); iter != mOutfitsMap.end(); ++iter) @@ -1084,9 +1096,13 @@ void LLOutfitsList::onCOFChanged() LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); if (!list) continue; + // Append removed ids to added ids because we should update all of them. + vadded.reserve(vadded.size() + vremoved.size()); + vadded.insert(vadded.end(), vremoved.begin(), vremoved.end()); + // Every list updates the labels of changed items or // the links that point to these items. - list->updateChangedItems(changed_linked_items); + list->updateChangedItems(vadded); } } -- cgit v1.2.3 From 98cc2365034a93c69704daa69efb389799cc9627 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 24 Aug 2010 18:44:39 +0100 Subject: Backed out changeset a62bf7c0af21 Backing out this merge that I pushed (prematurely) to the wrong place. --- indra/newview/lloutfitslist.cpp | 54 ++++++++++++----------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) (limited to 'indra/newview/lloutfitslist.cpp') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 51f9a03a9c..3eda077b87 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -398,12 +398,6 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/) mIsInitialized = true; } - - LLAccordionCtrlTab* selected_tab = mAccordion->getSelectedTab(); - if (!selected_tab) return; - - // Pass focus to the selected outfit tab. - selected_tab->showAndFocusHeader(); } void LLOutfitsList::refreshList(const LLUUID& category_id) @@ -1056,37 +1050,25 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) void LLOutfitsList::onCOFChanged() { - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - - // Collect current COF items - gInventory.collectDescendents( - LLAppearanceMgr::instance().getCOF(), - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH); - - uuid_vec_t vnew; - uuid_vec_t vadded; - uuid_vec_t vremoved; + LLInventoryModel::changed_items_t changed_linked_items; - // From gInventory we get the UUIDs of links that are currently in COF. - // These links UUIDs are not the same UUIDs that we have in each wearable items list. - // So we collect base items' UUIDs to find them or links that point to them in wearable - // items lists and update their worn state there. - for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); - iter != item_array.end(); - ++iter) + const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs(); + for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin(); + iter != changed_items.end(); + ++iter) { - vnew.push_back((*iter)->getLinkedUUID()); + LLViewerInventoryItem* item = gInventory.getItem(*iter); + if (item) + { + // From gInventory we get the UUIDs of new links added to COF + // or removed from COF. These links UUIDs are not the same UUIDs + // that we have in each wearable items list. So we collect base items + // UUIDs to find all items or links that point to same base items in wearable + // items lists and update their worn state there. + changed_linked_items.insert(item->getLinkedUUID()); + } } - // We need to update only items that were added or removed from COF. - LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved); - - // Store the ids of items currently linked from COF. - mCOFLinkedItems = vnew; - for (outfits_map_t::iterator iter = mOutfitsMap.begin(); iter != mOutfitsMap.end(); ++iter) @@ -1097,13 +1079,9 @@ void LLOutfitsList::onCOFChanged() LLWearableItemsList* list = dynamic_cast(tab->getAccordionView()); if (!list) continue; - // Append removed ids to added ids because we should update all of them. - vadded.reserve(vadded.size() + vremoved.size()); - vadded.insert(vadded.end(), vremoved.begin(), vremoved.end()); - // Every list updates the labels of changed items or // the links that point to these items. - list->updateChangedItems(vadded); + list->updateChangedItems(changed_linked_items); } } -- cgit v1.2.3