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/llpaneloutfitsinventory.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpaneloutfitsinventory.cpp') diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 8b451c156c..0e1e94129b 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -555,11 +555,25 @@ void LLPanelOutfitsInventory::onTrashButtonClick() void LLPanelOutfitsInventory::onClipboardAction(const LLSD& userdata) { std::string command_name = userdata.asString(); - // TODO: add handling "My Outfits" tab. if (isCOFPanelActive()) { getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name); } + else // "My Outfits" tab active + { + if (command_name == "delete") + { + const LLUUID& selected_outfit_id = mMyOutfitsPanel->getSelectedOutfitUUID(); + if (selected_outfit_id.notNull()) + { + remove_category(&gInventory, selected_outfit_id); + } + } + else + { + llwarns << "Unrecognized action" << llendl; + } + } updateListCommands(); updateVerbs(); } @@ -614,7 +628,6 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) { BOOL can_delete = FALSE; - // TODO: add handling "My Outfits" tab. if (isCOFPanelActive()) { LLFolderView* root = getActivePanel()->getRootFolder(); @@ -630,10 +643,15 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) LLFolderViewItem *item = root->getItemByID(item_id); can_delete &= item->getListener()->isItemRemovable(); } - return can_delete; } } - return FALSE; + else // "My Outfits" tab active + { + const LLUUID& selected_outfit = mMyOutfitsPanel->getSelectedOutfitUUID(); + can_delete = LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit); + } + + return can_delete; } if (command_name == "remove_link") { @@ -730,6 +748,7 @@ void LLPanelOutfitsInventory::initTabPanels() mCurrentOutfitPanel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onTabSelectionChange, this, mCurrentOutfitPanel, _1, _2)); mMyOutfitsPanel = getChild(OUTFITS_TAB_NAME); + mMyOutfitsPanel->addSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); mAppearanceTabs = getChild("appearance_tabs"); mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this)); -- cgit v1.2.3 From 62c82eef49006f6f94ca2f9ca10b5abc4612a61f Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Thu, 10 Jun 2010 15:39:13 +0300 Subject: EXT-7620 FIXED Disable context-dependant outfit gear menu items if no (or invalid) outfit selected. The "Create new clothes / body parts" menu items are always enabled because they have no on_enable callback set. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/548/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitsinventory.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llpaneloutfitsinventory.cpp') diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 0e1e94129b..1286642897 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -169,6 +169,11 @@ private: bool onEnable(LLSD::String param) { const LLUUID& selected_outfit_id = getSelectedOutfitID(); + if (selected_outfit_id.isNull()) // no selection or invalid outfit selected + { + return false; + } + bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == selected_outfit_id; if ("wear" == param) -- cgit v1.2.3 From eb1929c8f97f256264cac620871e4b498d985d68 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 11 Jun 2010 17:19:40 +0300 Subject: EXT-6726 WIP Improved the way we disable irrelevant items of the My Outfits gear menu. * Made the "Wear" and "Take Off" items mutually exclusive (i.e. only one of them is now shown). * Hide all context-dependant items ("Wear", "Take off", "Rename", "Delete") when no outfit selected. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/566/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitsinventory.cpp | 67 ++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 20 deletions(-) (limited to 'indra/newview/llpaneloutfitsinventory.cpp') diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 1286642897..b5cffd84b3 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -91,6 +91,7 @@ public: registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2)); enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenu::onEnable, this, _2)); + enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2)); mMenu = LLUICtrlFactory::getInstance()->createFromFile( "menu_outfit_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -99,6 +100,28 @@ public: LLMenuGL* getMenu() { return 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() { @@ -174,6 +197,26 @@ private: return false; } + if ("rename" == param) + { + return get_is_category_renameable(&gInventory, selected_outfit_id); + } + else if ("delete" == param) + { + return LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit_id); + } + + return 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; + } + bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == selected_outfit_id; if ("wear" == param) @@ -184,14 +227,6 @@ private: { return is_worn; } - else if ("rename" == param) - { - return get_is_category_renameable(&gInventory, selected_outfit_id); - } - else if ("delete" == param) - { - return LLAppearanceMgr::instance().getCanRemoveOutfit(selected_outfit_id); - } return true; } @@ -538,18 +573,10 @@ void LLPanelOutfitsInventory::updateListCommands() void LLPanelOutfitsInventory::showGearMenu() { - LLMenuGL* menu = mGearMenu ? mGearMenu->getMenu() : NULL; - if (menu) - { - menu->buildDrawLabels(); - menu->updateParent(LLMenuGL::sMenuContainer); - LLView* spawning_view = getChild("options_gear_btn"); - S32 menu_x, menu_y; - //show menu in co-ordinates of panel - spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this); - menu_y += menu->getRect().getHeight(); - LLMenuGL::showPopup(this, menu, menu_x, menu_y); - } + if (!mGearMenu) return; + + LLView* spawning_view = getChild("options_gear_btn"); + mGearMenu->show(spawning_view); } void LLPanelOutfitsInventory::onTrashButtonClick() -- cgit v1.2.3 From 03f43664223e7bf57aba04f81bc3737c6ab63285 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 11 Jun 2010 17:35:31 +0300 Subject: EXT-7792 FIXED Made Wear button disabled if there are no selected outfit (or list is empty). Also fixed some issues in accordion caused by removing My Outfits content via Inventory: - updated accordion's help text to not shown nothing if there are no any tabs and filter substring is empty. - added check of necessity to show help text when accordion "arrange" Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/568/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitsinventory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpaneloutfitsinventory.cpp') diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 1286642897..1e1e1aaf9b 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -528,11 +528,12 @@ void LLPanelOutfitsInventory::updateListCommands() { bool trash_enabled = isActionEnabled("delete"); bool wear_enabled = isActionEnabled("wear"); + bool wear_visible = !isCOFPanelActive(); bool make_outfit_enabled = isActionEnabled("save_outfit"); mListCommands->childSetEnabled("trash_btn", trash_enabled); mListCommands->childSetEnabled("wear_btn", wear_enabled); - mListCommands->childSetVisible("wear_btn", wear_enabled); + mListCommands->childSetVisible("wear_btn", wear_visible); mSaveComboBtn->setMenuItemEnabled("save_outfit", make_outfit_enabled); } @@ -691,6 +692,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) { return FALSE; } + return hasItemsSelected(); } if (command_name == "save_outfit") { @@ -713,7 +715,6 @@ bool LLPanelOutfitsInventory::hasItemsSelected() { bool has_items_selected = false; - // TODO: add handling "My Outfits" tab. if (isCOFPanelActive()) { LLFolderView* root = getActivePanel()->getRootFolder(); @@ -723,6 +724,10 @@ bool LLPanelOutfitsInventory::hasItemsSelected() has_items_selected = (selection_set.size() > 0); } } + else // My Outfits Tab is active + { + has_items_selected = mMyOutfitsPanel->getSelectedOutfitUUID().notNull(); + } return has_items_selected; } -- cgit v1.2.3