summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-04-09 15:07:42 +0300
committerIgor Borovkov <iborovkov@productengine.com>2010-04-09 15:07:42 +0300
commit43c85b0dfb4e7e7c9fdfc02954bbb0115ec344c4 (patch)
tree55de2ec227dbd322f7467edb29e535d1820e72cd /indra/newview/llpaneloutfitedit.cpp
parent691237cee84b8dcb014e8b261eb8d918c9df31b7 (diff)
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
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp47
1 files changed, 33 insertions, 14 deletions
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<LLInventoryPanel>("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<LLComboBox>("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<LLButton>("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<LLInventoryCallback>(NULL));
- updateLookInfo();
+ if (!listenerp) return;
+
+ if (LLAppearanceMgr::getInstance()->wearItemOnAvatar(listenerp->getUUID()))
+ {
+ updateLookInfo();
+ }
}
@@ -444,6 +448,21 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderView
{
return;
}
+
+ LLViewerInventoryItem* item = current_item->getInventoryItem();
+ 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,