From d2bb4cd19d3a044276cc4c60770cff607d697b35 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Mon, 21 Aug 2023 10:58:52 -0700 Subject: 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 --- .../newview/llfloaterinventorythumbnailshelper.cpp | 71 +++++++++++++--------- .../newview/skins/default/xui/en/notifications.xml | 14 ++++- 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::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::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::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::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"/> - + + 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? + confirm + + -- cgit v1.2.3