diff options
Diffstat (limited to 'indra/newview/llfloaterscriptlimits.cpp')
| -rw-r--r-- | indra/newview/llfloaterscriptlimits.cpp | 147 | 
1 files changed, 73 insertions, 74 deletions
| diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 4792d761d8..cd792c263c 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.   *  - * 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 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.   *  - * 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. + * 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.   *  - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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$   */ @@ -121,7 +115,7 @@ BOOL LLFloaterScriptLimits::postBuild()  		LLPanelScriptLimitsRegionMemory* panel_memory;  		panel_memory = new LLPanelScriptLimitsRegionMemory;  		mInfoPanels.push_back(panel_memory); -		LLUICtrlFactory::getInstance()->buildPanel(panel_memory, "panel_script_limits_region_memory.xml"); +		panel_memory->buildFromFile( "panel_script_limits_region_memory.xml");  		mTab->addTabPanel(panel_memory);  	} @@ -130,7 +124,7 @@ BOOL LLFloaterScriptLimits::postBuild()  	{  		LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment;  		mInfoPanels.push_back(panel_attachments); -		LLUICtrlFactory::getInstance()->buildPanel(panel_attachments, "panel_script_limits_my_avatar.xml"); +		panel_attachments->buildFromFile("panel_script_limits_my_avatar.xml");  		mTab->addTabPanel(panel_attachments);  	} @@ -298,7 +292,7 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)  			LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");  			if(panel_memory)  			{ -				panel_memory->childSetValue("loading_text", LLSD(std::string(""))); +				panel_memory->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));  				LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn");  				if(btn) @@ -495,7 +489,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)  			LLPanelScriptLimitsAttachment* panel = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel");  			if(panel)  			{ -				panel->childSetValue("loading_text", LLSD(std::string(""))); +				panel->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));  				LLButton* btn = panel->getChild<LLButton>("refresh_list_btn");  				if(btn) @@ -557,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));  	}  } @@ -580,13 +572,14 @@ void LLPanelScriptLimitsRegionMemory::setParcelID(const LLUUID& parcel_id)  			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));  	}  } @@ -642,7 +635,7 @@ 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));  	uuid_vec_t names_requested; @@ -713,38 +706,44 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)  				}  			} -			LLSD element; +			LLScrollListItem::Params item_params; +			item_params.value = task_id; -			element["id"] = task_id; -			element["columns"][0]["column"] = "size"; -			element["columns"][0]["value"] = llformat("%d", size); -			element["columns"][0]["font"] = "SANSSERIF"; -			element["columns"][1]["column"] = "urls"; -			element["columns"][1]["value"] = llformat("%d", urls); -			element["columns"][1]["font"] = "SANSSERIF"; -			element["columns"][2]["column"] = "name"; -			element["columns"][2]["value"] = name_buf; -			element["columns"][2]["font"] = "SANSSERIF"; -			element["columns"][3]["column"] = "owner"; -			element["columns"][3]["value"] = owner_buf; -			element["columns"][3]["font"] = "SANSSERIF"; -			element["columns"][4]["column"] = "parcel"; -			element["columns"][4]["value"] = parcel_name; -			element["columns"][4]["font"] = "SANSSERIF"; -			element["columns"][5]["column"] = "location"; -			if(has_locations) -			{ -				element["columns"][5]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); -			} -			else -			{ -				element["columns"][5]["value"] = ""; -			} -			element["columns"][5]["font"] = "SANSSERIF"; +			LLScrollListCell::Params cell_params; +			cell_params.font = LLFontGL::getFontSansSerif(); + +			cell_params.column = "size"; +			cell_params.value = size; +			item_params.columns.add(cell_params); + +			cell_params.column = "urls"; +			cell_params.value = urls; +			item_params.columns.add(cell_params); -			list->addElement(element, ADD_SORTED); +			cell_params.column = "name"; +			cell_params.value = name_buf; +			item_params.columns.add(cell_params); + +			cell_params.column = "owner"; +			cell_params.value = owner_buf; +			item_params.columns.add(cell_params); + +			cell_params.column = "parcel"; +			cell_params.value = parcel_name; +			item_params.columns.add(cell_params); + +			cell_params.column = "location"; +			cell_params.value = has_locations +				? llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z) +				: ""; +			item_params.columns.add(cell_params); + +			list->addRow(item_params); +			LLSD element;  			element["owner_id"] = owner_id; + +			element["id"] = task_id;  			element["local_id"] = local_id;  			mObjectListItems.push_back(element);  		} @@ -819,7 +818,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)) @@ -831,7 +830,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));  	}  } @@ -842,7 +841,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) @@ -867,7 +866,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; @@ -886,7 +885,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;  		} @@ -915,13 +914,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(); @@ -943,9 +942,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();  } @@ -1214,7 +1213,7 @@ 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) @@ -1228,7 +1227,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();  } @@ -1242,7 +1241,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) @@ -1292,7 +1291,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)) @@ -1304,7 +1303,7 @@ 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));  	}  } | 
