diff options
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.h | 3 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 67 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.h | 2 | ||||
-rw-r--r-- | indra/newview/llsidepanelappearance.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llsidepanelappearance.h | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory.xml | 51 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml | 54 |
9 files changed, 189 insertions, 51 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d91b9d7ea4..c06098689d 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -574,29 +574,32 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) linkAll(cof, obj_items, link_waiter); linkAll(cof, gest_items, link_waiter); - LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); // Add link to outfit if category is an outfit. LLViewerInventoryCategory* catp = gInventory.getCategory(category); - if (!append && catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) + if (!append) { - link_inventory_item(gAgent.getID(), category, cof, catp->getName(), - LLAssetType::AT_LINK_FOLDER, link_waiter); - - // Update the current outfit name of the appearance sidepanel. - if (panel_appearance) + std::string new_outfit_name = ""; + if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { - panel_appearance->refreshCurrentOutfitName(catp->getName()); + link_inventory_item(gAgent.getID(), category, cof, catp->getName(), + LLAssetType::AT_LINK_FOLDER, link_waiter); + new_outfit_name = catp->getName(); } + updatePanelOutfitName(new_outfit_name); } - else +} + +void LLAppearanceManager::updatePanelOutfitName(const std::string& name) +{ + LLSidepanelAppearance* panel_appearance = + dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + if (panel_appearance) { - if (panel_appearance) - { - panel_appearance->refreshCurrentOutfitName(""); - } + panel_appearance->refreshCurrentOutfitName(name); } } + void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) { lldebugs << "updateAgentWearables()" << llendl; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 7038d1a35b..b625d42a50 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -64,6 +64,9 @@ public: // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getCurrentOutfitLink(); + // Update the displayed outfit name in UI. + void updatePanelOutfitName(const std::string& name); + void updateAgentWearables(LLWearableHoldingPattern* holder, bool append); // For debugging - could be moved elsewhere. diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4c28d5e2df..28b982d386 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2455,6 +2455,8 @@ void LLFolderBridge::folderOptionsMenu() mItems.push_back(std::string("Wear As Ensemble")); } mItems.push_back(std::string("Remove From Outfit")); + if (is_sidepanel) + mItems.push_back(std::string("Outfit Separator")); } hide_context_entries(*mMenu, mItems, disabled_items); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 6aba8c0ebb..4511bca23a 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -136,6 +136,24 @@ void LLPanelOutfitsInventory::onWear() } } +void LLPanelOutfitsInventory::onAdd() +{ + LLFolderViewEventListener* listenerp = getCorrectListenerForAction(); + if (listenerp) + { + listenerp->performAction(NULL, NULL,"addtooutfit"); + } +} + +void LLPanelOutfitsInventory::onRemove() +{ + LLFolderViewEventListener* listenerp = getCorrectListenerForAction(); + if (listenerp) + { + listenerp->performAction(NULL, NULL,"removefromoutfit"); + } +} + void LLPanelOutfitsInventory::onEdit() { } @@ -224,8 +242,10 @@ void LLPanelOutfitsInventory::initListCommandsHandlers() , _7 // EAcceptance* accept )); - mCommitCallbackRegistrar.add("panel_outfits_inventory_gear_default.Custom.Action", boost::bind(&LLPanelOutfitsInventory::onCustomAction, this, _2)); - mEnableCallbackRegistrar.add("panel_outfits_inventory_gear_default.Enable", boost::bind(&LLPanelOutfitsInventory::isActionEnabled, this, _2)); + mCommitCallbackRegistrar.add("panel_outfits_inventory_gear_default.Custom.Action", + boost::bind(&LLPanelOutfitsInventory::onCustomAction, this, _2)); + mEnableCallbackRegistrar.add("panel_outfits_inventory_gear_default.Enable", + boost::bind(&LLPanelOutfitsInventory::isActionEnabled, this, _2)); mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("panel_outfits_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); } @@ -290,6 +310,22 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata) { onWear(); } + if (command_name == "add") + { + onAdd(); + } + if (command_name == "remove") + { + onRemove(); + } + if (command_name == "rename") + { + onClipboardAction("rename"); + } + if (command_name == "remove_link") + { + onClipboardAction("delete"); + } if (command_name == "delete") { onClipboardAction("delete"); @@ -320,8 +356,33 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) } return FALSE; } + if (command_name == "remove_link") + { + BOOL can_delete = FALSE; + LLFolderView *folder = getActivePanel()->getRootFolder(); + if (folder) + { + can_delete = TRUE; + std::set<LLUUID> selection_set; + folder->getSelectionList(selection_set); + for (std::set<LLUUID>::iterator iter = selection_set.begin(); + iter != selection_set.end(); + ++iter) + { + const LLUUID &item_id = (*iter); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + if (!item || !item->getIsLinkType()) + return FALSE; + } + return can_delete; + } + return FALSE; + } if (command_name == "edit" || - command_name == "wear") + command_name == "wear" || + command_name == "add" || + command_name == "remove" + ) { return (getCorrectListenerForAction() != NULL); } diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index aa0ab4efbc..afeaef485d 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -55,6 +55,8 @@ public: void onSearchEdit(const std::string& string); void onWear(); + void onAdd(); + void onRemove(); void onEdit(); void onNew(); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index d5f01418c6..eb3695a371 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -67,6 +67,26 @@ private: LLSidepanelAppearance *mPanel; }; +class LLWatchForOutfitRenameObserver : public LLInventoryObserver +{ +public: + LLWatchForOutfitRenameObserver(LLSidepanelAppearance *panel) : + mPanel(panel) + {} + virtual void changed(U32 mask); + +private: + LLSidepanelAppearance *mPanel; +}; + +void LLWatchForOutfitRenameObserver::changed(U32 mask) +{ + if (mask & LABEL) + { + mPanel->refreshCurrentOutfitName(); + } +} + LLSidepanelAppearance::LLSidepanelAppearance() : LLPanel(), mFilterSubString(LLStringUtil::null), @@ -76,6 +96,8 @@ LLSidepanelAppearance::LLSidepanelAppearance() : { //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_appearance.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() mFetchWorn = new LLCurrentlyWornFetchObserver(this); + + mOutfitRenameWatcher = new LLWatchForOutfitRenameObserver(this); } LLSidepanelAppearance::~LLSidepanelAppearance() @@ -135,6 +157,8 @@ BOOL LLSidepanelAppearance::postBuild() mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook"); + gInventory.addObserver(mOutfitRenameWatcher); + return TRUE; } @@ -299,7 +323,7 @@ void LLSidepanelAppearance::updateVerbs() } } -void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string name) +void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) { if (name == "") { diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index b335fd910d..9c870f631a 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -40,6 +40,7 @@ class LLFilterEditor; class LLCurrentlyWornFetchObserver; +class LLWatchForOutfitRenameObserver; class LLPanelEditWearable; class LLWearable; class LLPanelOutfitsInventory; @@ -53,7 +54,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - void refreshCurrentOutfitName(const std::string name = ""); + void refreshCurrentOutfitName(const std::string& name = ""); static void editWearable(LLWearable *wearable, void *data); @@ -91,6 +92,9 @@ private: // Used to make sure the user's inventory is in memory. LLCurrentlyWornFetchObserver* mFetchWorn; + // Used to update title when currently worn outfit gets renamed. + LLWatchForOutfitRenameObserver* mOutfitRenameWatcher; + // Search string for filtering landmarks and teleport // history locations std::string mFilterSubString; diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index b65a49eaed..a36bfb8ec1 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -340,6 +340,33 @@ parameter="open" /> </menu_item_call> <menu_item_call + label="Replace Current Outfit" + layout="topleft" + name="Replace Outfit"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="replaceoutfit" /> + </menu_item_call> + <menu_item_call + label="Add To Current Outfit" + layout="topleft" + name="Add To Outfit"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="addtooutfit" /> + </menu_item_call> + <menu_item_call + label="Remove From Current Outfit" + layout="topleft" + name="Remove From Outfit"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="removefromoutfit" /> + </menu_item_call> + <menu_item_separator + layout="topleft" + name="Outfit Separator" /> + <menu_item_call label="Purge Item" layout="topleft" name="Purge Item"> @@ -433,30 +460,6 @@ </menu_item_call> <menu_item_separator layout="topleft" /> - <menu_item_call - label="Remove From Outfit" - layout="topleft" - name="Remove From Outfit"> - <menu_item_call.on_click - function="Inventory.DoToSelected" - parameter="removefromoutfit" /> - </menu_item_call> - <menu_item_call - label="Add To Outfit" - layout="topleft" - name="Add To Outfit"> - <menu_item_call.on_click - function="Inventory.DoToSelected" - parameter="addtooutfit" /> - </menu_item_call> - <menu_item_call - label="Replace Outfit" - layout="topleft" - name="Replace Outfit"> - <menu_item_call.on_click - function="Inventory.DoToSelected" - parameter="replaceoutfit" /> - </menu_item_call> <menu_item_separator layout="topleft" /> <menu_item_call diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml index c8c79f8761..7b88fca7c3 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory_gear_default.xml @@ -7,29 +7,65 @@ name="menu_gear_default" visible="false"> <menu_item_call - label="New Outfit" + label="Replace Current Outfit" layout="topleft" - name="new"> + name="wear"> <on_click function="panel_outfits_inventory_gear_default.Custom.Action" - parameter="new" /> + parameter="wear" /> <on_enable function="panel_outfits_inventory_gear_default.Enable" - parameter="new" /> + parameter="wear" /> </menu_item_call> <menu_item_call - label="Wear Outfit" + label="Add To Current Outfit" layout="topleft" - name="wear"> + name="add"> <on_click function="panel_outfits_inventory_gear_default.Custom.Action" - parameter="wear" /> + parameter="add" /> <on_enable function="panel_outfits_inventory_gear_default.Enable" - parameter="wear" /> + parameter="add" /> + </menu_item_call> + <menu_item_call + label="Remove From Current Outfit" + layout="topleft" + name="remove"> + <on_click + function="panel_outfits_inventory_gear_default.Custom.Action" + parameter="remove" /> + <on_enable + function="panel_outfits_inventory_gear_default.Enable" + parameter="remove" /> + </menu_item_call> + <menu_item_separator + layout="topleft" + name="Outfits Gear Separator" /> + <menu_item_call + label="Rename" + layout="topleft" + name="rename"> + <on_click + function="panel_outfits_inventory_gear_default.Custom.Action" + parameter="rename" /> + <on_enable + function="panel_outfits_inventory_gear_default.Enable" + parameter="rename" /> + </menu_item_call> + <menu_item_call + label="Remove" + layout="topleft" + name="remove_link"> + <on_click + function="panel_outfits_inventory_gear_default.Custom.Action" + parameter="remove_link" /> + <on_enable + function="panel_outfits_inventory_gear_default.Enable" + parameter="remove_link" /> </menu_item_call> <menu_item_call - label="Delete Outfit" + label="Delete" layout="topleft" name="delete"> <on_click |