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/llviewermessage.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') 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.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/newview/llviewermessage.cpp') 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.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/newview/llviewermessage.cpp') 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.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/newview/llviewermessage.cpp') 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.3 From 00462c243116e2720acf51ee1f777e69e8189f33 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 8 Apr 2010 12:07:58 +0300 Subject: Fixed normal bug EXT-4347 (Moving object contents to inventory opens files, changes menu) Implementation details: * Added new LLViewerInventoryMoveFromWorldObserver to watch moved items via their Asses UUIDs. It is instantiated only once due to drop events are sent separately for each item while multi-dragging. * Existent LLOpenTaskOffer observer uses it to exclude watched by LLViewerInventoryMoveFromWorldObserver items from own processing. * Removed dependancy on LLPanelPlaces in open_inventory_offer(). Openning of offered LM via group notice moved into an appropriate section (processed by LLOpenTaskGroupOffer) Known Issues: * If Script item is among the dragged items from object to inventory it will be the only selected item in the inventory panel. Reason: it does not have its own Asset UUID and processed via LLOpenTaskOffer when should not. Reviewed by Leyla and Richard at https://codereview.productengine.com/secondlife/r/116/ --HG-- branch : product-engine --- indra/newview/llinventorybridge.cpp | 3 + indra/newview/llinventoryobserver.cpp | 63 ++++++++++ indra/newview/llinventoryobserver.h | 30 +++++ indra/newview/llviewermessage.cpp | 212 ++++++++++++++++++++++++++++++---- indra/newview/llviewermessage.h | 2 + 5 files changed, 285 insertions(+), 25 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b552b5ac07..943a851c13 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3167,6 +3167,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else { + // store dad inventory item to select added one later. See EXT-4347 + set_dad_inventory_item(inv_item, mUUID); + LLNotification::Params params("MoveInventoryFromObject"); params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 83e1bbd5a0..922fcc16c0 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -495,6 +495,69 @@ void LLInventoryExistenceObserver::changed(U32 mask) } } +void LLInventoryMoveFromWorldObserver::changed(U32 mask) +{ + if(!(mask & LLInventoryObserver::ADD)) + { + return; + } + + // nothing is watched + if (mWatchedAssets.size() == 0) + { + return; + } + + LLPointer item = new LLViewerInventoryItem; + LLMessageSystem* msg = gMessageSystem; + S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); + for(S32 i = 0; i < num_blocks; ++i) + { + item->unpackMessage(msg, _PREHASH_InventoryData, i); + const LLUUID& asset_uuid = item->getAssetUUID(); + if (item->getUUID().notNull() && asset_uuid.notNull()) + { + if (isAssetWatched(asset_uuid)) + { + LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL; + mAddedItems.push_back(item->getUUID()); + } + } + } + + if (mAddedItems.size() == mWatchedAssets.size()) + { + done(); + LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL; + mAddedItems.clear(); + + // Unable to clean watched items here due to somebody can require to check them in current frame. + // set dirty state to clean them while next watch cycle. + mIsDirty = true; + } +} + +void LLInventoryMoveFromWorldObserver::watchAsset(const LLUUID& asset_id) +{ + if(asset_id.notNull()) + { + if (mIsDirty) + { + LL_DEBUGS("Inventory_Move") << "Watched items are dirty. Clean them." << LL_ENDL; + mWatchedAssets.clear(); + mIsDirty = false; + } + + mWatchedAssets.push_back(asset_id); + onAssetAdded(asset_id); + } +} + +bool LLInventoryMoveFromWorldObserver::isAssetWatched( const LLUUID& asset_id ) +{ + return std::find(mWatchedAssets.begin(), mWatchedAssets.end(), asset_id) != mWatchedAssets.end(); +} + void LLInventoryAddedObserver::changed(U32 mask) { if(!(mask & LLInventoryObserver::ADD)) diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index ba70552ebc..b710a9d326 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -193,6 +193,36 @@ protected: uuid_vec_t mMIA; }; +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryMovedObserver +// +// This class is used as a base class for doing something when all the +// item for observed asset ids were added into the inventory. +// Derive a class from this class and implement the done() method to do +// something useful. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLInventoryMoveFromWorldObserver : public LLInventoryObserver +{ +public: + LLInventoryMoveFromWorldObserver() : mIsDirty(false) {} + virtual void changed(U32 mask); + + void watchAsset(const LLUUID& asset_id); + bool isAssetWatched(const LLUUID& asset_id); + +protected: + virtual void onAssetAdded(const LLUUID& asset_id) {} + virtual void done() = 0; + + typedef std::vector item_ref_t; + item_ref_t mAddedItems; + item_ref_t mWatchedAssets; + +private: + bool mIsDirty; +}; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryAddedObserver // diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c542459cdb..2b41a83ba5 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -71,7 +71,6 @@ #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpanelgrouplandmoney.h" -#include "llpanelplaces.h" #include "llrecentpeople.h" #include "llscriptfloater.h" #include "llselectmgr.h" @@ -692,6 +691,52 @@ bool join_group_response(const LLSD& notification, const LLSD& response) return false; } + +static void highlight_inventory_items_in_panel(const std::vector& items, LLInventoryPanel *inventory_panel) +{ + if (NULL == inventory_panel) return; + + for (std::vector::const_iterator item_iter = items.begin(); + item_iter != items.end(); + ++item_iter) + { + const LLUUID& item_id = (*item_iter); + if(!highlight_offered_item(item_id)) + { + continue; + } + + LLInventoryItem* item = gInventory.getItem(item_id); + llassert(item); + if (!item) { + continue; + } + + LL_DEBUGS("Inventory_Move") << "Highlighting inventory item: " << item->getName() << ", " << item_id << LL_ENDL; + LLFolderView* fv = inventory_panel->getRootFolder(); + if (fv) + { + LLFolderViewItem* fv_item = fv->getItemByID(item_id); + if (fv_item) + { + LLFolderViewItem* fv_folder = fv_item->getParentFolder(); + if (fv_folder) + { + // Parent folders can be different in case of 2 consecutive drag and drop + // operations when the second one is started before the first one completes. + LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL; + fv_folder->setOpen(TRUE); + if (fv_folder->isSelected()) + { + fv->changeSelection(fv_folder, FALSE); + } + } + fv->changeSelection(fv_item, TRUE); + } + } + } +} + static LLNotificationFunctorRegistration jgr_1("JoinGroup", join_group_response); static LLNotificationFunctorRegistration jgr_2("JoinedTooManyGroupsMember", join_group_response); static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_response); @@ -714,6 +759,108 @@ private: std::string mFromName; }; +/** + * Class to observe adding of new items moved from the world to user's inventory to select them in inventory. + * + * We can't create it each time items are moved because "drop" event is sent separately for each + * element even while multi-dragging. We have to have the only instance of the observer. See EXT-4347. + */ +class LLViewerInventoryMoveFromWorldObserver : public LLInventoryMoveFromWorldObserver +{ +public: + LLViewerInventoryMoveFromWorldObserver() + : LLInventoryMoveFromWorldObserver() + , mActivePanel(NULL) + { + + } + + void setMoveIntoFolderID(const LLUUID& into_folder_uuid) {mMoveIntoFolderID = into_folder_uuid; } + +private: + /*virtual */void onAssetAdded(const LLUUID& asset_id) + { + // Store active Inventory panel. + mActivePanel = LLInventoryPanel::getActiveInventoryPanel(); + + // Store selected items (without destination folder) + mSelectedItems.clear(); + mActivePanel->getRootFolder()->getSelectionList(mSelectedItems); + mSelectedItems.erase(mMoveIntoFolderID); + } + + /** + * Selects added inventory items watched by their Asset UUIDs if selection was not changed since + * all items were started to watch (dropped into a folder). + */ + void done() + { + // if selection is not changed since watch started lets hightlight new items. + if (mActivePanel && !isSelectionChanged()) + { + LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL; + mActivePanel->clearSelection(); + highlight_inventory_items_in_panel(mAddedItems, mActivePanel); + } + } + + /** + * Returns true if selected inventory items were changed since moved inventory items were started to watch. + */ + bool isSelectionChanged() + { + const LLInventoryPanel * const current_active_panel = LLInventoryPanel::getActiveInventoryPanel(); + + if (NULL == mActivePanel || current_active_panel != mActivePanel) + { + return true; + } + + // get selected items (without destination folder) + selected_items_t selected_items; + mActivePanel->getRootFolder()->getSelectionList(selected_items); + selected_items.erase(mMoveIntoFolderID); + + // compare stored & current sets of selected items + selected_items_t different_items; + std::set_symmetric_difference(mSelectedItems.begin(), mSelectedItems.end(), + selected_items.begin(), selected_items.end(), std::inserter(different_items, different_items.begin())); + + LL_DEBUGS("Inventory_Move") << "Selected firstly: " << mSelectedItems.size() + << ", now: " << selected_items.size() << ", difference: " << different_items.size() << LL_ENDL; + + return different_items.size() > 0; + } + + LLInventoryPanel *mActivePanel; + typedef std::set selected_items_t; + selected_items_t mSelectedItems; + + /** + * UUID of FolderViewFolder into which watched items are moved. + * + * Destination FolderViewFolder becomes selected while mouse hovering (when dragged items are dropped). + * + * If mouse is moved out it set unselected and number of selected items is changed + * even if selected items in Inventory stay the same. + * So, it is used to update stored selection list. + * + * @see onAssetAdded() + * @see isSelectionChanged() + */ + LLUUID mMoveIntoFolderID; +}; + +LLViewerInventoryMoveFromWorldObserver* gInventoryMoveObserver = NULL; + +void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid) +{ + start_new_inventory_observer(); + + gInventoryMoveObserver->setMoveIntoFolderID(into_folder_uuid); + gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID()); +} + //unlike the FetchObserver for AgentOffer, we only make one //instance of the AddedObserver for TaskOffers //and it never dies. We do this because we don't know the UUID of @@ -724,6 +871,33 @@ class LLOpenTaskOffer : public LLInventoryAddedObserver protected: /*virtual*/ void done() { + for (uuid_vec_t::iterator it = mAdded.begin(); it != mAdded.end();) + { + const LLUUID& item_uuid = *it; + bool was_moved = false; + LLInventoryObject* added_object = gInventory.getObject(item_uuid); + if (added_object) + { + // cast to item to get Asset UUID + LLInventoryItem* added_item = dynamic_cast(added_object); + if (added_item) + { + const LLUUID& asset_uuid = added_item->getAssetUUID(); + if (gInventoryMoveObserver->isAssetWatched(asset_uuid)) + { + LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL; + was_moved = true; + } + } + } + + if (was_moved) + { + it = mAdded.erase(it); + } + else ++it; + } + open_inventory_offer(mAdded, ""); mAdded.clear(); } @@ -752,6 +926,13 @@ void start_new_inventory_observer() gNewInventoryObserver = new LLOpenTaskOffer; gInventory.addObserver(gNewInventoryObserver); } + + if (!gInventoryMoveObserver) //inventory move from the world observer + { + // Observer is deleted by gInventory + gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver; + gInventory.addObserver(gInventoryMoveObserver); + } } class LLDiscardAgentOffer : public LLInventoryFetchComboObserver @@ -916,9 +1097,12 @@ void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name) } else if("group_offer" == from_name) { - // do not open inventory when we open group notice attachment because - // we already opened landmark info panel // "group_offer" is passed by LLOpenTaskGroupOffer + // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done(). + LLSD args; + args["type"] = "landmark"; + args["id"] = item_id; + LLSideTray::getInstance()->showPanel("panel_places", args); continue; } @@ -929,28 +1113,6 @@ void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name) args["LANDMARK_NAME"] = item->getName(); args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown"); LLNotificationsUtil::add("LandmarkCreated", args); - // Created landmark is passed to Places panel to allow its editing. In fact panel should be already displayed. - // If the panel is closed we don't reopen it until created landmark is loaded. - //TODO*:: dserduk(7/12/09) remove LLPanelPlaces dependency from here - LLPanelPlaces *places_panel = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_places")); - if (places_panel) - { - // Landmark creation handling is moved to LLPanelPlaces::showAddedLandmarkInfo() - // TODO* LLPanelPlaces dependency is going to be removed. See EXT-4347. - //if("create_landmark" == places_panel->getPlaceInfoType() && !places_panel->getItem()) - //{ - // places_panel->setItem(item); - //} - //else - // we are opening a group notice attachment - if("create_landmark" != places_panel->getPlaceInfoType()) - { - LLSD args; - args["type"] = "landmark"; - args["id"] = item_id; - LLSideTray::getInstance()->showPanel("panel_places", args); - } - } } } break; diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 4015cca77b..7c021dc05f 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -208,6 +208,8 @@ void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name) // Returns false if item is not found. bool highlight_offered_item(const LLUUID& item_id); +void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid); + struct LLOfferInfo { LLOfferInfo() -- cgit v1.3 From 978d62e9e75d52a3443db36fd02062c3dbf4040a Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 8 Apr 2010 18:56:02 +0300 Subject: Fixed normal bug EXT-6751 (Wrong "You paid" text in notification when creating a classified). - Bug was caused by absence of localizable string for "You paid..." notifications without name and reason simultaneously. Added such string("you_paid_ldollars_no_info") to strings.xml and used it in code. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/206/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 7 ++++--- indra/newview/skins/default/xui/en/strings.xml | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2b41a83ba5..ef3ee32f11 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4714,11 +4714,12 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) if(boost::regex_match(desc, matches, expr)) { // Name of full localizable notification string - // there are three types of this string- with name of receiver and reason of payment, - // without name and without reason (but not simultaneously) + // there are four types of this string- with name of receiver and reason of payment, + // without name and without reason (both may also be absent simultaneously). // example of string without name - You paid L$100 to create a group. // example of string without reason - You paid Smdby Linden L$100. // example of string with reason and name - You paid Smbdy Linden L$100 for a land access pass. + // example of string with no info - You paid L$50. std::string line = "you_paid_ldollars_no_name"; // arguments of string which will be in notification @@ -4739,7 +4740,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) std::string reason = std::string(matches[3]); if (reason.empty()) { - line = "you_paid_ldollars_no_reason"; + line = name.empty() ? "you_paid_ldollars_no_info" : "you_paid_ldollars_no_reason"; } else { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 0c73b8d769..27d11ead7e 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3056,6 +3056,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. [NAME] paid you L$[AMOUNT] You paid [NAME] L$[AMOUNT] [REASON]. + You paid L$[AMOUNT]. You paid [NAME] L$[AMOUNT]. You paid L$[AMOUNT] [REASON]. for a parcel of land -- cgit v1.3 From a782eaf36e5cd4edc74ade855db8582213ae7c0f Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 9 Apr 2010 17:34:01 +0300 Subject: Fixed normal bug EXT-4766 - System notifications in nearby chat has default avatar icon and behave like sent from object Updated nearby toast to display system icon for system message. Reviewed by Vadim Savchuk - https://codereview.productengine.com/secondlife/r/208/ --HG-- branch : product-engine --- indra/newview/llchatitemscontainerctrl.cpp | 2 ++ indra/newview/llviewermessage.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 81edb55f93..aef36b677c 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -324,6 +324,8 @@ void LLNearbyChatToastPanel::draw() icon->setDrawTooltip(mSourceType == CHAT_SOURCE_AGENT); if(mSourceType == CHAT_SOURCE_AGENT) icon->setValue(mFromID); + else if(mSourceType == CHAT_SOURCE_SYSTEM) + icon->setValue(LLSD("SL_Logo")); else icon->setValue(LLSD("OBJECT_Icon")); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ef3ee32f11..d8a3932a22 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2392,10 +2392,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id ^ gAgent.getSessionID(); } + chat.mSourceType = CHAT_SOURCE_OBJECT; + if(SYSTEM_FROM == name) { // System's UUID is NULL (fixes EXT-4766) chat.mFromID = LLUUID::null; + chat.mSourceType = CHAT_SOURCE_SYSTEM; } LLSD query_string; @@ -2412,7 +2415,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mURL = link.str(); chat.mText = message; - chat.mSourceType = CHAT_SOURCE_OBJECT; // Note: lie to Nearby Chat, pretending that this is NOT an IM, because // IMs from obejcts don't open IM sessions. -- cgit v1.3 From f98f79be8fdec2cf4d234abe9c6837deef0a81e0 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Mon, 12 Apr 2010 15:20:27 +0300 Subject: Fixed major bug EXT-6590 (Preference> Maturity rating changes without direct user input). Now we're notifying user that his/her maturity preference has been changed. Reviewed by Mike: https://codereview.productengine.com/secondlife/r/216/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 4 ++++ indra/newview/skins/default/xui/en/notifications.xml | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d8a3932a22..32df7d8410 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4786,6 +4786,10 @@ bool handle_special_notification_callback(const LLSD& notification, const LLSD& gSavedSettings.setU32("PreferredMaturity", preferredMaturity); gAgent.sendMaturityPreferenceToServer(preferredMaturity); + // notify user that the maturity preference has been changed + LLSD args; + args["RATING"] = LLViewerRegion::accessToString(preferredMaturity); + LLNotificationsUtil::add("PreferredMaturityChanged", args); } return false; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index ff8de3514f..7f0e8891d7 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3379,6 +3379,13 @@ You can click 'Change Preference' to raise your maturity Rating prefer + +Your maturity rating preference is now [RATING]. + + Date: Wed, 14 Apr 2010 13:18:40 +0300 Subject: Fixed normal bug EXT-6302 (TP requests need to display destination region maturity) Added: - parsing of region information from "lure" binary bucket - displaying destination region maturity by teleport offer Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/229/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 57 ++++++++++++++++++++++ .../newview/skins/default/xui/en/notifications.xml | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 32df7d8410..48e781e95d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -32,6 +32,7 @@ #include "llviewerprecompiledheaders.h" #include "llviewermessage.h" +#include "boost/lexical_cast.hpp" #include "llanimationstates.h" #include "llaudioengine.h" @@ -1860,6 +1861,53 @@ protected: } }; +static void parse_lure_bucket(const std::string& bucket, + U64& region_handle, + LLVector3& pos, + LLVector3& look_at, + U8& region_access) +{ + // tokenize the bucket + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("|", "", boost::keep_empty_tokens); + tokenizer tokens(bucket, sep); + tokenizer::iterator iter = tokens.begin(); + + S32 gx = boost::lexical_cast((*(iter)).c_str()); + S32 gy = boost::lexical_cast((*(++iter)).c_str()); + S32 rx = boost::lexical_cast((*(++iter)).c_str()); + S32 ry = boost::lexical_cast((*(++iter)).c_str()); + S32 rz = boost::lexical_cast((*(++iter)).c_str()); + S32 lx = boost::lexical_cast((*(++iter)).c_str()); + S32 ly = boost::lexical_cast((*(++iter)).c_str()); + S32 lz = boost::lexical_cast((*(++iter)).c_str()); + + // Grab region access + region_access = SIM_ACCESS_MIN; + if (++iter != tokens.end()) + { + std::string access_str((*iter).c_str()); + LLStringUtil::trim(access_str); + if ( access_str == "A" ) + { + region_access = SIM_ACCESS_ADULT; + } + else if ( access_str == "M" ) + { + region_access = SIM_ACCESS_MATURE; + } + else if ( access_str == "PG" ) + { + region_access = SIM_ACCESS_PG; + } + } + + pos.setVec((F32)rx, (F32)ry, (F32)rz); + look_at.setVec((F32)lx, (F32)ly, (F32)lz); + + region_handle = to_region_handle(gx, gy); +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2493,10 +2541,19 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { + LLVector3 pos, look_at; + U64 region_handle; + U8 region_access; + std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size); + parse_lure_bucket(region_info, region_handle, pos, look_at, region_access); + + std::string region_access_str = LLViewerRegion::accessToString(region_access); + LLSD args; // *TODO: Translate -> [FIRST] [LAST] (maybe) args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about"); args["MESSAGE"] = message; + args["MATURITY"] = region_access_str; LLSD payload; payload["from_id"] = from_id; payload["lure_id"] = session_id; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 9ee4e13f3c..6c9564c8cf 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5165,7 +5165,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th type="offer"> [NAME_SLURL] has offered to teleport you to their location: -[MESSAGE] +[MESSAGE], ([MATURITY])