summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitsinventory.cpp
diff options
context:
space:
mode:
authorYchebotarev ProductEngine <ychebotarev@productengine.com>2010-01-19 17:13:21 +0200
committerYchebotarev ProductEngine <ychebotarev@productengine.com>2010-01-19 17:13:21 +0200
commit82de841c52357642d30b6d89b11da079f9c0f5d1 (patch)
tree8ed3ec82392b6afd2ddf2023035fdfa45cd74c0b /indra/newview/llpaneloutfitsinventory.cpp
parent4610e911c959cdd21728822ae80b9e717ccd3012 (diff)
parent00c05a885fb1cbee967065798f57d74bf47f2478 (diff)
merge
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llpaneloutfitsinventory.cpp')
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp92
1 files changed, 88 insertions, 4 deletions
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index e058b3b326..df73c27f54 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -35,6 +35,7 @@
#include "llagent.h"
#include "llagentwearables.h"
+#include "llappearancemgr.h"
#include "llbutton.h"
#include "llfloaterreg.h"
@@ -44,6 +45,8 @@
#include "llinventoryfunctions.h"
#include "llinventorypanel.h"
#include "lllandmark.h"
+#include "lllineeditor.h"
+#include "llmodaldialog.h"
#include "llsidepanelappearance.h"
#include "llsidetray.h"
#include "lltabcontainer.h"
@@ -61,12 +64,75 @@
static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
bool LLPanelOutfitsInventory::sShowDebugEditor = false;
+class LLOutfitSaveAsDialog : public LLModalDialog
+{
+private:
+ std::string mItemName;
+ std::string mTempItemName;
+
+ boost::signals2::signal<void (const std::string&)> mSaveAsSignal;
+
+public:
+ LLOutfitSaveAsDialog( const LLSD& key )
+ : LLModalDialog( key ),
+ mTempItemName(key.asString())
+ {
+ }
+
+ BOOL postBuild()
+ {
+ getChild<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onSave, this ));
+ getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onCancel, this ));
+
+ childSetTextArg("name ed", "[DESC]", mTempItemName);
+ return TRUE;
+ }
+
+ void setSaveAsCommit( const boost::signals2::signal<void (const std::string&)>::slot_type& cb )
+ {
+ mSaveAsSignal.connect(cb);
+ }
+
+ virtual void onOpen(const LLSD& key)
+ {
+ LLLineEditor* edit = getChild<LLLineEditor>("name ed");
+ if (edit)
+ {
+ edit->setFocus(TRUE);
+ edit->selectAll();
+ }
+ }
+
+ void onSave()
+ {
+ mItemName = childGetValue("name ed").asString();
+ LLStringUtil::trim(mItemName);
+ if( !mItemName.empty() )
+ {
+ mSaveAsSignal(mItemName);
+ closeFloater(); // destroys this object
+ }
+ }
+
+ void onCancel()
+ {
+ closeFloater(); // destroys this object
+ }
+};
+
LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
mActivePanel(NULL),
mParent(NULL)
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
+
+ static bool registered_dialog = false;
+ if (!registered_dialog)
+ {
+ LLFloaterReg::add("outfit_save_as", "floater_outfit_save_as.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutfitSaveAsDialog>);
+ registered_dialog = true;
+ }
}
LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
@@ -177,10 +243,28 @@ void LLPanelOutfitsInventory::onEdit()
{
}
-void LLPanelOutfitsInventory::onNew()
+void LLPanelOutfitsInventory::onSave()
+{
+ std::string outfit_name;
+
+ if (!LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name))
+ {
+ outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
+ }
+
+ LLOutfitSaveAsDialog* save_as_dialog = LLFloaterReg::showTypedInstance<LLOutfitSaveAsDialog>("outfit_save_as", LLSD(outfit_name), TRUE);
+ if (save_as_dialog)
+ {
+ save_as_dialog->setSaveAsCommit(boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1 ));
+ }
+}
+
+void LLPanelOutfitsInventory::onSaveCommit(const std::string& outfit_name)
{
- const std::string& outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
+ LLSD key;
+ LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
+
if (mAppearanceTabs)
{
mAppearanceTabs->selectTabByName("outfitslist_tab");
@@ -291,7 +375,7 @@ void LLPanelOutfitsInventory::onGearButtonClick()
void LLPanelOutfitsInventory::onAddButtonClick()
{
- onNew();
+ onSave();
}
void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
@@ -330,7 +414,7 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
const std::string command_name = userdata.asString();
if (command_name == "new")
{
- onNew();
+ onSave();
}
if (command_name == "edit")
{