diff options
author | Callum Prentice <callum@lindenlab.com> | 2023-08-21 10:58:52 -0700 |
---|---|---|
committer | Callum Prentice <callum@lindenlab.com> | 2023-08-21 10:58:52 -0700 |
commit | d2bb4cd19d3a044276cc4c60770cff607d697b35 (patch) | |
tree | 32b4ded498bd2da31e6977cb7f208389925824de /indra/newview/llfloaterinventorythumbnailshelper.cpp | |
parent | 2830d5c09e3bb3fb81752de9027bfbee5edd0cc7 (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
Diffstat (limited to 'indra/newview/llfloaterinventorythumbnailshelper.cpp')
-rw-r--r-- | indra/newview/llfloaterinventorythumbnailshelper.cpp | 71 |
1 files changed, 42 insertions, 29 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 |