From cdbdb1168694bcbfc58208f2941f513b556a0d6e Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 6 Apr 2010 14:47:20 -0400 Subject: EXT-4151 : Immediately check if a fetchObserver filter is done, else add to observer list automatically FetchObservers now take in a list of IDs to check against. Made some naming changes. --- indra/newview/llagentwearables.cpp | 21 +++++---- indra/newview/llagentwearablesfetch.cpp | 35 ++++++++------- indra/newview/llagentwearablesfetch.h | 4 +- indra/newview/llappearancemgr.h | 17 ++++--- indra/newview/llfloatergesture.cpp | 6 ++- indra/newview/llfriendcard.cpp | 15 ++++--- indra/newview/llgesturemgr.cpp | 5 ++- indra/newview/llgesturemgr.h | 2 +- indra/newview/llinventorybridge.cpp | 27 ++++++++---- indra/newview/llinventoryobserver.cpp | 43 +++++++++++------- indra/newview/llinventoryobserver.h | 78 +++++++++++++++++---------------- indra/newview/llpaneloutfitedit.cpp | 3 +- indra/newview/llsidepanelappearance.cpp | 12 ++--- indra/newview/llstartup.cpp | 3 +- indra/newview/lltooldraganddrop.cpp | 16 ++++--- indra/newview/llviewermenu.cpp | 15 ++++--- indra/newview/llviewermessage.cpp | 29 +++++++----- 17 files changed, 187 insertions(+), 144 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 9d3b5763e8..bc8931827e 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -905,8 +905,9 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // Get the UUID of the current outfit folder (will be created if it doesn't exist) const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - - LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(); + uuid_vec_t folders; + folders.push_back(current_outfit_id); + LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(folders); //lldebugs << "processAgentInitialWearablesUpdate()" << llendl; // Add wearables @@ -952,9 +953,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // Get the complete information on the items in the inventory and set up an observer // that will trigger when the complete information is fetched. - uuid_vec_t folders; - folders.push_back(current_outfit_id); - outfit->fetch(folders); + outfit->startFetch(); if(outfit->isEverythingComplete()) { // everything is already here - call done. @@ -2061,16 +2060,16 @@ void LLAgentWearables::populateMyOutfitsFolder(void) { llinfos << "starting outfit population" << llendl; - LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(); + const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + uuid_vec_t folders; + folders.push_back(my_outfits_id); + LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(folders); + outfits->mMyOutfitsID = my_outfits_id; // Get the complete information on the items in the inventory and // setup an observer that will wait for that to happen. - uuid_vec_t folders; - outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - - folders.push_back(outfits->mMyOutfitsID); gInventory.addObserver(outfits); - outfits->fetch(folders); + outfits->startFetch(); if (outfits->isEverythingComplete()) { outfits->done(); diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 3d6740f5a1..6b7edaa302 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -39,7 +39,8 @@ #include "llinventoryfunctions.h" #include "llvoavatarself.h" -LLInitialWearablesFetch::LLInitialWearablesFetch() +LLInitialWearablesFetch::LLInitialWearablesFetch(const uuid_vec_t& ids) : + LLInventoryFetchDescendentsObserver(ids) { } @@ -86,12 +87,11 @@ void LLInitialWearablesFetch::processContents() delete this; } -class LLFetchAndLinkObserver: public LLInventoryFetchObserver +class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver { public: LLFetchAndLinkObserver(uuid_vec_t& ids): - m_ids(ids), - LLInventoryFetchObserver(true) // retry for missing items + LLInventoryFetchItemsObserver(ids, true) // retry for missing items { } ~LLFetchAndLinkObserver() @@ -103,8 +103,8 @@ public: // Link to all fetched items in COF. LLPointer link_waiter = new LLUpdateAppearanceOnDestroy; - for (uuid_vec_t::iterator it = m_ids.begin(); - it != m_ids.end(); + for (uuid_vec_t::iterator it = mIDs.begin(); + it != mIDs.end(); ++it) { LLUUID id = *it; @@ -123,8 +123,6 @@ public: link_waiter); } } -private: - uuid_vec_t m_ids; }; void LLInitialWearablesFetch::processWearablesMessage() @@ -173,9 +171,9 @@ void LLInitialWearablesFetch::processWearablesMessage() // Need to fetch the inventory items for ids, then create links to them after they arrive. LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); - fetcher->fetch(ids); + fetcher->startFetch(); // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. if (fetcher->isEverythingComplete()) { fetcher->done(); @@ -191,7 +189,8 @@ void LLInitialWearablesFetch::processWearablesMessage() } } -LLLibraryOutfitsFetch::LLLibraryOutfitsFetch() : +LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const uuid_vec_t& ids) : + LLInventoryFetchDescendentsObserver(ids), mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) { @@ -288,7 +287,8 @@ void LLLibraryOutfitsFetch::folderDone() uuid_vec_t folders; folders.push_back(mClothingID); folders.push_back(mLibraryClothingID); - fetch(folders); + setFolders(folders); + startFetch(); if (isEverythingComplete()) { done(); @@ -337,8 +337,8 @@ void LLLibraryOutfitsFetch::outfitsDone() } mComplete.clear(); - - fetch(folders); + setFolders(folders); + startFetch(); if (isEverythingComplete()) { done(); @@ -434,8 +434,8 @@ void LLLibraryOutfitsFetch::importedFolderFetch() folders.push_back(mImportedClothingID); mComplete.clear(); - - fetch(folders); + setFolders(folders); + startFetch(); if (isEverythingComplete()) { done(); @@ -464,7 +464,8 @@ void LLLibraryOutfitsFetch::importedFolderDone() } mComplete.clear(); - fetch(folders); + setFolders(folders); + startFetch(); if (isEverythingComplete()) { done(); diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h index 1d0c6739ba..33368811c0 100644 --- a/indra/newview/llagentwearablesfetch.h +++ b/indra/newview/llagentwearablesfetch.h @@ -47,7 +47,7 @@ class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver { public: - LLInitialWearablesFetch(); + LLInitialWearablesFetch(const uuid_vec_t& ids); ~LLInitialWearablesFetch(); virtual void done(); @@ -92,7 +92,7 @@ public: LOFS_CONTENTS }; - LLLibraryOutfitsFetch(); + LLLibraryOutfitsFetch(const uuid_vec_t& ids); ~LLLibraryOutfitsFetch(); virtual void done(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 40b8844731..1cf8d584db 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -244,10 +244,12 @@ void doOnIdleRepeating(T callable) } template -class CallAfterCategoryFetchStage2: public LLInventoryFetchObserver +class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver { public: - CallAfterCategoryFetchStage2(T callable): + CallAfterCategoryFetchStage2(const uuid_vec_t& ids, + T callable) : + LLInventoryFetchItemsObserver(ids), mCallable(callable) { } @@ -268,7 +270,8 @@ template class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver { public: - CallAfterCategoryFetchStage1(T callable): + CallAfterCategoryFetchStage1(const uuid_vec_t& ids, T callable) : + LLInventoryFetchDescendentsObserver(ids), mCallable(callable) { } @@ -297,7 +300,6 @@ public: return; } - CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(mCallable); uuid_vec_t ids; for(S32 i = 0; i < count; ++i) { @@ -307,7 +309,8 @@ public: gInventory.removeObserver(this); // do the fetch - stage2->fetch(ids); + CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(ids, mCallable); + stage2->startFetch(); if(stage2->isEverythingComplete()) { // everything is already here - call done. @@ -328,10 +331,10 @@ protected: template void callAfterCategoryFetch(const LLUUID& cat_id, T callable) { - CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(callable); uuid_vec_t folders; folders.push_back(cat_id); - stage1->fetch(folders); + CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(folders, callable); + stage1->startFetch(); if (stage1->isEverythingComplete()) { stage1->done(); diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 8ee8d13a9c..04fb6bca3c 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -148,7 +148,8 @@ void LLFloaterGesture::done() if (!unloaded_folders.empty()) { LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL; - fetch(unloaded_folders); + setFolders(unloaded_folders); + startFetch(); } else { @@ -202,7 +203,8 @@ BOOL LLFloaterGesture::postBuild() folders.push_back(mGestureFolderID); //perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details. gInventory.addObserver(this); - fetch(folders); + setFolders(folders); + startFetch(); if (mGestureList) { diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 6f069cca17..aaa09ba5da 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -111,8 +111,11 @@ class LLInitialFriendCardsFetch : public LLInventoryFetchDescendentsObserver public: typedef boost::function callback_t; - LLInitialFriendCardsFetch(callback_t cb) - : mCheckFolderCallback(cb) {} + LLInitialFriendCardsFetch(const uuid_vec_t& ids, + callback_t cb) : + LLInventoryFetchDescendentsObserver(ids), + mCheckFolderCallback(cb) + {} /* virtual */ void done(); @@ -407,13 +410,11 @@ void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInve void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_id, callback_t cb) { - // This instance will be deleted in LLInitialFriendCardsFetch::done(). - LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(cb); - uuid_vec_t folders; folders.push_back(folder_id); - - fetch->fetch(folders); + // This instance will be deleted in LLInitialFriendCardsFetch::done(). + LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folders, cb); + fetch->startFetch(); if(fetch->isEverythingComplete()) { // everything is already here - call done. diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index a4342a4bc9..034806acfc 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -100,7 +100,7 @@ void LLGestureMgr::init() void LLGestureMgr::changed(U32 mask) { - LLInventoryFetchObserver::changed(mask); + LLInventoryFetchItemsObserver::changed(mask); if (mask & LLInventoryObserver::GESTURE) { @@ -1033,7 +1033,8 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs, // Watch this item and set gesture name when item exists in inventory uuid_vec_t ids; ids.push_back(item_id); - self.fetch(ids); + self.setItems(ids); + self.startFetch(); } self.mActive[item_id] = gesture; diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index 081ca983a9..5f2c3e2d61 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -54,7 +54,7 @@ public: virtual void changed() = 0; }; -class LLGestureMgr : public LLSingleton, public LLInventoryFetchObserver +class LLGestureMgr : public LLSingleton, public LLInventoryFetchItemsObserver { public: diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b552b5ac07..82043ab523 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1933,13 +1933,17 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, } //Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver +class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver { public: - LLRightClickInventoryFetchObserver() : + LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : + LLInventoryFetchItemsObserver(ids), mCopyItems(false) { }; - LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) : + LLRightClickInventoryFetchObserver(const uuid_vec_t& ids, + const LLUUID& cat_id, + bool copy_items) : + LLInventoryFetchItemsObserver(ids), mCatID(cat_id), mCopyItems(copy_items) { }; @@ -1963,7 +1967,11 @@ protected: class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver { public: - LLRightClickInventoryFetchDescendentsObserver(bool copy_items) : mCopyItems(copy_items) {} + LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids, + bool copy_items) : + LLInventoryFetchDescendentsObserver(ids), + mCopyItems(copy_items) + {} ~LLRightClickInventoryFetchDescendentsObserver() {} virtual void done(); protected: @@ -2006,14 +2014,14 @@ void LLRightClickInventoryFetchDescendentsObserver::done() } #endif - LLRightClickInventoryFetchObserver* outfit; - outfit = new LLRightClickInventoryFetchObserver(mComplete.front(), mCopyItems); uuid_vec_t ids; for(S32 i = 0; i < count; ++i) { ids.push_back(item_array.get(i)->getUUID()); } + LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems); + // clean up, and remove this as an observer since the call to the // outfit could notify observers and throw us into an infinite // loop. @@ -2026,7 +2034,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done() inc_busy_count(); // do the fetch - outfit->fetch(ids); + outfit->startFetch(); outfit->done(); //Not interested in waiting and this will be right 99% of the time. //Uncomment the following code for laggy Inventory UI. /* if(outfit->isEverythingComplete()) @@ -2715,7 +2723,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mMenu = &menu; sSelf = this; - LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE); + uuid_vec_t folders; LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); @@ -2723,7 +2731,8 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { folders.push_back(category->getUUID()); } - fetch->fetch(folders); + LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); + fetch->startFetch(); inc_busy_count(); if(fetch->isEverythingComplete()) { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 83e1bbd5a0..0f8d76a4cc 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -108,12 +108,19 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id) } } -LLInventoryFetchObserver::LLInventoryFetchObserver(bool retry_if_missing) : +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(bool retry_if_missing) : mRetryIfMissing(retry_if_missing) { } -void LLInventoryFetchObserver::changed(U32 mask) +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& ids, + bool retry_if_missing) : + mIDs(ids), + mRetryIfMissing(retry_if_missing) +{ +} + +void LLInventoryFetchItemsObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as // appropriate. @@ -153,11 +160,11 @@ void LLInventoryFetchObserver::changed(U32 mask) done(); } } - //llinfos << "LLInventoryFetchObserver::changed() mComplete size " << mComplete.size() << llendl; - //llinfos << "LLInventoryFetchObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; + //llinfos << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << llendl; + //llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; } -bool LLInventoryFetchObserver::isEverythingComplete() const +bool LLInventoryFetchItemsObserver::isEverythingComplete() const { return mIncomplete.empty(); } @@ -223,11 +230,11 @@ void fetch_items_from_llsd(const LLSD& items_llsd) } } -void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids) +void LLInventoryFetchItemsObserver::startFetch() { LLUUID owner_id; LLSD items_llsd; - for(uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); ++it) + for(uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it) { LLViewerInventoryItem* item = gInventory.getItem(*it); if(item) @@ -262,6 +269,14 @@ void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids) fetch_items_from_llsd(items_llsd); } +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver() +{ +} + +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : + mIDs(ids) +{ +} // virtual void LLInventoryFetchDescendentsObserver::changed(U32 mask) { @@ -287,9 +302,9 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask) } } -void LLInventoryFetchDescendentsObserver::fetch(const uuid_vec_t& ids) +void LLInventoryFetchDescendentsObserver::startFetch() { - for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + for(uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it) { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if(!cat) continue; @@ -400,11 +415,10 @@ void LLInventoryFetchComboObserver::changed(U32 mask) } } -void LLInventoryFetchComboObserver::fetch( - const uuid_vec_t& folder_ids, - const uuid_vec_t& item_ids) +void LLInventoryFetchComboObserver::startFetch(const uuid_vec_t& folder_ids, + const uuid_vec_t& item_ids) { - lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; + lldebugs << "LLInventoryFetchComboObserver::startFetch()" << llendl; for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) { LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); @@ -544,8 +558,7 @@ void LLInventoryAddedObserver::changed(U32 mask) } } -LLInventoryTransactionObserver::LLInventoryTransactionObserver( - const LLTransactionID& transaction_id) : +LLInventoryTransactionObserver::LLInventoryTransactionObserver(const LLTransactionID& transaction_id) : mTransactionID(transaction_id) { } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index ba70552ebc..03f9e9c553 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -73,68 +73,46 @@ public: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryCompletionObserver -// -// Base class for doing something when when all observed items are locally -// complete. Implements the changed() method of LLInventoryObserver -// and declares a new method named done() which is called when all watched items -// have complete information in the inventory model. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryCompletionObserver : public LLInventoryObserver -{ -public: - LLInventoryCompletionObserver() {} - virtual void changed(U32 mask); - - void watchItem(const LLUUID& id); - -protected: - virtual void done() = 0; - - uuid_vec_t mComplete; - uuid_vec_t mIncomplete; -}; - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryFetchObserver +// Class LLInventoryFetchItemsObserver // -// This class is much like the LLInventoryCompletionObserver, except -// that it handles all the the fetching necessary. Override the done() -// method to do the thing you want. +// Fetches inventory items, calls done() when all inventory has arrived. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryFetchObserver : public LLInventoryObserver +class LLInventoryFetchItemsObserver : public LLInventoryObserver { public: - LLInventoryFetchObserver(bool retry_if_missing = false); + LLInventoryFetchItemsObserver(bool retry_if_missing = false); + LLInventoryFetchItemsObserver(const uuid_vec_t& ids, bool retry_if_missing = false); virtual void changed(U32 mask); bool isEverythingComplete() const; - void fetch(const uuid_vec_t& ids); + void setItems(const uuid_vec_t& ids) { mIDs = ids; } + void startFetch(); + virtual void done() {}; protected: bool mRetryIfMissing; uuid_vec_t mComplete; uuid_vec_t mIncomplete; + uuid_vec_t mIDs; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryFetchDescendentsObserver // -// This class is much like the LLInventoryCompletionObserver, except -// that it handles fetching based on category. Override the done() -// method to do the thing you want. +// Fetches children of a category/folder, calls done() when all +// inventory has arrived. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLInventoryFetchDescendentsObserver : public LLInventoryObserver { public: - LLInventoryFetchDescendentsObserver() {} + LLInventoryFetchDescendentsObserver(); + LLInventoryFetchDescendentsObserver(const uuid_vec_t& ids); virtual void changed(U32 mask); - void fetch(const uuid_vec_t& ids); + void setFolders(const uuid_vec_t& ids) { mIDs = ids; } + void startFetch(); bool isEverythingComplete() const; virtual void done() = 0; @@ -142,6 +120,7 @@ protected: bool isComplete(LLViewerInventoryCategory* cat); uuid_vec_t mIncomplete; uuid_vec_t mComplete; + uuid_vec_t mIDs; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -158,7 +137,7 @@ public: LLInventoryFetchComboObserver() : mDone(false) {} virtual void changed(U32 mask); - void fetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); + void startFetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); virtual void done() = 0; @@ -237,6 +216,29 @@ protected: LLTransactionID mTransactionID; }; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryCompletionObserver +// +// Base class for doing something when when all observed items are locally +// complete. Implements the changed() method of LLInventoryObserver +// and declares a new method named done() which is called when all watched items +// have complete information in the inventory model. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLInventoryCompletionObserver : public LLInventoryObserver +{ +public: + LLInventoryCompletionObserver() {} + virtual void changed(U32 mask); + + void watchItem(const LLUUID& id); + +protected: + virtual void done() = 0; + + uuid_vec_t mComplete; + uuid_vec_t mIncomplete; +}; #endif // LL_LLINVENTORYOBSERVERS_H diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ccd1bfe224..5701fcb582 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -484,7 +484,8 @@ void LLPanelOutfitEdit::updateLookInfo() uuid_vec_t folders; folders.push_back(mLookID); - mFetchLook->fetch(folders); + mFetchLook->setFolders(folders); + mFetchLook->startFetch(); if (mFetchLook->isEverythingComplete()) { mFetchLook->done(); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 511196809a..6dd4dc1ce7 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -52,10 +52,12 @@ static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); -class LLCurrentlyWornFetchObserver : public LLInventoryFetchObserver +class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver { public: - LLCurrentlyWornFetchObserver(LLSidepanelAppearance *panel) : + LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, + LLSidepanelAppearance *panel) : + LLInventoryFetchItemsObserver(ids), mPanel(panel) {} ~LLCurrentlyWornFetchObserver() {} @@ -390,10 +392,10 @@ void LLSidepanelAppearance::fetchInventory() } } - LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(this); - fetch_worn->fetch(ids); + LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); + fetch_worn->startFetch(); // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. if (fetch_worn->isEverythingComplete()) { fetch_worn->done(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d7c8b5fcd4..340327a1e2 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1771,7 +1771,8 @@ bool idle_startup() } } // no need to add gesture to inventory observer, it's already made in constructor - LLGestureMgr::instance().fetch(item_ids); + LLGestureMgr::instance().setItems(item_ids); + LLGestureMgr::instance().startFetch(); } } gDisplaySwapBuffers = TRUE; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 1e81e675e6..cc90b0753f 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -244,11 +244,13 @@ public: } }; -class LLCategoryDropObserver : public LLInventoryFetchObserver +class LLCategoryDropObserver : public LLInventoryFetchItemsObserver { public: LLCategoryDropObserver( + const uuid_vec_t& ids, const LLUUID& obj_id, LLToolDragAndDrop::ESource src) : + LLInventoryFetchItemsObserver(ids), mObjectID(obj_id), mSource(src) {} @@ -331,8 +333,8 @@ void LLCategoryDropDescendentsObserver::done() std::back_insert_iterator copier(ids); std::copy(unique_ids.begin(), unique_ids.end(), copier); LLCategoryDropObserver* dropper; - dropper = new LLCategoryDropObserver(mObjectID, mSource); - dropper->fetch(ids); + dropper = new LLCategoryDropObserver(ids, mObjectID, mSource); + dropper->startFetch(); if (dropper->isEverythingComplete()) { dropper->done(); @@ -480,7 +482,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, if (!folder_ids.empty() || !item_ids.empty()) { LLCategoryFireAndForget fetcher; - fetcher.fetch(folder_ids, item_ids); + fetcher.startFetch(folder_ids, item_ids); } } } @@ -550,7 +552,7 @@ void LLToolDragAndDrop::beginMultiDrag( std::back_insert_iterator copier(folder_ids); std::copy(cat_ids.begin(), cat_ids.end(), copier); LLCategoryFireAndForget fetcher; - fetcher.fetch(folder_ids, item_ids); + fetcher.startFetch(folder_ids, item_ids); } } } @@ -2576,8 +2578,8 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( const LLViewerInventoryItem *item = (*item_iter); ids.push_back(item->getUUID()); } - LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource); - dropper->fetch(ids); + LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource); + dropper->startFetch(); if (dropper->isEverythingComplete()) { dropper->done(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d91b6d0b1e..807595960e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6096,10 +6096,12 @@ class LLAttachmentDetach : public view_listener_t //Adding an observer for a Jira 2422 and needs to be a fetch observer //for Jira 3119 -class LLWornItemFetchedObserver : public LLInventoryFetchObserver +class LLWornItemFetchedObserver : public LLInventoryFetchItemsObserver { public: - LLWornItemFetchedObserver() {} + LLWornItemFetchedObserver(const uuid_vec_t& ids) : + LLInventoryFetchItemsObserver(ids) + {} virtual ~LLWornItemFetchedObserver() {} protected: @@ -6153,13 +6155,12 @@ class LLAttachmentEnableDrop : public view_listener_t // when the item finishes fetching worst case scenario // if a fetch is already out there (being sent from a slow sim) // we refetch and there are 2 fetches - LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver(); + uuid_vec_t items; //add item to the inventory item to be fetched - items.push_back((*attachment_iter)->getItemID()); - - wornItemFetched->fetch(items); - gInventory.addObserver(wornItemFetched); + LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver(items); + worn_item_fetched->startFetch(); + gInventory.addObserver(worn_item_fetched); } } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a471876ce1..6f39de996e 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -700,10 +700,13 @@ static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_ //----------------------------------------------------------------------------- // Instant Message //----------------------------------------------------------------------------- -class LLOpenAgentOffer : public LLInventoryFetchObserver +class LLOpenAgentOffer : public LLInventoryFetchItemsObserver { public: - LLOpenAgentOffer(const std::string& from_name) : mFromName(from_name) {} + LLOpenAgentOffer(const uuid_vec_t& ids, + const std::string& from_name) : + LLInventoryFetchItemsObserver(ids), + mFromName(from_name) {} /*virtual*/ void done() { open_inventory_offer(mComplete, mFromName); @@ -1206,8 +1209,8 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // so we can fetch it out of our inventory. uuid_vec_t items; items.push_back(mObjectID); - LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string); - open_agent_offer->fetch(items); + LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(items, from_string); + open_agent_offer->startFetch(); if(catp || (itemp && itemp->isComplete())) { open_agent_offer->done(); @@ -1270,7 +1273,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& items.push_back(mObjectID); LLDiscardAgentOffer* discard_agent_offer; discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); - discard_agent_offer->fetch(folders, items); + discard_agent_offer->startFetch(folders, items); if(catp || (itemp && itemp->isComplete())) { discard_agent_offer->done(); @@ -1604,8 +1607,8 @@ void inventory_offer_handler(LLOfferInfo* info) // Prefetch the item into your local inventory. uuid_vec_t items; items.push_back(info->mObjectID); - LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver(); - fetch_item->fetch(items); + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(items); + fetch_item->startFetch(); if(fetch_item->isEverythingComplete()) { fetch_item->done(); @@ -2123,8 +2126,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331) uuid_vec_t items; items.push_back(info->mObjectID); - LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver(); - fetch_item->fetch(items); + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(items); + fetch_item->startFetch(); delete fetch_item; // Same as closing window @@ -2844,7 +2847,9 @@ void process_teleport_progress(LLMessageSystem* msg, void**) class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver { public: - LLFetchInWelcomeArea() {} + LLFetchInWelcomeArea(const uuid_vec_t &ids) : + LLInventoryFetchDescendentsObserver(ids) + {} virtual void done() { LLIsType is_landmark(LLAssetType::AT_LANDMARK); @@ -2926,8 +2931,8 @@ BOOL LLPostTeleportNotifiers::tick() folders.push_back(folder_id); if(!folders.empty()) { - LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea; - fetcher->fetch(folders); + LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders); + fetcher->startFetch(); if(fetcher->isEverythingComplete()) { fetcher->done(); -- cgit v1.2.3 From c3d9316dff568d5265d856a708e3909deae09f18 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 6 Apr 2010 17:30:23 -0400 Subject: EXT-6727 : Allow LLInventoryObservers to target a single item (instead of a vector of items) Added new constructors to LLInventoryFetch types to allow passing in a single item. --- indra/newview/llagentwearables.cpp | 8 ++------ indra/newview/llagentwearablesfetch.cpp | 8 ++++---- indra/newview/llagentwearablesfetch.h | 4 ++-- indra/newview/llappearancemgr.cpp | 2 +- indra/newview/llappearancemgr.h | 8 +++----- indra/newview/llfriendcard.cpp | 8 +++----- indra/newview/llinventoryobserver.cpp | 22 ++++++++++++++++++---- indra/newview/llinventoryobserver.h | 11 +++++++---- indra/newview/llpaneloutfitedit.cpp | 6 ++---- indra/newview/llviewermenu.cpp | 9 +++------ indra/newview/llviewermessage.cpp | 16 +++++----------- 11 files changed, 50 insertions(+), 52 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index bc8931827e..aedea5660f 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -905,9 +905,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // Get the UUID of the current outfit folder (will be created if it doesn't exist) const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - uuid_vec_t folders; - folders.push_back(current_outfit_id); - LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(folders); + LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(current_outfit_id); //lldebugs << "processAgentInitialWearablesUpdate()" << llendl; // Add wearables @@ -2061,9 +2059,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void) llinfos << "starting outfit population" << llendl; const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - uuid_vec_t folders; - folders.push_back(my_outfits_id); - LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(folders); + LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(my_outfits_id); outfits->mMyOutfitsID = my_outfits_id; // Get the complete information on the items in the inventory and diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 6b7edaa302..04a970b683 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -39,8 +39,8 @@ #include "llinventoryfunctions.h" #include "llvoavatarself.h" -LLInitialWearablesFetch::LLInitialWearablesFetch(const uuid_vec_t& ids) : - LLInventoryFetchDescendentsObserver(ids) +LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : + LLInventoryFetchDescendentsObserver(cof_id) { } @@ -189,8 +189,8 @@ void LLInitialWearablesFetch::processWearablesMessage() } } -LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const uuid_vec_t& ids) : - LLInventoryFetchDescendentsObserver(ids), +LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) : + LLInventoryFetchDescendentsObserver(my_outfits_id), mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) { diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h index 33368811c0..6695727d46 100644 --- a/indra/newview/llagentwearablesfetch.h +++ b/indra/newview/llagentwearablesfetch.h @@ -47,7 +47,7 @@ class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver { public: - LLInitialWearablesFetch(const uuid_vec_t& ids); + LLInitialWearablesFetch(const LLUUID& cof_id); ~LLInitialWearablesFetch(); virtual void done(); @@ -92,7 +92,7 @@ public: LOFS_CONTENTS }; - LLLibraryOutfitsFetch(const uuid_vec_t& ids); + LLLibraryOutfitsFetch(const LLUUID& my_outfits_id); ~LLLibraryOutfitsFetch(); virtual void done(); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e0f1d5348d..7700d4de7f 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -49,7 +49,7 @@ #include "llviewerregion.h" #include "llwearablelist.h" -LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name) +LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string& name) { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 1cf8d584db..27a4ffd8cb 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -270,8 +270,8 @@ template class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver { public: - CallAfterCategoryFetchStage1(const uuid_vec_t& ids, T callable) : - LLInventoryFetchDescendentsObserver(ids), + CallAfterCategoryFetchStage1(const LLUUID& cat_id, T callable) : + LLInventoryFetchDescendentsObserver(cat_id), mCallable(callable) { } @@ -331,9 +331,7 @@ protected: template void callAfterCategoryFetch(const LLUUID& cat_id, T callable) { - uuid_vec_t folders; - folders.push_back(cat_id); - CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(folders, callable); + CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(cat_id, callable); stage1->startFetch(); if (stage1->isEverythingComplete()) { diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index aaa09ba5da..945d2d26da 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -111,9 +111,9 @@ class LLInitialFriendCardsFetch : public LLInventoryFetchDescendentsObserver public: typedef boost::function callback_t; - LLInitialFriendCardsFetch(const uuid_vec_t& ids, + LLInitialFriendCardsFetch(const LLUUID& folder_id, callback_t cb) : - LLInventoryFetchDescendentsObserver(ids), + LLInventoryFetchDescendentsObserver(folder_id), mCheckFolderCallback(cb) {} @@ -410,10 +410,8 @@ void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInve void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_id, callback_t cb) { - uuid_vec_t folders; - folders.push_back(folder_id); // This instance will be deleted in LLInitialFriendCardsFetch::done(). - LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folders, cb); + LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folder_id, cb); fetch->startFetch(); if(fetch->isEverythingComplete()) { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 0f8d76a4cc..fecd18b4bb 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -113,9 +113,17 @@ LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(bool retry_if_missi { } -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& ids, +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id, bool retry_if_missing) : - mIDs(ids), + mRetryIfMissing(retry_if_missing) +{ + mIDs.clear(); + mIDs.push_back(item_id); +} + +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, + bool retry_if_missing) : + mIDs(item_ids), mRetryIfMissing(retry_if_missing) { } @@ -273,8 +281,14 @@ LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver() { } -LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : - mIDs(ids) +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const LLUUID& cat_id) +{ + mIDs.clear(); + mIDs.push_back(cat_id); +} + +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids) : + mIDs(cat_ids) { } // virtual diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 03f9e9c553..420afdfadc 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -81,8 +81,9 @@ public: class LLInventoryFetchItemsObserver : public LLInventoryObserver { public: - LLInventoryFetchItemsObserver(bool retry_if_missing = false); - LLInventoryFetchItemsObserver(const uuid_vec_t& ids, bool retry_if_missing = false); + LLInventoryFetchItemsObserver(bool retry_if_missing = false); // deprecated + LLInventoryFetchItemsObserver(const LLUUID& item_id, bool retry_if_missing = false); // single item + LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, bool retry_if_missing = false); // multiple items virtual void changed(U32 mask); bool isEverythingComplete() const; @@ -108,10 +109,12 @@ class LLInventoryFetchDescendentsObserver : public LLInventoryObserver { public: LLInventoryFetchDescendentsObserver(); - LLInventoryFetchDescendentsObserver(const uuid_vec_t& ids); + LLInventoryFetchDescendentsObserver(const LLUUID& cat_id); + LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids); virtual void changed(U32 mask); - void setFolders(const uuid_vec_t& ids) { mIDs = ids; } + void setFolders(const uuid_vec_t& cat_ids) { mIDs = cat_ids; } + void setFolders(const LLUUID& cat_id) { mIDs.clear(); mIDs.push_back(cat_id); } void startFetch(); bool isEverythingComplete() const; virtual void done() = 0; diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 5701fcb582..e93293a0f0 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -481,10 +481,8 @@ void LLPanelOutfitEdit::updateLookInfo() if (getVisible()) { mLookContents->clearRows(); - - uuid_vec_t folders; - folders.push_back(mLookID); - mFetchLook->setFolders(folders); + + mFetchLook->setFolders(mLookID); mFetchLook->startFetch(); if (mFetchLook->isEverythingComplete()) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 807595960e..820db7e3ff 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6099,8 +6099,8 @@ class LLAttachmentDetach : public view_listener_t class LLWornItemFetchedObserver : public LLInventoryFetchItemsObserver { public: - LLWornItemFetchedObserver(const uuid_vec_t& ids) : - LLInventoryFetchItemsObserver(ids) + LLWornItemFetchedObserver(const LLUUID& worn_item_id) : + LLInventoryFetchItemsObserver(worn_item_id) {} virtual ~LLWornItemFetchedObserver() {} @@ -6155,10 +6155,7 @@ class LLAttachmentEnableDrop : public view_listener_t // when the item finishes fetching worst case scenario // if a fetch is already out there (being sent from a slow sim) // we refetch and there are 2 fetches - - uuid_vec_t items; //add item to the inventory item to be fetched - items.push_back((*attachment_iter)->getItemID()); - LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver(items); + LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver((*attachment_iter)->getItemID()); worn_item_fetched->startFetch(); gInventory.addObserver(worn_item_fetched); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6f39de996e..35eb3390a5 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -703,9 +703,9 @@ static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_ class LLOpenAgentOffer : public LLInventoryFetchItemsObserver { public: - LLOpenAgentOffer(const uuid_vec_t& ids, + LLOpenAgentOffer(const LLUUID& object_id, const std::string& from_name) : - LLInventoryFetchItemsObserver(ids), + LLInventoryFetchItemsObserver(object_id), mFromName(from_name) {} /*virtual*/ void done() { @@ -1207,9 +1207,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // This is an offer from an agent. In this case, the back // end has already copied the items into your inventory, // so we can fetch it out of our inventory. - uuid_vec_t items; - items.push_back(mObjectID); - LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(items, from_string); + LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string); open_agent_offer->startFetch(); if(catp || (itemp && itemp->isComplete())) { @@ -1605,9 +1603,7 @@ void inventory_offer_handler(LLOfferInfo* info) p.name = "UserGiveItem"; // Prefetch the item into your local inventory. - uuid_vec_t items; - items.push_back(info->mObjectID); - LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(items); + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); fetch_item->startFetch(); if(fetch_item->isEverythingComplete()) { @@ -2124,9 +2120,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (is_muted) { // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331) - uuid_vec_t items; - items.push_back(info->mObjectID); - LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(items); + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); fetch_item->startFetch(); delete fetch_item; -- cgit v1.2.3 From f096f02278f3b8c8fdd962c85b237492defa93ec Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 6 Apr 2010 18:58:26 -0400 Subject: EXT-6728 : Have LLInventoryFetchItems/DescendentsObserver inherit from a base abstract LLInventoryFetchObserver class Added a new abstract class LLInventoryFetchObserver from which LLInventoryFetchItems and LLInventoryFetchDescendents inherit. Also changed isEverythingComplete to isFinished and made some other minor superficial changes. --- indra/newview/llagentwearables.cpp | 4 +- indra/newview/llagentwearablesfetch.cpp | 18 +++---- indra/newview/llappearancemgr.h | 4 +- indra/newview/llfloatergesture.cpp | 4 +- indra/newview/llfloaterproperties.cpp | 6 +-- indra/newview/llfriendcard.cpp | 2 +- indra/newview/llgesturemgr.cpp | 4 +- indra/newview/llinventorybridge.cpp | 14 ++--- indra/newview/llinventoryobserver.cpp | 95 ++++++++++++++++++++------------- indra/newview/llinventoryobserver.h | 69 ++++++++++++++---------- indra/newview/llinventorypanel.cpp | 2 +- indra/newview/llpaneloutfitedit.cpp | 4 +- indra/newview/llpreview.cpp | 2 +- indra/newview/llpreviewgesture.cpp | 4 +- indra/newview/llpreviewscript.cpp | 2 +- indra/newview/llsidepanelappearance.cpp | 2 +- indra/newview/llsidepaneliteminfo.cpp | 6 +-- indra/newview/llstartup.cpp | 2 +- indra/newview/lltooldraganddrop.cpp | 35 ++++++------ indra/newview/llviewerinventory.h | 2 +- indra/newview/llviewermessage.cpp | 8 +-- 21 files changed, 162 insertions(+), 127 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index aedea5660f..7f248eee30 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -952,7 +952,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs // Get the complete information on the items in the inventory and set up an observer // that will trigger when the complete information is fetched. outfit->startFetch(); - if(outfit->isEverythingComplete()) + if(outfit->isFinished()) { // everything is already here - call done. outfit->done(); @@ -2066,7 +2066,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void) // setup an observer that will wait for that to happen. gInventory.addObserver(outfits); outfits->startFetch(); - if (outfits->isEverythingComplete()) + if (outfits->isFinished()) { outfits->done(); } diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 04a970b683..aafbb0d22c 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -174,7 +174,7 @@ void LLInitialWearablesFetch::processWearablesMessage() fetcher->startFetch(); // If no items to be fetched, done will never be triggered. // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. - if (fetcher->isEverythingComplete()) + if (fetcher->isFinished()) { fetcher->done(); } @@ -287,9 +287,9 @@ void LLLibraryOutfitsFetch::folderDone() uuid_vec_t folders; folders.push_back(mClothingID); folders.push_back(mLibraryClothingID); - setFolders(folders); + setFetchIDs(folders); startFetch(); - if (isEverythingComplete()) + if (isFinished()) { done(); } @@ -337,9 +337,9 @@ void LLLibraryOutfitsFetch::outfitsDone() } mComplete.clear(); - setFolders(folders); + setFetchIDs(folders); startFetch(); - if (isEverythingComplete()) + if (isFinished()) { done(); } @@ -434,9 +434,9 @@ void LLLibraryOutfitsFetch::importedFolderFetch() folders.push_back(mImportedClothingID); mComplete.clear(); - setFolders(folders); + setFetchIDs(folders); startFetch(); - if (isEverythingComplete()) + if (isFinished()) { done(); } @@ -464,9 +464,9 @@ void LLLibraryOutfitsFetch::importedFolderDone() } mComplete.clear(); - setFolders(folders); + setFetchIDs(folders); startFetch(); - if (isEverythingComplete()) + if (isFinished()) { done(); } diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 27a4ffd8cb..93b3cecb6f 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -311,7 +311,7 @@ public: // do the fetch CallAfterCategoryFetchStage2 *stage2 = new CallAfterCategoryFetchStage2(ids, mCallable); stage2->startFetch(); - if(stage2->isEverythingComplete()) + if(stage2->isFinished()) { // everything is already here - call done. stage2->done(); @@ -333,7 +333,7 @@ void callAfterCategoryFetch(const LLUUID& cat_id, T callable) { CallAfterCategoryFetchStage1 *stage1 = new CallAfterCategoryFetchStage1(cat_id, callable); stage1->startFetch(); - if (stage1->isEverythingComplete()) + if (stage1->isFinished()) { stage1->done(); } diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 04fb6bca3c..eff7131145 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -148,7 +148,7 @@ void LLFloaterGesture::done() if (!unloaded_folders.empty()) { LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL; - setFolders(unloaded_folders); + setFetchIDs(unloaded_folders); startFetch(); } else @@ -203,7 +203,7 @@ BOOL LLFloaterGesture::postBuild() folders.push_back(mGestureFolderID); //perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details. gInventory.addObserver(this); - setFolders(folders); + setFetchIDs(folders); startFetch(); if (mGestureList) diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index bb9d151cd2..30b654de24 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -237,7 +237,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) // do not enable the UI for incomplete items. LLViewerInventoryItem* i = (LLViewerInventoryItem*)item; - BOOL is_complete = i->isComplete(); + BOOL is_complete = i->isFinished(); const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(i->getInventoryType()); const BOOL is_calling_card = (i->getInventoryType() == LLInventoryType::IT_CALLINGCARD); const LLPermissions& perm = item->getPermissions(); @@ -683,7 +683,7 @@ void LLFloaterProperties::onCommitPermissions() CheckNextOwnerTransfer->get(), PERM_TRANSFER); } if(perm != item->getPermissions() - && item->isComplete()) + && item->isFinished()) { LLPointer new_item = new LLViewerInventoryItem(item); new_item->setPermissions(perm); @@ -813,7 +813,7 @@ void LLFloaterProperties::updateSaleInfo() sale_info.setSaleType(LLSaleInfo::FS_NOT); } if(sale_info != item->getSaleInfo() - && item->isComplete()) + && item->isFinished()) { LLPointer new_item = new LLViewerInventoryItem(item); diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 945d2d26da..7f28e09933 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -413,7 +413,7 @@ void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_i // This instance will be deleted in LLInitialFriendCardsFetch::done(). LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(folder_id, cb); fetch->startFetch(); - if(fetch->isEverythingComplete()) + if(fetch->isFinished()) { // everything is already here - call done. fetch->done(); diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 034806acfc..3d38ff3730 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -1031,9 +1031,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs, else { // Watch this item and set gesture name when item exists in inventory - uuid_vec_t ids; - ids.push_back(item_id); - self.setItems(ids); + self.setFetchID(item_id); self.startFetch(); } self.mActive[item_id] = gesture; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 82043ab523..87b3c2e835 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1133,7 +1133,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) void LLItemBridge::selectItem() { LLViewerInventoryItem* item = static_cast(getItem()); - if(item && !item->isComplete()) + if(item && !item->isFinished()) { item->fetchFromServer(); } @@ -2037,7 +2037,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done() outfit->startFetch(); outfit->done(); //Not interested in waiting and this will be right 99% of the time. //Uncomment the following code for laggy Inventory UI. -/* if(outfit->isEverythingComplete()) +/* if(outfit->isFinished()) { // everything is already here - call done. outfit->done(); @@ -2734,7 +2734,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); fetch->startFetch(); inc_busy_count(); - if(fetch->isEverythingComplete()) + if(fetch->isFinished()) { // everything is already here - call done. fetch->done(); @@ -3195,7 +3195,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, else if(LLToolDragAndDrop::SOURCE_LIBRARY == source) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; - if(item && item->isComplete()) + if(item && item->isFinished()) { accept = TRUE; if(drop) @@ -4054,7 +4054,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) { rez_attachment(item, NULL); } - else if(item && item->isComplete()) + else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. LLPointer cb = new RezAttachmentCallback(0); @@ -4687,7 +4687,7 @@ BOOL LLWearableBridge::canWearOnAvatar(void* user_data) if(!self->isAgentInventory()) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); - if(!item || !item->isComplete()) return FALSE; + if(!item || !item->isFinished()) return FALSE; } return (!get_is_item_worn(self->mUUID)); } @@ -5307,7 +5307,7 @@ public: // must be in the inventory library. copy it to our inventory // and put it on right away. LLViewerInventoryItem* item = getItem(); - if(item && item->isComplete()) + if(item && item->isFinished()) { LLPointer cb = new WearOnAvatarCallback(); copy_inventory_item( diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index fecd18b4bb..ab32db9c8e 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -71,6 +71,36 @@ LLInventoryObserver::~LLInventoryObserver() { } +LLInventoryFetchObserver::LLInventoryFetchObserver(const LLUUID& id) +{ + mIDs.clear(); + if (id != LLUUID::null) + { + setFetchID(id); + } +} + +LLInventoryFetchObserver::LLInventoryFetchObserver(const uuid_vec_t& ids) +{ + setFetchIDs(ids); +} + +BOOL LLInventoryFetchObserver::isFinished() const +{ + return mIncomplete.empty(); +} + +void LLInventoryFetchObserver::setFetchIDs(const uuid_vec_t& ids) +{ + mIDs = ids; +} +void LLInventoryFetchObserver::setFetchID(const LLUUID& id) +{ + mIDs.clear(); + mIDs.push_back(id); +} + + void LLInventoryCompletionObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as @@ -79,13 +109,13 @@ void LLInventoryCompletionObserver::changed(U32 mask) { for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { - LLViewerInventoryItem* item = gInventory.getItem(*it); + const LLViewerInventoryItem* item = gInventory.getItem(*it); if(!item) { it = mIncomplete.erase(it); continue; } - if(item->isComplete()) + if(item->isFinished()) { mComplete.push_back(*it); it = mIncomplete.erase(it); @@ -108,13 +138,16 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id) } } -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(bool retry_if_missing) : +/* +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(BOOL retry_if_missing) : mRetryIfMissing(retry_if_missing) { } +*/ LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id, - bool retry_if_missing) : + BOOL retry_if_missing) : + LLInventoryFetchObserver(item_id), mRetryIfMissing(retry_if_missing) { mIDs.clear(); @@ -122,8 +155,8 @@ LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_ } LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, - bool retry_if_missing) : - mIDs(item_ids), + BOOL retry_if_missing) : + LLInventoryFetchObserver(item_ids), mRetryIfMissing(retry_if_missing) { } @@ -155,7 +188,7 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) } continue; } - if(item->isComplete()) + if(item->isFinished()) { mComplete.push_back(*it); it = mIncomplete.erase(it); @@ -172,9 +205,8 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) //llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; } -bool LLInventoryFetchItemsObserver::isEverythingComplete() const +void LLInventoryFetchItemsObserver::done() { - return mIncomplete.empty(); } void fetch_items_from_llsd(const LLSD& items_llsd) @@ -247,7 +279,7 @@ void LLInventoryFetchItemsObserver::startFetch() LLViewerInventoryItem* item = gInventory.getItem(*it); if(item) { - if(item->isComplete()) + if(item->isFinished()) { // It's complete, so put it on the complete container. mComplete.push_back(*it); @@ -277,32 +309,28 @@ void LLInventoryFetchItemsObserver::startFetch() fetch_items_from_llsd(items_llsd); } -LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver() -{ -} - -LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const LLUUID& cat_id) +LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const LLUUID& cat_id) : + LLInventoryFetchObserver(cat_id) { - mIDs.clear(); - mIDs.push_back(cat_id); } LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids) : - mIDs(cat_ids) + LLInventoryFetchObserver(cat_ids) { } + // virtual void LLInventoryFetchDescendentsObserver::changed(U32 mask) { for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();) { - LLViewerInventoryCategory* cat = gInventory.getCategory(*it); + const LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if(!cat) { it = mIncomplete.erase(it); continue; } - if(isComplete(cat)) + if(isCategoryComplete(cat)) { mComplete.push_back(*it); it = mIncomplete.erase(it); @@ -322,7 +350,7 @@ void LLInventoryFetchDescendentsObserver::startFetch() { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); if(!cat) continue; - if(!isComplete(cat)) + if(!isCategoryComplete(cat)) { cat->fetch(); //blindly fetch it without seeing if anything else is fetching it. mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer. @@ -334,19 +362,14 @@ void LLInventoryFetchDescendentsObserver::startFetch() } } -bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const -{ - return mIncomplete.empty(); -} - -bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat) +BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInventoryCategory* cat) const { const S32 version = cat->getVersion(); const S32 expected_num_descendents = cat->getDescendentCount(); if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) || (expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)) { - return false; + return FALSE; } // it might be complete - check known descendents against // currently available. @@ -360,14 +383,14 @@ bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* // that the cat just doesn't have any items or subfolders). // Unrecoverable, so just return done so that this observer can be cleared // from memory. - return true; + return TRUE; } const S32 current_num_known_descendents = cats->count() + items->count(); // Got the number of descendents that we were expecting, so we're done. if (current_num_known_descendents == expected_num_descendents) { - return true; + return TRUE; } // Error condition, but recoverable. This happens if something was added to the @@ -376,10 +399,10 @@ bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* if (current_num_known_descendents >= expected_num_descendents) { llwarns << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << llendl; - cat->setDescendentCount(current_num_known_descendents); - return true; + const_cast(cat)->setDescendentCount(current_num_known_descendents); + return TRUE; } - return false; + return FALSE; } void LLInventoryFetchComboObserver::changed(U32 mask) @@ -394,7 +417,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask) it = mIncompleteItems.erase(it); continue; } - if(item->isComplete()) + if(item->isFinished()) { mCompleteItems.push_back(*it); it = mIncompleteItems.erase(it); @@ -424,7 +447,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask) } if(!mDone && mIncompleteItems.empty() && mIncompleteFolders.empty()) { - mDone = true; + mDone = TRUE; done(); } } @@ -464,7 +487,7 @@ void LLInventoryFetchComboObserver::startFetch(const uuid_vec_t& folder_ids, lldebugs << "uanble to find item " << *iit << llendl; continue; } - if(item->isComplete()) + if(item->isFinished()) { // It's complete, so put it on the complete container. mCompleteItems.push_back(*iit); diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 420afdfadc..7480b7e7af 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -73,57 +73,70 @@ public: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryFetchItemsObserver +// Class LLInventoryFetchObserver // -// Fetches inventory items, calls done() when all inventory has arrived. +// Abstract class to handle fetching items, folders, etc. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryFetchItemsObserver : public LLInventoryObserver +class LLInventoryFetchObserver : public LLInventoryObserver { public: - LLInventoryFetchItemsObserver(bool retry_if_missing = false); // deprecated - LLInventoryFetchItemsObserver(const LLUUID& item_id, bool retry_if_missing = false); // single item - LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, bool retry_if_missing = false); // multiple items - virtual void changed(U32 mask); + LLInventoryFetchObserver(const LLUUID& id = LLUUID::null); // single item + LLInventoryFetchObserver(const uuid_vec_t& ids); // multiple items + void setFetchID(const LLUUID& id); + void setFetchIDs(const uuid_vec_t& ids); - bool isEverythingComplete() const; - void setItems(const uuid_vec_t& ids) { mIDs = ids; } - void startFetch(); + BOOL isFinished() const; - virtual void done() {}; + virtual void startFetch() = 0; + virtual void done() = 0; + virtual void changed(U32 mask) = 0; protected: - bool mRetryIfMissing; uuid_vec_t mComplete; uuid_vec_t mIncomplete; uuid_vec_t mIDs; }; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryFetchItemsObserver +// +// Fetches inventory items, calls done() when all inventory has arrived. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver +{ +public: + // LLInventoryFetchItemsObserver(BOOL retry_if_missing = FALSE); + LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null, + BOOL retry_if_missing = FALSE); + LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, + BOOL retry_if_missing = FALSE); + + /*virtual*/ void startFetch(); + /*virtual*/ void changed(U32 mask); + /*virtual*/ void done(); + +protected: + BOOL mRetryIfMissing; +}; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryFetchDescendentsObserver // // Fetches children of a category/folder, calls done() when all // inventory has arrived. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryFetchDescendentsObserver : public LLInventoryObserver +class LLInventoryFetchDescendentsObserver : public LLInventoryFetchObserver { public: - LLInventoryFetchDescendentsObserver(); - LLInventoryFetchDescendentsObserver(const LLUUID& cat_id); + // LLInventoryFetchDescendentsObserver(); + LLInventoryFetchDescendentsObserver(const LLUUID& cat_id = LLUUID::null); LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids); - virtual void changed(U32 mask); - - void setFolders(const uuid_vec_t& cat_ids) { mIDs = cat_ids; } - void setFolders(const LLUUID& cat_id) { mIDs.clear(); mIDs.push_back(cat_id); } - void startFetch(); - bool isEverythingComplete() const; - virtual void done() = 0; + /*virtual*/ void startFetch(); + /*virtual*/ void changed(U32 mask); protected: - bool isComplete(LLViewerInventoryCategory* cat); - uuid_vec_t mIncomplete; - uuid_vec_t mComplete; - uuid_vec_t mIDs; + BOOL isCategoryComplete(const LLViewerInventoryCategory* cat) const; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -137,7 +150,7 @@ protected: class LLInventoryFetchComboObserver : public LLInventoryObserver { public: - LLInventoryFetchComboObserver() : mDone(false) {} + LLInventoryFetchComboObserver() : mDone(FALSE) {} virtual void changed(U32 mask); void startFetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index c6c2d23a4b..f3ad4b6890 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -901,7 +901,7 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata) { rez_attachment(item, attachmentp); } - else if(item && item->isComplete()) + else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. LLPointer cb = new RezAttachmentCallback(attachmentp); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index e93293a0f0..270999e560 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -482,9 +482,9 @@ void LLPanelOutfitEdit::updateLookInfo() { mLookContents->clearRows(); - mFetchLook->setFolders(mLookID); + mFetchLook->setFetchID(mLookID); mFetchLook->startFetch(); - if (mFetchLook->isEverythingComplete()) + if (mFetchLook->isFinished()) { mFetchLook->done(); } diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index d0db77dcbe..dd31a62642 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -138,7 +138,7 @@ void LLPreview::onCommit() const LLViewerInventoryItem *item = dynamic_cast(getItem()); if(item) { - if (!item->isComplete()) + if (!item->isFinished()) { // We are attempting to save an item that was never loaded llwarns << "LLPreview::onCommit() called with mIsComplete == FALSE" diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index fce90e4c44..2e061b235d 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -141,7 +141,7 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob // this will call refresh when we have everything. LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem(); - if (item && !item->isComplete()) + if (item && !item->isFinished()) { LLInventoryGestureAvailable* observer; observer = new LLInventoryGestureAvailable(); @@ -648,7 +648,7 @@ void LLPreviewGesture::refresh() LLPreview::refresh(); // If previewing or item is incomplete, all controls are disabled LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); - bool is_complete = (item && item->isComplete()) ? true : false; + bool is_complete = (item && item->isFinished()) ? true : false; if (mPreviewGesture || !is_complete) { diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 6b0e524f8c..7b926f468d 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1823,7 +1823,7 @@ void LLLiveLSLEditor::saveIfNeeded() return; } - if(mItem.isNull() || !mItem->isComplete()) + if(mItem.isNull() || !mItem->isFinished()) { // $NOTE: While the error message may not be exactly correct, // it's pretty close. diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 6dd4dc1ce7..88043365db 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -396,7 +396,7 @@ void LLSidepanelAppearance::fetchInventory() fetch_worn->startFetch(); // If no items to be fetched, done will never be triggered. // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. - if (fetch_worn->isEverythingComplete()) + if (fetch_worn->isFinished()) { fetch_worn->done(); } diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 9b073943b4..0ec351965a 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -236,7 +236,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) if (!item) return; // do not enable the UI for incomplete items. - BOOL is_complete = item->isComplete(); + BOOL is_complete = item->isFinished(); const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType()); const BOOL is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD); const LLPermissions& perm = item->getPermissions(); @@ -743,7 +743,7 @@ void LLSidepanelItemInfo::onCommitPermissions() CheckNextOwnerTransfer->get(), PERM_TRANSFER); } if(perm != item->getPermissions() - && item->isComplete()) + && item->isFinished()) { LLPointer new_item = new LLViewerInventoryItem(item); new_item->setPermissions(perm); @@ -873,7 +873,7 @@ void LLSidepanelItemInfo::updateSaleInfo() sale_info.setSaleType(LLSaleInfo::FS_NOT); } if(sale_info != item->getSaleInfo() - && item->isComplete()) + && item->isFinished()) { LLPointer new_item = new LLViewerInventoryItem(item); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 340327a1e2..83a97c1ab1 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1771,7 +1771,7 @@ bool idle_startup() } } // no need to add gesture to inventory observer, it's already made in constructor - LLGestureMgr::instance().setItems(item_ids); + LLGestureMgr::instance().setFetchIDs(item_ids); LLGestureMgr::instance().startFetch(); } } diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index cc90b0753f..8f2e82914a 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -287,7 +287,7 @@ void LLCategoryDropObserver::done() } delete this; } - +/* Doesn't seem to be used anymore. class LLCategoryDropDescendentsObserver : public LLInventoryFetchDescendentsObserver { public: @@ -335,7 +335,7 @@ void LLCategoryDropDescendentsObserver::done() LLCategoryDropObserver* dropper; dropper = new LLCategoryDropObserver(ids, mObjectID, mSource); dropper->startFetch(); - if (dropper->isEverythingComplete()) + if (dropper->isDone()) { dropper->done(); } @@ -346,6 +346,7 @@ void LLCategoryDropDescendentsObserver::done() } delete this; } +*/ LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none, dragOrDrop3dImpl f_self, @@ -1205,7 +1206,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return; + if (!item || !item->isFinished()) return; //if (regionp // && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX)) @@ -1836,7 +1837,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL if (!item || !obj) return ACCEPT_NO; // HACK: downcast LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item; - if (!vitem->isComplete()) return ACCEPT_NO; + if (!vitem->isFinished()) return ACCEPT_NO; if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links // deny attempts to drop from an object onto itself. This is to @@ -1996,7 +1997,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; // must not be in the trash const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); @@ -2045,7 +2046,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID())) { @@ -2107,7 +2108,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID())) { return ACCEPT_NO; @@ -2186,7 +2187,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; EAcceptance rv = willObjectAcceptInventory(obj, item); if (drop && (ACCEPT_YES_SINGLE <= rv)) { @@ -2224,7 +2225,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; EAcceptance rv = willObjectAcceptInventory(obj, item); if ((mask & MASK_CONTROL)) { @@ -2289,7 +2290,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) { @@ -2344,7 +2345,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) { @@ -2452,7 +2453,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; LLViewerObject* root_object = obj; if (obj && obj->getParent()) { @@ -2580,7 +2581,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( } LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource); dropper->startFetch(); - if (dropper->isEverythingComplete()) + if (dropper->isFinished()) { dropper->done(); } @@ -2611,7 +2612,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { // cannot give away no-transfer objects @@ -2645,7 +2646,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (!isInventoryGiveAcceptable(item)) { return ACCEPT_NO; @@ -2684,7 +2685,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( LLViewerInventoryItem* item = NULL; LLViewerInventoryCategory* cat = NULL; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if (!gAgent.allowOperation(PERM_COPY, item->getPermissions()) || !item->getPermissions().allowTransferTo(LLUUID::null)) @@ -2705,7 +2706,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isComplete()) return ACCEPT_NO; + if (!item || !item->isFinished()) return ACCEPT_NO; if ((mask & MASK_CONTROL)) { // *HACK: In order to resolve SL-22177, we need to block drags diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 2db88c2ff8..9d449399e8 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -138,7 +138,7 @@ public: bool importFileLocal(LLFILE* fp); // new methods - BOOL isComplete() const { return mIsComplete; } + BOOL isFinished() const { return mIsComplete; } void setComplete(BOOL complete) { mIsComplete = complete; } //void updateAssetOnServer() const; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 35eb3390a5..e800611914 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1209,7 +1209,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // so we can fetch it out of our inventory. LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string); open_agent_offer->startFetch(); - if(catp || (itemp && itemp->isComplete())) + if(catp || (itemp && itemp->isFinished())) { open_agent_offer->done(); } @@ -1272,7 +1272,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& LLDiscardAgentOffer* discard_agent_offer; discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); discard_agent_offer->startFetch(folders, items); - if(catp || (itemp && itemp->isComplete())) + if(catp || (itemp && itemp->isFinished())) { discard_agent_offer->done(); } @@ -1605,7 +1605,7 @@ void inventory_offer_handler(LLOfferInfo* info) // Prefetch the item into your local inventory. LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); fetch_item->startFetch(); - if(fetch_item->isEverythingComplete()) + if(fetch_item->isFinished()) { fetch_item->done(); } @@ -2927,7 +2927,7 @@ BOOL LLPostTeleportNotifiers::tick() { LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders); fetcher->startFetch(); - if(fetcher->isEverythingComplete()) + if(fetcher->isFinished()) { fetcher->done(); } -- cgit v1.2.3 From e9f06764412af37023f45c4d83b2b97c48d2a13e Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 7 Apr 2010 11:15:27 -0400 Subject: EXT-6728 : Have LLInventoryFetchItems/DescendentsObserver inherit from a base abstract LLInventoryFetchObserver class Minor cleanup of LLInventoryFetchComboObserver --- indra/newview/llinventoryobserver.cpp | 123 ++++++++++++++++++---------------- indra/newview/llinventoryobserver.h | 59 +++++++--------- indra/newview/lltooldraganddrop.cpp | 12 ++-- indra/newview/llviewermessage.cpp | 13 ++-- 4 files changed, 100 insertions(+), 107 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index ab32db9c8e..35bd06125f 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -105,17 +105,17 @@ void LLInventoryCompletionObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as // appropriate. - if(!mIncomplete.empty()) + if (!mIncomplete.empty()) { - for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) + for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { const LLViewerInventoryItem* item = gInventory.getItem(*it); - if(!item) + if (!item) { it = mIncomplete.erase(it); continue; } - if(item->isFinished()) + if (item->isFinished()) { mComplete.push_back(*it); it = mIncomplete.erase(it); @@ -123,7 +123,7 @@ void LLInventoryCompletionObserver::changed(U32 mask) } ++it; } - if(mIncomplete.empty()) + if (mIncomplete.empty()) { done(); } @@ -132,7 +132,7 @@ void LLInventoryCompletionObserver::changed(U32 mask) void LLInventoryCompletionObserver::watchItem(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { mIncomplete.push_back(id); } @@ -165,12 +165,12 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as // appropriate. - if(!mIncomplete.empty()) + if (!mIncomplete.empty()) { - for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) + for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { LLViewerInventoryItem* item = gInventory.getItem(*it); - if(!item) + if (!item) { if (mRetryIfMissing) { @@ -188,7 +188,7 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) } continue; } - if(item->isFinished()) + if (item->isFinished()) { mComplete.push_back(*it); it = mIncomplete.erase(it); @@ -196,7 +196,7 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) } ++it; } - if(mIncomplete.empty()) + if (mIncomplete.empty()) { done(); } @@ -246,7 +246,7 @@ void fetch_items_from_llsd(const LLSD& items_llsd) for (S32 j=0; jnewMessageFast(_PREHASH_FetchInventory); @@ -257,13 +257,13 @@ void fetch_items_from_llsd(const LLSD& items_llsd) msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_OwnerID, item_entry["owner_id"].asUUID()); msg->addUUIDFast(_PREHASH_ItemID, item_entry["item_id"].asUUID()); - if(msg->isSendFull(NULL)) + if (msg->isSendFull(NULL)) { start_new_message = TRUE; gAgent.sendReliableMessage(); } } - if(!start_new_message) + if (!start_new_message) { gAgent.sendReliableMessage(); } @@ -274,12 +274,12 @@ void LLInventoryFetchItemsObserver::startFetch() { LLUUID owner_id; LLSD items_llsd; - for(uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it) + for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it) { LLViewerInventoryItem* item = gInventory.getItem(*it); - if(item) + if (item) { - if(item->isFinished()) + if (item->isFinished()) { // It's complete, so put it on the complete container. mComplete.push_back(*it); @@ -322,15 +322,15 @@ LLInventoryFetchDescendentsObserver::LLInventoryFetchDescendentsObserver(const u // virtual void LLInventoryFetchDescendentsObserver::changed(U32 mask) { - for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();) + for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();) { const LLViewerInventoryCategory* cat = gInventory.getCategory(*it); - if(!cat) + if (!cat) { it = mIncomplete.erase(it); continue; } - if(isCategoryComplete(cat)) + if (isCategoryComplete(cat)) { mComplete.push_back(*it); it = mIncomplete.erase(it); @@ -338,7 +338,7 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask) } ++it; } - if(mIncomplete.empty()) + if (mIncomplete.empty()) { done(); } @@ -346,11 +346,11 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask) void LLInventoryFetchDescendentsObserver::startFetch() { - for(uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it) + for (uuid_vec_t::const_iterator it = mIDs.begin(); it != mIDs.end(); ++it) { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); - if(!cat) continue; - if(!isCategoryComplete(cat)) + if (!cat) continue; + if (!isCategoryComplete(cat)) { cat->fetch(); //blindly fetch it without seeing if anything else is fetching it. mIncomplete.push_back(*it); //Add to list of things being downloaded for this observer. @@ -376,7 +376,7 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven LLInventoryModel::cat_array_t* cats; LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items); - if(!cats || !items) + if (!cats || !items) { llwarns << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << llendl; // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean @@ -405,19 +405,27 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven return FALSE; } +LLInventoryFetchComboObserver::LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids, + const uuid_vec_t& item_ids) : + mFolderIDs(folder_ids), + mItemIDs(item_ids), + mDone(FALSE) +{ +} + void LLInventoryFetchComboObserver::changed(U32 mask) { - if(!mIncompleteItems.empty()) + if (!mIncompleteItems.empty()) { - for(uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); ) + for (uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); ) { LLViewerInventoryItem* item = gInventory.getItem(*it); - if(!item) + if (!item) { it = mIncompleteItems.erase(it); continue; } - if(item->isFinished()) + if (item->isFinished()) { mCompleteItems.push_back(*it); it = mIncompleteItems.erase(it); @@ -426,17 +434,17 @@ void LLInventoryFetchComboObserver::changed(U32 mask) ++it; } } - if(!mIncompleteFolders.empty()) + if (!mIncompleteFolders.empty()) { - for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) + for (uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) { LLViewerInventoryCategory* cat = gInventory.getCategory(*it); - if(!cat) + if (!cat) { it = mIncompleteFolders.erase(it); continue; } - if(gInventory.isCategoryComplete(*it)) + if (gInventory.isCategoryComplete(*it)) { mCompleteFolders.push_back(*it); it = mIncompleteFolders.erase(it); @@ -445,22 +453,21 @@ void LLInventoryFetchComboObserver::changed(U32 mask) ++it; } } - if(!mDone && mIncompleteItems.empty() && mIncompleteFolders.empty()) + if (!mDone && mIncompleteItems.empty() && mIncompleteFolders.empty()) { mDone = TRUE; done(); } } -void LLInventoryFetchComboObserver::startFetch(const uuid_vec_t& folder_ids, - const uuid_vec_t& item_ids) +void LLInventoryFetchComboObserver::startFetch() { lldebugs << "LLInventoryFetchComboObserver::startFetch()" << llendl; - for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) + for (uuid_vec_t::const_iterator fit = mFolderIDs.begin(); fit != mFolderIDs.end(); ++fit) { LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); - if(!cat) continue; - if(!gInventory.isCategoryComplete(*fit)) + if (!cat) continue; + if (!gInventory.isCategoryComplete(*fit)) { cat->fetch(); lldebugs << "fetching folder " << *fit <isFinished()) + if (item->isFinished()) { // It's complete, so put it on the complete container. mCompleteItems.push_back(*iit); @@ -499,7 +506,7 @@ void LLInventoryFetchComboObserver::startFetch(const uuid_vec_t& folder_ids, mIncompleteItems.push_back(*iit); owner_id = item->getPermissions().getOwner(); } - if(std::find(mIncompleteFolders.begin(), mIncompleteFolders.end(), item->getParentUUID()) == mIncompleteFolders.end()) + if (std::find(mIncompleteFolders.begin(), mIncompleteFolders.end(), item->getParentUUID()) == mIncompleteFolders.end()) { LLSD item_entry; item_entry["owner_id"] = owner_id; @@ -516,7 +523,7 @@ void LLInventoryFetchComboObserver::startFetch(const uuid_vec_t& folder_ids, void LLInventoryExistenceObserver::watchItem(const LLUUID& id) { - if(id.notNull()) + if (id.notNull()) { mMIA.push_back(id); } @@ -526,12 +533,12 @@ void LLInventoryExistenceObserver::changed(U32 mask) { // scan through the incomplete items and move or erase them as // appropriate. - if(!mMIA.empty()) + if (!mMIA.empty()) { - for(uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); ) + for (uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); ) { LLViewerInventoryItem* item = gInventory.getItem(*it); - if(!item) + if (!item) { ++it; continue; @@ -539,7 +546,7 @@ void LLInventoryExistenceObserver::changed(U32 mask) mExist.push_back(*it); it = mMIA.erase(it); } - if(mMIA.empty()) + if (mMIA.empty()) { done(); } @@ -548,7 +555,7 @@ void LLInventoryExistenceObserver::changed(U32 mask) void LLInventoryAddedObserver::changed(U32 mask) { - if(!(mask & LLInventoryObserver::ADD)) + if (!(mask & LLInventoryObserver::ADD)) { return; } @@ -580,7 +587,7 @@ void LLInventoryAddedObserver::changed(U32 mask) LLPointer titem = new LLViewerInventoryItem; S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); - for(S32 i = 0; i < num_blocks; ++i) + for (S32 i = 0; i < num_blocks; ++i) { titem->unpackMessage(msg, _PREHASH_InventoryData, i); if (!(titem->getUUID().isNull())) @@ -602,18 +609,18 @@ LLInventoryTransactionObserver::LLInventoryTransactionObserver(const LLTransacti void LLInventoryTransactionObserver::changed(U32 mask) { - if(mask & LLInventoryObserver::ADD) + if (mask & LLInventoryObserver::ADD) { // This could be it - see if we are processing a bulk update LLMessageSystem* msg = gMessageSystem; - if(msg->getMessageName() + if (msg->getMessageName() && (0 == strcmp(msg->getMessageName(), "BulkUpdateInventory"))) { // we have a match for the message - now check the // transaction id. LLUUID id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, id); - if(id == mTransactionID) + if (id == mTransactionID) { // woo hoo, we found it uuid_vec_t folders; @@ -621,19 +628,19 @@ void LLInventoryTransactionObserver::changed(U32 mask) S32 count; count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); S32 i; - for(i = 0; i < count; ++i) + for (i = 0; i < count; ++i) { msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_FolderID, id, i); - if(id.notNull()) + if (id.notNull()) { folders.push_back(id); } } count = msg->getNumberOfBlocksFast(_PREHASH_ItemData); - for(i = 0; i < count; ++i) + for (i = 0; i < count; ++i) { msg->getUUIDFast(_PREHASH_ItemData, _PREHASH_ItemID, id, i); - if(id.notNull()) + if (id.notNull()) { items.push_back(id); } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 7480b7e7af..e4ae9097bd 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -97,7 +97,6 @@ protected: uuid_vec_t mIDs; }; - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryFetchItemsObserver // @@ -106,7 +105,6 @@ protected: class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver { public: - // LLInventoryFetchItemsObserver(BOOL retry_if_missing = FALSE); LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null, BOOL retry_if_missing = FALSE); LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, @@ -129,7 +127,6 @@ protected: class LLInventoryFetchDescendentsObserver : public LLInventoryFetchObserver { public: - // LLInventoryFetchDescendentsObserver(); LLInventoryFetchDescendentsObserver(const LLUUID& cat_id = LLUUID::null); LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids); @@ -142,46 +139,44 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryFetchComboObserver // -// This class does an appropriate combination of fetch descendents and -// item fetches based on completion of categories and items. Much like -// the fetch and fetch descendents, this will call done() when everything -// has arrived. +// Does an appropriate combination of fetch descendents and +// item fetches based on completion of categories and items. Much like +// the fetch and fetch descendents, this will call done() when everything +// has arrived. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLInventoryFetchComboObserver : public LLInventoryObserver { public: - LLInventoryFetchComboObserver() : mDone(FALSE) {} - virtual void changed(U32 mask); - - void startFetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); + LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids, + const uuid_vec_t& item_ids); + /*virtual*/ void changed(U32 mask); + void startFetch(); virtual void done() = 0; - protected: - bool mDone; + BOOL mDone; uuid_vec_t mCompleteFolders; uuid_vec_t mIncompleteFolders; uuid_vec_t mCompleteItems; uuid_vec_t mIncompleteItems; + + uuid_vec_t mItemIDs; + uuid_vec_t mFolderIDs; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryExistenceObserver // -// This class is used as a base class for doing somethign when all the -// observed item ids exist in the inventory somewhere. You can derive -// a class from this class and implement the done() method to do -// something useful. +// Used as a base class for doing something when all the +// observed item ids exist in the inventory somewhere. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryExistenceObserver : public LLInventoryObserver { public: LLInventoryExistenceObserver() {} - virtual void changed(U32 mask); + /*virtual*/ void changed(U32 mask); void watchItem(const LLUUID& id); - protected: virtual void done() = 0; uuid_vec_t mExist; @@ -191,18 +186,14 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryAddedObserver // -// This class is used as a base class for doing something when -// a new item arrives in inventory. -// It does not watch for a certain UUID, rather it acts when anything is added -// Derive a class from this class and implement the done() method to do -// something useful. +// Base class for doing something when a new item arrives in inventory. +// It does not watch for a certain UUID, rather it acts when anything is added //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryAddedObserver : public LLInventoryObserver { public: LLInventoryAddedObserver() : mAdded() {} - virtual void changed(U32 mask); + /*virtual*/ void changed(U32 mask); protected: virtual void done() = 0; @@ -213,18 +204,15 @@ protected: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryTransactionObserver // -// Class which can be used as a base class for doing something when an -// inventory transaction completes. -// -// *NOTE: This class is not quite complete. Avoid using unless you fix up it's -// functionality gaps. +// Base class for doing something when an inventory transaction completes. +// NOTE: This class is not quite complete. Avoid using unless you fix up its +// functionality gaps. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryTransactionObserver : public LLInventoryObserver { public: LLInventoryTransactionObserver(const LLTransactionID& transaction_id); - virtual void changed(U32 mask); + /*virtual*/ void changed(U32 mask); protected: virtual void done(const uuid_vec_t& folders, const uuid_vec_t& items) = 0; @@ -240,12 +228,11 @@ protected: // and declares a new method named done() which is called when all watched items // have complete information in the inventory model. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryCompletionObserver : public LLInventoryObserver { public: LLInventoryCompletionObserver() {} - virtual void changed(U32 mask); + /*virtual*/ void changed(U32 mask); void watchItem(const LLUUID& id); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 8f2e82914a..a67067d29c 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -235,7 +235,10 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item) class LLCategoryFireAndForget : public LLInventoryFetchComboObserver { public: - LLCategoryFireAndForget() {} + LLCategoryFireAndForget(const uuid_vec_t& folder_ids, + const uuid_vec_t& item_ids) : + LLInventoryFetchComboObserver(folder_ids, item_ids) + {} ~LLCategoryFireAndForget() {} virtual void done() { @@ -482,8 +485,8 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, } if (!folder_ids.empty() || !item_ids.empty()) { - LLCategoryFireAndForget fetcher; - fetcher.startFetch(folder_ids, item_ids); + LLCategoryFireAndForget fetcher(folder_ids, item_ids); + fetcher.startFetch(); } } } @@ -552,8 +555,7 @@ void LLToolDragAndDrop::beginMultiDrag( uuid_vec_t item_ids; std::back_insert_iterator copier(folder_ids); std::copy(cat_ids.begin(), cat_ids.end(), copier); - LLCategoryFireAndForget fetcher; - fetcher.startFetch(folder_ids, item_ids); + LLCategoryFireAndForget fetcher(folder_ids, item_ids); } } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e800611914..1afbca81c3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -757,11 +757,12 @@ void start_new_inventory_observer() } } -class LLDiscardAgentOffer : public LLInventoryFetchComboObserver +class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver { LOG_CLASS(LLDiscardAgentOffer); public: LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) : + LLInventoryFetchItemsObserver(object_id), mFolderID(folder_id), mObjectID(object_id) {} virtual ~LLDiscardAgentOffer() {} @@ -1266,13 +1267,9 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // Disabled logging to old chat floater to fix crash in group notices - EXT-4149 // LLFloaterChat::addChatHistory(chat); - uuid_vec_t folders; - uuid_vec_t items; - items.push_back(mObjectID); - LLDiscardAgentOffer* discard_agent_offer; - discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); - discard_agent_offer->startFetch(folders, items); - if(catp || (itemp && itemp->isFinished())) + LLDiscardAgentOffer* discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); + discard_agent_offer->startFetch(); + if (catp || (itemp && itemp->isFinished())) { discard_agent_offer->done(); } -- cgit v1.2.3 From 5d3de2ea03ff500690acec13fd4b403dc8a72088 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 7 Apr 2010 13:30:21 -0400 Subject: EXT-6745 : Refactor LLFetchComboObserver to use LLFetchItems and LLFetchDescedents instead of code duplication Took out a bunch of code duplication from the FetchComboObserver and am using the LLFetchItems/DescendentsObservers instead. Also added some comments and made some minor superficial cleanup to LLInventoryObserver done(). --- indra/newview/llinventoryobserver.cpp | 135 ++++++++-------------------------- indra/newview/llinventoryobserver.h | 23 ++---- indra/newview/lltooldraganddrop.cpp | 8 +- 3 files changed, 44 insertions(+), 122 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 35bd06125f..26fe1904fb 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -205,10 +205,6 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) //llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; } -void LLInventoryFetchItemsObserver::done() -{ -} - void fetch_items_from_llsd(const LLSD& items_llsd) { if (!items_llsd.size()) return; @@ -406,119 +402,50 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven } LLInventoryFetchComboObserver::LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids, - const uuid_vec_t& item_ids) : - mFolderIDs(folder_ids), - mItemIDs(item_ids), - mDone(FALSE) + const uuid_vec_t& item_ids) { -} + mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids); -void LLInventoryFetchComboObserver::changed(U32 mask) -{ - if (!mIncompleteItems.empty()) - { - for (uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); ) - { - LLViewerInventoryItem* item = gInventory.getItem(*it); - if (!item) - { - it = mIncompleteItems.erase(it); - continue; - } - if (item->isFinished()) - { - mCompleteItems.push_back(*it); - it = mIncompleteItems.erase(it); - continue; - } - ++it; - } - } - if (!mIncompleteFolders.empty()) + uuid_vec_t pruned_item_ids; + for (uuid_vec_t::const_iterator item_iter = item_ids.begin(); + item_iter != item_ids.end(); + ++item_iter) { - for (uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();) + const LLUUID& item_id = (*item_iter); + const LLViewerInventoryItem* item = gInventory.getItem(item_id); + if (item && std::find(folder_ids.begin(), folder_ids.end(), item->getParentUUID()) == folder_ids.end()) { - LLViewerInventoryCategory* cat = gInventory.getCategory(*it); - if (!cat) - { - it = mIncompleteFolders.erase(it); - continue; - } - if (gInventory.isCategoryComplete(*it)) - { - mCompleteFolders.push_back(*it); - it = mIncompleteFolders.erase(it); - continue; - } - ++it; + continue; } + pruned_item_ids.push_back(item_id); } - if (!mDone && mIncompleteItems.empty() && mIncompleteFolders.empty()) + + mFetchItems = new LLInventoryFetchItemsObserver(pruned_item_ids); + mFetchDescendents = new LLInventoryFetchDescendentsObserver(folder_ids); +} + +LLInventoryFetchComboObserver::~LLInventoryFetchComboObserver() +{ + mFetchItems->done(); + mFetchDescendents->done(); + delete mFetchItems; + delete mFetchDescendents; +} + +void LLInventoryFetchComboObserver::changed(U32 mask) +{ + mFetchItems->changed(mask); + mFetchDescendents->changed(mask); + if (mFetchItems->isFinished() && mFetchDescendents->isFinished()) { - mDone = TRUE; done(); } } void LLInventoryFetchComboObserver::startFetch() { - lldebugs << "LLInventoryFetchComboObserver::startFetch()" << llendl; - for (uuid_vec_t::const_iterator fit = mFolderIDs.begin(); fit != mFolderIDs.end(); ++fit) - { - LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); - if (!cat) continue; - if (!gInventory.isCategoryComplete(*fit)) - { - cat->fetch(); - lldebugs << "fetching folder " << *fit <isFinished()) - { - // It's complete, so put it on the complete container. - mCompleteItems.push_back(*iit); - lldebugs << "completing item " << *iit << llendl; - continue; - } - else - { - mIncompleteItems.push_back(*iit); - owner_id = item->getPermissions().getOwner(); - } - if (std::find(mIncompleteFolders.begin(), mIncompleteFolders.end(), item->getParentUUID()) == mIncompleteFolders.end()) - { - LLSD item_entry; - item_entry["owner_id"] = owner_id; - item_entry["item_id"] = (*iit); - items_llsd.append(item_entry); - } - else - { - lldebugs << "not worrying about " << *iit << llendl; - } - } - fetch_items_from_llsd(items_llsd); + mFetchItems->startFetch(); + mFetchDescendents->startFetch(); } void LLInventoryExistenceObserver::watchItem(const LLUUID& id) diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index e4ae9097bd..7b4d3dfe7b 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -45,7 +45,6 @@ class LLViewerInventoryCategory; // A simple abstract base class that can relay messages when the inventory // changes. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryObserver { public: @@ -60,7 +59,7 @@ public: ADD = 4, // Something added REMOVE = 8, // Something deleted STRUCTURE = 16, // Structural change (e.g. item or folder moved) - CALLING_CARD = 32, // Calling card change (e.g. online, grant status, cancel) + CALLING_CARD = 32, // Calling card change (e.g. online, grant status, cancel) GESTURE = 64, REBUILD = 128, // Item UI changed (e.g. item type different) SORT = 256, // Folder needs to be resorted. @@ -88,9 +87,8 @@ public: BOOL isFinished() const; virtual void startFetch() = 0; - virtual void done() = 0; virtual void changed(U32 mask) = 0; - + virtual void done() {}; protected: uuid_vec_t mComplete; uuid_vec_t mIncomplete; @@ -112,8 +110,6 @@ public: /*virtual*/ void startFetch(); /*virtual*/ void changed(U32 mask); - /*virtual*/ void done(); - protected: BOOL mRetryIfMissing; }; @@ -140,28 +136,23 @@ protected: // Class LLInventoryFetchComboObserver // // Does an appropriate combination of fetch descendents and -// item fetches based on completion of categories and items. Much like -// the fetch and fetch descendents, this will call done() when everything -// has arrived. +// item fetches based on completion of categories and items. This is optimized +// to not fetch item_ids that are descendents of any of the folder_ids. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLInventoryFetchComboObserver : public LLInventoryObserver { public: LLInventoryFetchComboObserver(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); + ~LLInventoryFetchComboObserver(); /*virtual*/ void changed(U32 mask); void startFetch(); virtual void done() = 0; protected: BOOL mDone; - uuid_vec_t mCompleteFolders; - uuid_vec_t mIncompleteFolders; - uuid_vec_t mCompleteItems; - uuid_vec_t mIncompleteItems; - - uuid_vec_t mItemIDs; - uuid_vec_t mFolderIDs; + LLInventoryFetchItemsObserver *mFetchItems; + LLInventoryFetchDescendentsObserver *mFetchDescendents; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index a67067d29c..774626f19d 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -232,6 +232,9 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item) return allowed; } +// Starts a fetch on folders and items. This is really not used +// as an observer in the traditional sense; we're just using it to +// request a fetch and we don't care about when/if the response arrives. class LLCategoryFireAndForget : public LLInventoryFetchComboObserver { public: @@ -485,8 +488,9 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, } if (!folder_ids.empty() || !item_ids.empty()) { - LLCategoryFireAndForget fetcher(folder_ids, item_ids); - fetcher.startFetch(); + LLCategoryFireAndForget *fetcher = new LLCategoryFireAndForget(folder_ids, item_ids); + fetcher->startFetch(); + delete fetcher; } } } -- cgit v1.2.3 From 516ec63f52245a777725d29efe3c35e4e4e72936 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 7 Apr 2010 14:40:36 -0400 Subject: EXT-6749 : Have all observers persist/retry when items are missing after notifications Added mNumTries and took out mRetryIfMissing --- indra/newview/llagentwearablesfetch.cpp | 2 +- indra/newview/llgesturemgr.cpp | 1 - indra/newview/llinventoryobserver.cpp | 51 ++++++++++++++++++--------------- indra/newview/llinventoryobserver.h | 10 +++---- 4 files changed, 33 insertions(+), 31 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index aafbb0d22c..08d8ccfd23 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -91,7 +91,7 @@ class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver { public: LLFetchAndLinkObserver(uuid_vec_t& ids): - LLInventoryFetchItemsObserver(ids, true) // retry for missing items + LLInventoryFetchItemsObserver(ids) { } ~LLFetchAndLinkObserver() diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 3d38ff3730..0996d09e25 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -73,7 +73,6 @@ LLGestureMgr::LLGestureMgr() mActive(), mLoadingCount(0) { - mRetryIfMissing = true; gInventory.addObserver(this); } diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 26fe1904fb..fb2ef01c8f 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -62,6 +62,14 @@ #include "llsdutil.h" #include +// If the viewer gets a notification, your observer assumes +// that that notification is for itself and then tries to process +// the results. The notification could be for something else (e.g. +// 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; + LLInventoryObserver::LLInventoryObserver() { } @@ -138,66 +146,63 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id) } } -/* -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(BOOL retry_if_missing) : - mRetryIfMissing(retry_if_missing) -{ -} -*/ - -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id, - BOOL retry_if_missing) : +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const LLUUID& item_id) : LLInventoryFetchObserver(item_id), - mRetryIfMissing(retry_if_missing) + mNumTries(MAX_NUM_NOTIFICATIONS_TO_PROCESS) { mIDs.clear(); mIDs.push_back(item_id); } -LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, - BOOL retry_if_missing) : - LLInventoryFetchObserver(item_ids), - mRetryIfMissing(retry_if_missing) +LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids) : + LLInventoryFetchObserver(item_ids) { } void LLInventoryFetchItemsObserver::changed(U32 mask) { + BOOL any_items_missing = FALSE; + // scan through the incomplete items and move or erase them as // appropriate. if (!mIncomplete.empty()) { for (uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); ) { - LLViewerInventoryItem* item = gInventory.getItem(*it); + const LLUUID& item_id = (*it); + LLViewerInventoryItem* item = gInventory.getItem(item_id); if (!item) { - if (mRetryIfMissing) + any_items_missing = TRUE; + if (mNumTries > 0) { - // BAP changed to skip these items, so we should keep retrying until they arrive. - // Did not make this the default behavior because of uncertainty about impact - - // could cause some observers that currently complete to wait forever. + // Keep trying. ++it; } else { - // BUG: This can cause done() to get called prematurely below. - // This happens with the LLGestureInventoryFetchObserver that - // loads gestures at startup. JC + // Just concede that this item hasn't arrived in reasonable time and continue on. + llwarns << "Fetcher timed out when fetching inventory item assetID:" << item_id << llendl; it = mIncomplete.erase(it); } continue; } if (item->isFinished()) { - mComplete.push_back(*it); + mComplete.push_back(item_id); it = mIncomplete.erase(it); continue; } ++it; } + if (any_items_missing) + { + mNumTries--; + } + if (mIncomplete.empty()) { + mNumTries = MAX_NUM_NOTIFICATIONS_TO_PROCESS; done(); } } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 7b4d3dfe7b..ac2eca3477 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -103,15 +103,13 @@ protected: class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver { public: - LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null, - BOOL retry_if_missing = FALSE); - LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, - BOOL retry_if_missing = FALSE); + LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null); + LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids); /*virtual*/ void startFetch(); /*virtual*/ void changed(U32 mask); -protected: - BOOL mRetryIfMissing; +private: + S8 mNumTries; // Number of times changed() was called without success }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From dbe288bf8f14447f7bda5413c7886f539fec2a20 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 7 Apr 2010 16:33:44 -0400 Subject: fixes from automated merge --- indra/newview/llpaneloutfitedit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index dc039486e1..c3def73753 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -376,14 +376,14 @@ void LLPanelOutfitEdit::onEditWearableClicked(void) if(wearable_to_edit) { bool can_modify = false; - bool is_complete = item_to_edit->isComplete(); + bool is_complete = item_to_edit->isFinished(); // if item_to_edit is a link, its properties are not appropriate, // lets get original item with actual properties LLViewerInventoryItem* original_item = gInventory.getItem(wearable_to_edit->getItemID()); if(original_item) { can_modify = original_item->getPermissions().allowModifyBy(gAgentID); - is_complete = original_item->isComplete(); + is_complete = original_item->isFinished(); } if (can_modify && is_complete) -- cgit v1.2.3 From ab246784b069913363e544ab3c9a9fb615e0c71d Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Tue, 13 Apr 2010 13:32:39 +0300 Subject: Fixed normal bug EXT-6034 (Need "View People Icons" option for group IM window) - added new menu item to participant list menu for group and ad-hoc chats. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/225/. --HG-- branch : product-engine --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llcallfloater.cpp | 2 +- indra/newview/llparticipantlist.cpp | 12 +++++++++++- indra/newview/llparticipantlist.h | 3 ++- .../skins/default/xui/en/menu_participant_list.xml | 17 +++++++++++++++-- 5 files changed, 40 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 00c29477ce..2dda853f73 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5395,6 +5395,17 @@ Value 1 + ParticipantListShowIcons + + Comment + Show/hide people icons in participant list + Persist + 1 + Type + Boolean + Value + 1 + PerAccountSettingsFile Comment diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 0b58c8f476..d15c5f9bf4 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -334,7 +334,7 @@ void LLCallFloater::refreshParticipantList() if (!non_avatar_caller) { - mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT); + mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false); mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1)); mParticipants->setSortOrder(LLParticipantList::E_SORT_BY_RECENT_SPEAKERS); diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index dbb8e962bd..026be882ed 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -39,6 +39,7 @@ #include "llparticipantlist.h" #include "llspeakers.h" +#include "llviewercontrol.h" #include "llviewermenu.h" #include "llvoiceclient.h" @@ -50,7 +51,7 @@ static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR; LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/, - bool exclude_agent /*= true*/): + bool exclude_agent /*= true*/, bool can_toggle_icons /*= true*/): mSpeakerMgr(data_source), mAvatarList(avatar_list), mSortOrder(E_SORT_BY_NAME) @@ -87,6 +88,12 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av mAvatarList->setContextMenu(NULL); } + if (use_context_menu && can_toggle_icons) + { + mAvatarList->setShowIcons("ParticipantListShowIcons"); + mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList)); + } + //Lets fill avatarList with existing speakers LLSpeakerMgr::speaker_list_t speaker_list; mSpeakerMgr->getSpeakerList(&speaker_list, true); @@ -113,6 +120,7 @@ LLParticipantList::~LLParticipantList() mAvatarListDoubleClickConnection.disconnect(); mAvatarListRefreshConnection.disconnect(); mAvatarListReturnConnection.disconnect(); + mAvatarListToggleIconsConnection.disconnect(); // It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged() // See ticket EXT-3427 @@ -440,6 +448,8 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu() main_menu->setItemVisible("SortByName", is_sort_visible); main_menu->setItemVisible("SortByRecentSpeakers", is_sort_visible); main_menu->setItemVisible("Moderator Options", isGroupModerator()); + main_menu->setItemVisible("View Icons Separator", mParent.mAvatarListToggleIconsConnection.connected()); + main_menu->setItemVisible("View Icons", mParent.mAvatarListToggleIconsConnection.connected()); main_menu->arrangeAndClear(); return main_menu; diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index d9ca4230a9..953dff4551 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -46,7 +46,7 @@ class LLParticipantList typedef boost::function validate_speaker_callback_t; - LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true); + LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true, bool can_toggle_icons = true); ~LLParticipantList(); void setSpeakingIndicatorsVisible(BOOL visible); @@ -268,6 +268,7 @@ class LLParticipantList boost::signals2::connection mAvatarListDoubleClickConnection; boost::signals2::connection mAvatarListRefreshConnection; boost::signals2::connection mAvatarListReturnConnection; + boost::signals2::connection mAvatarListToggleIconsConnection; LLPointer mSortByRecentSpeakers; validate_speaker_callback_t mValidateSpeakerCallback; diff --git a/indra/newview/skins/default/xui/en/menu_participant_list.xml b/indra/newview/skins/default/xui/en/menu_participant_list.xml index d03a7e3d41..59c7f4ed85 100644 --- a/indra/newview/skins/default/xui/en/menu_participant_list.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_list.xml @@ -82,8 +82,21 @@ function="ParticipantList.EnableItem" parameter="can_pay" /> - + + + + + + Date: Tue, 13 Apr 2010 13:37:14 +0300 Subject: done EXT-6675 Fix TRASH btn on Edit Outfit panel to remove an item from avatar (from COF) Trash button removes from avatar a selected item only of "clothing" and "object" types Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/209/ --HG-- branch : product-engine --- indra/newview/llappearancemgr.cpp | 35 ++++++++++ indra/newview/llappearancemgr.h | 3 + indra/newview/llpaneloutfitedit.cpp | 80 +++++++++------------- indra/newview/llpaneloutfitedit.h | 6 +- .../skins/default/xui/en/panel_outfit_edit.xml | 2 +- 5 files changed, 76 insertions(+), 50 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4a30ba3066..b6fc33e9a2 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -42,8 +42,10 @@ #include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llnotificationsutil.h" +#include "llselectmgr.h" #include "llsidepanelappearance.h" #include "llsidetray.h" +#include "llviewerobjectlist.h" #include "llvoavatar.h" #include "llvoavatarself.h" #include "llviewerregion.h" @@ -1587,6 +1589,39 @@ void LLAppearanceMgr::wearBaseOutfit() updateCOF(base_outfit_id); } +void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) +{ + LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove); + if (!item_to_remove) return; + + switch (item_to_remove->getType()) + { + case LLAssetType::AT_CLOTHING: + if (get_is_item_worn(id_to_remove)) + { + //*TODO move here the exact removing code from LLWearableBridge::removeItemFromAvatar in the future + LLWearableBridge::removeItemFromAvatar(item_to_remove); + } + break; + case LLAssetType::AT_OBJECT: + gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); + gMessageSystem->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_to_remove->getLinkedUUID()); + gMessageSystem->sendReliable( gAgent.getRegion()->getHost()); + + { + // this object might have been selected, so let the selection manager know it's gone now + LLViewerObject *found_obj = gObjectList.findObject(item_to_remove->getLinkedUUID()); + if (found_obj) + { + LLSelectMgr::getInstance()->remove(found_obj); + }; + } + default: break; + } +} + //#define DUMP_CAT_VERBOSE void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg) diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index dffd421898..83261bbbd0 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -135,6 +135,9 @@ public: // @return false if there is no base outfit bool updateBaseOutfit(); + //Remove clothing or detach an object from the agent (a bodypart cannot be removed) + void removeItemFromAvatar(const LLUUID& item_id); + protected: LLAppearanceMgr(); ~LLAppearanceMgr(); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index d1e6d7de42..75a2080f74 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -118,7 +118,7 @@ private: LLPanelOutfitEdit::LLPanelOutfitEdit() : LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL), mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToOutfitBtn(NULL), -mRemoveFromLookBtn(NULL), mLookObserver(NULL) +mRemoveFromOutfitBtn(NULL), mLookObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); @@ -164,14 +164,10 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL); - /* - mLookContents->setDoubleClickCallback(onDoubleClickSpeaker, this); - mLookContents->setCommitOnSelectionChange(TRUE); - mLookContents->setCommitCallback(boost::bind(&LLPanelActiveSpeakers::handleSpeakerSelect, this, _2)); - mLookContents->setSortChangedCallback(boost::bind(&LLPanelActiveSpeakers::onSortChanged, this)); - mLookContents->setContextMenu(LLScrollListCtrl::MENU_AVATAR); - */ - + mLookContents = getChild("look_items_list"); + mLookContents->sortByColumn("look_item_sort", TRUE); + mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); + mInventoryItemsPanel = getChild("inventory_items"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); @@ -207,31 +203,20 @@ BOOL LLPanelOutfitEdit::postBuild() mUpBtn->setEnabled(TRUE); mUpBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onUpClicked, this)); + //*TODO rename mLookContents to mOutfitContents mLookContents = getChild("look_items_list"); mLookContents->sortByColumn("look_item_sort", TRUE); - mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onLookItemSelectionChange, this)); + mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); + + mRemoveFromOutfitBtn = getChild("remove_from_outfit_btn"); + mRemoveFromOutfitBtn->setEnabled(FALSE); + mRemoveFromOutfitBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this)); - /* - LLButton::Params remove_params; - remove_params.name("remove_from_look"); - remove_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this)); - remove_params.label("-"); */ - - //mRemoveFromLookBtn = LLUICtrlFactory::create(remove_params); - mRemoveFromLookBtn = getChild("remove_from_look_btn"); - mRemoveFromLookBtn->setEnabled(FALSE); - mRemoveFromLookBtn->setVisible(FALSE); - //childSetAction("remove_from_look_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this); - mRemoveFromLookBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this)); - //getChild("look_info_group_bar")->addChild(mRemoveFromLookBtn); remove_item_btn - mEditWearableBtn = getChild("edit_wearable_btn"); mEditWearableBtn->setEnabled(FALSE); mEditWearableBtn->setVisible(FALSE); mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this)); - childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this); - childSetAction("revert_btn", boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance())); childSetAction("save_btn", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); @@ -353,27 +338,15 @@ void LLPanelOutfitEdit::onAddToOutfitClicked(void) } -void LLPanelOutfitEdit::onRemoveFromLookClicked(void) +void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) { LLUUID id_to_remove = mLookContents->getSelectionInterface()->getCurrentID(); - LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove); - - if (item_to_remove) - { - // returns null if not a wearable (attachment, etc). - const LLWearable* wearable_to_remove = gAgentWearables.getWearableFromAssetID(item_to_remove->getAssetUUID()); - if (!wearable_to_remove || gAgentWearables.canWearableBeRemoved( wearable_to_remove )) - { - gInventory.purgeObject( id_to_remove ); - updateLookInfo(); - mRemoveFromLookBtn->setEnabled(FALSE); - if (mRemoveFromLookBtn->getVisible()) - { - mRemoveFromLookBtn->setVisible(FALSE); - } - } - } + LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove); + + updateLookInfo(); + + mRemoveFromOutfitBtn->setEnabled(FALSE); } @@ -482,7 +455,7 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::dequeaddChild(mAddToLookBtn); */ } -void LLPanelOutfitEdit::onLookItemSelectionChange(void) +void LLPanelOutfitEdit::onOutfitItemSelectionChange(void) { S32 left_offset = -4; S32 top_offset = -10; @@ -504,7 +477,22 @@ void LLPanelOutfitEdit::onLookItemSelectionChange(void) { mEditWearableBtn->setVisible(TRUE); } - //mLookContents->addChild(mRemoveFromLookBtn); + + + const LLUUID& id_item_to_remove = item->getUUID(); + LLViewerInventoryItem* item_to_remove = gInventory.getItem(id_item_to_remove); + if (!item_to_remove) return; + + switch (item_to_remove->getType()) + { + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_OBJECT: + mRemoveFromOutfitBtn->setEnabled(TRUE); + break; + default: + mRemoveFromOutfitBtn->setEnabled(FALSE); + break; + } } void LLPanelOutfitEdit::changed(U32 mask) diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 1a8d7d2bef..fa92d4c314 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -94,8 +94,8 @@ public: void onSearchEdit(const std::string& string); void onInventorySelectionChange(const std::deque &items, BOOL user_action); void onAddToOutfitClicked(void); - void onLookItemSelectionChange(void); - void onRemoveFromLookClicked(void); + void onOutfitItemSelectionChange(void); + void onRemoveFromOutfitClicked(void); void onEditWearableClicked(void); void onUpClicked(void); @@ -117,7 +117,7 @@ private: LLSaveFolderState* mSavedFolderState; std::string mSearchString; LLButton* mAddToOutfitBtn; - LLButton* mRemoveFromLookBtn; + LLButton* mRemoveFromOutfitBtn; LLButton* mUpBtn; LLButton* mEditWearableBtn; LLToggleableMenu* mSaveMenu; diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index a5e6506463..9ece4aead8 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -211,7 +211,7 @@ image_selected="Toolbar_Middle_Selected" image_unselected="Toolbar_Middle_Off" layout="topleft" - name="trash_btn" + name="remove_from_outfit_btn" right="-1" top="1" width="31" /> -- cgit v1.2.3 From e2d32b9e9d48d0efde92c54c9aaa62fa56671002 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 13 Apr 2010 16:29:33 +0300 Subject: Fixed bug EXT-5415 (Edit floater and object profile show group as "loading..." when set to "none"). Made LLCacheName getGroupName() and getName() methods return TRUE if the given group/avatar name is NULL, so that LLNameBox doesn't display "Loading..." indefinitely. There's nothing to wait for in case of NULL id: the name cache returns a predefined name that won't change (i.e. it's the final result). Reviewed by Mike: https://codereview.productengine.com/secondlife/r/223/ --HG-- branch : product-engine --- indra/llmessage/llcachename.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 9363b3a8d5..9871c922f1 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -486,7 +486,7 @@ BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& las { first = sCacheName["nobody"]; last.clear(); - return FALSE; + return TRUE; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); @@ -530,7 +530,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) if(id.isNull()) { group = sCacheName["none"]; - return FALSE; + return TRUE; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); -- cgit v1.2.3 From 3a5ae14b85d0ba8d562cddaa06f6c0bc0dccde33 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 13 Apr 2010 18:26:36 +0300 Subject: Completed normal subtask EXT-6621 (Code cleanup: Remove unused LLFloaterActiveSpeakers and related classes from viewer) * Removed llfloateractivespeacker.h/cpp from CMakeLists.txt and from the repo. * Removed llmediaremotectrl.h/cpp, llvoiceremotectrl.h/cpp from the repo (were not in CMakeLists.txt). * Unused in 2.0 setings ("ShowVoiceChannelPopup" & "ShowVolumeSettingsPopup") are moved to the end of settings.xml (to not affect 1.23 if remove). * Removed xml files related to Active Speakers floater and old Communication floater (related cpp files have been already removed). Also removed their localized versions. * Also removed old textures related to removed xml and unused in 2.0 anymore. Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/226/ --HG-- branch : product-engine --- indra/newview/CMakeLists.txt | 2 - indra/newview/app_settings/settings.xml | 52 +++++++++++++---------- indra/newview/llbottomtray.cpp | 19 --------- indra/newview/llbottomtray.h | 2 - indra/newview/llviewerfloaterreg.cpp | 3 -- indra/newview/llvoiceclient.cpp | 2 +- indra/newview/skins/default/textures/textures.xml | 20 --------- 7 files changed, 31 insertions(+), 69 deletions(-) (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b3f7a64efb..73e83b9793 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -145,7 +145,6 @@ set(viewer_SOURCE_FILES llfirstuse.cpp llflexibleobject.cpp llfloaterabout.cpp - llfloateractivespeakers.cpp llfloateranimpreview.cpp llfloaterauction.cpp llfloateravatarpicker.cpp @@ -650,7 +649,6 @@ set(viewer_HEADER_FILES llfirstuse.h llflexibleobject.h llfloaterabout.h - llfloateractivespeakers.h llfloateranimpreview.h llfloaterauction.h llfloateravatarpicker.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b26077eec9..f76b471c9c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8546,17 +8546,6 @@ Value 0 - ShowVoiceChannelPopup - - Comment - Controls visibility of the current voice channel popup above the voice tab - Persist - 1 - Type - Boolean - Value - 0 - ShowVoiceVisualizersInCalls Comment @@ -8568,17 +8557,6 @@ Value 0 - ShowVolumeSettingsPopup - - Comment - Show individual volume slider for voice, sound effects, etc - Persist - 1 - Type - Boolean - Value - 0 - SkinCurrent Comment @@ -10965,5 +10943,35 @@ Value 1 + + + + ShowVoiceChannelPopup + + Comment + Controls visibility of the current voice channel popup above the voice tab + Persist + 1 + Type + Boolean + Value + 0 + + ShowVolumeSettingsPopup + + Comment + Show individual volume slider for voice, sound effects, etc + Persist + 1 + Type + Boolean + Value + 0 + + + diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 41bee540fc..4ebccbe731 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -185,24 +185,6 @@ LLBottomTray::~LLBottomTray() } } -void LLBottomTray::onChicletClick(LLUICtrl* ctrl) -{ - LLIMChiclet* chiclet = dynamic_cast(ctrl); - if (chiclet) - { - // Until you can type into an IM Window and have a conversation, - // still show the old communicate window - //LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); - - // Show after comm window so it is frontmost (and hence will not - // auto-hide) - -// this logic has been moved to LLIMChiclet::handleMouseDown -// LLIMFloater::show(chiclet->getSessionId()); -// chiclet->setCounter(0); - } -} - // *TODO Vadim: why void* ? void* LLBottomTray::createNearbyChatBar(void* userdata) { @@ -499,7 +481,6 @@ BOOL LLBottomTray::postBuild() mNearbyChatBar->getChatBox()->setContextMenu(NULL); mChicletPanel = getChild("chiclet_list"); - mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); initStateProcessedObjectMap(); diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 3c45777645..8395b484cf 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -212,8 +212,6 @@ protected: LLBottomTray(const LLSD& key = LLSD()); - void onChicletClick(LLUICtrl* ctrl); - static void* createNearbyChatBar(void* userdata); void updateContextMenu(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 65e9d8971a..506cebfe73 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -40,7 +40,6 @@ #include "llcompilequeue.h" #include "llcallfloater.h" #include "llfloaterabout.h" -#include "llfloateractivespeakers.h" #include "llfloateranimpreview.h" #include "llfloaterauction.h" #include "llfloateravatarpicker.h" @@ -135,7 +134,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterAboutUtil::registerFloater(); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("active_speakers", "floater_active_speakers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -151,7 +149,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - //LLFloaterReg::add("chat", "floater_chat_history.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("nearby_chat", "floater_nearby_chat.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 2238acd643..298ce3fcec 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -5150,7 +5150,7 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con else { // Create a UUID by hashing the URI, but do NOT set mAvatarIDValid. - // This tells both code in LLVoiceClient and code in llfloateractivespeakers.cpp that the ID will not be in the name cache. + // This tells code in LLVoiceClient that the ID will not be in the name cache. setUUIDFromStringHash(result->mAvatarID, uri); } } diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 41bcc62220..84a99ba92a 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -522,8 +522,6 @@ with the same filename but different name - - @@ -545,10 +543,6 @@ with the same filename but different name - - - - @@ -582,20 +576,6 @@ with the same filename but different name - - - - - - - - - - - - - - -- cgit v1.2.3 From 91e00620d8ac1f57c8e22ca568ba2d0fcd7cbdfc Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Tue, 13 Apr 2010 21:39:13 +0300 Subject: Fixed normal bug EXT-4915 (Duplicated "Buy" item in object context menu). - Bug was caused by making "Take" menu item from object context menu consistent with the one from Build->Object menu where it was replaced by "Buy" when it was needed. But in object menu we already have "Buy" option at the bottom of the list so we don't need to hide "Take" and show "Buy" instead. Removed appearance of "Buy" instead of "Take" and made "Take" item's behaviour consistent with "Take" from object inspector gear menu. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/227/ --HG-- branch : product-engine --- indra/newview/skins/default/xui/en/menu_object.xml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index 2c97112e38..8b10c7b049 100644 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -137,27 +137,14 @@ - - - - - - + function="Object.Take"/> + function="Object.VisibleTake"/> Date: Tue, 13 Apr 2010 21:51:18 +0300 Subject: Fixed low bug EXT-5844 (Group chat invite appears when voice is disabled because connection problem). - Added additional check for client's voice working properly before inviting to session. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/228/ --HG-- branch : product-engine --- indra/newview/llimview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 92b994ad67..10146ee9d3 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -3077,7 +3077,7 @@ public: return; } - if(!LLVoiceClient::voiceEnabled()) + if(!LLVoiceClient::voiceEnabled() || !LLVoiceClient::getInstance()->voiceWorking()) { // Don't display voice invites unless the user has voice enabled. return; -- cgit v1.2.3 From 8fa23739a1409d8e93252985d7f5951f518cdb21 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 13 Apr 2010 13:18:54 -0700 Subject: Fix for EXT-6750 (disabled attachment media still plays). LLViewerMediaImpl::shouldShowBasedOnClass() was always returning true for focused media. This was incorrect, since it made click-focusing on media override the class-based disable preferences. Reviewed by Callum at http://codereview.lindenlab.com/1178023 --- indra/newview/llviewermedia.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 0f5a984188..6ff46222ff 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2985,8 +2985,9 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const // " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << llendl; // If it has focus, we should show it - if (hasFocus()) - return true; + // This is incorrect, and causes EXT-6750 (disabled attachment media still plays) +// if (hasFocus()) +// return true; // If it is attached to an avatar and the pref is off, we shouldn't show it if (attached_to_another_avatar) -- cgit v1.2.3 From 88782e75462ac3a959a59be97ff50b5fc34aabb9 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 13 Apr 2010 16:36:48 -0400 Subject: EXT-6840 : Miscellaneous Avatar Debug Textures Floater improvements Changed "Debug" into "Debug Textures" on right-click menu. Added "Debug Textures" to right-click menu for self (so you don't need to CTRL+SHIFT+ALT+A). Prettied up the dump textures console output. Fixed a bug where component textures for yourself were showing up when viewing others (you shouldn't see any component textures when viewing others). Enlarged debug textures floater a bit. --- indra/newview/llfloateravatartextures.cpp | 45 +++++++++++++--------- indra/newview/lltexlayer.cpp | 8 ++-- .../default/xui/en/floater_avatar_textures.xml | 4 +- .../skins/default/xui/en/menu_attachment_other.xml | 2 +- .../skins/default/xui/en/menu_attachment_self.xml | 9 ++++- .../skins/default/xui/en/menu_avatar_other.xml | 2 +- .../skins/default/xui/en/menu_avatar_self.xml | 8 ++++ .../default/xui/en/menu_inspect_avatar_gear.xml | 2 +- .../default/xui/en/menu_inspect_self_gear.xml | 8 ++++ 9 files changed, 60 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 18db60705b..deef85cc6c 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -38,7 +38,7 @@ #include "lltexturectrl.h" #include "lluictrlfactory.h" #include "llviewerobjectlist.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" using namespace LLVOAvatarDefines; @@ -82,14 +82,17 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture(te); if (tex_entry->mIsLocalTexture) { - const EWearableType wearable_type = tex_entry->mWearableType; - LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); - if (wearable) + if (avatarp->isSelf()) { - LLLocalTextureObject *lto = wearable->getLocalTextureObject(te); - if (lto) + const EWearableType wearable_type = tex_entry->mWearableType; + LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + if (wearable) { - id = lto->getID(); + LLLocalTextureObject *lto = wearable->getLocalTextureObject(te); + if (lto) + { + id = lto->getID(); + } } } } @@ -101,12 +104,12 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, if (id == IMG_DEFAULT_AVATAR) { ctrl->setImageAssetID(LLUUID::null); - ctrl->setToolTip(std::string("IMG_DEFAULT_AVATAR")); + ctrl->setToolTip(tex_entry->mName + " : " + std::string("IMG_DEFAULT_AVATAR")); } else { ctrl->setImageAssetID(id); - ctrl->setToolTip(id.asString()); + ctrl->setToolTip(tex_entry->mName + " : " + id.asString()); } } @@ -160,37 +163,43 @@ void LLFloaterAvatarTextures::onClickDump(void* data) LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data; LLVOAvatar* avatarp = find_avatar(self->mID); if (!avatarp) return; - for (S32 i = 0; i < avatarp->getNumTEs(); i++) { const LLTextureEntry* te = avatarp->getTE(i); if (!te) continue; + const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)(i)); + if (!tex_entry) + continue; + if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i)) { LLUUID id = IMG_DEFAULT_AVATAR; EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i); - LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); - if (wearable) + if (avatarp->isSelf()) { - LLLocalTextureObject *lto = wearable->getLocalTextureObject(i); - if (lto) + LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0); + if (wearable) { - id = lto->getID(); + LLLocalTextureObject *lto = wearable->getLocalTextureObject(i); + if (lto) + { + id = lto->getID(); + } } } if (id != IMG_DEFAULT_AVATAR) { - llinfos << "Avatar TE " << i << " id " << id << llendl; + llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << id << llendl; } else { - llinfos << "Avatar TE " << i << " id " << "" << llendl; + llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << "" << llendl; } } else { - llinfos << "Avatar TE " << i << " id " << te->getID() << llendl; + llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << te->getID() << llendl; } } } diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 3f4dab4fea..e489a12513 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -166,12 +166,13 @@ void LLTexLayerSetBuffer::popProjection() const BOOL LLTexLayerSetBuffer::needsRender() { - const LLVOAvatarSelf* avatar = mTexLayerSet->getAvatar(); + llassert(mTexLayerSet->getAvatar() == gAgentAvatarp); + if (!isAgentAvatarValid()) return FALSE; BOOL upload_now = mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal() && gAgentQueryManager.hasNoPendingQueries(); - BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating; + BOOL needs_update = (mNeedsUpdate || upload_now) && !gAgentAvatarp->mAppearanceAnimating; if (needs_update) { - BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT); + BOOL invalid_skirt = gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT); if (invalid_skirt) { // we were trying to create a skirt texture @@ -181,7 +182,6 @@ BOOL LLTexLayerSetBuffer::needsRender() } else { - needs_update &= (avatar->isSelf() || (avatar->isVisible() && !avatar->isCulled())); needs_update &= mTexLayerSet->isLocalTextureDataAvailable(); } } diff --git a/indra/newview/skins/default/xui/en/floater_avatar_textures.xml b/indra/newview/skins/default/xui/en/floater_avatar_textures.xml index 54b6edb0ec..e30e958543 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar_textures.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar_textures.xml @@ -1,12 +1,12 @@ + width="1253"> INVALID AVATAR diff --git a/indra/newview/skins/default/xui/en/menu_attachment_other.xml b/indra/newview/skins/default/xui/en/menu_attachment_other.xml index c5b31c7f63..b46b62ec4d 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_other.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_other.xml @@ -72,7 +72,7 @@ function="Avatar.EnableFreezeEject"/> diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml index 281ec5a7c3..5c30b9ee94 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -99,5 +99,12 @@ function="ShowAgentProfile" parameter="agent" /> - + + + + diff --git a/indra/newview/skins/default/xui/en/menu_avatar_other.xml b/indra/newview/skins/default/xui/en/menu_avatar_other.xml index ac9101cfd9..276b5f106f 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_other.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_other.xml @@ -72,7 +72,7 @@ function="Avatar.EnableFreezeEject"/> diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml index 1e32cfd9df..a21c1ac44b 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml @@ -215,4 +215,12 @@ function="ShowAgentProfile" parameter="agent" /> + + + + diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml index a5ac5f76e1..334decdf58 100644 --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -89,7 +89,7 @@ function="InspectAvatar.VisibleFreezeEject"/> diff --git a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml index 9dc2611663..03bd93e271 100644 --- a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml @@ -45,4 +45,12 @@ function="SideTray.PanelPeopleTab" parameter="groups_panel" /> + + + + -- cgit v1.2.3 From d7e4fa17e80072d609aaadaf060ee8f51f1069eb Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 13 Apr 2010 15:16:03 -0700 Subject: Minor cleanup in mac_volume_catcher.cpp. --- indra/media_plugins/webkit/mac_volume_catcher.cpp | 100 +++++++++++----------- 1 file changed, 49 insertions(+), 51 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/webkit/mac_volume_catcher.cpp b/indra/media_plugins/webkit/mac_volume_catcher.cpp index 03249f9e83..9788f10a58 100644 --- a/indra/media_plugins/webkit/mac_volume_catcher.cpp +++ b/indra/media_plugins/webkit/mac_volume_catcher.cpp @@ -52,9 +52,8 @@ public: void setVolume(F32 volume); void setPan(F32 pan); - void pump(void); - void setDelegateVolume(ComponentInstance delegate); + void setInstanceVolume(VolumeCatcherStorage *instance); std::list mComponentInstances; Component mOriginalDefaultOutput; @@ -62,12 +61,14 @@ public: static VolumeCatcherImpl *getInstance(); private: + // This is a singleton class -- both callers and the component implementation should use getInstance() to find the instance. VolumeCatcherImpl(); - ~VolumeCatcherImpl(); - - // The component entry point needs to be able to find the instance. static VolumeCatcherImpl *sInstance; + // The singlar instance of this class is expected to last until the process exits. + // To ensure this, we declare the destructor here but never define it, so any code which attempts to destroy the instance will not link. + ~VolumeCatcherImpl(); + F32 mVolume; F32 mPan; }; @@ -88,8 +89,7 @@ VolumeCatcherImpl *VolumeCatcherImpl::getInstance() { if(!sInstance) { - // The constructor will set up the instance pointer. - new VolumeCatcherImpl; + sInstance = new VolumeCatcherImpl; } return sInstance; @@ -97,14 +97,9 @@ VolumeCatcherImpl *VolumeCatcherImpl::getInstance() VolumeCatcherImpl::VolumeCatcherImpl() { - sInstance = this; - mVolume = 1.0; // default to full volume mPan = 0.5; // and center pan - - // Register a component which can delegate - - // Capture the default audio output component. + ComponentDescription desc; desc.componentType = kAudioUnitType_Output; desc.componentSubType = kAudioUnitSubType_DefaultOutput; @@ -153,23 +148,33 @@ static ComponentResult volume_catcher_component_entry(ComponentParameters *cp, H static ComponentResult volume_catcher_component_open(VolumeCatcherStorage *storage, ComponentInstance self) { ComponentResult result = noErr; + VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance(); storage = new VolumeCatcherStorage; - SetComponentInstanceStorage(self, (Handle)storage); - - VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance(); - - impl->mComponentInstances.push_back(storage); - storage->self = self; storage->delegate = NULL; result = OpenAComponent(impl->mOriginalDefaultOutput, &(storage->delegate)); -// std::cerr << "OpenAComponent result = " << result << ", component ref = " << storage->delegate << std::endl; + if(result != noErr) + { +// std::cerr << "OpenAComponent result = " << result << ", component ref = " << storage->delegate << std::endl; + + // If we failed to open the delagate component, our open is going to fail. Clean things up. + delete storage; + } + else + { + // Success -- set up this component's storage + SetComponentInstanceStorage(self, (Handle)storage); - impl->setDelegateVolume(storage->delegate); + // add this instance to the global list + impl->mComponentInstances.push_back(storage); + + // and set up the initial volume + impl->setInstanceVolume(storage); + } return result; } @@ -194,22 +199,15 @@ static ComponentResult volume_catcher_component_close(VolumeCatcherStorage *stor return result; } -VolumeCatcherImpl::~VolumeCatcherImpl() -{ - // We expect to persist until the process exits. This should never be called. - abort(); -} - void VolumeCatcherImpl::setVolume(F32 volume) { VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance(); impl->mVolume = volume; - - std::list::iterator iter; - - for(iter = mComponentInstances.begin(); iter != mComponentInstances.end(); ++iter) + + // Iterate through all known instances, setting the volume on each. + for(std::list::iterator iter = mComponentInstances.begin(); iter != mComponentInstances.end(); ++iter) { - impl->setDelegateVolume((*iter)->delegate); + impl->setInstanceVolume(*iter); } } @@ -223,23 +221,23 @@ void VolumeCatcherImpl::setPan(F32 pan) // There's also a "3d mixer" component that we might be able to use... } -void VolumeCatcherImpl::pump(void) -{ -} - -void VolumeCatcherImpl::setDelegateVolume(ComponentInstance delegate) +void VolumeCatcherImpl::setInstanceVolume(VolumeCatcherStorage *instance) { -// std::cerr << "Setting volume on component instance: " << (delegate) << " to " << mVolume << std::endl; - - OSStatus err; - err = AudioUnitSetParameter( - delegate, - kHALOutputParam_Volume, - kAudioUnitScope_Global, - 0, - mVolume, - 0); - +// std::cerr << "Setting volume on component instance: " << (instance->delegate) << " to " << mVolume << std::endl; + + OSStatus err = noErr; + + if(instance && instance->delegate) + { + err = AudioUnitSetParameter( + instance->delegate, + kHALOutputParam_Volume, + kAudioUnitScope_Global, + 0, + mVolume, + 0); + } + if(err) { // std::cerr << " AudioUnitSetParameter returned " << err << std::endl; @@ -260,16 +258,16 @@ VolumeCatcher::~VolumeCatcher() void VolumeCatcher::setVolume(F32 volume) { - VolumeCatcherImpl::getInstance()->setVolume(volume); + pimpl->setVolume(volume); } void VolumeCatcher::setPan(F32 pan) { - VolumeCatcherImpl::getInstance()->setPan(pan); + pimpl->setPan(pan); } void VolumeCatcher::pump() { - VolumeCatcherImpl::getInstance()->pump(); + // No periodic tasks are necessary for this implementation. } -- cgit v1.2.3 From 7e210d185f9b5bccdeb108e79b97a7a1a44b4374 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 13 Apr 2010 18:07:24 -0700 Subject: fix for EXT-6317 and EXT-2418 regressions in installed viewers new 32-bit mouse cursors were not getting packaged by installer for windows builds reviewed by Monroe --- indra/llwindow/llwindowwin32.cpp | 6 +++--- indra/newview/res/toolbuy.cur | Bin 4286 -> 0 bytes indra/newview/res/toolopen.cur | Bin 4286 -> 0 bytes indra/newview/res/toolsit.cur | Bin 4286 -> 0 bytes indra/newview/res/viewerRes.rc | 3 --- 5 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 indra/newview/res/toolbuy.cur delete mode 100644 indra/newview/res/toolopen.cur delete mode 100644 indra/newview/res/toolsit.cur (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8df9dad581..13e71ed936 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1548,9 +1548,9 @@ void LLWindowWin32::initCursors() // Color cursors gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "res", "toolbuy.cur"); - mCursor[UI_CURSOR_TOOLSIT] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolsit.cur").c_str()); - mCursor[UI_CURSOR_TOOLBUY] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolbuy.cur").c_str()); - mCursor[UI_CURSOR_TOOLOPEN] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolopen.cur").c_str()); + mCursor[UI_CURSOR_TOOLSIT] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->findSkinnedFilename("textures", "toolsit.cur")).c_str()); + mCursor[UI_CURSOR_TOOLBUY] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->findSkinnedFilename("textures", "toolbuy.cur")).c_str()); + mCursor[UI_CURSOR_TOOLOPEN] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->findSkinnedFilename("textures", "toolopen.cur")).c_str()); mCursor[UI_CURSOR_TOOLPLAY] = loadColorCursor(TEXT("TOOLPLAY")); mCursor[UI_CURSOR_TOOLPAUSE] = loadColorCursor(TEXT("TOOLPAUSE")); mCursor[UI_CURSOR_TOOLMEDIAOPEN] = loadColorCursor(TEXT("TOOLMEDIAOPEN")); diff --git a/indra/newview/res/toolbuy.cur b/indra/newview/res/toolbuy.cur deleted file mode 100644 index 7fd552a78e..0000000000 Binary files a/indra/newview/res/toolbuy.cur and /dev/null differ diff --git a/indra/newview/res/toolopen.cur b/indra/newview/res/toolopen.cur deleted file mode 100644 index 1562f5bc95..0000000000 Binary files a/indra/newview/res/toolopen.cur and /dev/null differ diff --git a/indra/newview/res/toolsit.cur b/indra/newview/res/toolsit.cur deleted file mode 100644 index a1f99cfe6d..0000000000 Binary files a/indra/newview/res/toolsit.cur and /dev/null differ diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 7a965cf57e..3a20d91129 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -119,9 +119,6 @@ TOOLPIPETTE CURSOR "toolpipette.cur" TOOLPLAY CURSOR "toolplay.cur" TOOLPAUSE CURSOR "toolpause.cur" TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" -TOOLOPEN CURSOR "toolopen.cur" -TOOLSIT CURSOR "toolsit.cur" -TOOLBUY CURSOR "toolbuy.cur" ///////////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3