summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermyscripts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatermyscripts.cpp')
-rw-r--r--indra/newview/llfloatermyscripts.cpp386
1 files changed, 193 insertions, 193 deletions
diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp
index 6f9a6c9066..5426629430 100644
--- a/indra/newview/llfloatermyscripts.cpp
+++ b/indra/newview/llfloatermyscripts.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llfloatermyscripts.cpp
* @brief LLFloaterMyScripts class implementation.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,25 +39,25 @@
const S32 SIZE_OF_ONE_KB = 1024;
LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed)
- : LLFloater(seed),
- mGotAttachmentMemoryUsed(false),
- mAttachmentDetailsRequested(false),
- mAttachmentMemoryMax(0),
- mAttachmentMemoryUsed(0),
- mGotAttachmentURLsUsed(false),
- mAttachmentURLsMax(0),
- mAttachmentURLsUsed(0)
+ : LLFloater(seed),
+ mGotAttachmentMemoryUsed(false),
+ mAttachmentDetailsRequested(false),
+ mAttachmentMemoryMax(0),
+ mAttachmentMemoryUsed(0),
+ mGotAttachmentURLsUsed(false),
+ mAttachmentURLsMax(0),
+ mAttachmentURLsUsed(0)
{
}
BOOL LLFloaterMyScripts::postBuild()
{
- childSetAction("refresh_list_btn", onClickRefresh, this);
+ childSetAction("refresh_list_btn", onClickRefresh, this);
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
- mAttachmentDetailsRequested = requestAttachmentDetails();
- return TRUE;
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ mAttachmentDetailsRequested = requestAttachmentDetails();
+ return TRUE;
}
// virtual
@@ -73,20 +73,20 @@ void LLFloaterMyScripts::onOpen(const LLSD& key)
bool LLFloaterMyScripts::requestAttachmentDetails()
{
- if (!gAgent.getRegion()) return false;
-
- LLSD body;
- std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
- if (!url.empty())
- {
- LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
- boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
- return true;
- }
- else
- {
- return false;
- }
+ if (!gAgent.getRegion()) return false;
+
+ LLSD body;
+ std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
+ if (!url.empty())
+ {
+ LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
+ boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url)
@@ -115,193 +115,193 @@ void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url)
return;
}
- instance->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
+ instance->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
- LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
+ LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
if (btn)
{
btn->setEnabled(true);
}
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
- instance->setAttachmentDetails(result);
+ instance->setAttachmentDetails(result);
}
void LLFloaterMyScripts::setAttachmentDetails(LLSD content)
{
- LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
-
- if(!list)
- {
- return;
- }
-
- S32 number_attachments = content["attachments"].size();
-
- for(int i = 0; i < number_attachments; i++)
- {
- std::string humanReadableLocation = "";
- if(content["attachments"][i].has("location"))
- {
- std::string actualLocation = content["attachments"][i]["location"];
- humanReadableLocation = LLTrans::getString(actualLocation.c_str());
- }
-
- S32 number_objects = content["attachments"][i]["objects"].size();
- for(int j = 0; j < number_objects; j++)
- {
- LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
- S32 size = 0;
- if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
- {
- size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
- }
- S32 urls = 0;
- if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
- {
- urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger();
- }
- std::string name = content["attachments"][i]["objects"][j]["name"].asString();
-
- LLSD element;
-
- element["id"] = task_id;
- element["columns"][0]["column"] = "size";
- element["columns"][0]["value"] = llformat("%d", size);
- element["columns"][0]["font"] = "SANSSERIF";
- element["columns"][0]["halign"] = LLFontGL::RIGHT;
-
- element["columns"][1]["column"] = "urls";
- element["columns"][1]["value"] = llformat("%d", urls);
- element["columns"][1]["font"] = "SANSSERIF";
- element["columns"][1]["halign"] = LLFontGL::RIGHT;
-
- element["columns"][2]["column"] = "name";
- element["columns"][2]["value"] = name;
- element["columns"][2]["font"] = "SANSSERIF";
-
- element["columns"][3]["column"] = "location";
- element["columns"][3]["value"] = humanReadableLocation;
- element["columns"][3]["font"] = "SANSSERIF";
-
- list->addElement(element);
- }
- }
-
- setAttachmentSummary(content);
-
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
-
- LLButton* btn = getChild<LLButton>("refresh_list_btn");
- if(btn)
- {
- btn->setEnabled(true);
- }
+ LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
+
+ if(!list)
+ {
+ return;
+ }
+
+ S32 number_attachments = content["attachments"].size();
+
+ for(int i = 0; i < number_attachments; i++)
+ {
+ std::string humanReadableLocation = "";
+ if(content["attachments"][i].has("location"))
+ {
+ std::string actualLocation = content["attachments"][i]["location"];
+ humanReadableLocation = LLTrans::getString(actualLocation.c_str());
+ }
+
+ S32 number_objects = content["attachments"][i]["objects"].size();
+ for(int j = 0; j < number_objects; j++)
+ {
+ LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
+ S32 size = 0;
+ if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
+ {
+ size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
+ }
+ S32 urls = 0;
+ if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
+ {
+ urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger();
+ }
+ std::string name = content["attachments"][i]["objects"][j]["name"].asString();
+
+ LLSD element;
+
+ element["id"] = task_id;
+ element["columns"][0]["column"] = "size";
+ element["columns"][0]["value"] = llformat("%d", size);
+ element["columns"][0]["font"] = "SANSSERIF";
+ element["columns"][0]["halign"] = LLFontGL::RIGHT;
+
+ element["columns"][1]["column"] = "urls";
+ element["columns"][1]["value"] = llformat("%d", urls);
+ element["columns"][1]["font"] = "SANSSERIF";
+ element["columns"][1]["halign"] = LLFontGL::RIGHT;
+
+ element["columns"][2]["column"] = "name";
+ element["columns"][2]["value"] = name;
+ element["columns"][2]["font"] = "SANSSERIF";
+
+ element["columns"][3]["column"] = "location";
+ element["columns"][3]["value"] = humanReadableLocation;
+ element["columns"][3]["font"] = "SANSSERIF";
+
+ list->addElement(element);
+ }
+ }
+
+ setAttachmentSummary(content);
+
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
+
+ LLButton* btn = getChild<LLButton>("refresh_list_btn");
+ if(btn)
+ {
+ btn->setEnabled(true);
+ }
}
void LLFloaterMyScripts::clearList()
{
- LLCtrlListInterface *list = childGetListInterface("scripts_list");
+ LLCtrlListInterface *list = childGetListInterface("scripts_list");
- if (list)
- {
- list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- }
+ if (list)
+ {
+ list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+ }
- std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
- getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
+ std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
+ getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
}
void LLFloaterMyScripts::setAttachmentSummary(LLSD content)
{
- if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
- {
- mAttachmentMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mAttachmentMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mGotAttachmentMemoryUsed = true;
- }
- else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
- {
- mAttachmentMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mAttachmentMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
- mGotAttachmentMemoryUsed = true;
- }
- else
- {
- LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
- return;
- }
-
- if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
- {
- mAttachmentURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
- mAttachmentURLsMax = content["summary"]["available"][0]["amount"].asInteger();
- mGotAttachmentURLsUsed = true;
- }
- else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
- {
- mAttachmentURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
- mAttachmentURLsMax = content["summary"]["available"][1]["amount"].asInteger();
- mGotAttachmentURLsUsed = true;
- }
- else
- {
- LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
- return;
- }
-
- if((mAttachmentMemoryUsed >= 0) && (mAttachmentMemoryMax >= 0))
- {
- LLStringUtil::format_map_t args_attachment_memory;
- args_attachment_memory["[COUNT]"] = llformat ("%d", mAttachmentMemoryUsed);
- std::string translate_message = "ScriptLimitsMemoryUsedSimple";
-
- if (0 < mAttachmentMemoryMax)
- {
- S32 attachment_memory_available = mAttachmentMemoryMax - mAttachmentMemoryUsed;
-
- args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax);
- args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available);
- translate_message = "ScriptLimitsMemoryUsed";
- }
-
- getChild<LLUICtrl>("memory_used")->setValue(LLTrans::getString(translate_message, args_attachment_memory));
- }
-
- if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0))
- {
- S32 attachment_urls_available = mAttachmentURLsMax - mAttachmentURLsUsed;
-
- LLStringUtil::format_map_t args_attachment_urls;
- args_attachment_urls["[COUNT]"] = llformat ("%d", mAttachmentURLsUsed);
- args_attachment_urls["[MAX]"] = llformat ("%d", mAttachmentURLsMax);
- args_attachment_urls["[AVAILABLE]"] = llformat ("%d", attachment_urls_available);
- std::string msg_attachment_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_attachment_urls);
- getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls));
- }
+ if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
+ {
+ mAttachmentMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mAttachmentMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mGotAttachmentMemoryUsed = true;
+ }
+ else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
+ {
+ mAttachmentMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mAttachmentMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
+ mGotAttachmentMemoryUsed = true;
+ }
+ else
+ {
+ LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
+ return;
+ }
+
+ if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
+ {
+ mAttachmentURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
+ mAttachmentURLsMax = content["summary"]["available"][0]["amount"].asInteger();
+ mGotAttachmentURLsUsed = true;
+ }
+ else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
+ {
+ mAttachmentURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
+ mAttachmentURLsMax = content["summary"]["available"][1]["amount"].asInteger();
+ mGotAttachmentURLsUsed = true;
+ }
+ else
+ {
+ LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
+ return;
+ }
+
+ if((mAttachmentMemoryUsed >= 0) && (mAttachmentMemoryMax >= 0))
+ {
+ LLStringUtil::format_map_t args_attachment_memory;
+ args_attachment_memory["[COUNT]"] = llformat ("%d", mAttachmentMemoryUsed);
+ std::string translate_message = "ScriptLimitsMemoryUsedSimple";
+
+ if (0 < mAttachmentMemoryMax)
+ {
+ S32 attachment_memory_available = mAttachmentMemoryMax - mAttachmentMemoryUsed;
+
+ args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax);
+ args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available);
+ translate_message = "ScriptLimitsMemoryUsed";
+ }
+
+ getChild<LLUICtrl>("memory_used")->setValue(LLTrans::getString(translate_message, args_attachment_memory));
+ }
+
+ if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0))
+ {
+ S32 attachment_urls_available = mAttachmentURLsMax - mAttachmentURLsUsed;
+
+ LLStringUtil::format_map_t args_attachment_urls;
+ args_attachment_urls["[COUNT]"] = llformat ("%d", mAttachmentURLsUsed);
+ args_attachment_urls["[MAX]"] = llformat ("%d", mAttachmentURLsMax);
+ args_attachment_urls["[AVAILABLE]"] = llformat ("%d", attachment_urls_available);
+ std::string msg_attachment_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_attachment_urls);
+ getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls));
+ }
}
// static
void LLFloaterMyScripts::onClickRefresh(void* userdata)
{
- LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts");
- if(instance)
- {
- LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
-
- //To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
- //turn the button off, then turn it on when we get a response
- if(btn)
- {
- btn->setEnabled(false);
- }
- instance->clearList();
- instance->mAttachmentDetailsRequested = instance->requestAttachmentDetails();
- }
- else
- {
- LL_WARNS() << "could not find LLFloaterMyScripts instance after refresh button clicked" << LL_ENDL;
- }
+ LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts");
+ if(instance)
+ {
+ LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
+
+ //To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
+ //turn the button off, then turn it on when we get a response
+ if(btn)
+ {
+ btn->setEnabled(false);
+ }
+ instance->clearList();
+ instance->mAttachmentDetailsRequested = instance->requestAttachmentDetails();
+ }
+ else
+ {
+ LL_WARNS() << "could not find LLFloaterMyScripts instance after refresh button clicked" << LL_ENDL;
+ }
}