#3957 Add indication to a folder's context menu that it is the default upload location

master
Maxim Nikolenko 2025-09-12 15:54:21 +03:00 committed by GitHub
parent 452c8e0ea4
commit cf3352e6f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 107 additions and 79 deletions

View File

@ -3890,6 +3890,31 @@ void LLInventoryAction::fileUploadLocation(const LLUUID& dest_id, const std::str
}
}
bool LLInventoryAction::isFileUploadLocation(const LLUUID& dest_id, const std::string& action)
{
if (action == "def_model")
{
return gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT) == dest_id;
}
else if (action == "def_texture")
{
return gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE) == dest_id;
}
else if (action == "def_sound")
{
return gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_SOUND) == dest_id;
}
else if (action == "def_animation")
{
return gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_ANIMATION) == dest_id;
}
else if (action == "def_pbr_material")
{
return gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL) == dest_id;
}
return false;
}
void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);

View File

@ -653,6 +653,7 @@ struct LLInventoryAction
static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root);
static void removeItemFromDND(LLFolderView* root);
static void fileUploadLocation(const LLUUID& dest_id, const std::string& action);
static bool isFileUploadLocation(const LLUUID& dest_id, const std::string& action);
static void saveMultipleTextures(const std::vector<std::string>& filenames, std::set<LLFolderViewItem*> selected_items, LLInventoryModel* model);

View File

@ -110,6 +110,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()
registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery)));
enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2));
enable_registrar.add("Inventory.FileUploadLocation.Check", boost::bind(&LLInventoryGalleryContextMenu::isUploadLocationSelected, this, _2));
enable_registrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl*, const LLSD&)
{
@ -489,6 +490,12 @@ void LLInventoryGalleryContextMenu::fileUploadLocation(const LLSD& userdata)
LLInventoryAction::fileUploadLocation(mUUIDs.front(), param);
}
bool LLInventoryGalleryContextMenu::isUploadLocationSelected(const LLSD& userdata)
{
const std::string param = userdata.asString();
return LLInventoryAction::isFileUploadLocation(mUUIDs.front(), param);
}
bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata)
{
if (mUUIDs.size() != 1)

View File

@ -47,6 +47,7 @@ protected:
void updateMenuItemsVisibility(LLContextMenu* menu);
void fileUploadLocation(const LLSD& userdata);
bool isUploadLocationSelected(const LLSD& userdata);
bool canSetUploadLocation(const LLSD& userdata);
static void onRename(const LLSD& notification, const LLSD& response);

View File

@ -187,6 +187,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2));
mEnableCallbackRegistrar.add("Inventory.FileUploadLocation.Check", boost::bind(&LLInventoryPanel::isUploadLocationSelected, this, _2));
mCommitCallbackRegistrar.add("Inventory.OpenNewFolderWindow", boost::bind(&LLInventoryPanel::openSingleViewInventory, this, LLUUID()));
}
@ -1832,6 +1833,13 @@ void LLInventoryPanel::fileUploadLocation(const LLSD& userdata)
LLInventoryAction::fileUploadLocation(dest, param);
}
bool LLInventoryPanel::isUploadLocationSelected(const LLSD& userdata)
{
const std::string param = userdata.asString();
const LLUUID dest = LLFolderBridge::sSelf.get()->getUUID();
return LLInventoryAction::isFileUploadLocation(dest, param);
}
void LLInventoryPanel::openSingleViewInventory(LLUUID folder_id)
{
LLPanelMainInventory::newFolderWindow(folder_id.isNull() ? LLFolderBridge::sSelf.get()->getUUID() : folder_id);

View File

@ -225,6 +225,7 @@ public:
void doCreate(const LLSD& userdata);
bool beginIMSession();
void fileUploadLocation(const LLSD& userdata);
bool isUploadLocationSelected(const LLSD& userdata);
void openSingleViewInventory(LLUUID folder_id = LLUUID());
void purgeSelectedItems();
bool attachObject(const LLSD& userdata);

View File

@ -686,51 +686,6 @@
function="Inventory.DoToSelected"
parameter="remove_from_favorites" />
</menu_item_call>
<menu
label="Use as default for"
layout="topleft"
name="upload_def">
<menu_item_call
label="Image uploads"
layout="topleft"
name="Image uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="texture" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
label="Sound uploads"
layout="topleft"
name="Sound uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="sound" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
label="Animation uploads"
layout="topleft"
name="Animation uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="animation" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
label="Model uploads"
layout="topleft"
name="Model uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="model" />
<menu_item_call.on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
</menu>
<menu
label="Upload to folder"
layout="topleft"
@ -812,54 +767,69 @@
label="Use as default for"
layout="topleft"
name="upload_def">
<menu_item_call
<menu_item_check
label="Image uploads"
layout="topleft"
name="Image uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_texture" />
<menu_item_call.on_visible
<on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_texture" />
</menu_item_check>
<menu_item_check
label="Sound uploads"
layout="topleft"
name="Sound uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_sound" />
<menu_item_call.on_visible
<on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_sound" />
</menu_item_check>
<menu_item_check
label="Animation uploads"
layout="topleft"
name="Animation uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_animation" />
<menu_item_call.on_visible
<on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_animation" />
</menu_item_check>
<menu_item_check
label="Model uploads"
layout="topleft"
name="Model uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_model" />
<menu_item_call.on_visible
<on_visible
function="Inventory.CanSetUploadLocation" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_model" />
</menu_item_check>
<menu_item_check
label="PBR material uploads"
layout="topleft"
name="PBR uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_pbr_material" />
</menu_item_call>
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_pbr_material" />
</menu_item_check>
</menu>
<menu_item_separator
layout="topleft"

View File

@ -1064,46 +1064,61 @@
label="Use as default for"
layout="topleft"
name="upload_def">
<menu_item_call
<menu_item_check
label="Image uploads"
layout="topleft"
name="Image uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_texture" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_texture" />
</menu_item_check>
<menu_item_check
label="Sound uploads"
layout="topleft"
name="Sound uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_sound" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_sound" />
</menu_item_check>
<menu_item_check
label="Animation uploads"
layout="topleft"
name="Animation uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_animation" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_animation" />
</menu_item_check>
<menu_item_check
label="Model uploads"
layout="topleft"
name="Model uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_model" />
</menu_item_call>
<menu_item_call
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_model" />
</menu_item_check>
<menu_item_check
label="PBR material uploads"
layout="topleft"
name="PBR uploads">
<menu_item_call.on_click
<on_click
function="Inventory.FileUploadLocation"
parameter="def_pbr_material" />
</menu_item_call>
<on_check
function="Inventory.FileUploadLocation.Check"
parameter="def_pbr_material" />
</menu_item_check>
</menu>
<menu_item_separator
layout="topleft"