diff options
| author | Mike Antipov <mantipov@productengine.com> | 2010-06-03 11:26:38 +0300 | 
|---|---|---|
| committer | Mike Antipov <mantipov@productengine.com> | 2010-06-03 11:26:38 +0300 | 
| commit | 86c230e4902ec06bb65e81b638d60e6b80b51613 (patch) | |
| tree | 13dc7a981ad5723a0fde8a21b86b162172c620c8 /indra/newview | |
| parent | f09e53da5f3bc56649c3f08894eb71c5fb907c10 (diff) | |
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-engine
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/lloutfitslist.cpp | 55 | ||||
| -rw-r--r-- | indra/newview/lloutfitslist.h | 12 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 1 | 
3 files changed, 33 insertions, 35 deletions
| diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 98ec272e96..7bf41b0f92 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -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); + +		// *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, +		// 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); - -	// 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); +		// 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); + +		mIsInitialized = true; +	}  }  void LLOutfitsList::refreshList(const LLUUID& category_id) diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index d3da850e19..6dbdf00067 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -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 diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 21f69d3470..9babddc033 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -632,6 +632,7 @@ void LLPanelOutfitsInventory::onTabChange()  	else  	{  		mMyOutfitsPanel->setFilterSubString(mFilterSubString); +		mMyOutfitsPanel->onOpen(LLSD());  	}  	updateVerbs(); | 
