summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitgallery.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-16 17:58:39 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-16 18:00:14 +0300
commit382b45cf227d5ec2063b39e50c4d68d4a5c4dd67 (patch)
tree779f711d9b19b85c16a5d057622e5b48074896a0 /indra/newview/lloutfitgallery.cpp
parent98f7d73d46fdc045759023eda6409e8c791f5cb2 (diff)
viewer#1424 Favorite support in galleries #2
Diffstat (limited to 'indra/newview/lloutfitgallery.cpp')
-rw-r--r--indra/newview/lloutfitgallery.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 54a468d029..c428a4ea92 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -85,6 +85,12 @@ LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
mSortMenu(nullptr)
{
updateGalleryWidth();
+
+ LLControlVariable* ctrl = gSavedSettings.getControl("InventoryFavoritesColorText");
+ if (ctrl)
+ {
+ mSavedSettingInvFavColor = ctrl->getSignal()->connect(boost::bind(&LLOutfitGallery::handleInvFavColorChange, this));
+ }
}
LLOutfitGallery::Params::Params()
@@ -481,6 +487,20 @@ void LLOutfitGallery::updateGalleryWidth()
mGalleryWidth = mGalleryWidthFactor * mItemsInRow - mItemHorizontalGap;
}
+void LLOutfitGallery::handleInvFavColorChange()
+{
+ for (outfit_map_t::iterator iter = mOutfitMap.begin();
+ iter != mOutfitMap.end();
+ ++iter)
+ {
+ if (!iter->second) continue;
+ LLOutfitGalleryItem* item = (LLOutfitGalleryItem*)iter->second;
+
+ // refresh font color
+ item->setOutfitFavorite(item->isFavorite());
+ }
+}
+
LLPanel* LLOutfitGallery::addLastRow()
{
mRowCount++;
@@ -1001,8 +1021,9 @@ void LLOutfitGalleryItem::draw()
mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight()));
}
}
-
- if(mFavorite)
+
+ static LLUICachedControl<bool> draw_star("InventoryFavoritesUseStar", true);
+ if(mFavorite && draw_star())
{
const S32 HPAD = 3;
const S32 VPAD = 6; // includes padding for text and for the image
@@ -1025,7 +1046,9 @@ void LLOutfitGalleryItem::setOutfitName(std::string name)
void LLOutfitGalleryItem::setOutfitFavorite(bool is_favorite)
{
mFavorite = is_favorite;
- mOutfitNameText->setReadOnlyColor(mFavorite ? sDefaultFavoriteColor.get() : sDefaultTextColor.get());
+
+ LLCachedControl<bool> use_color(gSavedSettings, "InventoryFavoritesColorText");
+ mOutfitNameText->setReadOnlyColor((mFavorite && use_color()) ? sDefaultFavoriteColor.get() : sDefaultTextColor.get());
}
void LLOutfitGalleryItem::setOutfitWorn(bool value)
@@ -1034,11 +1057,13 @@ void LLOutfitGalleryItem::setOutfitWorn(bool value)
LLStringUtil::format_map_t worn_string_args;
std::string worn_string = getString("worn_string", worn_string_args);
mOutfitWornText->setReadOnlyColor(sDefaultTextColor.get());
- mOutfitNameText->setReadOnlyColor(mFavorite ? sDefaultFavoriteColor.get() : sDefaultTextColor.get());
mOutfitWornText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall());
mOutfitNameText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall());
mOutfitWornText->setValue(value ? worn_string : "");
mOutfitNameText->setText(mOutfitName); // refresh LLTextViewModel to pick up font changes
+
+ LLCachedControl<bool> use_color(gSavedSettings, "InventoryFavoritesColorText");
+ mOutfitNameText->setReadOnlyColor((mFavorite && use_color()) ? sDefaultFavoriteColor.get() : sDefaultTextColor.get());
}
void LLOutfitGalleryItem::setSelected(bool value)