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