SL-19379 WIP update Add menu for Gallery view

meow-7.2.2
Maxim Nikolenko 2023-03-23 11:58:17 +02:00
parent 24b41ee746
commit dfbf9e6d96
3 changed files with 99 additions and 78 deletions

View File

@ -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())
{
LLFolderBridge* bridge = (LLFolderBridge*)current_folder->getViewModelItem();
menu_create_inventory_item(getPanel(), bridge, userdata);
LLFolderViewItem* current_folder = getActivePanel()->getRootFolder();
if (current_folder)
{
LLFolderBridge* bridge = (LLFolderBridge*)current_folder->getViewModelItem();
menu_create_inventory_item(getPanel(), bridge, userdata);
}
}
else if(isGalleryViewMode())
{
menu_create_inventory_item(NULL, mInventoryGalleryPanel->getRootFolder(), userdata);
}
}
else

View File

@ -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(
LLUUID parent_id;
if (dest_id.notNull())
{
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)
{
gInventory.notifyObservers();
LLInventoryPanel* panel = static_cast<LLInventoryPanel*>(handle.get());
if (panel)
{
panel->setSelectionByID(new_category_id, TRUE);
}
};
}
gInventory.createNewCategory(
parent_id,
preferred_type,
LLStringUtil::null,
[handle](const LLUUID &new_category_id)
{
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
}
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

View File

@ -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);