viewer#1424 Favorites in Appearance floater #1

master
Andrey Kleshchev 2024-05-09 00:40:30 +03:00
parent 1c170381ae
commit 5c78396b64
13 changed files with 169 additions and 9 deletions

View File

@ -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,

View File

@ -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<LLInventoryCallback> cb = new LLUpdateFavorite(obj_id);
LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(obj);
if (view_folder)
{
update_inventory_category(obj_id, updates, cb);
}
LLViewerInventoryItem* view_item = dynamic_cast<LLViewerInventoryItem*>(obj);
if (view_item)
{
update_inventory_item(obj_id, updates, cb);
}
}
std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id)
{
if (model)

View File

@ -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);

View File

@ -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"));

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 485 B

View File

@ -125,6 +125,22 @@
function="Inventory.DoToSelected"
parameter="thumbnail" />
</menu_item_call>
<menu_item_call
label="Add to favorites"
layout="topleft"
name="favorites_add">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="favorite" />
</menu_item_call>
<menu_item_call
label="Remove from favorites"
layout="topleft"
name="favorites_remove">
<menu_item_call.on_click
function="Inventory.DoToSelected"
parameter="favorite" />
</menu_item_call>
<menu_item_call
label="Copy Asset UUID"
layout="topleft"

View File

@ -49,6 +49,26 @@
<on_click
function="Outfit.Thumbnail" />
</menu_item_call>
<menu_item_call
label="Add to favorites"
layout="topleft"
name="favorites_add">
<on_visible
function="Outfit.OnVisible"
parameter="favorites_add" />
<on_click
function="Outfit.Favorite" />
</menu_item_call>
<menu_item_call
label="Remove from favorites"
layout="topleft"
name="favorites_remove">
<on_visible
function="Outfit.OnVisible"
parameter="favorites_remove" />
<on_click
function="Outfit.Favorite" />
</menu_item_call>
<menu_item_call
label="Edit outfit"
layout="topleft"

View File

@ -49,6 +49,26 @@
<on_click
function="Gear.Thumbnail" />
</menu_item_call>
<menu_item_call
label="Add to favorite outfits"
layout="topleft"
name="favorites_add">
<on_visible
function="Gear.OnVisible"
parameter="favorites_add" />
<on_click
function="Gear.Favorite" />
</menu_item_call>
<menu_item_call
label="Remove from favorite outfits"
layout="topleft"
name="favorites_remove">
<on_visible
function="Gear.OnVisible"
parameter="favorites_remove" />
<on_click
function="Gear.Favorite" />
</menu_item_call>
<menu_item_call
label="Rename outfit"
layout="topleft"
@ -94,14 +114,14 @@
function="Gear.OnVisible"/>
</menu_item_separator>
<menu_item_check
label="Sort folders always by name"
label="Show outfits with images first"
layout="topleft"
name="sort_folders_by_name">
name="sort_order_by_image">
<on_click
function="Gear.SortByName" />
function="Gear.SortByImage" />
<on_check
function="CheckControl"
parameter="OutfitGallerySortByName" />
function="Gear.OnEnable"
parameter="sort_by_image" />
</menu_item_check>
<menu_item_call
label="Expand all folders"

View File

@ -49,6 +49,20 @@
<on_click
function="Outfit.Thumbnail" />
</menu_item_call>
<menu_item_call
label="Add to favorites"
layout="topleft"
name="favorites_add">
<on_click
function="Outfit.Favorite" />
</menu_item_call>
<menu_item_call
label="Remove from favorites"
layout="topleft"
name="favorites_remove">
<on_click
function="Outfit.Favorite" />
</menu_item_call>
<menu_item_call
label="Edit outfit"
layout="topleft"