viewer#1424 Favorite support in galleries
parent
1eeecfa1a8
commit
50b93bd83a
|
|
@ -784,8 +784,8 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI
|
|||
|
||||
if (favorite_image)
|
||||
{
|
||||
const S32 PAD = 2;
|
||||
const S32 image_size = 18;
|
||||
const S32 PAD = 3;
|
||||
const S32 image_size = 14;
|
||||
|
||||
gl_draw_scaled_image(
|
||||
getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD,
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ void LLInventoryGallery::removeFromLastRow(LLInventoryGalleryItem* item)
|
|||
mItemPanels.pop_back();
|
||||
}
|
||||
|
||||
LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn)
|
||||
LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn, bool is_favorite)
|
||||
{
|
||||
LLInventoryGalleryItem::Params giparams;
|
||||
giparams.visible = true;
|
||||
|
|
@ -646,6 +646,7 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L
|
|||
gitem->setUUID(item_id);
|
||||
gitem->setGallery(this);
|
||||
gitem->setType(type, inventory_type, flags, is_link);
|
||||
gitem->setFavorite(is_favorite);
|
||||
gitem->setLoadImmediately(mLoadThumbnailsImmediately);
|
||||
gitem->setThumbnail(thumbnail_id);
|
||||
gitem->setWorn(is_worn);
|
||||
|
|
@ -929,7 +930,17 @@ bool LLInventoryGallery::updateAddedItem(LLUUID item_id)
|
|||
|
||||
bool res = false;
|
||||
|
||||
LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, inventory_type, misc_flags, obj->getCreationDate(), obj->getIsLinkType(), is_worn);
|
||||
LLInventoryGalleryItem* item = buildGalleryItem(
|
||||
name,
|
||||
item_id,
|
||||
obj->getType(),
|
||||
thumbnail_id,
|
||||
inventory_type,
|
||||
misc_flags,
|
||||
obj->getCreationDate(),
|
||||
obj->getIsLinkType(),
|
||||
is_worn,
|
||||
obj->getIsFavorite());
|
||||
mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item));
|
||||
if (mGalleryCreated)
|
||||
{
|
||||
|
|
@ -966,7 +977,7 @@ void LLInventoryGallery::updateRemovedItem(LLUUID item_id)
|
|||
mItemBuildQuery.erase(item_id);
|
||||
}
|
||||
|
||||
void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name)
|
||||
void LLInventoryGallery::updateChangedItemData(LLUUID item_id, std::string name, bool is_favorite)
|
||||
{
|
||||
gallery_item_map_t::iterator iter = mItemMap.find(item_id);
|
||||
if (iter != mItemMap.end())
|
||||
|
|
@ -975,6 +986,7 @@ void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name)
|
|||
if (item)
|
||||
{
|
||||
item->setItemName(name);
|
||||
item->setFavorite(is_favorite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2142,7 +2154,7 @@ void LLInventoryGallery::refreshList(const LLUUID& category_id)
|
|||
return;
|
||||
}
|
||||
|
||||
updateChangedItemName(*items_iter, obj->getName());
|
||||
updateChangedItemData(*items_iter, obj->getName(), obj->getIsFavorite());
|
||||
mNeedsArrange = true;
|
||||
}
|
||||
|
||||
|
|
@ -2656,6 +2668,14 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E
|
|||
getChild<LLIconCtrl>("link_overlay")->setVisible(is_link);
|
||||
}
|
||||
|
||||
void LLInventoryGalleryItem::setFavorite(bool is_favorite)
|
||||
{
|
||||
getChild<LLIconCtrl>("fav_icon")->setVisible(is_favorite);
|
||||
static const LLUIColor text_color = LLUIColorTable::instance().getColor("LabelTextColor", LLColor4::white);
|
||||
static const LLUIColor favorite_color = LLUIColorTable::instance().getColor("InventoryFavoriteColor", LLColor4::white);
|
||||
mNameText->setReadOnlyColor(is_favorite ? favorite_color : text_color);
|
||||
}
|
||||
|
||||
void LLInventoryGalleryItem::setThumbnail(LLUUID id)
|
||||
{
|
||||
mDefaultImage = id.isNull();
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public:
|
|||
void getCurrentCategories(uuid_vec_t& vcur);
|
||||
bool updateAddedItem(LLUUID item_id); // returns true if added item is visible
|
||||
void updateRemovedItem(LLUUID item_id);
|
||||
void updateChangedItemName(LLUUID item_id, std::string name);
|
||||
void updateChangedItemData(LLUUID item_id, std::string name, bool is_favorite);
|
||||
void updateItemThumbnail(LLUUID item_id);
|
||||
void updateWornItem(LLUUID item_id, bool is_worn);
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ private:
|
|||
bool updateRowsIfNeeded();
|
||||
void updateGalleryWidth();
|
||||
|
||||
LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn);
|
||||
LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn, bool is_favorite);
|
||||
|
||||
void buildGalleryPanel(int row_count);
|
||||
void reshapeGalleryPanel(int row_count);
|
||||
|
|
@ -341,6 +341,7 @@ public:
|
|||
void setHidden(bool hidden) {mHidden = hidden;}
|
||||
|
||||
void setType(LLAssetType::EType type, LLInventoryType::EType inventory_type, U32 flags, bool is_link);
|
||||
void setFavorite(bool is_favorite);
|
||||
LLAssetType::EType getAssetType() { return mType; }
|
||||
void setThumbnail(LLUUID id);
|
||||
void setGallery(LLInventoryGallery* gallery) { mGallery = gallery; }
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ void LLOutfitGallery::removeFromLastRow(LLOutfitGalleryItem* item)
|
|||
mItemPanels.pop_back();
|
||||
}
|
||||
|
||||
LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID outfit_id)
|
||||
LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID outfit_id, bool is_favorite)
|
||||
{
|
||||
LLOutfitGalleryItem::Params giparams;
|
||||
LLOutfitGalleryItem* gitem = LLUICtrlFactory::create<LLOutfitGalleryItem>(giparams);
|
||||
|
|
@ -626,6 +626,7 @@ LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID
|
|||
gitem->setFollowsLeft();
|
||||
gitem->setFollowsTop();
|
||||
gitem->setOutfitName(name);
|
||||
gitem->setOutfitFavorite(is_favorite);
|
||||
gitem->setUUID(outfit_id);
|
||||
gitem->setGallery(this);
|
||||
return gitem;
|
||||
|
|
@ -770,8 +771,7 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id)
|
|||
LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
|
||||
if (!cat) return;
|
||||
|
||||
std::string name = cat->getName();
|
||||
LLOutfitGalleryItem* item = buildGalleryItem(name, cat_id);
|
||||
LLOutfitGalleryItem* item = buildGalleryItem(cat->getName(), cat_id, cat->getIsFavorite());
|
||||
mOutfitMap.insert(LLOutfitGallery::outfit_map_value_t(cat_id, item));
|
||||
item->setRightMouseDownCallback(boost::bind(&LLOutfitListBase::outfitRightClickCallBack, this,
|
||||
_1, _2, _3, cat_id));
|
||||
|
|
@ -840,6 +840,7 @@ void LLOutfitGallery::updateChangedCategoryName(LLViewerInventoryCategory *cat,
|
|||
if (item)
|
||||
{
|
||||
item->setOutfitName(name);
|
||||
item->setOutfitFavorite(cat->getIsFavorite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -916,6 +917,10 @@ LLOutfitListGearMenuBase* LLOutfitGallery::createGearMenu()
|
|||
|
||||
static LLDefaultChildRegistry::Register<LLOutfitGalleryItem> r("outfit_gallery_item");
|
||||
|
||||
bool LLOutfitGalleryItem::sColorSetInitialized = false;
|
||||
LLUIColor LLOutfitGalleryItem::sDefaultTextColor;
|
||||
LLUIColor LLOutfitGalleryItem::sDefaultFavoriteColor;
|
||||
|
||||
LLOutfitGalleryItem::LLOutfitGalleryItem(const Params& p)
|
||||
: LLPanel(p),
|
||||
mGallery(nullptr),
|
||||
|
|
@ -927,6 +932,12 @@ LLOutfitGalleryItem::LLOutfitGalleryItem(const Params& p)
|
|||
mUUID(LLUUID())
|
||||
{
|
||||
buildFromFile("panel_outfit_gallery_item.xml");
|
||||
if (!sColorSetInitialized)
|
||||
{
|
||||
sDefaultTextColor = LLUIColorTable::instance().getColor("White", LLColor4::white);
|
||||
sDefaultFavoriteColor = LLUIColorTable::instance().getColor("InventoryFavoriteColor", LLColor4::white);
|
||||
sColorSetInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
LLOutfitGalleryItem::~LLOutfitGalleryItem()
|
||||
|
|
@ -980,6 +991,17 @@ void LLOutfitGalleryItem::draw()
|
|||
}
|
||||
}
|
||||
|
||||
if(mFavorite)
|
||||
{
|
||||
const S32 HPAD = 3;
|
||||
const S32 VPAD = 6; // includes padding for text and for the image
|
||||
const S32 image_size = 14;
|
||||
static LLPointer<LLUIImage> fav_img = LLRender2D::getInstance()->getUIImage("Inv_Favorite_Star_Full");
|
||||
|
||||
gl_draw_scaled_image(
|
||||
border.getWidth() - image_size - HPAD, image_size + VPAD + mOutfitNameText->getRect().getHeight(),
|
||||
image_size, image_size, fav_img->getImage(), UI_VERTEX_COLOR % alpha);
|
||||
}
|
||||
}
|
||||
|
||||
void LLOutfitGalleryItem::setOutfitName(std::string name)
|
||||
|
|
@ -989,14 +1011,19 @@ void LLOutfitGalleryItem::setOutfitName(std::string name)
|
|||
mOutfitName = name;
|
||||
}
|
||||
|
||||
void LLOutfitGalleryItem::setOutfitFavorite(bool is_favorite)
|
||||
{
|
||||
mFavorite = is_favorite;
|
||||
mOutfitNameText->setReadOnlyColor(mFavorite ? sDefaultFavoriteColor.get() : sDefaultTextColor.get());
|
||||
}
|
||||
|
||||
void LLOutfitGalleryItem::setOutfitWorn(bool value)
|
||||
{
|
||||
mWorn = value;
|
||||
LLStringUtil::format_map_t worn_string_args;
|
||||
std::string worn_string = getString("worn_string", worn_string_args);
|
||||
LLUIColor text_color = LLUIColorTable::instance().getColor("White", LLColor4::white);
|
||||
mOutfitWornText->setReadOnlyColor(text_color.get());
|
||||
mOutfitNameText->setReadOnlyColor(text_color.get());
|
||||
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 : "");
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ private:
|
|||
void updateRowsIfNeeded();
|
||||
void updateGalleryWidth();
|
||||
|
||||
LLOutfitGalleryItem* buildGalleryItem(std::string name, LLUUID outfit_id);
|
||||
LLOutfitGalleryItem* buildGalleryItem(std::string name, LLUUID outfit_id, bool is_favorite);
|
||||
LLOutfitGalleryItem* getSelectedItem();
|
||||
|
||||
void onTextureSelectionChanged(LLInventoryItem* itemp);
|
||||
|
|
@ -244,6 +244,7 @@ public:
|
|||
bool setImageAssetId(LLUUID asset_id);
|
||||
LLUUID getImageAssetId();
|
||||
void setOutfitName(std::string name);
|
||||
void setOutfitFavorite(bool is_favorite);
|
||||
void setOutfitWorn(bool value);
|
||||
void setSelected(bool value);
|
||||
void setUUID(const LLUUID &outfit_id) {mUUID = outfit_id;}
|
||||
|
|
@ -267,8 +268,13 @@ private:
|
|||
bool mWorn;
|
||||
bool mDefaultImage;
|
||||
bool mImageUpdatePending;
|
||||
bool mHidden;
|
||||
bool mHidden;
|
||||
bool mFavorite;
|
||||
std::string mOutfitName;
|
||||
|
||||
static bool sColorSetInitialized;
|
||||
static LLUIColor sDefaultTextColor;
|
||||
static LLUIColor sDefaultFavoriteColor;
|
||||
};
|
||||
|
||||
#endif // LL_LLOUTFITGALLERYCTRL_H
|
||||
|
|
|
|||
|
|
@ -43,6 +43,16 @@
|
|||
follows="left|top"
|
||||
visible="false"
|
||||
image_name="Inv_Link"/>
|
||||
<icon
|
||||
layout="topleft"
|
||||
follows="left|top"
|
||||
name="fav_icon"
|
||||
left="110"
|
||||
top_pad="-14"
|
||||
height="14"
|
||||
width="14"
|
||||
visible="true"
|
||||
image_name="Inv_Favorite_Star_Full"/>
|
||||
<panel
|
||||
background_visible="false"
|
||||
background_opaque="true"
|
||||
|
|
|
|||
Loading…
Reference in New Issue