From 5c78396b64c985a7e58d045ff3f343bccc81c8d3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 May 2024 00:40:30 +0300 Subject: [PATCH] viewer#1424 Favorites in Appearance floater #1 --- indra/llui/llfolderviewitem.cpp | 2 +- indra/newview/llinventoryfunctions.cpp | 21 ++++++++ indra/newview/llinventoryfunctions.h | 1 + indra/newview/llinventorygallerymenu.cpp | 23 +++++++++ indra/newview/lloutfitgallery.cpp | 3 +- indra/newview/lloutfitslist.cpp | 46 +++++++++++++++++- indra/newview/lloutfitslist.h | 2 + .../icons/Inv_Favorite_Star_Content.png | Bin 474 -> 620 bytes .../textures/icons/Inv_Favorite_Star_Full.png | Bin 582 -> 485 bytes .../default/xui/en/menu_gallery_inventory.xml | 16 ++++++ .../xui/en/menu_gallery_outfit_tab.xml | 20 ++++++++ .../skins/default/xui/en/menu_outfit_gear.xml | 30 ++++++++++-- .../skins/default/xui/en/menu_outfit_tab.xml | 14 ++++++ 13 files changed, 169 insertions(+), 9 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index b473b3b395..59be1444d9 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -785,7 +785,7 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI if (favorite_image) { const S32 PAD = 2; - const S32 image_size = 30; + const S32 image_size = 18; gl_draw_scaled_image( getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD, diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 81be2c1f24..604adea125 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2382,6 +2382,27 @@ void set_favorite(const LLUUID& obj_id, bool favorite) } } +void toggle_favorite(const LLUUID& obj_id) +{ + LLInventoryObject* obj = gInventory.getObject(obj_id); + + LLSD updates; + updates["favorite"] = LLSD().with("toggled", !obj->getIsFavorite()); + + LLPointer cb = new LLUpdateFavorite(obj_id); + + LLViewerInventoryCategory* view_folder = dynamic_cast(obj); + if (view_folder) + { + update_inventory_category(obj_id, updates, cb); + } + LLViewerInventoryItem* view_item = dynamic_cast(obj); + if (view_item) + { + update_inventory_item(obj_id, updates, cb); + } +} + std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id) { if (model) diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 44f85bfb3e..fe05e30353 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -115,6 +115,7 @@ std::string get_localized_folder_name(LLUUID cat_uuid); void new_folder_window(const LLUUID& folder_id); void ungroup_folder_items(const LLUUID& folder_id); void set_favorite(const LLUUID& obj_id, bool favorite); +void toggle_favorite(const LLUUID& obj_id); std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id); std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& item_id); std::string get_searchable_UUID(LLInventoryModel* model, const LLUUID& item_id); diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 6e5d8802a4..de7ebd5ca8 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -547,6 +547,18 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men items.push_back(std::string("New Outfit")); } + if (!is_trash && !is_in_trash && gInventory.getRootFolderID() != selected_id) + { + if (obj->getIsFavorite()) + { + items.push_back(std::string("Remove from Favorites")); + } + else + { + items.push_back(std::string("Add to Favorites")); + } + } + items.push_back(std::string("Subfolder Separator")); if (!is_system_folder && !isRootFolder()) { @@ -587,6 +599,17 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men if(is_agent_inventory) { items.push_back(std::string("Cut")); + if (!is_in_trash) + { + if (obj->getIsFavorite()) + { + items.push_back(std::string("Remove from Favorites")); + } + else + { + items.push_back(std::string("Add to Favorites")); + } + } if (!is_link || !is_cof || !get_is_item_worn(selected_id)) { items.push_back(std::string("Delete")); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index efffcefc4a..da2fbebc14 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1149,6 +1149,7 @@ LLContextMenu* LLOutfitGalleryContextMenu::createMenu() registrar.add("Outfit.Delete", boost::bind(LLOutfitGallery::onRemoveOutfit, selected_id)); registrar.add("Outfit.Create", boost::bind(&LLOutfitGalleryContextMenu::onCreate, this, _2)); registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitGalleryContextMenu::onThumbnail, this, selected_id)); + registrar.add("Outfit.Favorite", boost::bind(&LLOutfitGalleryContextMenu::onFavorite, this, selected_id)); registrar.add("Outfit.Save", boost::bind(&LLOutfitGalleryContextMenu::onSave, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitGalleryContextMenu::onEnable, this, _2)); enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitGalleryContextMenu::onVisible, this, _2)); @@ -1190,7 +1191,7 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility() mMenu->setItemVisible("expand", FALSE); mMenu->setItemVisible("collapse", FALSE); mMenu->setItemVisible("thumbnail", have_selection); - mMenu->setItemVisible("sort_folders_by_name", TRUE); + mMenu->setItemVisible("sort_order_by_image", TRUE); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 1a6c5db535..c01e04f88d 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -45,6 +45,7 @@ #include "lloutfitobserver.h" #include "lltoggleablemenu.h" #include "lltransutil.h" +#include "llviewercontrol.h" #include "llviewermenu.h" #include "llvoavatar.h" #include "llvoavatarself.h" @@ -1062,6 +1063,7 @@ LLContextMenu* LLOutfitContextMenu::createMenu() registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id)); registrar.add("Outfit.Delete", boost::bind(&LLOutfitListBase::removeSelected, mOutfitList)); registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitContextMenu::onThumbnail, this, selected_id)); + registrar.add("Outfit.Favorite", boost::bind(&LLOutfitContextMenu::onFavorite, this, selected_id)); registrar.add("Outfit.Save", boost::bind(&LLOutfitContextMenu::onSave, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2)); @@ -1112,6 +1114,16 @@ bool LLOutfitContextMenu::onVisible(LLSD::String param) { return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id); } + else if ("favorites_add" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_cat_id); + return cat && !cat->getIsFavorite(); + } + else if ("favorites_remove" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_cat_id); + return cat && cat->getIsFavorite(); + } return true; } @@ -1136,6 +1148,14 @@ void LLOutfitContextMenu::onThumbnail(const LLUUID &outfit_cat_id) } } +void LLOutfitContextMenu::onFavorite(const LLUUID& outfit_cat_id) +{ + if (outfit_cat_id.notNull()) + { + toggle_favorite(outfit_cat_id); + } +} + void LLOutfitContextMenu::onSave(const LLUUID &outfit_cat_id) { if (outfit_cat_id.notNull()) @@ -1173,7 +1193,8 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist) registrar.add("Gear.Save", boost::bind(&LLOutfitListGearMenuBase::onSave, this)); registrar.add("Gear.Thumbnail", boost::bind(&LLOutfitListGearMenuBase::onThumbnail, this)); - registrar.add("Gear.SortByName", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this)); + registrar.add("Gear.Favorite", boost::bind(&LLOutfitListGearMenuBase::onFavorite, this)); + registrar.add("Gear.SortByImage", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this)); enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2)); enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2)); @@ -1296,6 +1317,10 @@ bool LLOutfitListGearMenuBase::onEnable(LLSD::String param) { return LLAppearanceMgr::instance().getCanReplaceCOF(mOutfitList->getSelectedOutfitUUID()); } + if ("sort_by_image" == param) + { + return !gSavedSettings.getBOOL("OutfitGallerySortByName"); + } return mOutfitList->isActionEnabled(param); } @@ -1307,6 +1332,16 @@ bool LLOutfitListGearMenuBase::onVisible(LLSD::String param) { return false; } + else if ("favorites_add" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id); + return cat && !cat->getIsFavorite(); + } + else if ("favorites_remove" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id); + return cat && cat->getIsFavorite(); + } return true; } @@ -1318,6 +1353,12 @@ void LLOutfitListGearMenuBase::onThumbnail() LLFloaterReg::showInstance("change_item_thumbnail", data); } +void LLOutfitListGearMenuBase::onFavorite() +{ + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + toggle_favorite(selected_outfit_id); +} + void LLOutfitListGearMenuBase::onChangeSortOrder() { @@ -1336,7 +1377,8 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility() mMenu->setItemVisible("expand", TRUE); mMenu->setItemVisible("collapse", TRUE); mMenu->setItemVisible("thumbnail", getSelectedOutfitID().notNull()); - mMenu->setItemVisible("sort_folders_by_name", FALSE); + mMenu->setItemVisible("favorite", getSelectedOutfitID().notNull()); + mMenu->setItemVisible("sort_order_by_image", FALSE); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 89821f9333..86702cedfb 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -161,6 +161,7 @@ protected: static void renameOutfit(const LLUUID& outfit_cat_id); void onThumbnail(const LLUUID &outfit_cat_id); + void onFavorite(const LLUUID& outfit_cat_id); void onSave(const LLUUID &outfit_cat_id); private: @@ -180,6 +181,7 @@ public: protected: virtual void onUpdateItemsVisibility(); virtual void onThumbnail(); + virtual void onFavorite(); virtual void onChangeSortOrder(); const LLUUID& getSelectedOutfitID(); diff --git a/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Content.png b/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Content.png index bf7ec1599ad0b9a5305033910d8079396f98ac1f..b71b2022348e0b0f08dd2b1fe7b5a9a5f99af0ce 100644 GIT binary patch literal 620 zcmV-y0+aoTP)J)2Vx0`Z6zPx>;n%9$>i*`1?74w?^Z);6elzo%c@zu=NtR_Y8jU21qM}ZxQ!158 zUtBJiq*kj*qtTGrY^GEyMWIlL*6THi{9(t=&W-}&dn^{)^>{qD*$RR{DwRs{a~%6w zME;zgpOf8gCx^qKIFiZaL$--TLa|$0TV%7@Xti3=M%0VNf|koAZ32*W+wb?wNLKgx ze6ri^-Uf}I^Z8uqh~pJtHk&P5ES9Ut2J9L!#v6LQ{x8mX*iVH*;czmU`~YYQ6-J}c zZ{P}QWYU53Bd!R2kH^ojFJPO{eMyq;!`i_$$9#{Ek6&{|fv1+qWcDGi3y75~`48aq4dC4k3ZTP&zkjPzsXS=6 z+fAKLN8|CBM6Sp?>~uQK;c(bR;F9B^H+kx~F9w4_uhnWbwOZ}vI{3h2#@?iGI4tA* z6~P}di0^Fq9*IO!;ObQXqWBMp-f23WQXmkxizy0lJnQv(?sB>OxZCYs$Nf3l6Qa@R zJqB@A1&DzVc#7$CI>(Miqfspui+3=+H?YZiy{8_tGQaO zKCRViFZmb4ZVBD|LFF8VbArTsyyVlPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0dGk}K~y+Tt&%@1 z1VI$W_b&ciLP9GlnoA@q4M9aB!8N)owz!6nC^Zx!q0%E7#U@G}iR4rwD6W!RqR~>4 zXi)I`#=A9lnbq(mzkKuNy?rw~Gtqx2XC73NB)!-;T*Yzx>?Q-sn`fyHmdrDi*@Rtm zU=#2pw>YTZcG3^?P%&2=RE`yNE)9Im!VwhV9@Oj%e0>^W(fk<7HZCi6iGZ{d9oi^t z!Vt8Bw9k#K*jSDBu;uS4`hYrY!A+jRM+P-G2OZ)J6#NE~#RX7ab*iuF`}7=GNjsQ> zH5h>&3f^!h@}1ZVXu(}LC9fU*+>T9DVF&JD73I~b57 z#V&7kshX~p5A>j>;1I@O614ILT*5Uh!Uc`qai`YD)&{!Pb-0BRY?~|Ayz;6`)!L*B z2H^l!L96P0=w=jaUU}7}@^44KqJjm`0oVP1C$BTnJDP?Q(AlKF^hZU}7odM{-7YPB QBLDyZ07*qoM6N<$f(V(%PXGV_ diff --git a/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Full.png b/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Full.png index 916b57f3c5b1cfbb34222da45eafcb5d6e2a56a1..7d55fb5cfe8e5fa6bc6505bcc74e2663c3b83680 100644 GIT binary patch literal 485 zcmV~um z3d3*(ouVk}dcA(LZTniZIvS1cgCJOO)eM_5e@tRFz`#KREkIF`2`Uzg`F_9uST2`u z{~1M9*L9zV!{OaxvH0Q+_QqT;N4y*HFtqV_{LZU&ykE5LdERHQ*Sp~Ln=8|Dx!g|` zB<`tNt={ku^5ULkSp;%m;Gj7UO&ERO$F9_DHXXif8HV|M{)9jd3>-Ajo?eb=nq*m) z&M)O-Hk-8%pUmeG>(NZ>>6@eTWIB1}SM>_YB b{|YbwnQO=}4i2+300000NkvXXu0mjfA{x~2 literal 582 zcmV-M0=fN(P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0ozGLK~y+Ttx`=( z0#Ov54?h}^U?AvY(JrDkZCVul0HFv%1w~v1K`q(^{eU2d+O^148$}Q`S_Lk07rAKJ zrfm?l2nI@=Mjh>(ndi`?uIj+!dhfaC`0jlp{RdKD2lSg$XrkZ7-<6G0#4L4%`PKzK@C8z)oKbF72CFd z?`PMttP@?=HN!B>a5#L3TGpjpsH)o2G_5;wv6V{YJ`@VAKrF#b!fxvEczjjRKFH;A zc^=ze$4w5fz$xs&88H|PN-*JaCGa%ih>oZWp!SBFoPobl5{bkU3~q7iX!@iF#f+U! z$2&jk>|;N5)O+I;i^Vax?m@7RI2(yXR6%)YG#WN;@EiyP&Jiz?$>bO7-s^}$4p%%y ze8Imsqx27R)&-yI8xX!HPNh=s2#+`x#`eUF%vmQd`aJkdN~My9nHM3NWX@$an@xj} zV4XbsoPvPQ1p5d>kipF35Px8Sb%?Tz%vmSTJ|S`7GXZp5e+J)08?zt5U=s^G#_t$& z*2%NaZFk|lPN7iH(6Efzw;{fU_%4&lc(dp8`3a1(27U|tB}^aE>9i^6ze19}0g(VC U&ZlaTQ2+n{07*qoM6N<$g7d%m#Q*>R 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 929c626947..11c9988dd6 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -125,6 +125,22 @@ function="Inventory.DoToSelected" parameter="thumbnail" /> + + + + + + + + + + + + + + + + + + + + + + + name="sort_order_by_image"> + function="Gear.SortByImage" /> + function="Gear.OnEnable" + parameter="sort_by_image" /> + + + + + +