summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpathfindingobjects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpathfindingobjects.cpp')
-rw-r--r--indra/newview/llfloaterpathfindingobjects.cpp132
1 files changed, 75 insertions, 57 deletions
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index e246265be9..20c1215bcb 100644
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -29,6 +29,8 @@
#include "llfloaterpathfindingobjects.h"
+#include <string>
+#include <map>
#include <vector>
#include <boost/bind.hpp>
@@ -96,7 +98,6 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey)
void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting)
{
-
if (mGodLevelChangeSlot.connected())
{
mGodLevelChangeSlot.disconnect();
@@ -119,6 +120,11 @@ void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting)
{
mObjectsSelection.clear();
}
+
+ if (pIsAppQuitting)
+ {
+ clearAllObjects();
+ }
}
void LLFloaterPathfindingObjects::draw()
@@ -168,13 +174,13 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed)
mReturnButton(NULL),
mDeleteButton(NULL),
mTeleportButton(NULL),
- mLoadingAvatarNames(),
mDefaultBeaconColor(),
mDefaultBeaconTextColor(),
mErrorTextColor(),
mWarningTextColor(),
mMessagingState(kMessagingUnknown),
mMessagingRequestId(0U),
+ mMissingNameObjectsScrollListItems(),
mObjectList(),
mObjectsSelection(),
mHasObjectsToBeSelected(false),
@@ -186,6 +192,7 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed)
LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects()
{
+ clearAllObjects();
}
BOOL LLFloaterPathfindingObjects::postBuild()
@@ -343,54 +350,21 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList()
S32 origScrollPosition = mObjectsScrollList->getScrollPos();
mObjectsScrollList->deleteAllItems();
+ mMissingNameObjectsScrollListItems.clear();
if ((mObjectList != NULL) && !mObjectList->isEmpty())
{
- LLSD scrollListData = convertObjectsIntoScrollListData(mObjectList);
- llassert(scrollListData.isArray());
+ buildObjectsScrollList(mObjectList);
- LLScrollListCell::Params cellParams;
- cellParams.font = LLFontGL::getFontSansSerif();
-
- for (LLSD::array_const_iterator rowElementIter = scrollListData.beginArray(); rowElementIter != scrollListData.endArray(); ++rowElementIter)
+ mObjectsScrollList->selectMultiple(mObjectsToBeSelected);
+ if (mHasObjectsToBeSelected)
{
- const LLSD &rowElement = *rowElementIter;
-
- LLScrollListItem::Params rowParams;
- llassert(rowElement.has("id"));
- llassert(rowElement.get("id").isString());
- rowParams.value = rowElement.get("id");
-
- llassert(rowElement.has("column"));
- llassert(rowElement.get("column").isArray());
- const LLSD &columnElement = rowElement.get("column");
- for (LLSD::array_const_iterator cellIter = columnElement.beginArray(); cellIter != columnElement.endArray(); ++cellIter)
- {
- const LLSD &cellElement = *cellIter;
-
- llassert(cellElement.has("column"));
- llassert(cellElement.get("column").isString());
- cellParams.column = cellElement.get("column").asString();
-
- llassert(cellElement.has("value"));
- llassert(cellElement.get("value").isString());
- cellParams.value = cellElement.get("value").asString();
-
- rowParams.columns.add(cellParams);
- }
-
- mObjectsScrollList->addRow(rowParams);
+ mObjectsScrollList->scrollToShowSelected();
+ }
+ else
+ {
+ mObjectsScrollList->setScrollPos(origScrollPosition);
}
- }
-
- mObjectsScrollList->selectMultiple(mObjectsToBeSelected);
- if (mHasObjectsToBeSelected)
- {
- mObjectsScrollList->scrollToShowSelected();
- }
- else
- {
- mObjectsScrollList->setScrollPos(origScrollPosition);
}
mObjectsToBeSelected.clear();
@@ -399,20 +373,42 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList()
updateControlsOnScrollListChange();
}
-LLSD LLFloaterPathfindingObjects::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr)
+void LLFloaterPathfindingObjects::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr)
{
llassert(0);
- LLSD nullObjs = LLSD::emptyArray();
- return nullObjs;
}
-void LLFloaterPathfindingObjects::rebuildScrollListAfterAvatarNameLoads(const LLUUID &pAvatarId)
+void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjectPtr pObjectPtr, const LLSD &pScrollListItemData)
{
- std::set<LLUUID>::const_iterator iter = mLoadingAvatarNames.find(pAvatarId);
- if (iter == mLoadingAvatarNames.end())
+ LLScrollListCell::Params cellParams;
+ cellParams.font = LLFontGL::getFontSansSerif();
+
+ LLScrollListItem::Params rowParams;
+ rowParams.value = pObjectPtr->getUUID().asString();
+
+ llassert(pScrollListItemData.isArray());
+ for (LLSD::array_const_iterator cellIter = pScrollListItemData.beginArray();
+ cellIter != pScrollListItemData.endArray(); ++cellIter)
+ {
+ const LLSD &cellElement = *cellIter;
+
+ llassert(cellElement.has("column"));
+ llassert(cellElement.get("column").isString());
+ cellParams.column = cellElement.get("column").asString();
+
+ llassert(cellElement.has("value"));
+ llassert(cellElement.get("value").isString());
+ cellParams.value = cellElement.get("value").asString();
+
+ rowParams.columns.add(cellParams);
+ }
+
+ LLScrollListItem *scrollListItem = mObjectsScrollList->addRow(rowParams);
+
+ if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
{
- mLoadingAvatarNames.insert(pAvatarId);
- LLAvatarNameCache::get(pAvatarId, boost::bind(&LLFloaterPathfindingObjects::handleAvatarNameLoads, this, _1, _2));
+ mMissingNameObjectsScrollListItems.insert(std::make_pair<std::string, LLScrollListItem *>(pObjectPtr->getUUID().asString(), scrollListItem));
+ pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
}
}
@@ -434,6 +430,18 @@ S32 LLFloaterPathfindingObjects::getNameColumnIndex() const
return 0;
}
+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;
@@ -496,6 +504,7 @@ void LLFloaterPathfindingObjects::clearAllObjects()
{
selectNoneObjects();
mObjectsScrollList->deleteAllItems();
+ mMissingNameObjectsScrollListItems.clear();
mObjectList.reset();
}
@@ -683,13 +692,22 @@ void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel)
requestGetObjects();
}
-void LLFloaterPathfindingObjects::handleAvatarNameLoads(const LLUUID &pAvatarId, const LLAvatarName &pAvatarName)
+void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLPathfindingObject *pObject)
{
- llassert(mLoadingAvatarNames.find(pAvatarId) != mLoadingAvatarNames.end());
- mLoadingAvatarNames.erase(pAvatarId);
- if (mLoadingAvatarNames.empty())
+ llassert(pObject != NULL);
+ const std::string uuid = pObject->getUUID().asString();
+ scroll_list_item_map::iterator scrollListItemIter = mMissingNameObjectsScrollListItems.find(uuid);
+ if (scrollListItemIter != mMissingNameObjectsScrollListItems.end())
{
- rebuildObjectsScrollList();
+ LLScrollListItem *scrollListItem = scrollListItemIter->second;
+ llassert(scrollListItem != NULL);
+
+ LLScrollListCell *scrollListCell = scrollListItem->getColumn(getOwnerNameColumnIndex());
+ LLSD ownerName = getOwnerName(pObject);
+
+ scrollListCell->setValue(ownerName);
+
+ mMissingNameObjectsScrollListItems.erase(scrollListItemIter);
}
}