diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloatermyscripts.cpp | 294 | ||||
-rw-r--r-- | indra/newview/llfloatermyscripts.h | 60 | ||||
-rw-r--r-- | indra/newview/llfloaterscriptlimits.cpp | 299 | ||||
-rw-r--r-- | indra/newview/llfloaterscriptlimits.h | 47 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_my_scripts.xml | 22 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 7 |
8 files changed, 389 insertions, 344 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 60c27665bf..c389de1232 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -265,6 +265,7 @@ set(viewer_SOURCE_FILES llfloatermemleak.cpp llfloatermodelpreview.cpp llfloatermodeluploadbase.cpp + llfloatermyscripts.cpp llfloaternamedesc.cpp llfloaternotificationsconsole.cpp llfloaternotificationstabbed.cpp @@ -893,6 +894,7 @@ set(viewer_HEADER_FILES llfloatermemleak.h llfloatermodelpreview.h llfloatermodeluploadbase.h + llfloatermyscripts.h llfloaternamedesc.h llfloaternotificationsconsole.h llfloaternotificationstabbed.h diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp new file mode 100644 index 0000000000..fa2de21a8f --- /dev/null +++ b/indra/newview/llfloatermyscripts.cpp @@ -0,0 +1,294 @@ +/** + * @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$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloatermyscripts.h" + +#include "llagent.h" +#include "llcorehttputil.h" +#include "llcoros.h" +#include "lleventcoro.h" +#include "llfloaterreg.h" +#include "llscrolllistctrl.h" +#include "lltrans.h" +#include "llviewerregion.h" + +const S32 SIZE_OF_ONE_KB = 1024; + +LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed) + : LLFloater(seed), + mGotAttachmentMemoryUsed(false), + mAttachmentMemoryMax(0), + mAttachmentMemoryUsed(0), + mGotAttachmentURLsUsed(false), + mAttachmentURLsMax(0), + mAttachmentURLsUsed(0) +{ +} + +BOOL LLFloaterMyScripts::postBuild() +{ + childSetAction("refresh_list_btn", onClickRefresh, this); + + std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); + return requestAttachmentDetails(); +} + +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; + } +} + +void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + LLSD result = httpAdapter->getAndSuspend(httpRequest, url); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (!status) + { + LL_WARNS() << "Unable to retrieve attachment limits." << LL_ENDL; + return; + } + + LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts"); + + if (!instance) + { + LL_WARNS() << "Failed to get LLFloaterMyScripts instance" << LL_ENDL; + return; + } + + instance->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); + + LLButton* btn = instance->getChild<LLButton>("refresh_list_btn"); + if (btn) + { + btn->setEnabled(true); + } + + result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); + 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); + } +} + +void LLFloaterMyScripts::clearList() +{ + LLCtrlListInterface *list = childGetListInterface("scripts_list"); + + if (list) + { + list->operateOnAll(LLCtrlListInterface::OP_DELETE); + } + + 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)); + } +} + +// 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->requestAttachmentDetails(); + } + else + { + LL_WARNS() << "could not find LLFloaterMyScripts instance after refresh button clicked" << LL_ENDL; + } +} + diff --git a/indra/newview/llfloatermyscripts.h b/indra/newview/llfloatermyscripts.h new file mode 100644 index 0000000000..fe33ab90ae --- /dev/null +++ b/indra/newview/llfloatermyscripts.h @@ -0,0 +1,60 @@ +/** + * @file llfloatermyscripts.h + * @brief LLFloaterMyScripts class definition. + * + * $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$ + */ + +#ifndef LL_LLFLOATERMYSCRIPTS_H +#define LL_LLFLOATERMYSCRIPTS_H + +#include "llfloater.h" +#include "llpanel.h" + +class LLFloaterMyScripts : public LLFloater +{ +public: + LLFloaterMyScripts(const LLSD& seed); + + BOOL postBuild(); + void setAttachmentDetails(LLSD content); + void setAttachmentSummary(LLSD content); + BOOL requestAttachmentDetails(); + void clearList(); + +private: + void getAttachmentLimitsCoro(std::string url); + + bool mGotAttachmentMemoryUsed; + S32 mAttachmentMemoryMax; + S32 mAttachmentMemoryUsed; + + bool mGotAttachmentURLsUsed; + S32 mAttachmentURLsMax; + S32 mAttachmentURLsUsed; + +protected: + + static void onClickRefresh(void* userdata); +}; + +#endif diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 21df769d0c..3746b9b6c2 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -90,19 +90,6 @@ LLFloaterScriptLimits::LLFloaterScriptLimits(const LLSD& seed) BOOL LLFloaterScriptLimits::postBuild() { - // a little cheap and cheerful - if there's an about land panel open default to showing parcel info, - // otherwise default to showing attachments (avatar appearance) - bool selectParcelPanel = false; - - LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); - if(instance) - { - if(instance->isShown()) - { - selectParcelPanel = true; - } - } - mTab = getChild<LLTabContainer>("scriptlimits_panels"); if(!mTab) @@ -111,28 +98,12 @@ BOOL LLFloaterScriptLimits::postBuild() return FALSE; } - // contruct the panels + // contruct the panel LLPanelScriptLimitsRegionMemory* panel_memory = new LLPanelScriptLimitsRegionMemory; mInfoPanels.push_back(panel_memory); panel_memory->buildFromFile( "panel_script_limits_region_memory.xml"); mTab->addTabPanel(panel_memory); - - LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment; - mInfoPanels.push_back(panel_attachments); - panel_attachments->buildFromFile("panel_script_limits_my_avatar.xml"); - mTab->addTabPanel(panel_attachments); - - - if(mInfoPanels.size() > 0) - { - mTab->selectTab(0); - } - - if(!selectParcelPanel && (mInfoPanels.size() > 1)) - { - mTab->selectTab(1); - } - + mTab->selectTab(0); return TRUE; } @@ -969,269 +940,3 @@ void LLPanelScriptLimitsRegionMemory::onClickReturn(void* userdata) } } -///---------------------------------------------------------------------------- -// Attachment Panel -///---------------------------------------------------------------------------- - -BOOL LLPanelScriptLimitsAttachment::requestAttachmentDetails() -{ - if (!gAgent.getRegion()) return FALSE; - - LLSD body; - std::string url = gAgent.getRegion()->getCapability("AttachmentResources"); - if (!url.empty()) - { - LLCoros::instance().launch("LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro", - boost::bind(&LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro, this, url)); - return TRUE; - } - else - { - return FALSE; - } -} - -void LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro(std::string url) -{ - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - - LLSD result = httpAdapter->getAndSuspend(httpRequest, url); - - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - - if (!status) - { - LL_WARNS() << "Unable to retrieve attachment limits." << LL_ENDL; - return; - } - - LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); - - if (!instance) - { - LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; - return; - } - - LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels"); - if (!tab) - { - LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL; - return; - } - - LLPanelScriptLimitsAttachment* panel = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel"); - if (!panel) - { - LL_WARNS() << "Failed to get script_limits_my_avatar_panel" << LL_ENDL; - return; - } - - panel->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); - - LLButton* btn = panel->getChild<LLButton>("refresh_list_btn"); - if (btn) - { - btn->setEnabled(true); - } - - result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); - panel->setAttachmentDetails(result); -} - - -void LLPanelScriptLimitsAttachment::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); - } -} - -BOOL LLPanelScriptLimitsAttachment::postBuild() -{ - childSetAction("refresh_list_btn", onClickRefresh, this); - - std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); - getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); - return requestAttachmentDetails(); -} - -void LLPanelScriptLimitsAttachment::clearList() -{ - LLCtrlListInterface *list = childGetListInterface("scripts_list"); - - if (list) - { - list->operateOnAll(LLCtrlListInterface::OP_DELETE); - } - - std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); - getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); -} - -void LLPanelScriptLimitsAttachment::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)); - } -} - -// static -void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata) -{ - LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); - if(instance) - { - LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels"); - LLPanelScriptLimitsAttachment* panel_attachments = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel"); - LLButton* btn = panel_attachments->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); - } - panel_attachments->clearList(); - panel_attachments->requestAttachmentDetails(); - - return; - } - else - { - LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL; - return; - } -} - diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h index 16450c6527..d2192f9d01 100644 --- a/indra/newview/llfloaterscriptlimits.h +++ b/indra/newview/llfloaterscriptlimits.h @@ -152,51 +152,4 @@ protected: static void onClickReturn(void* userdata); }; -///////////////////////////////////////////////////////////////////////////// -// Attachment panel -///////////////////////////////////////////////////////////////////////////// - -class LLPanelScriptLimitsAttachment : public LLPanelScriptLimitsInfo -{ - -public: - LLPanelScriptLimitsAttachment() - : LLPanelScriptLimitsInfo(), - mGotAttachmentMemoryUsed(false), - mAttachmentMemoryMax(0), - mAttachmentMemoryUsed(0), - mGotAttachmentURLsUsed(false), - mAttachmentURLsMax(0), - mAttachmentURLsUsed(0) - {}; - - ~LLPanelScriptLimitsAttachment() - { - }; - - // LLPanel - virtual BOOL postBuild(); - - void setAttachmentDetails(LLSD content); - - void setAttachmentSummary(LLSD content); - BOOL requestAttachmentDetails(); - void clearList(); - -private: - void getAttachmentLimitsCoro(std::string url); - - bool mGotAttachmentMemoryUsed; - S32 mAttachmentMemoryMax; - S32 mAttachmentMemoryUsed; - - bool mGotAttachmentURLsUsed; - S32 mAttachmentURLsMax; - S32 mAttachmentURLsUsed; - -protected: - - static void onClickRefresh(void* userdata); -}; - #endif diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0ebacddd9b..a7b2fafddf 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -90,6 +90,7 @@ #include "llfloatermediasettings.h" #include "llfloatermemleak.h" #include "llfloatermodelpreview.h" +#include "llfloatermyscripts.h" #include "llfloaternamedesc.h" #include "llfloaternotificationsconsole.h" #include "llfloaternotificationstabbed.h" @@ -335,6 +336,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebugOutput>); LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLScriptFloater>); LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>); + LLFloaterReg::add("my_scripts", "floater_my_scripts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyScripts>); LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>); diff --git a/indra/newview/skins/default/xui/en/floater_my_scripts.xml b/indra/newview/skins/default/xui/en/floater_my_scripts.xml new file mode 100644 index 0000000000..3b0b6723c7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_scripts.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + can_resize="true" + height="570" + help_topic="scriptlimits" + layout="topleft" + name="myscripts" + save_rect="true" + title="My Scripts" + min_width="620" + width="620"> + <panel + filename="panel_script_limits_my_avatar.xml" + follows="all" + bottom="555" + layout="topleft" + left="3" + right="-2" + name="script_limits_my_avatar_panel" + top="20"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 42744b561f..cac84cfccf 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -73,6 +73,13 @@ function="Floater.ToggleOrBringToFront" parameter="experiences"/> </menu_item_call> + <menu_item_call + label="My Scripts..." + name="MyScripts"> + <menu_item_call.on_click + function="Floater.ToggleOrBringToFront" + parameter="my_scripts"/> + </menu_item_call> <menu_item_separator/> <menu_item_call label="Camera Controls..." |