EXT-7503 WIP Made first inventory fetch in My Outfits panel only on first panel opening.
* LLOutfitsList is not Inventory Observer anymore * Content is fetched in onOpen now * Added call of the LLOutfitsList::onOpen when "My Outfits" tab is switched on in My Appearance panel Reviewed by Brad Payne at https://codereview.productengine.com/secondlife/r/456/ --HG-- branch : product-enginemeow-7.2.2
parent
f09e53da5f
commit
86c230e490
|
|
@ -84,11 +84,9 @@ LLOutfitsList::LLOutfitsList()
|
|||
: LLPanel()
|
||||
, mAccordion(NULL)
|
||||
, mListCommands(NULL)
|
||||
, mIsInitialized(false)
|
||||
{
|
||||
mCategoriesObserver = new LLInventoryCategoriesObserver();
|
||||
gInventory.addObserver(mCategoriesObserver);
|
||||
|
||||
gInventory.addObserver(this);
|
||||
|
||||
mOutfitMenu = new OutfitContextMenu();
|
||||
}
|
||||
|
|
@ -102,11 +100,6 @@ LLOutfitsList::~LLOutfitsList()
|
|||
gInventory.removeObserver(mCategoriesObserver);
|
||||
delete mCategoriesObserver;
|
||||
}
|
||||
|
||||
if (gInventory.containsObserver(this))
|
||||
{
|
||||
gInventory.removeObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLOutfitsList::postBuild()
|
||||
|
|
@ -117,32 +110,36 @@ BOOL LLOutfitsList::postBuild()
|
|||
}
|
||||
|
||||
//virtual
|
||||
void LLOutfitsList::changed(U32 mask)
|
||||
void LLOutfitsList::onOpen(const LLSD& /*info*/)
|
||||
{
|
||||
if (!gInventory.isInventoryUsable())
|
||||
return;
|
||||
if (!mIsInitialized)
|
||||
{
|
||||
// *TODO: I'm not sure is this check necessary but it never match while developing.
|
||||
if (!gInventory.isInventoryUsable())
|
||||
return;
|
||||
|
||||
const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
|
||||
LLViewerInventoryCategory* category = gInventory.getCategory(outfits);
|
||||
if (!category)
|
||||
return;
|
||||
const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
|
||||
|
||||
// Start observing changes in "My Outfits" category.
|
||||
mCategoriesObserver->addCategory(outfits,
|
||||
// *TODO: I'm not sure is this check necessary but it never match while developing.
|
||||
LLViewerInventoryCategory* category = gInventory.getCategory(outfits);
|
||||
if (!category)
|
||||
return;
|
||||
|
||||
gInventory.addObserver(mCategoriesObserver);
|
||||
|
||||
// Start observing changes in "My Outfits" category.
|
||||
mCategoriesObserver->addCategory(outfits,
|
||||
boost::bind(&LLOutfitsList::refreshList, this, outfits));
|
||||
|
||||
// Fetch "My Outfits" contents and refresh the list to display
|
||||
// initially fetched items. If not all items are fetched now
|
||||
// the observer will refresh the list as soon as the new items
|
||||
// arrive.
|
||||
category->fetch();
|
||||
refreshList(outfits);
|
||||
// Fetch "My Outfits" contents and refresh the list to display
|
||||
// initially fetched items. If not all items are fetched now
|
||||
// the observer will refresh the list as soon as the new items
|
||||
// arrive.
|
||||
category->fetch();
|
||||
refreshList(outfits);
|
||||
|
||||
// This observer is used to start the initial outfits fetch
|
||||
// when inventory becomes usable. It is no longer needed because
|
||||
// "My Outfits" category is now observed by
|
||||
// LLInventoryCategoriesObserver.
|
||||
gInventory.removeObserver(this);
|
||||
mIsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LLOutfitsList::refreshList(const LLUUID& category_id)
|
||||
|
|
|
|||
|
|
@ -49,12 +49,10 @@ class LLListContextMenu;
|
|||
* A list of agents's outfits from "My Outfits" inventory category
|
||||
* which displays each outfit in an accordion tab with a flat list
|
||||
* of items inside it.
|
||||
* Uses LLInventoryCategoriesObserver to monitor changes to "My Outfits"
|
||||
* inventory category and refresh the outfits listed in it.
|
||||
* This class is derived from LLInventoryObserver to know when inventory
|
||||
* becomes usable and it is safe to request data from inventory model.
|
||||
*
|
||||
* Starts fetching nevessary inventory content on first openning.
|
||||
*/
|
||||
class LLOutfitsList : public LLPanel, public LLInventoryObserver
|
||||
class LLOutfitsList : public LLPanel
|
||||
{
|
||||
public:
|
||||
LLOutfitsList();
|
||||
|
|
@ -62,7 +60,7 @@ public:
|
|||
|
||||
/*virtual*/ BOOL postBuild();
|
||||
|
||||
/*virtual*/ void changed(U32 mask);
|
||||
/*virtual*/ void onOpen(const LLSD& info);
|
||||
|
||||
void refreshList(const LLUUID& category_id);
|
||||
|
||||
|
|
@ -128,6 +126,8 @@ private:
|
|||
outfits_map_t mOutfitsMap;
|
||||
|
||||
LLListContextMenu* mOutfitMenu;
|
||||
|
||||
bool mIsInitialized;
|
||||
};
|
||||
|
||||
#endif //LL_LLOUTFITSLIST_H
|
||||
|
|
|
|||
|
|
@ -632,6 +632,7 @@ void LLPanelOutfitsInventory::onTabChange()
|
|||
else
|
||||
{
|
||||
mMyOutfitsPanel->setFilterSubString(mFilterSubString);
|
||||
mMyOutfitsPanel->onOpen(LLSD());
|
||||
}
|
||||
|
||||
updateVerbs();
|
||||
|
|
|
|||
Loading…
Reference in New Issue