summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2023-08-21 10:58:52 -0700
committerCallum Prentice <callum@lindenlab.com>2023-08-21 10:58:52 -0700
commitd2bb4cd19d3a044276cc4c60770cff607d697b35 (patch)
tree32b4ded498bd2da31e6977cb7f208389925824de
parent2830d5c09e3bb3fb81752de9027bfbee5edd0cc7 (diff)
SL-20172: Add in an 'Are you sure Y/N' type dialog before writing thumbnails (as well as for clearing thumbnails) since it's also a destructive, non-undoiable operation
-rw-r--r--indra/newview/llfloaterinventorythumbnailshelper.cpp71
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml14
2 files changed, 55 insertions, 30 deletions
diff --git a/indra/newview/llfloaterinventorythumbnailshelper.cpp b/indra/newview/llfloaterinventorythumbnailshelper.cpp
index 15e1c88572..814f88e9b9 100644
--- a/indra/newview/llfloaterinventorythumbnailshelper.cpp
+++ b/indra/newview/llfloaterinventorythumbnailshelper.cpp
@@ -5,7 +5,7 @@
*
* Usage instructions and some brief notes can be found in Confluence here:
* https://lindenlab.atlassian.net/wiki/spaces/~174746736/pages/2928672843/Inventory+Thumbnail+Helper+Tool
- *
+ *
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
@@ -372,43 +372,56 @@ bool writeInventoryThumbnailID(LLUUID item_id, LLUUID thumbnail_asset_id)
// writes the thumbnail accordingly.
void LLFloaterInventoryThumbnailsHelper::onWriteThumbnails()
{
- std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin();
- while (item_iter != mItemNamesItems.end())
+ // create and show confirmation (Yes/No) textbox since this is a destructive operation
+ LLNotificationsUtil::add("WriteInventoryThumbnailsWarning", LLSD(), LLSD(),
+ [&](const LLSD & notif, const LLSD & resp)
{
- std::string item_name = (*item_iter).first;
-
- std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.find(item_name);
- if (texture_iter != mTextureNamesIDs.end())
+ S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
+ if (opt == 0)
{
- LLUUID item_id = (*item_iter).second->getUUID();
+ std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin();
+ while (item_iter != mItemNamesItems.end())
+ {
+ std::string item_name = (*item_iter).first;
- LLUUID thumbnail_asset_id = (*texture_iter).second;
+ std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.find(item_name);
+ if (texture_iter != mTextureNamesIDs.end())
+ {
+ LLUUID item_id = (*item_iter).second->getUUID();
- writeToLog(
- STRINGIZE(
- "WRITING THUMB " <<
- (*item_iter).first <<
- "\n" <<
- "item ID: " <<
- item_id <<
- "\n" <<
- "thumbnail texture ID: " <<
- thumbnail_asset_id <<
- "\n"
- ), true);
+ LLUUID thumbnail_asset_id = (*texture_iter).second;
+ writeToLog(
+ STRINGIZE(
+ "WRITING THUMB " <<
+ (*item_iter).first <<
+ "\n" <<
+ "item ID: " <<
+ item_id <<
+ "\n" <<
+ "thumbnail texture ID: " <<
+ thumbnail_asset_id <<
+ "\n"
+ ), true);
- (*item_iter).second->setThumbnailUUID(thumbnail_asset_id);
- // This additional step (notifying AIS API) is required
- // to make the changes persist outside of the local cache
- writeInventoryThumbnailID(item_id, thumbnail_asset_id);
- }
+ (*item_iter).second->setThumbnailUUID(thumbnail_asset_id);
- ++item_iter;
- }
+ // This additional step (notifying AIS API) is required
+ // to make the changes persist outside of the local cache
+ writeInventoryThumbnailID(item_id, thumbnail_asset_id);
+ }
- updateDisplayList();
+ ++item_iter;
+ }
+
+ updateDisplayList();
+ }
+ else
+ {
+ LL_INFOS() << "Writing new thumbnails was canceled" << LL_ENDL;
+ }
+ });
}
// Called when the Log Items with Missing Thumbnails is selected. This merely writes
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 45020163ef..ca9f2c07e8 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -12087,5 +12087,17 @@ Would you like to save them first?
notext="No"
yestext="Yes"/>
</notification>
-
+ <notification
+ icon="alertmodal.tga"
+ name="WriteInventoryThumbnailsWarning"
+ type="alertmodal">
+ You are about to overwrite thumbnail images for some or all of the inventory items in the list. This change cannot be undone.
+
+ Would you like to proceed?
+ <tag>confirm</tag>
+ <usetemplate
+ name="okcancelbuttons"
+ notext="No"
+ yestext="Yes"/>
+ </notification
</notifications>