summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatertopobjects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatertopobjects.cpp')
-rw-r--r--indra/newview/llfloatertopobjects.cpp84
1 files changed, 51 insertions, 33 deletions
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 84ea353dab..491daeebaf 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -34,7 +34,9 @@
#include "llfloatertopobjects.h"
+// library includes
#include "message.h"
+#include "llavatarnamecache.h"
#include "llfontgl.h"
#include "llagent.h"
@@ -98,7 +100,7 @@ LLFloaterTopObjects::~LLFloaterTopObjects()
BOOL LLFloaterTopObjects::postBuild()
{
LLScrollListCtrl *objects_list = getChild<LLScrollListCtrl>("objects_list");
- childSetFocus("objects_list");
+ getChild<LLUICtrl>("objects_list")->setFocus(TRUE);
objects_list->setDoubleClickCallback(onDoubleClickObjectsList, this);
objects_list->setCommitOnSelectionChange(TRUE);
@@ -196,37 +198,53 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
LLSD element;
element["id"] = task_id;
- element["object_name"] = name_buf;
- element["owner_name"] = owner_buf;
- element["columns"][0]["column"] = "score";
- element["columns"][0]["value"] = llformat("%0.3f", score);
- element["columns"][0]["font"] = "SANSSERIF";
+
+ LLSD columns;
+ columns[0]["column"] = "score";
+ columns[0]["value"] = llformat("%0.3f", score);
+ columns[0]["font"] = "SANSSERIF";
+
+ columns[1]["column"] = "name";
+ columns[1]["value"] = name_buf;
+ columns[1]["font"] = "SANSSERIF";
+
+ // Owner names can have trailing spaces sent from server
+ LLStringUtil::trim(owner_buf);
- element["columns"][1]["column"] = "name";
- element["columns"][1]["value"] = name_buf;
- element["columns"][1]["font"] = "SANSSERIF";
- element["columns"][2]["column"] = "owner";
- element["columns"][2]["value"] = owner_buf;
- element["columns"][2]["font"] = "SANSSERIF";
- element["columns"][3]["column"] = "location";
- element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
- element["columns"][3]["font"] = "SANSSERIF";
- element["columns"][4]["column"] = "time";
- element["columns"][4]["value"] = formatted_time((time_t)time_stamp);
- element["columns"][4]["font"] = "SANSSERIF";
+ if (LLAvatarNameCache::useDisplayNames())
+ {
+ // ...convert hard-coded name from server to a username
+ // *TODO: Send owner_id from server and look up display name
+ owner_buf = LLCacheName::buildUsername(owner_buf);
+ }
+ else
+ {
+ // ...just strip out legacy "Resident" name
+ owner_buf = LLCacheName::cleanFullName(owner_buf);
+ }
+ columns[2]["column"] = "owner";
+ columns[2]["value"] = owner_buf;
+ columns[2]["font"] = "SANSSERIF";
+
+ columns[3]["column"] = "location";
+ columns[3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
+ columns[3]["font"] = "SANSSERIF";
+ columns[4]["column"] = "time";
+ columns[4]["value"] = formatted_time((time_t)time_stamp);
+ columns[4]["font"] = "SANSSERIF";
if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
&& have_extended_data)
{
- element["columns"][5]["column"] = "mono_time";
- element["columns"][5]["value"] = llformat("%0.3f", mono_score);
- element["columns"][5]["font"] = "SANSSERIF";
+ columns[5]["column"] = "mono_time";
+ columns[5]["value"] = llformat("%0.3f", mono_score);
+ columns[5]["font"] = "SANSSERIF";
- element["columns"][6]["column"] = "URLs";
- element["columns"][6]["value"] = llformat("%d", public_urls);
- element["columns"][6]["font"] = "SANSSERIF";
+ columns[6]["column"] = "URLs";
+ columns[6]["value"] = llformat("%d", public_urls);
+ columns[6]["font"] = "SANSSERIF";
}
-
+ element["columns"] = columns;
list->addElement(element);
mObjectListData.append(element);
@@ -253,7 +271,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
LLUIString format = getString("top_scripts_text");
format.setArg("[COUNT]", llformat("%d", total_count));
format.setArg("[TIME]", llformat("%0.1f", mtotalScore));
- childSetValue("title_text", LLSD(format));
+ getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
}
else
{
@@ -262,7 +280,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
list->setColumnLabel("mono_time", "");
LLUIString format = getString("top_colliders_text");
format.setArg("[COUNT]", llformat("%d", total_count));
- childSetValue("title_text", LLSD(format));
+ getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
}
}
@@ -282,13 +300,13 @@ void LLFloaterTopObjects::updateSelectionInfo()
std::string object_id_string = object_id.asString();
- childSetValue("id_editor", LLSD(object_id_string));
+ getChild<LLUICtrl>("id_editor")->setValue(LLSD(object_id_string));
LLScrollListItem* sli = list->getFirstSelected();
llassert(sli);
if (sli)
{
- childSetValue("object_name_editor", sli->getColumn(1)->getValue().asString());
- childSetValue("owner_name_editor", sli->getColumn(2)->getValue().asString());
+ getChild<LLUICtrl>("object_name_editor")->setValue(sli->getColumn(1)->getValue().asString());
+ getChild<LLUICtrl>("owner_name_editor")->setValue(sli->getColumn(2)->getValue().asString());
}
}
@@ -312,7 +330,7 @@ void LLFloaterTopObjects::doToObjects(int action, bool all)
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
- LLCtrlListInterface *list = childGetListInterface("objects_list");
+ LLCtrlListInterface *list = getChild<LLUICtrl>("objects_list")->getListInterface();
if (!list || list->getItemCount() == 0) return;
uuid_vec_t::iterator id_itor;
@@ -457,14 +475,14 @@ void LLFloaterTopObjects::onRefresh()
void LLFloaterTopObjects::onGetByObjectName()
{
mFlags = STAT_FILTER_BY_OBJECT;
- mFilter = childGetText("object_name_editor");
+ mFilter = getChild<LLUICtrl>("object_name_editor")->getValue().asString();
onRefresh();
}
void LLFloaterTopObjects::onGetByOwnerName()
{
mFlags = STAT_FILTER_BY_OWNER;
- mFilter = childGetText("owner_name_editor");
+ mFilter = getChild<LLUICtrl>("owner_name_editor")->getValue().asString();
onRefresh();
}