From 34d3d02101e1838a4d8b875850a12867866a2935 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Fri, 27 Nov 2009 16:07:14 +0200 Subject: fixed bug EXT-2785 All gestures appear in Gestures window only after inventory/gestures has been invoked Cause: Specific implementation of LLInventoryCompletionObserver. It call done() on startup before all items had been loaded. Changes: LLGesturemanager will be loaded appropriated inventory item itself. LLGestureInventoryfetchObserver has been removed. --HG-- branch : product-engine --- indra/newview/llfloatergesture.cpp | 2 +- indra/newview/llgesturemgr.cpp | 12 ++++++++++-- indra/newview/llgesturemgr.h | 2 +- indra/newview/llstartup.cpp | 25 ++----------------------- 4 files changed, 14 insertions(+), 27 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 0f8e4c10d7..9d05d9de34 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -304,7 +304,7 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur { font_style = "BOLD"; } - + item_name = gesture->mName; element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = gesture->mTrigger; element["columns"][0]["font"]["name"] = "SANSSERIF"; diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 77a2cbcfca..18ff53c127 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -73,6 +73,7 @@ LLGestureManager::LLGestureManager() mActive(), mLoadingCount(0) { + mRetryIfMissing = true; gInventory.addObserver(this); } @@ -984,7 +985,9 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, else { // Watch this item and set gesture name when item exists in inventory - self.watchItem(item_id); + item_ref_t ids; + ids.push_back(item_id); + self.fetchItems(ids); } self.mActive[item_id] = gesture; @@ -1177,6 +1180,7 @@ void LLGestureManager::getItemIDs(std::vector* ids) void LLGestureManager::done() { + bool notify = false; for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it) { if(it->second && it->second->mName.empty()) @@ -1185,10 +1189,14 @@ void LLGestureManager::done() if(item) { it->second->mName = item->getName(); + notify = true; } } } - notifyObservers(); + if(notify) + { + notifyObservers(); + } } // static diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index 094ca13798..e80eea9ae9 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -54,7 +54,7 @@ public: virtual void changed() = 0; }; -class LLGestureManager : public LLSingleton, public LLInventoryCompletionObserver +class LLGestureManager : public LLSingleton, public LLInventoryFetchObserver { public: diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e7fe85bdf0..db8bda008e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -101,7 +101,6 @@ #include "llfeaturemanager.h" #include "llfirstuse.h" #include "llfloaterchat.h" -#include "llfloatergesture.h" #include "llfloaterhud.h" #include "llfloaterland.h" #include "llfloaterpreference.h" @@ -299,23 +298,6 @@ namespace }; } -class LLGestureInventoryFetchObserver : public LLInventoryFetchObserver -{ -public: - LLGestureInventoryFetchObserver() {} - virtual void done() - { - // we've downloaded all the items, so repaint the dialog - LLFloaterGesture* floater = LLFloaterReg::findTypedInstance("gestures"); - if (floater) - { - floater->refreshAll(); - } - gInventory.removeObserver(this); - delete this; - } -}; - void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread @@ -1825,11 +1807,8 @@ bool idle_startup() item_ids.push_back(item_id); } } - - LLGestureInventoryFetchObserver* fetch = new LLGestureInventoryFetchObserver(); - fetch->fetchItems(item_ids); - // deletes itself when done - gInventory.addObserver(fetch); + // no need to add gesture to inventory observer, it's already made in constructor + LLGestureManager::instance().fetchItems(item_ids); } } gDisplaySwapBuffers = TRUE; -- cgit v1.2.3