aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatertopobjects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloatertopobjects.cpp')
-rw-r--r--linden/indra/newview/llfloatertopobjects.cpp63
1 files changed, 40 insertions, 23 deletions
diff --git a/linden/indra/newview/llfloatertopobjects.cpp b/linden/indra/newview/llfloatertopobjects.cpp
index a6efb06..ada5c68 100644
--- a/linden/indra/newview/llfloatertopobjects.cpp
+++ b/linden/indra/newview/llfloatertopobjects.cpp
@@ -44,6 +44,7 @@
44#include "lllineeditor.h" 44#include "lllineeditor.h"
45#include "lltextbox.h" 45#include "lltextbox.h"
46#include "lltracker.h" 46#include "lltracker.h"
47#include "llviewermessage.h"
47#include "llviewerparcelmgr.h" 48#include "llviewerparcelmgr.h"
48#include "llviewerregion.h" 49#include "llviewerregion.h"
49#include "lluictrlfactory.h" 50#include "lluictrlfactory.h"
@@ -51,6 +52,8 @@
51 52
52LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL; 53LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL;
53 54
55// Globals
56// const U32 TIME_STR_LENGTH = 30;
54 57
55// static 58// static
56void LLFloaterTopObjects::show() 59void LLFloaterTopObjects::show()
@@ -67,7 +70,7 @@ void LLFloaterTopObjects::show()
67} 70}
68 71
69LLFloaterTopObjects::LLFloaterTopObjects() 72LLFloaterTopObjects::LLFloaterTopObjects()
70: LLFloater("top_objects"), 73: LLFloater(std::string("top_objects")),
71 mInitialized(FALSE), 74 mInitialized(FALSE),
72 mtotalScore(0.f) 75 mtotalScore(0.f)
73{ 76{
@@ -124,7 +127,7 @@ BOOL LLFloaterTopObjects::postBuild()
124 127
125 mCurrentMode = STAT_REPORT_TOP_SCRIPTS; 128 mCurrentMode = STAT_REPORT_TOP_SCRIPTS;
126 mFlags = 0; 129 mFlags = 0;
127 mFilter = ""; 130 mFilter.clear();
128 131
129 return TRUE; 132 return TRUE;
130} 133}
@@ -154,18 +157,20 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
154 msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count); 157 msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
155 msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode); 158 msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode);
156 159
157 LLCtrlListInterface *list = childGetListInterface("objects_list"); 160 LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list");
158 if (!list) return;
159 161
160 S32 block_count = msg->getNumberOfBlocks("ReportData"); 162 S32 block_count = msg->getNumberOfBlocks("ReportData");
161 for (S32 block = 0; block < block_count; ++block) 163 for (S32 block = 0; block < block_count; ++block)
162 { 164 {
163 U32 task_local_id; 165 U32 task_local_id;
166 U32 time_stamp = 0;
164 LLUUID task_id; 167 LLUUID task_id;
165 F32 location_x, location_y, location_z; 168 F32 location_x, location_y, location_z;
166 F32 score; 169 F32 score;
167 char name_buf[MAX_STRING]; /* Flawfinder: ignore */ 170 std::string name_buf;
168 char owner_buf[MAX_STRING]; /* Flawfinder: ignore */ 171 std::string owner_buf;
172 F32 mono_score = 0.f;
173 bool have_extended_data = false;
169 174
170 msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block); 175 msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
171 msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block); 176 msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
@@ -173,17 +178,24 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
173 msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block); 178 msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
174 msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block); 179 msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
175 msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block); 180 msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
176 msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, MAX_STRING, name_buf, block); 181 msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
177 msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, MAX_STRING, owner_buf, block); 182 msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
178 183 if(msg->getNumberOfBlocks("DataExtended"))
184 {
185 have_extended_data = true;
186 msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
187 msg->getF32(_PREHASH_ReportData, "MonoScore", mono_score, block);
188 }
189
179 LLSD element; 190 LLSD element;
180 191
181 element["id"] = task_id; 192 element["id"] = task_id;
182 element["object_name"] = LLString(name_buf); 193 element["object_name"] = name_buf;
183 element["owner_name"] = LLString(owner_buf); 194 element["owner_name"] = owner_buf;
184 element["columns"][0]["column"] = "score"; 195 element["columns"][0]["column"] = "score";
185 element["columns"][0]["value"] = llformat("%0.3f", score); 196 element["columns"][0]["value"] = llformat("%0.3f", score);
186 element["columns"][0]["font"] = "SANSSERIF"; 197 element["columns"][0]["font"] = "SANSSERIF";
198
187 element["columns"][1]["column"] = "name"; 199 element["columns"][1]["column"] = "name";
188 element["columns"][1]["value"] = name_buf; 200 element["columns"][1]["value"] = name_buf;
189 element["columns"][1]["font"] = "SANSSERIF"; 201 element["columns"][1]["font"] = "SANSSERIF";
@@ -193,7 +205,18 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
193 element["columns"][3]["column"] = "location"; 205 element["columns"][3]["column"] = "location";
194 element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); 206 element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
195 element["columns"][3]["font"] = "SANSSERIF"; 207 element["columns"][3]["font"] = "SANSSERIF";
208 element["columns"][4]["column"] = "time";
209 element["columns"][4]["value"] = formatted_time((time_t)time_stamp);
210 element["columns"][4]["font"] = "SANSSERIF";
196 211
212 if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
213 && have_extended_data)
214 {
215 element["columns"][5]["column"] = "Mono Time";
216 element["columns"][5]["value"] = llformat("%0.3f", mono_score);
217 element["columns"][5]["font"] = "SANSSERIF";
218 }
219
197 list->addElement(element); 220 list->addElement(element);
198 221
199 mObjectListData.append(element); 222 mObjectListData.append(element);
@@ -204,13 +227,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
204 227
205 if (total_count == 0 && list->getItemCount() == 0) 228 if (total_count == 0 && list->getItemCount() == 0)
206 { 229 {
207 LLSD element; 230 list->addCommentText(getString("none_descriptor"));
208 element["id"] = LLUUID::null;
209 element["columns"][0]["column"] = "name";
210 element["columns"][0]["value"] = getString("none_descriptor");
211 element["columns"][0]["font"] = "SANSSERIF";
212
213 list->addElement(element);
214 } 231 }
215 else 232 else
216 { 233 {
@@ -393,7 +410,7 @@ void LLFloaterTopObjects::onRefresh(void* data)
393{ 410{
394 U32 mode = STAT_REPORT_TOP_SCRIPTS; 411 U32 mode = STAT_REPORT_TOP_SCRIPTS;
395 U32 flags = 0; 412 U32 flags = 0;
396 LLString filter = ""; 413 std::string filter = "";
397 414
398 if (sInstance) 415 if (sInstance)
399 { 416 {
@@ -418,7 +435,7 @@ void LLFloaterTopObjects::onRefresh(void* data)
418 435
419 if (sInstance) 436 if (sInstance)
420 { 437 {
421 sInstance->mFilter = ""; 438 sInstance->mFilter.clear();
422 sInstance->mFlags = 0; 439 sInstance->mFlags = 0;
423 } 440 }
424} 441}
@@ -451,8 +468,8 @@ void LLFloaterTopObjects::showBeacon()
451 LLScrollListItem* first_selected = list->getFirstSelected(); 468 LLScrollListItem* first_selected = list->getFirstSelected();
452 if (!first_selected) return; 469 if (!first_selected) return;
453 470
454 LLString name = first_selected->getColumn(1)->getValue().asString(); 471 std::string name = first_selected->getColumn(1)->getValue().asString();
455 LLString pos_string = first_selected->getColumn(3)->getValue().asString(); 472 std::string pos_string = first_selected->getColumn(3)->getValue().asString();
456 473
457 F32 x, y, z; 474 F32 x, y, z;
458 S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z); 475 S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
@@ -460,6 +477,6 @@ void LLFloaterTopObjects::showBeacon()
460 477
461 LLVector3 pos_agent(x, y, z); 478 LLVector3 pos_agent(x, y, z);
462 LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); 479 LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
463 LLString tooltip(""); 480 std::string tooltip("");
464 LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM); 481 LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
465} 482}