diff options
| author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2025-09-12 15:54:21 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-12 15:54:21 +0300 |
| commit | cf3352e6f24630948c38db52b749a103e4d08d77 (patch) | |
| tree | 6ab40851a4e2bd009facc90f877436d669244f97 /indra | |
| parent | 452c8e0ea40da1de684c80b84ffa9ec712f72ed2 (diff) | |
#3957 Add indication to a folder's context menu that it is the default upload location
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 25 | ||||
| -rw-r--r-- | indra/newview/llinventoryfunctions.h | 1 | ||||
| -rw-r--r-- | indra/newview/llinventorygallerymenu.cpp | 7 | ||||
| -rw-r--r-- | indra/newview/llinventorygallerymenu.h | 1 | ||||
| -rw-r--r-- | indra/newview/llinventorypanel.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llinventorypanel.h | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_gallery_inventory.xml | 98 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory.xml | 45 |
8 files changed, 107 insertions, 79 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index d1fd82a7f1..e6b33453d5 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -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); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index ae7bb8770d..77a2a18877 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -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); diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 7212c4dedb..e129a1296a 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -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) diff --git a/indra/newview/llinventorygallerymenu.h b/indra/newview/llinventorygallerymenu.h index 7c3545432b..e90c7a19d2 100644 --- a/indra/newview/llinventorygallerymenu.h +++ b/indra/newview/llinventorygallerymenu.h @@ -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); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 590cbbec4e..a935ede186 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -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); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 473283352f..50333709fc 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -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); diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index d8090070bd..3cfe2e0e6f 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -687,51 +687,6 @@ 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" name="upload_options"> @@ -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" diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index f998aefb29..8bbcefceac 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -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" |
