diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-23 11:58:17 +0200 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-23 11:58:17 +0200 |
commit | dfbf9e6d96293b7f97553154d103883dede477b8 (patch) | |
tree | 8be140339fc89c416468d5a84eca6da1f10316ef | |
parent | 24b41ee746ccc6b5dd637b8704dc7ec819434605 (diff) |
SL-19379 WIP update Add menu for Gallery view
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 160 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.h | 2 |
3 files changed, 99 insertions, 78 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 2816a2dc89..e60ee20210 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -482,11 +482,18 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata) reset_inventory_filter(); if(mSingleFolderMode) { - LLFolderViewItem* current_folder = getActivePanel()->getRootFolder(); - if (current_folder) + if(isListViewMode()) + { + LLFolderViewItem* current_folder = getActivePanel()->getRootFolder(); + if (current_folder) + { + LLFolderBridge* bridge = (LLFolderBridge*)current_folder->getViewModelItem(); + menu_create_inventory_item(getPanel(), bridge, userdata); + } + } + else if(isGalleryViewMode()) { - LLFolderBridge* bridge = (LLFolderBridge*)current_folder->getViewModelItem(); - menu_create_inventory_item(getPanel(), bridge, userdata); + menu_create_inventory_item(NULL, mInventoryGalleryPanel->getRootFolder(), userdata); } } else diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 6f18d72be0..95174c75e9 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1698,69 +1698,78 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl // ! REFACTOR ! Really need to refactor this so that it's not a bunch of if-then statements... void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, const LLSD& userdata, const LLUUID& default_parent_uuid) { - std::string type_name = userdata.asString(); - - if (("inbox" == type_name) || ("category" == type_name) || ("current" == type_name) || ("outfit" == type_name) || ("my_otfts" == type_name)) - { - LLFolderType::EType preferred_type = LLFolderType::lookup(type_name); + menu_create_inventory_item(panel, bridge ? bridge->getUUID() : LLUUID::null, userdata, default_parent_uuid); +} - LLUUID parent_id; - if (bridge) - { - parent_id = bridge->getUUID(); - } - else if (default_parent_uuid.notNull()) - { - parent_id = default_parent_uuid; - } - else - { - parent_id = gInventory.getRootFolderID(); - } +void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const LLSD& userdata, const LLUUID& default_parent_uuid) +{ + std::string type_name = userdata.asString(); + + if (("inbox" == type_name) || ("category" == type_name) || ("current" == type_name) || ("outfit" == type_name) || ("my_otfts" == type_name)) + { + LLFolderType::EType preferred_type = LLFolderType::lookup(type_name); - LLHandle<LLPanel> handle = panel->getHandle(); - gInventory.createNewCategory( - parent_id, - preferred_type, - LLStringUtil::null, - [handle](const LLUUID &new_category_id) + LLUUID parent_id; + if (dest_id.notNull()) { - gInventory.notifyObservers(); - LLInventoryPanel* panel = static_cast<LLInventoryPanel*>(handle.get()); - if (panel) + parent_id = dest_id; + } + else if (default_parent_uuid.notNull()) + { + parent_id = default_parent_uuid; + } + else + { + parent_id = gInventory.getRootFolderID(); + } + + std::function<void(const LLUUID&)> callback_cat_created = NULL; + if(panel) + { + LLHandle<LLPanel> handle = panel->getHandle(); + std::function<void(const LLUUID&)> callback_cat_created = [handle](const LLUUID &new_category_id) { - panel->setSelectionByID(new_category_id, TRUE); - } + gInventory.notifyObservers(); + LLInventoryPanel* panel = static_cast<LLInventoryPanel*>(handle.get()); + if (panel) + { + panel->setSelectionByID(new_category_id, TRUE); + } + }; } - ); - } - else if ("lsl" == type_name) - { - const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_LSL_TEXT); - create_new_item(NEW_LSL_NAME, - parent_id, - LLAssetType::AT_LSL_TEXT, - LLInventoryType::IT_LSL, - PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item - } - else if ("notecard" == type_name) - { - const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_NOTECARD); - create_new_item(NEW_NOTECARD_NAME, - parent_id, - LLAssetType::AT_NOTECARD, - LLInventoryType::IT_NOTECARD, - PERM_ALL); // overridden in create_new_item - } - else if ("gesture" == type_name) - { - const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); - create_new_item(NEW_GESTURE_NAME, - parent_id, - LLAssetType::AT_GESTURE, - LLInventoryType::IT_GESTURE, - PERM_ALL); // overridden in create_new_item - } + gInventory.createNewCategory( + parent_id, + preferred_type, + LLStringUtil::null, + callback_cat_created); + } + else if ("lsl" == type_name) + { + const LLUUID parent_id = dest_id.notNull() ? dest_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_LSL_TEXT); + create_new_item(NEW_LSL_NAME, + parent_id, + LLAssetType::AT_LSL_TEXT, + LLInventoryType::IT_LSL, + PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item + } + else if ("notecard" == type_name) + { + const LLUUID parent_id = dest_id.notNull() ? dest_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_NOTECARD); + create_new_item(NEW_NOTECARD_NAME, + parent_id, + LLAssetType::AT_NOTECARD, + LLInventoryType::IT_NOTECARD, + PERM_ALL); // overridden in create_new_item + } + else if ("gesture" == type_name) + { + const LLUUID parent_id = dest_id.notNull() ? dest_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); + create_new_item(NEW_GESTURE_NAME, + parent_id, + LLAssetType::AT_GESTURE, + LLInventoryType::IT_GESTURE, + PERM_ALL); // overridden in create_new_item + } else if (("sky" == type_name) || ("water" == type_name) || ("daycycle" == type_name)) { LLSettingsType::type_e stype(LLSettingsType::ST_NONE); @@ -1783,25 +1792,28 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, return; } - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); + LLUUID parent_id = dest_id.notNull() ? dest_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); LLSettingsVOBase::createNewInventoryItem(stype, parent_id); } - else - { - // Use for all clothing and body parts. Adding new wearable types requires updating LLWearableDictionary. - LLWearableType::EType wearable_type = LLWearableType::getInstance()->typeNameToType(type_name); - if (wearable_type >= LLWearableType::WT_SHAPE && wearable_type < LLWearableType::WT_COUNT) - { - const LLUUID parent_id = bridge ? bridge->getUUID() : LLUUID::null; - LLAgentWearables::createWearable(wearable_type, false, parent_id); - } - else - { - LL_WARNS(LOG_INV) << "Can't create unrecognized type " << type_name << LL_ENDL; - } - } - panel->getRootFolder()->setNeedsAutoRename(TRUE); + else + { + // Use for all clothing and body parts. Adding new wearable types requires updating LLWearableDictionary. + LLWearableType::EType wearable_type = LLWearableType::getInstance()->typeNameToType(type_name); + if (wearable_type >= LLWearableType::WT_SHAPE && wearable_type < LLWearableType::WT_COUNT) + { + const LLUUID parent_id = dest_id; + LLAgentWearables::createWearable(wearable_type, false, parent_id); + } + else + { + LL_WARNS(LOG_INV) << "Can't create unrecognized type " << type_name << LL_ENDL; + } + } + if(panel) + { + panel->getRootFolder()->setNeedsAutoRename(TRUE); + } } LLAssetType::EType LLViewerInventoryItem::getType() const diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 3914dae343..63f163b168 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -446,6 +446,8 @@ void menu_create_inventory_item(LLInventoryPanel* root, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null); +void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const LLSD& userdata, const LLUUID& default_parent_uuid = LLUUID::null); + void slam_inventory_folder(const LLUUID& folder_id, const LLSD& contents, LLPointer<LLInventoryCallback> cb); |