diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-24 13:58:29 +0200 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-24 13:58:29 +0200 |
commit | 3605d3164d83b966c5c4a330713092d05e8e5698 (patch) | |
tree | cd823bafebb92d39f57673385154e1b7172b43ef /indra/newview | |
parent | d733ee60ea1d7cd7a9259c188b7b942a41d24460 (diff) |
SL-19379 WIP show localized folder names in Gallery
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.h | 2 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 27 |
4 files changed, 40 insertions, 30 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 29ee879076..5b46dc4753 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2097,6 +2097,34 @@ bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_ca return true; } + +std::string get_localized_folder_name(LLUUID cat_uuid) +{ + std::string localized_root_name; + const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_uuid); + if (cat) + { + LLFolderType::EType preferred_type = cat->getPreferredType(); + + // Translation of Accessories folder in Library inventory folder + bool accessories = false; + if(cat->getName() == "Accessories") + { + const LLUUID& parent_folder_id = cat->getParentUUID(); + accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); + } + + //"Accessories" inventory category has folder type FT_NONE. So, this folder + //can not be detected as protected with LLFolderType::lookupIsProtectedType + localized_root_name.assign(cat->getName()); + if (accessories || LLFolderType::lookupIsProtectedType(preferred_type)) + { + LLTrans::findString(localized_root_name, std::string("InvFolder ") + cat->getName(), LLSD()); + } + } + + return localized_root_name; +} ///---------------------------------------------------------------------------- /// LLMarketplaceValidator implementations ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 2dfe605ada..f7755be1dd 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -100,6 +100,8 @@ bool is_only_items_selected(const uuid_vec_t& selected_uuids); bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit); bool can_move_to_landmarks(LLInventoryItem* inv_item); bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_cat, U32 wear_limit); +std::string get_localized_folder_name(LLUUID cat_uuid); + /** Miscellaneous global functions ** ** *******************************************************************************/ diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index c2594c1b87..2624640bb4 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -586,14 +586,19 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id) return; } + std::string name = obj->getName(); LLUUID thumbnail_id = obj->getThumbnailUUID();; - if ((LLAssetType::AT_CATEGORY == obj->getType()) && thumbnail_id.isNull()) + if (LLAssetType::AT_CATEGORY == obj->getType()) { - thumbnail_id = getOutfitImageID(item_id); + name = get_localized_folder_name(item_id); + if(thumbnail_id.isNull()) + { + thumbnail_id = getOutfitImageID(item_id); + } } - - LLInventoryGalleryItem* item = buildGalleryItem(obj->getName(), item_id, obj->getType(), thumbnail_id, obj->getIsLinkType()); + + LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, obj->getIsLinkType()); mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item)); item->setFocusReceivedCallback(boost::bind(&LLInventoryGallery::onChangeItemSelection, this, item_id)); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 23a32df2cc..f430e44ec2 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1995,32 +1995,7 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) std::string LLPanelMainInventory::getLocalizedRootName() { - std::string localized_root_name; - if(mSingleFolderMode) - { - const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot()); - if (cat) - { - LLFolderType::EType preferred_type = cat->getPreferredType(); - - // Translation of Accessories folder in Library inventory folder - bool accessories = false; - if(getName() == "Accessories") - { - const LLUUID& parent_folder_id = cat->getParentUUID(); - accessories = (parent_folder_id == gInventory.getLibraryRootFolderID()); - } - - //"Accessories" inventory category has folder type FT_NONE. So, this folder - //can not be detected as protected with LLFolderType::lookupIsProtectedType - localized_root_name.assign(cat->getName()); - if (accessories || LLFolderType::lookupIsProtectedType(preferred_type)) - { - LLTrans::findString(localized_root_name, std::string("InvFolder ") + cat->getName(), LLSD()); - } - } - } - return localized_root_name; + return mSingleFolderMode ? get_localized_folder_name(getCurrentSFVRoot()) : ""; } LLUUID LLPanelMainInventory::getCurrentSFVRoot() |