From 9d93441b3117c59652fbb81abea2983f3cbca203 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 9 Apr 2010 12:30:33 +0300 Subject: done EXT-6687 Implement Save button functionality (Edit Outfit panel) Implemented "Save", "Save as new" functionality. If the base outfit doesn't exist "Save as new" functionality is employed Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/179 --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index b956004129..850a766ff4 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -45,6 +45,7 @@ #include "llfloaterreg.h" #include "llinventoryfunctions.h" #include "llinventorypanel.h" +#include "llviewermenu.h" #include "llviewerwindow.h" #include "llviewerinventory.h" #include "llbutton.h" @@ -54,12 +55,14 @@ #include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" +#include "llpaneloutfitsinventory.h" #include "lluiconstants.h" #include "llscrolllistctrl.h" #include "lltextbox.h" #include "lluictrlfactory.h" #include "llsdutil.h" #include "llsidepanelappearance.h" +#include "lltoggleablemenu.h" #include "llwearablelist.h" static LLRegisterPanelClassWrapper t_outfit_edit("panel_outfit_edit"); @@ -228,6 +231,15 @@ BOOL LLPanelOutfitEdit::postBuild() childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this); + childSetAction("save_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); + childSetAction("save_as_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); + childSetAction("save_flyout_btn", boost::bind(&LLPanelOutfitEdit::showSaveMenu, this)); + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; + save_registar.add("Outfit.Save.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); + save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); + mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + return TRUE; } @@ -236,6 +248,31 @@ void LLPanelOutfitEdit::showAddWearablesPanel() childSetVisible("add_wearables_panel", childGetValue("add_btn")); } +void LLPanelOutfitEdit::saveOutfit(bool as_new) +{ + if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) + { + // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. + // If updateBaseOutfit fails, ask for an outfit name anyways + return; + } + + LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance(); + if (panel_outfits_inventory) + { + panel_outfits_inventory->onSave(); + } +} + +void LLPanelOutfitEdit::showSaveMenu() +{ + S32 x, y; + LLUI::getMousePositionLocal(this, &x, &y); + + mSaveMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mSaveMenu, x, y); +} + void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl) { LLComboBox* type_filter = dynamic_cast(ctrl); @@ -301,6 +338,8 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) void LLPanelOutfitEdit::onAddToLookClicked(void) { LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); + if (!curr_item) return; + LLFolderViewEventListener* listenerp = curr_item->getListener(); link_inventory_item(gAgent.getID(), listenerp->getUUID(), mCurrentOutfitID, listenerp->getName(), LLAssetType::AT_LINK, LLPointer(NULL)); -- cgit v1.2.3 From 43c85b0dfb4e7e7c9fdfc02954bbb0115ec344c4 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 9 Apr 2010 15:07:42 +0300 Subject: done EXT-6716 Implement Add button functionality for adding a wearable to Current Outfit (Edit Outfit panel) Added temporary PLUS button on the button bar under the top list of Edit Outfit panel Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/203/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 47 ++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 70879cedf5..2e94eabb3f 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -117,7 +117,7 @@ private: LLPanelOutfitEdit::LLPanelOutfitEdit() : LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL), -mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL), +mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToOutfitBtn(NULL), mRemoveFromLookBtn(NULL), mLookObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); @@ -175,8 +175,8 @@ BOOL LLPanelOutfitEdit::postBuild() mInventoryItemsPanel = getChild("inventory_items"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - // mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); - // mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); + mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); + mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); LLComboBox* type_filter = getChild("inventory_filter"); type_filter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onTypeFilterChanged, this, _1)); @@ -200,7 +200,8 @@ BOOL LLPanelOutfitEdit::postBuild() mAddToLookBtn->setEnabled(FALSE); mAddToLookBtn->setVisible(FALSE); */ - childSetAction("add_item_btn", boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this), this); + childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this)); + childSetEnabled("add_to_outfit_btn", false); mUpBtn = getChild("up_btn"); mUpBtn->setEnabled(TRUE); @@ -250,12 +251,12 @@ void LLPanelOutfitEdit::showAddWearablesPanel() void LLPanelOutfitEdit::saveOutfit(bool as_new) { - if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) - { - // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. - // If updateBaseOutfit fails, ask for an outfit name anyways - return; - } + if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) + { + // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. + // If updateBaseOutfit fails, ask for an outfit name anyways + return; + } LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance(); if (panel_outfits_inventory) @@ -335,15 +336,18 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) mInventoryItemsPanel->setFilterSubString(mSearchString); } -void LLPanelOutfitEdit::onAddToLookClicked(void) +void LLPanelOutfitEdit::onAddToOutfitClicked(void) { LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); if (!curr_item) return; LLFolderViewEventListener* listenerp = curr_item->getListener(); - link_inventory_item(gAgent.getID(), listenerp->getUUID(), mCurrentOutfitID, listenerp->getName(), - LLAssetType::AT_LINK, LLPointer(NULL)); - updateLookInfo(); + if (!listenerp) return; + + if (LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID())) + { + updateLookInfo(); + } } @@ -444,6 +448,21 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::dequegetInventoryItem(); + if (!item) return; + + switch (item->getType()) + { + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_OBJECT: + childSetEnabled("add_to_outfit_btn", true); + break; + default: + childSetEnabled("add_to_outfit_btn", false); + break; + } /* Removing add to look inline button (not part of mvp for viewer 2) LLRect btn_rect(current_item->getLocalRect().mRight - 50, -- cgit v1.2.3 From cf31494b5053283b4d445b0c564b5e7d57af2a18 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 9 Apr 2010 15:19:11 +0300 Subject: done EXT-6688 Implement Revert button funtionality (Edit Outfit panel) On revert the base outfit is worn Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/205/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 2e94eabb3f..d1e6d7de42 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -232,6 +232,8 @@ BOOL LLPanelOutfitEdit::postBuild() childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this); + childSetAction("revert_btn", boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance())); + childSetAction("save_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); childSetAction("save_as_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); childSetAction("save_flyout_btn", boost::bind(&LLPanelOutfitEdit::showSaveMenu, this)); -- cgit v1.2.3