summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitsinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitsinventory.cpp')
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp176
1 files changed, 72 insertions, 104 deletions
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index c2f2d32142..b78268da7b 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -43,10 +43,12 @@
#include "llfloaterinventory.h"
#include "llfoldervieweventlistener.h"
#include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
#include "llinventorypanel.h"
#include "lllandmark.h"
#include "lllineeditor.h"
#include "llmodaldialog.h"
+#include "llnotificationsutil.h"
#include "llsidepanelappearance.h"
#include "llsidetray.h"
#include "lltabcontainer.h"
@@ -67,75 +69,13 @@ static const std::string COF_TAB_NAME = "cof_tab";
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()
@@ -191,7 +131,7 @@ void LLPanelOutfitsInventory::updateVerbs()
if (mListCommands)
{
- mListCommands->childSetVisible("look_edit_btn",sShowDebugEditor);
+ mListCommands->childSetVisible("edit_current_outfit_btn",sShowDebugEditor);
updateListCommands();
}
}
@@ -217,7 +157,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
getRootFolder()->scrollToShowSelection();
}
- gInventory.startBackgroundFetch();
+ LLInventoryModelBackgroundFetch::instance().start();
if (mActivePanel->getFilterSubString().empty() && string.empty())
{
@@ -241,7 +181,7 @@ void LLPanelOutfitsInventory::onWearButtonClick()
LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
if (listenerp)
{
- listenerp->performAction(NULL, NULL,"replaceoutfit");
+ listenerp->performAction(NULL, "replaceoutfit");
}
}
@@ -250,7 +190,7 @@ void LLPanelOutfitsInventory::onAdd()
LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
if (listenerp)
{
- listenerp->performAction(NULL, NULL,"addtooutfit");
+ listenerp->performAction(NULL, "addtooutfit");
}
}
@@ -259,7 +199,7 @@ void LLPanelOutfitsInventory::onRemove()
LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
if (listenerp)
{
- listenerp->performAction(NULL, NULL,"removefromoutfit");
+ listenerp->performAction(NULL, "removefromoutfit");
}
}
@@ -267,32 +207,61 @@ void LLPanelOutfitsInventory::onEdit()
{
}
+bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == option)
+ {
+ std::string outfit_name = response["message"].asString();
+ LLStringUtil::trim(outfit_name);
+ if( !outfit_name.empty() )
+ {
+ LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
+
+ LLSidepanelAppearance* panel_appearance =
+ dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
+ if (panel_appearance)
+ {
+ panel_appearance->showOutfitsInventoryPanel();
+ }
+
+ if (mAppearanceTabs)
+ {
+ mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
+ }
+ }
+ }
+
+ return false;
+}
+
+
+
void LLPanelOutfitsInventory::onSave()
{
std::string outfit_name;
- if (!LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name))
+ if (!LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
{
outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
}
+ LLSD args;
+ args["DESC"] = outfit_name;
+
+ LLSD payload;
+ //payload["ids"].append(*it);
+
+ LLNotificationsUtil::add("SaveOutfitAs", args, payload, boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1, _2));
+
+ //)
+
+/*
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)
-{
- LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
- LLSD key;
- LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
-
- if (mAppearanceTabs)
- {
- mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
- }
+ }*/
}
void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
@@ -305,19 +274,12 @@ void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewIte
}
}
-void LLPanelOutfitsInventory::onSelectorButtonClicked()
+void LLPanelOutfitsInventory::showEditOutfitPanel()
{
- LLFolderViewItem* cur_item = getRootFolder()->getCurSelectedItem();
-
- LLFolderViewEventListener* listenerp = cur_item->getListener();
- if (getIsCorrectType(listenerp))
- {
- LLSD key;
- key["type"] = "look";
- key["id"] = listenerp->getUUID();
-
- LLSideTray::getInstance()->showPanel("sidepanel_appearance", key);
- }
+ LLSD key;
+ key["type"] = "edit_outfit";
+
+ LLSideTray::getInstance()->showPanel("sidepanel_appearance", key);
}
LLFolderViewEventListener *LLPanelOutfitsInventory::getCorrectListenerForAction()
@@ -352,6 +314,12 @@ LLFolderView *LLPanelOutfitsInventory::getRootFolder()
return mActivePanel->getRootFolder();
}
+//static
+LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance()
+{
+ return dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
+}
+
//////////////////////////////////////////////////////////////////////////////////
// List Commands //
@@ -364,7 +332,7 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
mListCommands->childSetAction("make_outfit_btn", boost::bind(&LLPanelOutfitsInventory::onAddButtonClick, this));
mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
- mListCommands->childSetAction("look_edit_btn", boost::bind(&LLPanelOutfitsInventory::onSelectorButtonClicked, this));
+ mListCommands->childSetAction("edit_current_outfit_btn", boost::bind(&LLPanelOutfitsInventory::showEditOutfitPanel, this));
LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn");
trash_btn->setDragAndDropHandler(boost::bind(&LLPanelOutfitsInventory::handleDragAndDropToTrash, this
@@ -479,18 +447,18 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
if (command_name == "delete" || command_name == "remove")
{
BOOL can_delete = FALSE;
- LLFolderView *folder = getActivePanel()->getRootFolder();
- if (folder)
+ LLFolderView* root = getActivePanel()->getRootFolder();
+ if (root)
{
std::set<LLUUID> selection_set;
- folder->getSelectionList(selection_set);
+ root->getSelectionList(selection_set);
can_delete = (selection_set.size() > 0);
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
++iter)
{
const LLUUID &item_id = (*iter);
- LLFolderViewItem *item = folder->getItemByID(item_id);
+ LLFolderViewItem *item = root->getItemByID(item_id);
can_delete &= item->getListener()->isItemRemovable();
}
return can_delete;
@@ -500,11 +468,11 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
if (command_name == "remove_link")
{
BOOL can_delete = FALSE;
- LLFolderView *folder = getActivePanel()->getRootFolder();
- if (folder)
+ LLFolderView* root = getActivePanel()->getRootFolder();
+ if (root)
{
std::set<LLUUID> selection_set;
- folder->getSelectionList(selection_set);
+ root->getSelectionList(selection_set);
can_delete = (selection_set.size() > 0);
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
@@ -549,11 +517,11 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
bool LLPanelOutfitsInventory::hasItemsSelected()
{
bool has_items_selected = false;
- LLFolderView *folder = getActivePanel()->getRootFolder();
- if (folder)
+ LLFolderView* root = getActivePanel()->getRootFolder();
+ if (root)
{
std::set<LLUUID> selection_set;
- folder->getSelectionList(selection_set);
+ root->getSelectionList(selection_set);
has_items_selected = (selection_set.size() > 0);
}
return has_items_selected;