MAINT-6444 Outfits filter doesn't work in Outfit gallery
parent
5b49f5c56e
commit
2b9927863f
|
|
@ -152,6 +152,11 @@ void LLOutfitGallery::reArrangeRows(S32 row_diff)
|
|||
{
|
||||
removeFromGalleryLast(*it);
|
||||
}
|
||||
for (std::vector<LLOutfitGalleryItem*>::const_reverse_iterator it = mHiddenItems.rbegin(); it != mHiddenItems.rend(); ++it)
|
||||
{
|
||||
buf_items.push_back(*it);
|
||||
}
|
||||
mHiddenItems.clear();
|
||||
|
||||
mItemsInRow+= row_diff;
|
||||
updateGalleryWidth();
|
||||
|
|
@ -159,7 +164,9 @@ void LLOutfitGallery::reArrangeRows(S32 row_diff)
|
|||
|
||||
for (std::vector<LLOutfitGalleryItem*>::const_iterator it = buf_items.begin(); it != buf_items.end(); ++it)
|
||||
{
|
||||
addToGallery(*it);
|
||||
(*it)->setHidden(false);
|
||||
applyFilter(*it,sFilterSubString);
|
||||
addToGallery(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,6 +221,11 @@ LLPanel* LLOutfitGallery::addToRow(LLPanel* row_stack, LLOutfitGalleryItem* item
|
|||
|
||||
void LLOutfitGallery::addToGallery(LLOutfitGalleryItem* item)
|
||||
{
|
||||
if(item->isHidden())
|
||||
{
|
||||
mHiddenItems.push_back(item);
|
||||
return;
|
||||
}
|
||||
mItemsAddedCount++;
|
||||
mItemIndexMap[item] = mItemsAddedCount - 1;
|
||||
int n = mItemsAddedCount;
|
||||
|
|
@ -241,6 +253,11 @@ void LLOutfitGallery::addToGallery(LLOutfitGalleryItem* item)
|
|||
|
||||
void LLOutfitGallery::removeFromGalleryLast(LLOutfitGalleryItem* item)
|
||||
{
|
||||
if(item->isHidden())
|
||||
{
|
||||
mHiddenItems.pop_back();
|
||||
return;
|
||||
}
|
||||
int n_prev = mItemsAddedCount;
|
||||
int n = mItemsAddedCount - 1;
|
||||
int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1;
|
||||
|
|
@ -264,6 +281,11 @@ void LLOutfitGallery::removeFromGalleryLast(LLOutfitGalleryItem* item)
|
|||
|
||||
void LLOutfitGallery::removeFromGalleryMiddle(LLOutfitGalleryItem* item)
|
||||
{
|
||||
if(item->isHidden())
|
||||
{
|
||||
mHiddenItems.erase(std::remove(mHiddenItems.begin(), mHiddenItems.end(), item), mHiddenItems.end());
|
||||
return;
|
||||
}
|
||||
int n = mItemIndexMap[item];
|
||||
mItemIndexMap.erase(item);
|
||||
std::vector<LLOutfitGalleryItem*> saved;
|
||||
|
|
@ -371,9 +393,8 @@ LLOutfitGallery::~LLOutfitGallery()
|
|||
|
||||
void LLOutfitGallery::setFilterSubString(const std::string& string)
|
||||
{
|
||||
//TODO: Implement filtering
|
||||
|
||||
sFilterSubString = string;
|
||||
reArrangeRows();
|
||||
}
|
||||
|
||||
void LLOutfitGallery::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
|
||||
|
|
@ -388,6 +409,20 @@ void LLOutfitGallery::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
|
|||
}
|
||||
}
|
||||
|
||||
void LLOutfitGallery::applyFilter(LLOutfitGalleryItem* item, const std::string& filter_substring)
|
||||
{
|
||||
if (!item) return;
|
||||
|
||||
std::string outfit_name = item->getItemName();
|
||||
LLStringUtil::toUpper(outfit_name);
|
||||
|
||||
std::string cur_filter = filter_substring;
|
||||
LLStringUtil::toUpper(cur_filter);
|
||||
|
||||
bool hidden = (std::string::npos == outfit_name.find(cur_filter));
|
||||
item->setHidden(hidden);
|
||||
}
|
||||
|
||||
void LLOutfitGallery::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid)
|
||||
{
|
||||
}
|
||||
|
|
@ -555,6 +590,7 @@ BOOL LLOutfitGalleryItem::postBuild()
|
|||
mFotoBgPanel = getChild<LLPanel>("foto_bg_panel");
|
||||
mTextBgPanel = getChild<LLPanel>("text_bg_panel");
|
||||
setOutfitWorn(false);
|
||||
mHidden = false;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ protected:
|
|||
/*virtual*/ void onExpandAllFolders() {}
|
||||
/*virtual*/ LLOutfitListGearMenuBase* createGearMenu();
|
||||
|
||||
void applyFilter(LLOutfitGalleryItem* item, const std::string& filter_substring);
|
||||
|
||||
private:
|
||||
void loadPhotos();
|
||||
void uploadPhoto(LLUUID outfit_id);
|
||||
|
|
@ -153,6 +155,7 @@ private:
|
|||
std::vector<LLPanel*> mRowPanels;
|
||||
std::vector<LLPanel*> mItemPanels;
|
||||
std::vector<LLOutfitGalleryItem*> mItems;
|
||||
std::vector<LLOutfitGalleryItem*> mHiddenItems;
|
||||
LLScrollContainer* mScrollPanel;
|
||||
LLPanel* mGalleryPanel;
|
||||
LLPanel* mLastRowPanel;
|
||||
|
|
@ -250,6 +253,9 @@ public:
|
|||
std::string getItemName() {return mOutfitName;}
|
||||
bool mIsDefaultImage() {return mDefaultImage;}
|
||||
|
||||
bool isHidden() {return mHidden;}
|
||||
void setHidden(bool hidden) {mHidden = hidden;}
|
||||
|
||||
struct compareGalleryItem
|
||||
{
|
||||
bool operator()(LLOutfitGalleryItem* a, LLOutfitGalleryItem* b)
|
||||
|
|
@ -275,6 +281,7 @@ private:
|
|||
bool mSelected;
|
||||
bool mWorn;
|
||||
bool mDefaultImage;
|
||||
bool mHidden;
|
||||
std::string mOutfitName;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue