From 683a96a5f1e9111d62710fe621d52192d34079ed Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Aug 2012 14:54:29 -0700 Subject: PATH-849: Refactoring the behavior after loading the owner name of a pathfinding object into the avatar name cache so that each object can simply update its respective row in the scroll list rather than rebuilding from scratch after all names are loaded. --- indra/newview/llfloaterpathfindingobjects.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterpathfindingobjects.h') diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index e8d446b598..b7fd4340ed 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -27,7 +27,8 @@ #ifndef LL_LLFLOATERPATHFINDINGOBJECTS_H #define LL_LLFLOATERPATHFINDINGOBJECTS_H -#include +#include +#include #include @@ -80,14 +81,14 @@ protected: void handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList); void rebuildObjectsScrollList(); - virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr); - - void rebuildScrollListAfterAvatarNameLoads(const LLUUID &pAvatarId); + virtual void buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr); + void addObjectToScrollList(const LLPathfindingObjectPtr pObjectPr, const LLSD &pScrollListItemData); virtual void updateControlsOnScrollListChange(); virtual void updateControlsOnInWorldSelectionChange(); virtual S32 getNameColumnIndex() const; + virtual S32 getOwnerNameColumnIndex() const; virtual const LLColor4 &getBeaconColor() const; virtual const LLColor4 &getBeaconTextColor() const; virtual S32 getBeaconWidth() const; @@ -126,7 +127,7 @@ private: void onRegionBoundaryCrossed(); void onGodLevelChange(U8 pGodLevel); - void handleAvatarNameLoads(const LLUUID &pAvatarId, const LLAvatarName &pAvatarName); + void handleObjectNameResponse(const LLUUID &pObjectUUID, const std::string &pOwnerName); void updateMessagingStatus(); void updateStateOnListControls(); @@ -151,8 +152,6 @@ private: LLButton *mDeleteButton; LLButton *mTeleportButton; - std::set mLoadingAvatarNames; - LLColor4 mDefaultBeaconColor; LLColor4 mDefaultBeaconTextColor; LLColor4 mErrorTextColor; @@ -161,6 +160,9 @@ private: EMessagingState mMessagingState; LLPathfindingManager::request_id_t mMessagingRequestId; + typedef std::map scroll_list_item_map; + scroll_list_item_map mMissingNameObjectsScrollListItems; + LLPathfindingObjectListPtr mObjectList; LLObjectSelectionHandle mObjectsSelection; -- cgit v1.3 From fddaf38f892aa608f9db9c034f6c583d638b6fcf Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Aug 2012 16:04:12 -0700 Subject: PATH-849: Group objects were losing their [group] identifier following the last commit. This should fix that issue. --- indra/newview/llfloaterpathfindingcharacters.cpp | 24 +++++++++++++++++------- indra/newview/llfloaterpathfindingcharacters.h | 2 ++ indra/newview/llfloaterpathfindinglinksets.cpp | 24 +++++++++++++++++------- indra/newview/llfloaterpathfindinglinksets.h | 2 ++ indra/newview/llfloaterpathfindingobjects.cpp | 16 ++++++++++++---- indra/newview/llfloaterpathfindingobjects.h | 3 ++- indra/newview/llpathfindingobject.cpp | 4 ++-- indra/newview/llpathfindingobject.h | 6 +++--- 8 files changed, 57 insertions(+), 24 deletions(-) (limited to 'indra/newview/llfloaterpathfindingobjects.h') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 4cf82d162c..69c9d94dfa 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -162,6 +162,22 @@ S32 LLFloaterPathfindingCharacters::getNameColumnIndex() const return 0; } +S32 LLFloaterPathfindingCharacters::getOwnerNameColumnIndex() const +{ + return 2; +} + +std::string LLFloaterPathfindingCharacters::getOwnerName(const LLPathfindingObject *pObject) const +{ + return (pObject->hasOwner() + ? (pObject->hasOwnerName() + ? (pObject->isGroupOwned() + ? (pObject->getOwnerName() + " " + getString("character_owner_group")) + : pObject->getOwnerName()) + : getString("character_owner_loading")) + : getString("character_owner_unknown")); +} + const LLColor4 &LLFloaterPathfindingCharacters::getBeaconColor() const { return mBeaconColor; @@ -206,13 +222,7 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListItemData(const LLPa columns[1]["value"] = pCharacterPtr->getDescription(); columns[2]["column"] = "owner"; - columns[2]["value"] = (pCharacterPtr->hasOwner() - ? (pCharacterPtr->hasOwnerName() - ? (pCharacterPtr->isGroupOwned() - ? (pCharacterPtr->getOwnerName() + " " + getString("character_owner_group")) - : pCharacterPtr->getOwnerName()) - : getString("character_owner_loading")) - : getString("character_owner_unknown")); + columns[2]["value"] = getOwnerName(pCharacterPtr); S32 cpuTime = llround(pCharacterPtr->getCPUTime()); std::string cpuTimeString = llformat("%d", cpuTime); diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 72974f283d..4021f4f119 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -67,6 +67,8 @@ protected: virtual void updateControlsOnScrollListChange(); virtual S32 getNameColumnIndex() const; + virtual S32 getOwnerNameColumnIndex() const; + virtual std::string getOwnerName(const LLPathfindingObject *pObject) const; virtual const LLColor4 &getBeaconColor() const; virtual LLPathfindingObjectListPtr getEmptyObjectList() const; diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index dd28f82db1..4d3b7fca91 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -280,6 +280,22 @@ S32 LLFloaterPathfindingLinksets::getNameColumnIndex() const return 0; } +S32 LLFloaterPathfindingLinksets::getOwnerNameColumnIndex() const +{ + return 2; +} + +std::string LLFloaterPathfindingLinksets::getOwnerName(const LLPathfindingObject *pObject) const +{ + return (pObject->hasOwner() + ? (pObject->hasOwnerName() + ? (pObject->isGroupOwned() + ? (pObject->getOwnerName() + " " + getString("linkset_owner_group")) + : pObject->getOwnerName()) + : getString("linkset_owner_loading")) + : getString("linkset_owner_unknown")); +} + const LLColor4 &LLFloaterPathfindingLinksets::getBeaconColor() const { return mBeaconColor; @@ -398,13 +414,7 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfi columns[1]["value"] = pLinksetPtr->getDescription(); columns[2]["column"] = "owner"; - columns[2]["value"] = (pLinksetPtr->hasOwner() - ? (pLinksetPtr->hasOwnerName() - ? (pLinksetPtr->isGroupOwned() - ? (pLinksetPtr->getOwnerName() + " " + getString("linkset_owner_group")) - : pLinksetPtr->getOwnerName()) - : getString("linkset_owner_loading")) - : getString("linkset_owner_unknown")); + columns[2]["value"] = getOwnerName(pLinksetPtr); columns[3]["column"] = "land_impact"; columns[3]["value"] = llformat("%1d", pLinksetPtr->getLandImpact()); diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 0877a427b3..d371f36ac3 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -63,6 +63,8 @@ protected: virtual void updateControlsOnScrollListChange(); virtual S32 getNameColumnIndex() const; + virtual S32 getOwnerNameColumnIndex() const; + virtual std::string getOwnerName(const LLPathfindingObject *pObject) const; virtual const LLColor4 &getBeaconColor() const; virtual LLPathfindingObjectListPtr getEmptyObjectList() const; diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index b3ac18e106..20c1215bcb 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -408,7 +408,7 @@ void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjec if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName()) { mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem)); - pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1, _2)); + pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1)); } } @@ -435,6 +435,13 @@ S32 LLFloaterPathfindingObjects::getOwnerNameColumnIndex() const return 2; } +std::string LLFloaterPathfindingObjects::getOwnerName(const LLPathfindingObject *pObject) const +{ + llassert(0); + std::string returnVal; + return returnVal; +} + const LLColor4 &LLFloaterPathfindingObjects::getBeaconColor() const { return mDefaultBeaconColor; @@ -685,9 +692,10 @@ void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel) requestGetObjects(); } -void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLUUID &pObjectUUID, const std::string &pOwnerName) +void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLPathfindingObject *pObject) { - const std::string uuid = pObjectUUID.asString(); + llassert(pObject != NULL); + const std::string uuid = pObject->getUUID().asString(); scroll_list_item_map::iterator scrollListItemIter = mMissingNameObjectsScrollListItems.find(uuid); if (scrollListItemIter != mMissingNameObjectsScrollListItems.end()) { @@ -695,7 +703,7 @@ void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLUUID &pObject llassert(scrollListItem != NULL); LLScrollListCell *scrollListCell = scrollListItem->getColumn(getOwnerNameColumnIndex()); - LLSD ownerName = pOwnerName; + LLSD ownerName = getOwnerName(pObject); scrollListCell->setValue(ownerName); diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index b7fd4340ed..4024e15fd6 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -89,6 +89,7 @@ protected: virtual S32 getNameColumnIndex() const; virtual S32 getOwnerNameColumnIndex() const; + virtual std::string getOwnerName(const LLPathfindingObject *pObject) const; virtual const LLColor4 &getBeaconColor() const; virtual const LLColor4 &getBeaconTextColor() const; virtual S32 getBeaconWidth() const; @@ -127,7 +128,7 @@ private: void onRegionBoundaryCrossed(); void onGodLevelChange(U8 pGodLevel); - void handleObjectNameResponse(const LLUUID &pObjectUUID, const std::string &pOwnerName); + void handleObjectNameResponse(const LLPathfindingObject *pObject); void updateMessagingStatus(); void updateStateOnListControls(); diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp index 95da05740d..858d3203c0 100644 --- a/indra/newview/llpathfindingobject.cpp +++ b/indra/newview/llpathfindingobject.cpp @@ -129,7 +129,7 @@ LLPathfindingObject::name_connection_t LLPathfindingObject::registerOwnerNameLis name_connection_t connection; if (hasOwnerName()) { - pOwnerNameCallback(getUUID(), getOwnerName()); + pOwnerNameCallback(this); } else { @@ -187,7 +187,7 @@ void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const disconnectAvatarNameCacheConnection(); - mOwnerNameSignal(getUUID(), getOwnerName()); + mOwnerNameSignal(this); } void LLPathfindingObject::disconnectAvatarNameCacheConnection() diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index 81b6a2402f..b8d3ca2364 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -62,9 +62,9 @@ public: inline BOOL isGroupOwned() const {return mIsGroupOwned;}; inline const LLVector3& getLocation() const {return mLocation;}; - typedef boost::function name_callback_t; - typedef boost::signals2::signal name_signal_t; - typedef boost::signals2::connection name_connection_t; + typedef boost::function name_callback_t; + typedef boost::signals2::signal name_signal_t; + typedef boost::signals2::connection name_connection_t; name_connection_t registerOwnerNameListener(name_callback_t pOwnerNameCallback); -- cgit v1.3