diff options
-rw-r--r-- | indra/newview/llfilteredwearablelist.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llinventoryobserver.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 55 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.h | 12 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 1 |
8 files changed, 49 insertions, 37 deletions
diff --git a/indra/newview/llfilteredwearablelist.cpp b/indra/newview/llfilteredwearablelist.cpp index 28e159421c..0c13bbcab7 100644 --- a/indra/newview/llfilteredwearablelist.cpp +++ b/indra/newview/llfilteredwearablelist.cpp @@ -54,6 +54,15 @@ LLFilteredWearableListManager::~LLFilteredWearableListManager() void LLFilteredWearableListManager::changed(U32 mask) { + if (LLInventoryObserver::CALLING_CARD == mask
+ || LLInventoryObserver::GESTURE == mask
+ || LLInventoryObserver::SORT == mask
+ )
+ {
+ // skip non-related changes
+ return;
+ } + if(!gInventory.isInventoryUsable()) { return; diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 0ff6ab2644..b4f0947b2c 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -112,6 +112,8 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive { if (!mAllFoldersFetched) { + LL_DEBUGS("InventoryFetch") << "Start fetching category: " << cat_id << ", recursive: " << recursive << LL_ENDL; + mBackgroundFetchActive = TRUE; if (cat_id.isNull()) { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 8557548887..d2b402fe14 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -68,7 +68,7 @@ // you're fetching an item and a notification gets triggered because // you renamed some other item). This counter is to specify how many // notification to wait for before giving up. -static const U32 MAX_NUM_NOTIFICATIONS_TO_PROCESS = 20; +static const U32 MAX_NUM_NOTIFICATIONS_TO_PROCESS = 127; LLInventoryObserver::LLInventoryObserver() { diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 94bf2f4c7a..77db280487 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -137,11 +137,9 @@ LLOutfitsList::LLOutfitsList() : LLPanel() , mAccordion(NULL) , mListCommands(NULL) + , mIsInitialized(false) { mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - - gInventory.addObserver(this); mOutfitMenu = new OutfitContextMenu(); } @@ -155,11 +153,6 @@ LLOutfitsList::~LLOutfitsList() gInventory.removeObserver(mCategoriesObserver); delete mCategoriesObserver; } - - if (gInventory.containsObserver(this)) - { - gInventory.removeObserver(this); - } } BOOL LLOutfitsList::postBuild() @@ -170,32 +163,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 4784ee777b..44f6ec908b 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); @@ -132,6 +130,8 @@ private: outfits_map_t mOutfitsMap; LLListContextMenu* mOutfitMenu; + + bool mIsInitialized; }; #endif //LL_LLOUTFITSLIST_H diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 42de6d1ef4..dee9572357 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -375,7 +375,6 @@ BOOL LLPanelOutfitEdit::postBuild() mWearableItemsPanel = getChild<LLPanel>("filtered_wearables_panel"); mWearableItemsList = getChild<LLInventoryItemsList>("filtered_wearables_list"); - mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mWearableListMaskCollector); mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this)); return TRUE; @@ -386,6 +385,9 @@ void LLPanelOutfitEdit::onOpen(const LLSD& key) { if (!mInitialized) { + // *TODO: this method is called even panel is not visible to user because its parent layout panel is hidden.
+ // So, we can defer initializing a bit. + mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mWearableListMaskCollector); displayCurrentOutfit(); mInitialized = true; } diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 74631c03df..5f67f3d989 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -752,6 +752,7 @@ void LLPanelOutfitsInventory::onTabChange() else { mMyOutfitsPanel->setFilterSubString(mFilterSubString); + mMyOutfitsPanel->onOpen(LLSD()); } updateVerbs(); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index a788d3c457..d745356dcd 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -607,6 +607,7 @@ bool LLViewerInventoryCategory::fetch() if((VERSION_UNKNOWN == mVersion) && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads. { + LL_DEBUGS("InventoryFetch") << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL; const F32 FETCH_TIMER_EXPIRY = 10.0f; mDescendentsRequested.reset(); mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); |