summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp76
1 files changed, 68 insertions, 8 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index cf04ab378f..d1e6d7de42 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<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
@@ -114,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();
@@ -172,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));
@@ -197,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);
@@ -228,6 +232,17 @@ 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));
+
+ 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<LLToggleableMenu>("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+
return TRUE;
}
@@ -236,6 +251,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<LLComboBox*>(ctrl);
@@ -298,13 +338,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();
+ }
}
@@ -405,6 +450,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,