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/lltooldraganddrop.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/lltooldraganddrop.cpp') diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 1e81e675e6..cc90b0753f 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -244,11 +244,13 @@ public: } }; -class LLCategoryDropObserver : public LLInventoryFetchObserver +class LLCategoryDropObserver : public LLInventoryFetchItemsObserver { public: LLCategoryDropObserver( + const uuid_vec_t& ids, const LLUUID& obj_id, LLToolDragAndDrop::ESource src) : + LLInventoryFetchItemsObserver(ids), mObjectID(obj_id), mSource(src) {} @@ -331,8 +333,8 @@ void LLCategoryDropDescendentsObserver::done() std::back_insert_iterator copier(ids); std::copy(unique_ids.begin(), unique_ids.end(), copier); LLCategoryDropObserver* dropper; - dropper = new LLCategoryDropObserver(mObjectID, mSource); - dropper->fetch(ids); + dropper = new LLCategoryDropObserver(ids, mObjectID, mSource); + dropper->startFetch(); if (dropper->isEverythingComplete()) { dropper->done(); @@ -480,7 +482,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, if (!folder_ids.empty() || !item_ids.empty()) { LLCategoryFireAndForget fetcher; - fetcher.fetch(folder_ids, item_ids); + fetcher.startFetch(folder_ids, item_ids); } } } @@ -550,7 +552,7 @@ void LLToolDragAndDrop::beginMultiDrag( std::back_insert_iterator copier(folder_ids); std::copy(cat_ids.begin(), cat_ids.end(), copier); LLCategoryFireAndForget fetcher; - fetcher.fetch(folder_ids, item_ids); + fetcher.startFetch(folder_ids, item_ids); } } } @@ -2576,8 +2578,8 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( const LLViewerInventoryItem *item = (*item_iter); ids.push_back(item->getUUID()); } - LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource); - dropper->fetch(ids); + LLCategoryDropObserver* dropper = new LLCategoryDropObserver(ids, obj->getID(), mSource); + dropper->startFetch(); if (dropper->isEverythingComplete()) { dropper->done(); -- cgit v1.2.3 From f096f02278f3b8c8fdd962c85b237492defa93ec Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 6 Apr 2010 18:58:26 -0400 Subject: EXT-6728 : Have LLInventoryFetchItems/DescendentsObserver inherit from a base abstract LLInventoryFetchObserver class Added a new abstract class LLInventoryFetchObserver from which LLInventoryFetchItems and LLInventoryFetchDescendents inherit. Also changed isEverythingComplete to isFinished and made some other minor superficial changes. --- indra/newview/lltooldraganddrop.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'indra/newview/lltooldraganddrop.cpp') 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 -- cgit v1.2.3 From e9f06764412af37023f45c4d83b2b97c48d2a13e Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 7 Apr 2010 11:15:27 -0400 Subject: EXT-6728 : Have LLInventoryFetchItems/DescendentsObserver inherit from a base abstract LLInventoryFetchObserver class Minor cleanup of LLInventoryFetchComboObserver --- indra/newview/lltooldraganddrop.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indra/newview/lltooldraganddrop.cpp') 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); } } } -- cgit v1.2.3 From 5d3de2ea03ff500690acec13fd4b403dc8a72088 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 7 Apr 2010 13:30:21 -0400 Subject: EXT-6745 : Refactor LLFetchComboObserver to use LLFetchItems and LLFetchDescedents instead of code duplication Took out a bunch of code duplication from the FetchComboObserver and am using the LLFetchItems/DescendentsObservers instead. Also added some comments and made some minor superficial cleanup to LLInventoryObserver done(). --- indra/newview/lltooldraganddrop.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltooldraganddrop.cpp') diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index a67067d29c..774626f19d 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -232,6 +232,9 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item) return allowed; } +// Starts a fetch on folders and items. This is really not used +// as an observer in the traditional sense; we're just using it to +// request a fetch and we don't care about when/if the response arrives. class LLCategoryFireAndForget : public LLInventoryFetchComboObserver { public: @@ -485,8 +488,9 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, } if (!folder_ids.empty() || !item_ids.empty()) { - LLCategoryFireAndForget fetcher(folder_ids, item_ids); - fetcher.startFetch(); + LLCategoryFireAndForget *fetcher = new LLCategoryFireAndForget(folder_ids, item_ids); + fetcher->startFetch(); + delete fetcher; } } } -- cgit v1.2.3