summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitsinventory.cpp
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-06-02 20:46:16 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-06-02 20:46:16 +0300
commit671625695fc44adc430a7ddf3be158ce26a61cc6 (patch)
tree660eebb8544495a1653310c52663e7443920ff70 /indra/newview/llpaneloutfitsinventory.cpp
parent5a29fb38312d1a8ae39d1f408754475ecffaebc8 (diff)
EXT-6726 WIP Added more menus to the Appearance SP.
Done: - Implemented creating new wearables via My Outfits gear menu. - Implemented renaming/removing/editing an outfit via My Outfits context menu. - Implemented "Attach to..." / "Attach to HUD..." context submenus. - Now disabling (instead of hiding) irrelevant wearable context menu items. - Added "Take Off / Detach" context menu item that's shown for clothes and attachments. Useful if you selected a bunch of items and want to take them all off. - Fixed taking off an outfit (not all wearables were taken off because of a wrong inventory collector). - Fixed crash when editing a skirt (reference to a missing string). - In LLWearableItemsList::ContextMenu::updateItemsVisibility renamed variables and introduced MASK_UNKNOWN per Nyx's request. Known issues: - "Attach to..." context menus may be displayed partially off-screen (there is the same bug in the inventory panel). - The way we invoke wearable editing panel after the wearable gets created is currently a hack. TODO: - Wear / take off / rename / delete an outfit via My Outfits gear menu (currently not implemented because of missing selection support in My Outfits). - Add "Create new..." to body part / clothing context menu in Edit Outfit. - Add "Create new..." submenus to the Edit Outfit gear menu. Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/466/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llpaneloutfitsinventory.cpp')
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp89
1 files changed, 86 insertions, 3 deletions
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 21f69d3470..6fb016cdfd 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -42,6 +42,7 @@
#include "llfloaterworldmap.h"
#include "llfloaterinventory.h"
#include "llfoldervieweventlistener.h"
+#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llinventorypanel.h"
@@ -70,6 +71,89 @@ static const std::string COF_TAB_NAME = "cof_tab";
static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
+// Context-dependent menu actions are not implemented
+// because accordions don't properly support selection yet.
+class LLOutfitListGearMenu
+{
+public:
+ static LLMenuGL* createMenu()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+
+ registrar.add("Gear.Wear", boost::bind(onWear));
+ registrar.add("Gear.TakeOff", boost::bind(onTakeOff));
+ registrar.add("Gear.Rename", boost::bind(onRename));
+ registrar.add("Gear.Delete", boost::bind(onDelete));
+ registrar.add("Gear.Create", boost::bind(onCreate, _2));
+
+ enable_registrar.add("Gear.OnEnable", boost::bind(onEnable, _2));
+
+ return LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+ "menu_outfit_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ }
+
+private:
+ static void onWear()
+ {
+ // *TODO: not implemented
+ }
+
+ static void onTakeOff()
+ {
+ // *TODO: not implemented
+ }
+
+ static void onRename()
+ {
+ // *TODO: not implemented
+ }
+
+ static void onDelete()
+ {
+ // *TODO: not implemented
+ }
+
+ static void onCreate(const LLSD& data)
+ {
+ LLWearableType::EType type = LLWearableType::typeNameToType(data.asString());
+ if (type == LLWearableType::WT_NONE)
+ {
+ llwarns << "Invalid wearable type" << llendl;
+ return;
+ }
+
+ LLAgentWearables::createWearable(type, true);
+ }
+
+ static bool onEnable(const LLSD& data)
+ {
+ std::string param = data.asString();
+
+ if ("wear" == param)
+ {
+ // *TODO: not implemented
+ return false;
+ }
+ else if ("take_off" == param)
+ {
+ // *TODO: not implemented
+ return false;
+ }
+ else if ("rename" == param)
+ {
+ // *TODO: not implemented
+ return false;
+ }
+ else if ("delete" == param)
+ {
+ // *TODO: not implemented
+ return false;
+ }
+
+ return true;
+ }
+};
LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
mMyOutfitsPanel(NULL),
@@ -385,8 +469,7 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
, _7 // EAcceptance* accept
));
- mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_outfit_gear.xml",
- gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mGearMenu = LLOutfitListGearMenu::createMenu();
}
void LLPanelOutfitsInventory::updateListCommands()
@@ -403,7 +486,7 @@ void LLPanelOutfitsInventory::updateListCommands()
void LLPanelOutfitsInventory::onGearButtonClick()
{
- showActionMenu(mMenuGearDefault,"options_gear_btn");
+ showActionMenu(mGearMenu, "options_gear_btn");
}
void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)