diff options
Diffstat (limited to 'indra/newview/llfloaterscriptlimits.cpp')
-rw-r--r-- | indra/newview/llfloaterscriptlimits.cpp | 191 |
1 files changed, 117 insertions, 74 deletions
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index fdf128945e..571f26e09f 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -3,31 +3,25 @@ * @author Gabriel Lee * @brief Implementation of the region info and controls floater and panels. * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, 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. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -110,7 +104,7 @@ BOOL LLFloaterScriptLimits::postBuild() if(!mTab) { - llinfos << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << llendl; + llwarns << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << llendl; return FALSE; } @@ -214,7 +208,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content) LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(!instance) { - llinfos << "Failed to get llfloaterscriptlimits instance" << llendl; + llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; } } @@ -227,7 +221,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content) void fetchScriptLimitsRegionInfoResponder::error(U32 status, const std::string& reason) { - llinfos << "Error from responder " << reason << llendl; + llwarns << "Error from responder " << reason << llendl; } void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) @@ -281,26 +275,40 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) OSMessageBox(nice_llsd.str(), "summary response:", 0); - llinfos << "summary response:" << *content << llendl; + llwarns << "summary response:" << *content << llendl; #endif LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(!instance) { - llinfos << "Failed to get llfloaterscriptlimits instance" << llendl; + llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; } else { LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels"); - LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel"); - panel_memory->setRegionSummary(content); + if(tab) + { + LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel"); + if(panel_memory) + { + panel_memory->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); + + LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn"); + if(btn) + { + btn->setEnabled(true); + } + + panel_memory->setRegionSummary(content); + } + } } } void fetchScriptLimitsRegionSummaryResponder::error(U32 status, const std::string& reason) { - llinfos << "Error from responder " << reason << llendl; + llwarns << "Error from responder " << reason << llendl; } void fetchScriptLimitsRegionDetailsResponder::result(const LLSD& content_ref) @@ -383,7 +391,7 @@ result (map) if(!instance) { - llinfos << "Failed to get llfloaterscriptlimits instance" << llendl; + llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; } else { @@ -397,19 +405,19 @@ result (map) } else { - llinfos << "Failed to get scriptlimits memory panel" << llendl; + llwarns << "Failed to get scriptlimits memory panel" << llendl; } } else { - llinfos << "Failed to get scriptlimits_panels" << llendl; + llwarns << "Failed to get scriptlimits_panels" << llendl; } } } void fetchScriptLimitsRegionDetailsResponder::error(U32 status, const std::string& reason) { - llinfos << "Error from responder " << reason << llendl; + llwarns << "Error from responder " << reason << llendl; } void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) @@ -471,7 +479,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) if(!instance) { - llinfos << "Failed to get llfloaterscriptlimits instance" << llendl; + llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; } else { @@ -481,29 +489,46 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) LLPanelScriptLimitsAttachment* panel = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel"); if(panel) { + panel->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); + + LLButton* btn = panel->getChild<LLButton>("refresh_list_btn"); + if(btn) + { + btn->setEnabled(true); + } + panel->setAttachmentDetails(content); } else { - llinfos << "Failed to get script_limits_my_avatar_panel" << llendl; + llwarns << "Failed to get script_limits_my_avatar_panel" << llendl; } } else { - llinfos << "Failed to get scriptlimits_panels" << llendl; + llwarns << "Failed to get scriptlimits_panels" << llendl; } } } void fetchScriptLimitsAttachmentInfoResponder::error(U32 status, const std::string& reason) { - llinfos << "Error from responder " << reason << llendl; + llwarns << "Error from responder " << reason << llendl; } ///---------------------------------------------------------------------------- // Memory Panel ///---------------------------------------------------------------------------- +LLPanelScriptLimitsRegionMemory::~LLPanelScriptLimitsRegionMemory() +{ + if(!mParcelId.isNull()) + { + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this); + mParcelId.setNull(); + } +}; + BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources() { LLSD body; @@ -526,17 +551,15 @@ BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources() void LLPanelScriptLimitsRegionMemory::processParcelInfo(const LLParcelData& parcel_data) { - mParcelId = parcel_data.parcel_id; - if(!getLandScriptResources()) { std::string msg_error = LLTrans::getString("ScriptLimitsRequestError"); - childSetValue("loading_text", LLSD(msg_error)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_error)); } else { std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); - childSetValue("loading_text", LLSD(msg_waiting)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } } @@ -544,20 +567,26 @@ void LLPanelScriptLimitsRegionMemory::setParcelID(const LLUUID& parcel_id) { if (!parcel_id.isNull()) { + if(!mParcelId.isNull()) + { + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this); + mParcelId.setNull(); + } + mParcelId = parcel_id; LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this); LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id); } else { std::string msg_error = LLTrans::getString("ScriptLimitsRequestError"); - childSetValue("loading_text", LLSD(msg_error)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_error)); } } // virtual void LLPanelScriptLimitsRegionMemory::setErrorStatus(U32 status, const std::string& reason) { - llerrs << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<llendl; + llwarns << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<llendl; } // callback from the name cache with an owner name to add to the list @@ -597,7 +626,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) if(!list) { - llinfos << "Error getting the scripts_list control" << llendl; + llwarns << "Error getting the scripts_list control" << llendl; return; } @@ -606,9 +635,9 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) LLStringUtil::format_map_t args_parcels; args_parcels["[PARCELS]"] = llformat ("%d", number_parcels); std::string msg_parcels = LLTrans::getString("ScriptLimitsParcelsOwned", args_parcels); - childSetValue("parcels_listed", LLSD(msg_parcels)); + getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_parcels)); - std::vector<LLUUID> names_requested; + uuid_vec_t names_requested; // This makes the assumption that all objects will have the same set // of attributes, ie they will all have, or none will have locations @@ -734,8 +763,6 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) // save the structure to make object return easier mContent = content; - - childSetValue("loading_text", LLSD(std::string(""))); } void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) @@ -754,7 +781,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) } else { - llinfos << "summary doesn't contain memory info" << llendl; + llwarns << "summary doesn't contain memory info" << llendl; return; } @@ -772,7 +799,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) } else { - llinfos << "summary doesn't contain urls info" << llendl; + llwarns << "summary doesn't contain urls info" << llendl; return; } @@ -785,7 +812,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) args_parcel_memory["[MAX]"] = llformat ("%d", mParcelMemoryMax); args_parcel_memory["[AVAILABLE]"] = llformat ("%d", parcel_memory_available); std::string msg_parcel_memory = LLTrans::getString("ScriptLimitsMemoryUsed", args_parcel_memory); - childSetValue("memory_used", LLSD(msg_parcel_memory)); + getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_parcel_memory)); } if((mParcelURLsUsed >= 0) && (mParcelURLsMax >= 0)) @@ -797,7 +824,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) args_parcel_urls["[MAX]"] = llformat ("%d", mParcelURLsMax); args_parcel_urls["[AVAILABLE]"] = llformat ("%d", parcel_urls_available); std::string msg_parcel_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_parcel_urls); - childSetValue("urls_used", LLSD(msg_parcel_urls)); + getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_parcel_urls)); } } @@ -808,7 +835,7 @@ BOOL LLPanelScriptLimitsRegionMemory::postBuild() childSetAction("return_btn", onClickReturn, this); std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); - childSetValue("loading_text", LLSD(msg_waiting)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list"); if(!list) @@ -833,7 +860,7 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); if(!instance) { - childSetValue("loading_text", LLSD(std::string(""))); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); //might have to do parent post build here //if not logic below could use early outs return FALSE; @@ -852,7 +879,7 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() if(region_id != current_region_id) { std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion"); - childSetValue("loading_text", LLSD(msg_wrong_region)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region)); return FALSE; } @@ -881,13 +908,13 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() << " does not support RemoteParcelRequest" << llendl; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); - childSetValue("loading_text", LLSD(msg_waiting)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } } else { std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected"); - childSetValue("loading_text", LLSD(msg_waiting)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } return LLPanelScriptLimitsInfo::postBuild(); @@ -909,9 +936,9 @@ void LLPanelScriptLimitsRegionMemory::clearList() LLStringUtil::format_map_t args_parcel_memory; std::string msg_empty_string(""); - childSetValue("memory_used", LLSD(msg_empty_string)); - childSetValue("urls_used", LLSD(msg_empty_string)); - childSetValue("parcels_listed", LLSD(msg_empty_string)); + getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_empty_string)); + getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_empty_string)); + getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_empty_string)); mObjectListItems.clear(); } @@ -919,8 +946,6 @@ void LLPanelScriptLimitsRegionMemory::clearList() // static void LLPanelScriptLimitsRegionMemory::onClickRefresh(void* userdata) { - llinfos << "LLPanelRegionGeneralInfo::onClickRefresh" << llendl; - LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(instance) { @@ -930,6 +955,13 @@ void LLPanelScriptLimitsRegionMemory::onClickRefresh(void* userdata) LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel"); if(panel_memory) { + //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 + LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn"); + if(btn) + { + btn->setEnabled(false); + } panel_memory->clearList(); panel_memory->StartRequestChain(); @@ -969,7 +1001,6 @@ void LLPanelScriptLimitsRegionMemory::showBeacon() // static void LLPanelScriptLimitsRegionMemory::onClickHighlight(void* userdata) { - llinfos << "LLPanelRegionGeneralInfo::onClickHighlight" << llendl; LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(instance) { @@ -1075,7 +1106,6 @@ void LLPanelScriptLimitsRegionMemory::returnObjects() // static void LLPanelScriptLimitsRegionMemory::onClickReturn(void* userdata) { - llinfos << "LLPanelRegionGeneralInfo::onClickReturn" << llendl; LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(instance) { @@ -1177,7 +1207,13 @@ void LLPanelScriptLimitsAttachment::setAttachmentDetails(LLSD content) setAttachmentSummary(content); - childSetValue("loading_text", LLSD(std::string(""))); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); + + LLButton* btn = getChild<LLButton>("refresh_list_btn"); + if(btn) + { + btn->setEnabled(true); + } } BOOL LLPanelScriptLimitsAttachment::postBuild() @@ -1185,7 +1221,7 @@ BOOL LLPanelScriptLimitsAttachment::postBuild() childSetAction("refresh_list_btn", onClickRefresh, this); std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); - childSetValue("loading_text", LLSD(msg_waiting)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); return requestAttachmentDetails(); } @@ -1199,7 +1235,7 @@ void LLPanelScriptLimitsAttachment::clearList() } std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); - childSetValue("loading_text", LLSD(msg_waiting)); + getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) @@ -1218,7 +1254,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) } else { - llinfos << "attachment details don't contain memory summary info" << llendl; + llwarns << "attachment details don't contain memory summary info" << llendl; return; } @@ -1236,7 +1272,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) } else { - llinfos << "attachment details don't contain urls summary info" << llendl; + llwarns << "attachment details don't contain urls summary info" << llendl; return; } @@ -1249,7 +1285,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax); args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available); std::string msg_attachment_memory = LLTrans::getString("ScriptLimitsMemoryUsed", args_attachment_memory); - childSetValue("memory_used", LLSD(msg_attachment_memory)); + getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_attachment_memory)); } if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0)) @@ -1261,22 +1297,29 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) 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); - childSetValue("urls_used", LLSD(msg_attachment_urls)); + getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls)); } } // static void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata) -{ - llinfos << "Refresh clicked" << llendl; - +{ 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 |