From df8595b72e5f474b29ccbf0cd4541c57506bf078 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 28 Feb 2013 15:04:05 -0500 Subject: [PATCH] [Issue 662] Update llfloaterregioninfo.* in preparation for adding new functionality. --- indra/newview/llfloaterregioninfo.cpp | 627 ++++++++---------- indra/newview/llfloaterregioninfo.h | 90 +-- .../default/xui/en-us/panel_region_estate.xml | 9 - 3 files changed, 313 insertions(+), 413 deletions(-) diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 19f7af069..d40a3bcc4 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -53,6 +53,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llenvmanager.h" #include "statemachine/aifilepicker.h" #include "llfloaterdaycycle.h" #include "llfloatergodtools.h" // for send_sim_wide_deletes() @@ -62,10 +63,10 @@ #include "llfloaterwindlight.h" #include "llinventorymodel.h" #include "lllineeditor.h" -#include "llalertdialog.h" #include "llnamelistctrl.h" #include "llnotifications.h" #include "llnotificationsutil.h" +#include "llregioninfomodel.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "lltabcontainer.h" @@ -86,8 +87,6 @@ #include "rlvhandler.h" // [/RLVa:KB] -#define ELAR_ENABLED 0 // Enable when server support is implemented - const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; @@ -214,12 +213,14 @@ BOOL LLFloaterRegionInfo::postBuild() "EstateOwnerMessage", &processEstateOwnerRequest); + // Request region info when agent region changes. + LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionInfo::requestRegionInfo, this)); + return TRUE; } LLFloaterRegionInfo::~LLFloaterRegionInfo() -{ -} +{} void LLFloaterRegionInfo::onOpen() { @@ -236,7 +237,7 @@ void LLFloaterRegionInfo::onOpen() // static void LLFloaterRegionInfo::requestRegionInfo() { - LLTabContainer* tab = findInstance()->getChild("region_panels"); + LLTabContainer* tab = getChild("region_panels"); tab->getChild("General")->setCtrlsEnabled(FALSE); tab->getChild("Debug")->setCtrlsEnabled(FALSE); @@ -294,13 +295,12 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) { LLPanel* panel; - - llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl; LLFloaterRegionInfo* floater = findInstance(); if(!floater) { return; } + // We need to re-request environment setting here, // otherwise after we apply (send) updated region settings we won't get them back, // so our environment won't be updated. @@ -312,6 +312,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) LLViewerRegion* region = gAgent.getRegion(); BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + // *TODO: Replace parsing msg with accessing the region info model. + LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); + // extract message std::string sim_name; std::string sim_type = LLTrans::getString("land_type_unknown"); @@ -346,20 +349,20 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) // GENERAL PANEL panel = tab->getChild("General"); - panel->childSetValue("region_text", LLSD(sim_name)); - panel->childSetValue("region_type", LLSD(sim_type)); - panel->childSetValue("version_channel_text", gLastVersionChannel); + panel->getChild("region_text")->setValue(LLSD(sim_name)); + panel->getChild("region_type")->setValue(LLSD(sim_type)); + panel->getChild("version_channel_text")->setValue(gLastVersionChannel); - panel->childSetValue("block_terraform_check", (region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); - panel->childSetValue("block_fly_check", (region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE ); - panel->childSetValue("allow_damage_check", (region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE ); - panel->childSetValue("restrict_pushobject", (region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE ); - panel->childSetValue("allow_land_resell_check", (region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE ); - panel->childSetValue("allow_parcel_changes_check", (region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE ); - panel->childSetValue("block_parcel_search_check", (region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE ); - panel->childSetValue("agent_limit_spin", LLSD((F32)agent_limit) ); - panel->childSetValue("object_bonus_spin", LLSD(object_bonus_factor) ); - panel->childSetValue("access_combo", LLSD(sim_access) ); + panel->getChild("block_terraform_check")->setValue((region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); + panel->getChild("block_fly_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE ); + panel->getChild("allow_damage_check")->setValue((region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE ); + panel->getChild("restrict_pushobject")->setValue((region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE ); + panel->getChild("allow_land_resell_check")->setValue((region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE ); + panel->getChild("allow_parcel_changes_check")->setValue((region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE ); + panel->getChild("block_parcel_search_check")->setValue((region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE ); + panel->getChild("agent_limit_spin")->setValue(LLSD((F32)agent_limit) ); + panel->getChild("object_bonus_spin")->setValue(LLSD(object_bonus_factor) ); + panel->getChild("access_combo")->setValue(LLSD(sim_access) ); // detect teen grid for maturity @@ -367,32 +370,32 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) U32 parent_estate_id; msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id); BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that - panel->childSetEnabled("access_combo", gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); + panel->getChildView("access_combo")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); panel->setCtrlsEnabled(allow_modify); // DEBUG PANEL panel = tab->getChild("Debug"); - panel->childSetValue("region_text", LLSD(sim_name) ); - panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); - panel->childSetValue("disable_collisions_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); - panel->childSetValue("disable_physics_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); + panel->getChild("region_text")->setValue(LLSD(sim_name) ); + panel->getChild("disable_scripts_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); + panel->getChild("disable_collisions_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); + panel->getChild("disable_physics_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); panel->setCtrlsEnabled(allow_modify); // TERRAIN PANEL panel = tab->getChild("Terrain"); - panel->childSetValue("region_text", LLSD(sim_name)); - panel->childSetValue("water_height_spin", LLSD(water_height)); - panel->childSetValue("terrain_raise_spin", LLSD(terrain_raise_limit)); - panel->childSetValue("terrain_lower_spin", LLSD(terrain_lower_limit)); - panel->childSetValue("use_estate_sun_check", LLSD(use_estate_sun)); + panel->getChild("region_text")->setValue(LLSD(sim_name)); + panel->getChild("water_height_spin")->setValue(region_info.mWaterHeight); + panel->getChild("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit); + panel->getChild("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit); - panel->childSetValue("fixed_sun_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); - panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun); - panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); - panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); + panel->getChild("use_estate_sun_check")->setValue(region_info.mUseEstateSun); + panel->getChild("fixed_sun_check")->setValue(region_info.getUseFixedSun()); + panel->getChild("fixed_sun_check")->setEnabled(allow_modify && !region_info.mUseEstateSun); + panel->getChild("sun_hour_slider")->setValue(region_info.mSunHour); + panel->getChild("sun_hour_slider")->setEnabled(allow_modify && !region_info.mUseEstateSun); panel->setCtrlsEnabled(allow_modify); floater->refreshFromRegion( gAgent.getRegion() ); @@ -457,32 +460,36 @@ void LLFloaterRegionInfo::refresh() // LLPanelRegionInfo // -// static -void LLPanelRegionInfo::onBtnSet(void* user_data) +LLPanelRegionInfo::LLPanelRegionInfo() + : LLPanel(std::string("Region Info Panel")) { - LLPanelRegionInfo* panel = (LLPanelRegionInfo*)user_data; - if(!panel) return; - if (panel->sendUpdate()) +} + +void LLPanelRegionInfo::onBtnSet() +{ + if (sendUpdate()) { - panel->disableButton("apply_btn"); + disableButton("apply_btn"); } } -//static -void LLPanelRegionInfo::onChangeChildCtrl(LLUICtrl* ctrl, void* user_data) +void LLPanelRegionInfo::onChangeChildCtrl(LLUICtrl* ctrl) { - if (ctrl) - { - LLPanelRegionInfo* panel = (LLPanelRegionInfo*) ctrl->getParent(); - panel->updateChild(ctrl); - } + updateChild(ctrl); // virtual function } -// static // Enables the "set" button if it is not already enabled -void LLPanelRegionInfo::onChangeAnything(LLUICtrl* ctrl, void* user_data) +void LLPanelRegionInfo::onChangeAnything() { - LLPanelRegionInfo* panel = (LLPanelRegionInfo*)user_data; + enableButton("apply_btn"); + refresh(); +} + +// static +// Enables set button on change to line editor +void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) +{ + LLPanelRegionInfo* panel = dynamic_cast(caller->getParent()); if(panel) { panel->enableButton("apply_btn"); @@ -490,20 +497,17 @@ void LLPanelRegionInfo::onChangeAnything(LLUICtrl* ctrl, void* user_data) } } -// static -// Enables set button on change to line editor -void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) -{ - // reuse the previous method - onChangeAnything(0, user_data); -} - // virtual BOOL LLPanelRegionInfo::postBuild() { - childSetAction("apply_btn", onBtnSet, this); - childDisable("apply_btn"); + // If the panel has an Apply button, set a callback for it. + LLUICtrl* apply_btn = findChild("apply_btn"); + if (apply_btn) + { + apply_btn->setCommitCallback(boost::bind(&LLPanelRegionInfo::onBtnSet, this)); + } + refresh(); return TRUE; } @@ -555,29 +559,35 @@ void LLPanelRegionInfo::sendEstateOwnerMessage( void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) { - childSetEnabled(btn_name, enable); + LLView* button = findChild(btn_name); + if (button) button->setEnabled(enable); } void LLPanelRegionInfo::disableButton(const std::string& btn_name) { - childDisable(btn_name); + LLView* button = findChild(btn_name); + if (button) button->setEnabled(FALSE); } void LLPanelRegionInfo::initCtrl(const std::string& name) { - childSetCommitCallback(name, onChangeAnything, this); + getChild(name)->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this)); } void LLPanelRegionInfo::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, new std::string(xml_alert)); + childSetAction(name, boost::bind(&LLPanelRegionInfo::onClickHelp, this, xml_alert)); } -// static -void LLPanelRegionInfo::onClickHelp(void* data) +void LLPanelRegionInfo::onClickHelp(const std::string& xml_alert) { - std::string* xml_alert = (std::string*)data; - LLNotifications::instance().add(*xml_alert); + LLNotifications::instance().add(xml_alert); +} + +void LLPanelRegionInfo::onClickManageTelehub() +{ + LLFloaterRegionInfo::getInstance()->close(); + LLFloaterTelehub::show(); } ///////////////////////////////////////////////////////////////////////////// @@ -587,14 +597,14 @@ bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) { BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); setCtrlsEnabled(allow_modify); - childDisable("apply_btn"); - childSetEnabled("access_text", allow_modify); - // childSetEnabled("access_combo", allow_modify); + getChildView("apply_btn")->setEnabled(FALSE); + getChildView("access_text")->setEnabled(allow_modify); + // getChildView("access_combo")->setEnabled(allow_modify); // now set in processRegionInfo for teen grid detection - childSetEnabled("kick_btn", allow_modify); - childSetEnabled("kick_all_btn", allow_modify); - childSetEnabled("assign_btn", allow_modify); - childSetEnabled("manage_telehub_btn", allow_modify); + getChildView("kick_btn")->setEnabled(allow_modify); + getChildView("kick_all_btn")->setEnabled(allow_modify); + getChildView("assign_btn")->setEnabled(allow_modify); + getChildView("manage_telehub_btn")->setEnabled(allow_modify); // Data gets filled in by processRegionInfo @@ -626,24 +636,22 @@ BOOL LLPanelRegionGeneralInfo::postBuild() initHelpBtn("parcel_changes_help", "HelpParcelChanges"); initHelpBtn("parcel_search_help", "HelpRegionSearch"); - childSetAction("kick_btn", onClickKick, this); + childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this)); childSetAction("kick_all_btn", onClickKickAll, this); childSetAction("im_btn", onClickMessage, this); - childSetAction("manage_telehub_btn", onClickManageTelehub, this); + childSetAction("manage_telehub_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickManageTelehub, this)); return LLPanelRegionInfo::postBuild(); } -// static -void LLPanelRegionGeneralInfo::onClickKick(void* userdata) +void LLPanelRegionGeneralInfo::onClickKick() { llinfos << "LLPanelRegionGeneralInfo::onClickKick" << llendl; - LLPanelRegionGeneralInfo* panelp = (LLPanelRegionGeneralInfo*)userdata; // this depends on the grandparent view being a floater // in order to set up floater dependency - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, panelp, _1), FALSE, TRUE); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), FALSE, TRUE); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -737,14 +745,6 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L return false; } -// static -void LLPanelRegionGeneralInfo::onClickManageTelehub(void* data) -{ - LLFloaterRegionInfo::getInstance()->close(); - - LLFloaterTelehub::show(); -} - // setregioninfo // strings[0] = 'Y' - block terraform, 'N' - not // strings[1] = 'Y' - block fly, 'N' - not @@ -765,16 +765,16 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() std::string url = gAgent.getRegion()->getCapability("DispatchRegionInfo"); if (!url.empty()) { - body["block_terraform"] = childGetValue("block_terraform_check"); - body["block_fly"] = childGetValue("block_fly_check"); - body["allow_damage"] = childGetValue("allow_damage_check"); - body["allow_land_resell"] = childGetValue("allow_land_resell_check"); - body["agent_limit"] = childGetValue("agent_limit_spin"); - body["prim_bonus"] = childGetValue("object_bonus_spin"); - body["sim_access"] = childGetValue("access_combo"); - body["restrict_pushobject"] = childGetValue("restrict_pushobject"); - body["allow_parcel_changes"] = childGetValue("allow_parcel_changes_check"); - body["block_parcel_search"] = childGetValue("block_parcel_search_check"); + body["block_terraform"] = getChild("block_terraform_check")->getValue(); + body["block_fly"] = getChild("block_fly_check")->getValue(); + body["allow_damage"] = getChild("allow_damage_check")->getValue(); + body["allow_land_resell"] = getChild("allow_land_resell_check")->getValue(); + body["agent_limit"] = getChild("agent_limit_spin")->getValue(); + body["prim_bonus"] = getChild("object_bonus_spin")->getValue(); + body["sim_access"] = getChild("access_combo")->getValue(); + body["restrict_pushobject"] = getChild("restrict_pushobject")->getValue(); + body["allow_parcel_changes"] = getChild("allow_parcel_changes_check")->getValue(); + body["block_parcel_search"] = getChild("block_parcel_search_check")->getValue(); LLHTTPClient::post(url, body, new LLHTTPClient::ResponderIgnore); } @@ -783,33 +783,33 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() strings_t strings; std::string buffer; - buffer = llformat("%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("block_terraform_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - buffer = llformat("%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("block_fly_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - buffer = llformat("%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("allow_damage_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - buffer = llformat("%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("allow_land_resell_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - F32 value = (F32)childGetValue("agent_limit_spin").asReal(); + F32 value = (F32)getChild("agent_limit_spin")->getValue().asReal(); buffer = llformat("%f", value); strings.push_back(strings_t::value_type(buffer)); - value = (F32)childGetValue("object_bonus_spin").asReal(); + value = (F32)getChild("object_bonus_spin")->getValue().asReal(); buffer = llformat("%f", value); strings.push_back(strings_t::value_type(buffer)); - buffer = llformat("%d", childGetValue("access_combo").asInteger()); + buffer = llformat("%d", getChild("access_combo")->getValue().asInteger()); strings.push_back(strings_t::value_type(buffer)); - buffer = llformat("%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("restrict_pushobject")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); - buffer = llformat("%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("allow_parcel_changes_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(strings_t::value_type(buffer)); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -818,7 +818,7 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() // if we changed access levels, tell user about it LLViewerRegion* region = gAgent.getRegion(); - if (region && (childGetValue("access_combo").asInteger() != region->getSimAccess()) ) + if (region && (getChild("access_combo")->getValue().asInteger() != region->getSimAccess()) ) { LLNotificationsUtil::add("RegionMaturityChange"); } @@ -843,7 +843,7 @@ BOOL LLPanelRegionDebugInfo::postBuild() initHelpBtn("top_scripts_help", "HelpRegionTopScripts"); initHelpBtn("restart_help", "HelpRegionRestart"); - childSetAction("choose_avatar_btn", onClickChooseAvatar, this); + childSetAction("choose_avatar_btn", boost::bind(&LLPanelRegionDebugInfo::onClickChooseAvatar, this)); childSetAction("return_btn", onClickReturn, this); childSetAction("top_colliders_btn", onClickTopColliders, this); childSetAction("top_scripts_btn", onClickTopScripts, this); @@ -858,18 +858,18 @@ bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region) { BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); setCtrlsEnabled(allow_modify); - childDisable("apply_btn"); - childDisable("target_avatar_name"); + getChildView("apply_btn")->setEnabled(FALSE); + getChildView("target_avatar_name")->setEnabled(FALSE); - childSetEnabled("choose_avatar_btn", allow_modify); - childSetEnabled("return_scripts", allow_modify && !mTargetAvatar.isNull()); - childSetEnabled("return_other_land", allow_modify && !mTargetAvatar.isNull()); - childSetEnabled("return_estate_wide", allow_modify && !mTargetAvatar.isNull()); - childSetEnabled("return_btn", allow_modify && !mTargetAvatar.isNull()); - childSetEnabled("top_colliders_btn", allow_modify); - childSetEnabled("top_scripts_btn", allow_modify); - childSetEnabled("restart_btn", allow_modify); - childSetEnabled("cancel_restart_btn", allow_modify); + getChildView("choose_avatar_btn")->setEnabled(allow_modify); + getChildView("return_scripts")->setEnabled(allow_modify && !mTargetAvatar.isNull()); + getChildView("return_other_land")->setEnabled(allow_modify && !mTargetAvatar.isNull()); + getChildView("return_estate_wide")->setEnabled(allow_modify && !mTargetAvatar.isNull()); + getChildView("return_btn")->setEnabled(allow_modify && !mTargetAvatar.isNull()); + getChildView("top_colliders_btn")->setEnabled(allow_modify); + getChildView("top_scripts_btn")->setEnabled(allow_modify); + getChildView("restart_btn")->setEnabled(allow_modify); + getChildView("cancel_restart_btn")->setEnabled(allow_modify); return LLPanelRegionInfo::refreshFromRegion(region); } @@ -881,13 +881,13 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() strings_t strings; std::string buffer; - buffer = llformat("%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("disable_scripts_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(buffer); - buffer = llformat("%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("disable_collisions_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(buffer); - buffer = llformat("%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (getChild("disable_physics_check")->getValue().asBoolean() ? "Y" : "N")); strings.push_back(buffer); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -895,16 +895,17 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() return TRUE; } -void LLPanelRegionDebugInfo::onClickChooseAvatar(void* data) +void LLPanelRegionDebugInfo::onClickChooseAvatar() { - LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, (LLPanelRegionDebugInfo*)data, _1, _2), FALSE, TRUE); + LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), FALSE, TRUE); } + void LLPanelRegionDebugInfo::callbackAvatarID(const uuid_vec_t& ids, const std::vector& names) { if (ids.empty() || names.empty()) return; mTargetAvatar = ids[0]; - childSetValue("target_avatar_name", LLSD(names[0].getCompleteName())); + getChild("target_avatar_name")->setValue(LLSD(names[0].getCompleteName())); refreshFromRegion( gAgent.getRegion() ); } @@ -915,23 +916,23 @@ void LLPanelRegionDebugInfo::onClickReturn(void* data) if (panelp->mTargetAvatar.isNull()) return; LLSD args; - args["USER_NAME"] = panelp->childGetValue("target_avatar_name").asString(); + args["USER_NAME"] = panelp->getChild("target_avatar_name")->getValue().asString(); LLSD payload; payload["avatar_id"] = panelp->mTargetAvatar; U32 flags = SWD_ALWAYS_RETURN_OBJECTS; - if (panelp->childGetValue("return_scripts").asBoolean()) + if (panelp->getChild("return_scripts")->getValue().asBoolean()) { flags |= SWD_SCRIPTED_ONLY; } - if (panelp->childGetValue("return_other_land").asBoolean()) + if (panelp->getChild("return_other_land")->getValue().asBoolean()) { flags |= SWD_OTHERS_LAND_ONLY; } payload["flags"] = int(flags); - payload["return_estate_wide"] = panelp->childGetValue("return_estate_wide").asBoolean(); + payload["return_estate_wide"] = panelp->getChild("return_estate_wide")->getValue().asBoolean(); LLNotificationsUtil::add("EstateObjectReturn", args, payload, boost::bind(&LLPanelRegionDebugInfo::callbackReturn, panelp, _1, _2)); } @@ -994,18 +995,17 @@ void LLPanelRegionDebugInfo::onClickTopScripts(void* data) // static void LLPanelRegionDebugInfo::onClickRestart(void* data) { - LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; LLNotificationsUtil::add("ConfirmRestart", LLSD(), LLSD(), - boost::bind(&LLPanelRegionDebugInfo::callbackRestart, (LLPanelRegionDebugInfo*)data, _1, _2, self->getChild("rcount")->getValue().asInteger())); + boost::bind(&LLPanelRegionDebugInfo::callbackRestart, (LLPanelRegionDebugInfo*)data, _1, _2)); } -bool LLPanelRegionDebugInfo::callbackRestart(const LLSD& notification, const LLSD& response, S32 seconds) +bool LLPanelRegionDebugInfo::callbackRestart(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option != 0) return false; strings_t strings; - strings.push_back(llformat("%d",seconds)); + strings.push_back(llformat("%d", getChild("rcount")->getValue().asInteger())); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings); return false; @@ -1094,10 +1094,6 @@ BOOL LLPanelRegionTextureInfo::postBuild() initCtrl(buffer); } -// LLButton* btn = new LLButton("dump", LLRect(0, 20, 100, 0), "", onClickDump, this); -// btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); -// addChild(btn); - return LLPanelRegionInfo::postBuild(); } @@ -1189,17 +1185,11 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() return TRUE; } - -// static -void LLPanelRegionTextureInfo::onClickDump(void* data) -{ - llinfos << "LLPanelRegionTextureInfo::onClickDump()" << llendl; -} - - ///////////////////////////////////////////////////////////////////////////// // LLPanelRegionTerrainInfo ///////////////////////////////////////////////////////////////////////////// +// Initialize statics + BOOL LLPanelRegionTerrainInfo::postBuild() { LLPanelRegionInfo::postBuild(); @@ -1218,9 +1208,8 @@ BOOL LLPanelRegionTerrainInfo::postBuild() initCtrl("terrain_lower_spin"); initCtrl("fixed_sun_check"); - childSetCommitCallback("fixed_sun_check", onChangeFixedSun, this); childSetCommitCallback("use_estate_sun_check", onChangeUseEstateTime, this); - childSetCommitCallback("sun_hour_slider", onChangeSunHour, this); + initCtrl("sun_hour_slider"); childSetAction("download_raw_btn", onClickDownloadRaw, this); childSetAction("upload_raw_btn", onClickUploadRaw, this); @@ -1232,18 +1221,18 @@ BOOL LLPanelRegionTerrainInfo::postBuild() // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { - llinfos << "LLPanelRegionTerrainInfo::refreshFromRegion" << llendl; - BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); setCtrlsEnabled(owner_or_god_or_manager); - childDisable("apply_btn"); - childSetEnabled("download_raw_btn", owner_or_god); - childSetEnabled("upload_raw_btn", owner_or_god); - childSetEnabled("bake_terrain_btn", owner_or_god); + getChildView("apply_btn")->setEnabled(FALSE); + + + getChildView("download_raw_btn")->setEnabled(owner_or_god); + getChildView("upload_raw_btn")->setEnabled(owner_or_god); + getChildView("bake_terrain_btn")->setEnabled(owner_or_god); return LLPanelRegionInfo::refreshFromRegion(region); } @@ -1257,18 +1246,18 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() strings_t strings; LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - buffer = llformat("%f", (F32)childGetValue("water_height_spin").asReal()); - strings.push_back(buffer); - buffer = llformat("%f", (F32)childGetValue("terrain_raise_spin").asReal()); - strings.push_back(buffer); - buffer = llformat("%f", (F32)childGetValue("terrain_lower_spin").asReal()); - strings.push_back(buffer); - buffer = llformat("%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); - strings.push_back(buffer); - buffer = llformat("%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); - strings.push_back(buffer); - buffer = llformat("%f", (F32)childGetValue("sun_hour_slider").asReal() ); - strings.push_back(buffer); + // update the model + LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); + region_info.mWaterHeight = (F32) getChild("water_height_spin")->getValue().asReal(); + region_info.mTerrainRaiseLimit = (F32) getChild("terrain_raise_spin")->getValue().asReal(); + region_info.mTerrainLowerLimit = (F32) getChild("terrain_lower_spin")->getValue().asReal(); + region_info.mUseEstateSun = getChild("use_estate_sun_check")->getValue().asBoolean(); + region_info.setUseFixedSun(getChild("fixed_sun_check")->getValue().asBoolean()); + region_info.mSunHour = (F32) getChild("sun_hour_slider")->getValue().asReal(); + + + // and sync the region with it + region_info.sendRegionTerrain(invoice); // Grab estate information in case the user decided to set the // region back to estate time. JC @@ -1320,25 +1309,6 @@ void LLPanelRegionTerrainInfo::onChangeUseEstateTime(LLUICtrl* ctrl, void* user_ panel->childEnable("apply_btn"); } -// static -void LLPanelRegionTerrainInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) -{ - LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) user_data; - if (!panel) return; - // Just enable the apply button. We let the sun-hour slider be enabled - // for both fixed-sun and non-fixed-sun. JC - panel->childEnable("apply_btn"); -} - -// static -void LLPanelRegionTerrainInfo::onChangeSunHour(LLUICtrl* ctrl, void*) -{ - // can't use userdata to get panel, slider uses it internally - LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) ctrl->getParent(); - if (!panel) return; - panel->childEnable("apply_btn"); -} - // static void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) { @@ -1439,55 +1409,41 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) estate_dispatch_initialized = true; } -// static // Disables the sun-hour slider and the use fixed time check if the use global time is check -void LLPanelEstateInfo::onChangeUseGlobalTime(LLUICtrl* ctrl, void* user_data) +void LLPanelEstateInfo::onChangeUseGlobalTime() { - LLPanelEstateInfo* panel = (LLPanelEstateInfo*) user_data; - if (panel) - { - bool enabled = !panel->childGetValue("use_global_time_check").asBoolean(); - panel->childSetEnabled("sun_hour_slider", enabled); - panel->childSetEnabled("fixed_sun_check", enabled); - panel->childSetValue("fixed_sun_check", LLSD(FALSE)); - panel->enableButton("apply_btn"); - } + bool enabled = !childGetValue("use_global_time_check").asBoolean(); + childSetEnabled("sun_hour_slider", enabled); + childSetEnabled("fixed_sun_check", enabled); + childSetValue("fixed_sun_check", false); + enableButton("apply_btn"); } // Enables the sun-hour slider if the fixed-sun checkbox is set -void LLPanelEstateInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) +void LLPanelEstateInfo::onChangeFixedSun() { - LLPanelEstateInfo* panel = (LLPanelEstateInfo*) user_data; - if (panel) - { - bool enabled = !panel->childGetValue("fixed_sun_check").asBoolean(); - panel->childSetEnabled("use_global_time_check", enabled); - panel->childSetValue("use_global_time_check", LLSD(FALSE)); - panel->enableButton("apply_btn"); - } + bool enabled = !childGetValue("fixed_sun_check").asBoolean(); + childSetEnabled("use_global_time_check", enabled); + childSetValue("use_global_time_check", false); + enableButton("apply_btn"); } - - - //--------------------------------------------------------------------------- // Add/Remove estate access button callbacks //--------------------------------------------------------------------------- -void LLPanelEstateInfo::onClickEditSky(void* user_data) +void LLPanelEstateInfo::onClickEditSky() { LLFloaterWindLight::show(); } -void LLPanelEstateInfo::onClickEditDayCycle(void* user_data) +void LLPanelEstateInfo::onClickEditDayCycle() { LLFloaterDayCycle::show(); } -// static -void LLPanelEstateInfo::onClickAddAllowedAgent(void* user_data) +void LLPanelEstateInfo::onClickAddAllowedAgent() { - LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; - LLCtrlListInterface *list = self->childGetListInterface("allowed_avatar_name_list"); + LLCtrlListInterface *list = childGetListInterface("allowed_avatar_name_list"); if (!list) return; if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) { @@ -1501,17 +1457,14 @@ void LLPanelEstateInfo::onClickAddAllowedAgent(void* user_data) accessAddCore(ESTATE_ACCESS_ALLOWED_AGENT_ADD, "EstateAllowedAgentAdd"); } -// static -void LLPanelEstateInfo::onClickRemoveAllowedAgent(void* user_data) +void LLPanelEstateInfo::onClickRemoveAllowedAgent() { accessRemoveCore(ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, "EstateAllowedAgentRemove", "allowed_avatar_name_list"); } -// static -void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) +void LLPanelEstateInfo::onClickAddAllowedGroup() { - LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; - LLCtrlListInterface *list = self->childGetListInterface("allowed_group_name_list"); + LLCtrlListInterface *list = childGetListInterface("allowed_group_name_list"); if (!list) return; if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) { @@ -1522,7 +1475,7 @@ void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) } LLNotification::Params params("ChangeLindenAccess"); - params.functor(boost::bind(&LLPanelEstateInfo::addAllowedGroup, self, _1, _2)); + params.functor(boost::bind(&LLPanelEstateInfo::addAllowedGroup, this, _1, _2)); if (isLindenEstate()) { LLNotifications::instance().add(params); @@ -1540,8 +1493,7 @@ bool LLPanelEstateInfo::addAllowedGroup(const LLSD& notification, const LLSD& re LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); + LLFloaterGroupPicker* widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); if (widget) { widget->setSelectCallback(addAllowedGroup2, NULL); @@ -1556,17 +1508,14 @@ bool LLPanelEstateInfo::addAllowedGroup(const LLSD& notification, const LLSD& re return false; } -// static -void LLPanelEstateInfo::onClickRemoveAllowedGroup(void* user_data) +void LLPanelEstateInfo::onClickRemoveAllowedGroup() { accessRemoveCore(ESTATE_ACCESS_ALLOWED_GROUP_REMOVE, "EstateAllowedGroupRemove", "allowed_group_name_list"); } -// static -void LLPanelEstateInfo::onClickAddBannedAgent(void* user_data) +void LLPanelEstateInfo::onClickAddBannedAgent() { - LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; - LLCtrlListInterface *list = self->childGetListInterface("banned_avatar_name_list"); + LLCtrlListInterface *list = childGetListInterface("banned_avatar_name_list"); if (!list) return; if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) { @@ -1578,17 +1527,15 @@ void LLPanelEstateInfo::onClickAddBannedAgent(void* user_data) accessAddCore(ESTATE_ACCESS_BANNED_AGENT_ADD, "EstateBannedAgentAdd"); } -// static -void LLPanelEstateInfo::onClickRemoveBannedAgent(void* user_data) +void LLPanelEstateInfo::onClickRemoveBannedAgent() { accessRemoveCore(ESTATE_ACCESS_BANNED_AGENT_REMOVE, "EstateBannedAgentRemove", "banned_avatar_name_list"); } // static -void LLPanelEstateInfo::onClickAddEstateManager(void* user_data) +void LLPanelEstateInfo::onClickAddEstateManager() { - LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; - LLCtrlListInterface *list = self->childGetListInterface("estate_manager_name_list"); + LLCtrlListInterface *list = childGetListInterface("estate_manager_name_list"); if (!list) return; if (list->getItemCount() >= ESTATE_MAX_MANAGERS) { // Tell user they can't add more managers @@ -1603,7 +1550,7 @@ void LLPanelEstateInfo::onClickAddEstateManager(void* user_data) } // static -void LLPanelEstateInfo::onClickRemoveEstateManager(void* user_data) +void LLPanelEstateInfo::onClickRemoveEstateManager() { accessRemoveCore(ESTATE_ACCESS_MANAGER_REMOVE, "EstateManagerRemove", "estate_manager_name_list"); } @@ -1611,25 +1558,17 @@ void LLPanelEstateInfo::onClickRemoveEstateManager(void* user_data) //--------------------------------------------------------------------------- // Kick from estate methods //--------------------------------------------------------------------------- -struct LLKickFromEstateInfo -{ - LLPanelEstateInfo *mEstatePanelp; - LLUUID mAgentID; -}; -void LLPanelEstateInfo::onClickKickUser(void *user_data) +void LLPanelEstateInfo::onClickKickUser() { - LLPanelEstateInfo* panelp = (LLPanelEstateInfo*)user_data; - // this depends on the grandparent view being a floater // in order to set up floater dependency - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, panelp, _1, _2), FALSE, TRUE); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1, _2), FALSE, TRUE); if (child_floater) { parent_floater->addDependentFloater(child_floater); } - parent_floater->addDependentFloater(child_floater); } void LLPanelEstateInfo::onKickUserCommit(const uuid_vec_t& ids, const std::vector& names) @@ -1642,11 +1581,6 @@ void LLPanelEstateInfo::onKickUserCommit(const uuid_vec_t& ids, const std::vecto return; } - //keep track of what user they want to kick and other misc info - LLKickFromEstateInfo *kick_info = new LLKickFromEstateInfo(); - kick_info->mEstatePanelp = this; - kick_info->mAgentID = ids[0]; - //Bring up a confirmation dialog LLSD args; args["EVIL_USER"] = names[0].getCompleteName(); @@ -1721,7 +1655,6 @@ bool LLPanelEstateInfo::isLindenEstate() return (estate_id <= ESTATE_LAST_LINDEN); } -typedef std::vector AgentOrGroupIDsVector; struct LLEstateAccessChangeInfo { LLEstateAccessChangeInfo(const LLSD& sd) @@ -1742,7 +1675,7 @@ struct LLEstateAccessChangeInfo LLSD sd; sd["name"] = mDialogName; sd["operation"] = (S32)mOperationFlag; - for (AgentOrGroupIDsVector::const_iterator it = mAgentOrGroupIDs.begin(); + for (uuid_vec_t::const_iterator it = mAgentOrGroupIDs.begin(); it != mAgentOrGroupIDs.end(); ++it) { @@ -1753,12 +1686,12 @@ struct LLEstateAccessChangeInfo U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. std::string mDialogName; - AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change + uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change }; -// Special case callback for groups, since it has different callback format than names // static -void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) +// Special case callback for groups, since it has different callback format than names +void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void*) { LLSD payload; payload["operation"] = (S32)ESTATE_ACCESS_ALLOWED_GROUP_ADD; @@ -2071,25 +2004,38 @@ void LLPanelEstateInfo::updateControls(LLViewerRegion* region) BOOL owner = (region && (region->getOwner() == gAgent.getID())); BOOL manager = (region && region->isEstateManager()); setCtrlsEnabled(god || owner || manager); - childDisable("apply_btn"); - childSetEnabled("add_allowed_avatar_btn", god || owner || manager); - childSetEnabled("remove_allowed_avatar_btn", god || owner || manager); - childSetEnabled("add_allowed_group_btn", god || owner || manager); - childSetEnabled("remove_allowed_group_btn", god || owner || manager); - childSetEnabled("add_banned_avatar_btn", god || owner || manager); - childSetEnabled("remove_banned_avatar_btn", god || owner || manager); - childSetEnabled("message_estate_btn", god || owner || manager); - childSetEnabled("kick_user_from_estate_btn", god || owner || manager); -#if ELAR_ENABLED - childSetEnabled("abuse_email_address", god || owner || manager); -#else - childSetEnabled("abuse_email_address", false); -#endif + + BOOL has_allowed_avatar = getChild("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE; + BOOL has_allowed_group = getChild("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE; + BOOL has_banned_agent = getChild("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE; + BOOL has_estate_manager = getChild("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE; + + getChildView("add_allowed_avatar_btn")->setEnabled(god || owner || manager); + getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && (god || owner || manager)); + getChildView("allowed_avatar_name_list")->setEnabled(god || owner || manager); + + getChildView("add_allowed_group_btn")->setEnabled(god || owner || manager); + getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && (god || owner || manager) ); + getChildView("allowed_group_name_list")->setEnabled(god || owner || manager); + + // Can't ban people from mainland, orientation islands, etc. because this + // creates much network traffic and server load. + // Disable their accounts in CSR tool instead. + bool linden_estate = isLindenEstate(); + bool enable_ban = (god || owner || manager) && !linden_estate; + getChildView("add_banned_avatar_btn")->setEnabled(enable_ban); + getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban); + getChildView("banned_avatar_name_list")->setEnabled(god || owner || manager); + + getChildView("message_estate_btn")->setEnabled(god || owner || manager); + getChildView("kick_user_from_estate_btn")->setEnabled(god || owner || manager); // estate managers can't add estate managers - childSetEnabled("add_estate_manager_btn", god || owner); - childSetEnabled("remove_estate_manager_btn", god || owner); - childSetEnabled("estate_manager_name_list", god || owner); + getChildView("add_estate_manager_btn")->setEnabled(god || owner); + getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner)); + getChildView("estate_manager_name_list")->setEnabled(god || owner); + + refresh(); } bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) @@ -2123,14 +2069,8 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) { - if (checkRemovalButton(child_ctrl->getName())) - { - // do nothing - } - else if (checkSunHourSlider(child_ctrl)) - { - // do nothing - } + // Ensure appropriate state of the management ui. + updateControls(gAgent.getRegion()); } bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg) @@ -2150,9 +2090,6 @@ BOOL LLPanelEstateInfo::postBuild() initCtrl("limit_payment"); initCtrl("limit_age_verified"); initCtrl("voice_chat_check"); - childSetCommitCallback("abuse_email_address", onChangeAnything, this); - childSetKeystrokeCallback("abuse_email_address", onChangeText, this); - initHelpBtn("estate_manager_help", "HelpEstateEstateManager"); initHelpBtn("use_global_time_help", "HelpEstateUseGlobalTime"); initHelpBtn("fixed_sun_help", "HelpEstateFixedSun"); @@ -2164,15 +2101,14 @@ BOOL LLPanelEstateInfo::postBuild() initHelpBtn("allow_resident_help", "HelpEstateAllowResident"); initHelpBtn("allow_group_help", "HelpEstateAllowGroup"); initHelpBtn("ban_resident_help", "HelpEstateBanResident"); - initHelpBtn("abuse_email_address_help", "HelpEstateAbuseEmailAddress"); initHelpBtn("voice_chat_help", "HelpEstateVoiceChat"); // set up the use global time checkbox - childSetCommitCallback("use_global_time_check", onChangeUseGlobalTime, this); - childSetCommitCallback("fixed_sun_check", onChangeFixedSun, this); - childSetCommitCallback("sun_hour_slider", onChangeChildCtrl, this); + getChild("use_global_time_check")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeUseGlobalTime, this)); + getChild("fixed_sun_check")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeFixedSun, this)); + getChild("sun_hour_slider")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); - childSetCommitCallback("allowed_avatar_name_list", onChangeChildCtrl, this); + getChild("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); LLNameListCtrl *avatar_name_list = getChild("allowed_avatar_name_list"); if (avatar_name_list) { @@ -2180,10 +2116,10 @@ BOOL LLPanelEstateInfo::postBuild() avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } - childSetAction("add_allowed_avatar_btn", onClickAddAllowedAgent, this); - childSetAction("remove_allowed_avatar_btn", onClickRemoveAllowedAgent, this); + childSetAction("add_allowed_avatar_btn", boost::bind(&LLPanelEstateInfo::onClickAddAllowedAgent, this)); + childSetAction("remove_allowed_avatar_btn", boost::bind(&LLPanelEstateInfo::onClickRemoveAllowedAgent, this)); - childSetCommitCallback("allowed_group_name_list", onChangeChildCtrl, this); + getChild("allowed_group_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); LLNameListCtrl* group_name_list = getChild("allowed_group_name_list"); if (group_name_list) { @@ -2191,10 +2127,10 @@ BOOL LLPanelEstateInfo::postBuild() group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } - childSetAction("add_allowed_group_btn", onClickAddAllowedGroup, this); - childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this); + getChild("add_allowed_group_btn")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onClickAddAllowedGroup, this)); + childSetAction("remove_allowed_group_btn", boost::bind(&LLPanelEstateInfo::onClickRemoveAllowedGroup, this)); - childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this); + getChild("banned_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); LLNameListCtrl* banned_name_list = getChild("banned_avatar_name_list"); if (banned_name_list) { @@ -2202,10 +2138,10 @@ BOOL LLPanelEstateInfo::postBuild() banned_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } - childSetAction("add_banned_avatar_btn", onClickAddBannedAgent, this); - childSetAction("remove_banned_avatar_btn", onClickRemoveBannedAgent, this); + childSetAction("add_banned_avatar_btn", boost::bind(&LLPanelEstateInfo::onClickAddBannedAgent, this)); + childSetAction("remove_banned_avatar_btn", boost::bind(&LLPanelEstateInfo::onClickRemoveBannedAgent, this)); - childSetCommitCallback("estate_manager_name_list", onChangeChildCtrl, this); + getChild("estate_manager_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); LLNameListCtrl* manager_name_list = getChild("estate_manager_name_list"); if (manager_name_list) { @@ -2213,28 +2149,31 @@ BOOL LLPanelEstateInfo::postBuild() manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue } - childSetAction("add_estate_manager_btn", onClickAddEstateManager, this); - childSetAction("remove_estate_manager_btn", onClickRemoveEstateManager, this); - childSetAction("message_estate_btn", onClickMessageEstate, this); - childSetAction("kick_user_from_estate_btn", onClickKickUser, this); + childSetAction("add_estate_manager_btn", boost::bind(&LLPanelEstateInfo::onClickAddEstateManager, this)); + childSetAction("remove_estate_manager_btn", boost::bind(&LLPanelEstateInfo::onClickRemoveEstateManager, this)); + childSetAction("message_estate_btn", boost::bind(&LLPanelEstateInfo::onClickMessageEstate, this)); + childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this)); - childSetAction("WLEditSky", onClickEditSky, this); - childSetAction("WLEditDayCycle", onClickEditDayCycle, this); + childSetAction("WLEditSky", boost::bind(&LLPanelEstateInfo::onClickEditSky, this)); + childSetAction("WLEditDayCycle", boost::bind(&LLPanelEstateInfo::onClickEditDayCycle, this)); return LLPanelRegionInfo::postBuild(); } void LLPanelEstateInfo::refresh() { - bool public_access = childGetValue("externally_visible_check").asBoolean(); - childSetEnabled("Only Allow", public_access); - childSetEnabled("limit_payment", public_access); - childSetEnabled("limit_age_verified", public_access); + // Disable access restriction controls if they make no sense. + bool public_access = getChild("externally_visible_check")->getValue().asBoolean(); + + getChildView("Only Allow")->setEnabled(public_access); + getChildView("limit_payment")->setEnabled(public_access); + getChildView("limit_age_verified")->setEnabled(public_access); + // if this is set to false, then the limit fields are meaningless and should be turned off if (public_access == false) { - childSetValue("limit_payment", false); - childSetValue("limit_age_verified", false); + getChild("limit_payment")->setValue(false); + getChild("limit_age_verified")->setValue(false); } } @@ -2245,7 +2184,7 @@ BOOL LLPanelEstateInfo::sendUpdate() LLNotification::Params params("ChangeLindenEstate"); params.functor(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); - if (getEstateID() <= ESTATE_LAST_LINDEN) + if (isLindenEstate()) { // trying to change reserved estate, warn LLNotifications::instance().add(params); @@ -2382,8 +2321,6 @@ bool LLPanelEstateInfo::commitEstateInfoCaps() } body["sun_hour"] = sun_hour; - body["owner_abuse_email"] = childGetValue("abuse_email_address").asString(); - // we use a responder so that we can re-get the data after committing to the database LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder(this)); return true; @@ -2534,7 +2471,7 @@ void LLPanelEstateInfo::setEstateName(const std::string& name) const std::string LLPanelEstateInfo::getOwnerName() const { - return childGetValue("estate_owner").asString(); + return getChild("estate_owner")->getValue().asString(); } void LLPanelEstateInfo::setOwnerName(const std::string& name) @@ -2542,16 +2479,6 @@ void LLPanelEstateInfo::setOwnerName(const std::string& name) childSetValue("estate_owner", LLSD(name)); } -const std::string LLPanelEstateInfo::getAbuseEmailAddress() const -{ - return childGetValue("abuse_email_address").asString(); -} - -void LLPanelEstateInfo::setAbuseEmailAddress(const std::string& address) -{ - childSetValue("abuse_email_address", LLSD(address)); -} - void LLPanelEstateInfo::setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban) @@ -2701,7 +2628,8 @@ bool LLPanelEstateInfo::onMessageCommit(const LLSD& notification, const LLSD& re } LLPanelEstateCovenant::LLPanelEstateCovenant() -: mCovenantID(LLUUID::null) + : + mCovenantID(LLUUID::null) { } @@ -2747,10 +2675,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) } LLTextBox* region_landtype = getChild("region_landtype_text"); - if (region_landtype) - { - region_landtype->setText(region->getLocalizedSimProductName()); - } + region_landtype->setText(region->getLocalizedSimProductName()); // let the parent class handle the general data collection. bool rv = LLPanelRegionInfo::refreshFromRegion(region); @@ -2912,20 +2837,14 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, S32 file_length = file.getSize(); - char* buffer = new char[file_length+1]; - if (buffer == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - - file.read((U8*)buffer, file_length); /* Flawfinder: ignore */ + std::vector buffer(file_length+1); + file.read((U8*)&buffer[0], file_length); // put a EOS at the end buffer[file_length] = 0; - if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) + if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { - if( !panelp->mEditor->importBuffer( buffer, file_length+1 ) ) + if( !panelp->mEditor->importBuffer( &buffer[0], file_length+1 ) ) { llwarns << "Problem importing estate covenant." << llendl; LLNotificationsUtil::add("ProblemImportingEstateCovenant"); @@ -2940,7 +2859,6 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, // Version 0 (just text, doesn't include version number) panelp->sendChangeCovenantID(asset_uuid); } - delete[] buffer; } else { @@ -3091,18 +3009,6 @@ bool LLDispatchEstateUpdateInfo::operator()( std::string estate_name = strings[0].c_str(); // preserve c_str() call! panel->setEstateName(estate_name); -#if ELAR_ENABLED - if (strings.size() > 9) - { - std::string abuse_email = strings[9].c_str(); // preserve c_str() call! - panel->setAbuseEmailAddress(abuse_email); - } - else -#endif - { - panel->setAbuseEmailAddress(panel->getString("email_unsupported")); - } - LLViewerRegion* regionp = gAgent.getRegion(); LLUUID owner_id(strings[1]); @@ -3211,7 +3117,7 @@ bool LLDispatchSetEstateAccess::operator()( args["[ALLOWEDAGENTS]"] = llformat ("%d", totalAllowedAgents); args["[MAXACCESS]"] = llformat ("%d", ESTATE_MAX_ACCESS_IDS); std::string msg = LLTrans::getString("RegionInfoAllowedResidents", args); - panel->childSetValue("allow_resident_label", LLSD(msg)); + panel->getChild("allow_resident_label")->setValue(LLSD(msg)); if (allowed_agent_name_list) { @@ -3237,7 +3143,7 @@ bool LLDispatchSetEstateAccess::operator()( args["[ALLOWEDGROUPS]"] = llformat ("%d", num_allowed_groups); args["[MAXACCESS]"] = llformat ("%d", ESTATE_MAX_GROUP_IDS); std::string msg = LLTrans::getString("RegionInfoAllowedGroups", args); - panel->childSetValue("allow_group_label", LLSD(msg)); + panel->getChild("allow_group_label")->setValue(LLSD(msg)); if (allowed_group_name_list) { @@ -3271,7 +3177,7 @@ bool LLDispatchSetEstateAccess::operator()( std::string msg = llformat("Banned residents: (%d, max %d)", totalBannedAgents, ESTATE_MAX_ACCESS_IDS); - panel->childSetValue("ban_resident_label", LLSD(msg)); + panel->getChild("ban_resident_label")->setValue(LLSD(msg)); if (banned_agent_name_list) { @@ -3294,7 +3200,7 @@ bool LLDispatchSetEstateAccess::operator()( std::string msg = llformat("Estate Managers: (%d, max %d)", num_estate_managers, ESTATE_MAX_MANAGERS); - panel->childSetValue("estate_manager_label", LLSD(msg)); + panel->getChild("estate_manager_label")->setValue(LLSD(msg)); LLNameListCtrl* estate_manager_name_list = panel->getChild("estate_manager_name_list"); @@ -3319,6 +3225,9 @@ bool LLDispatchSetEstateAccess::operator()( } } + // Update the buttons which may change based on the list contents but also needs to account for general access features. + panel->updateControls(gAgent.getRegion()); + return true; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 8a3d77075..afd553888 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -62,11 +62,12 @@ class LLPanelRegionTerrainInfo; class LLPanelEstateInfo; class LLPanelEstateCovenant; + class LLFloaterRegionInfo : public LLFloater, public LLFloaterSingleton { friend class LLUISingleton >; public: - ~LLFloaterRegionInfo(); + /*virtual*/ void onOpen(); /*virtual*/ BOOL postBuild(); @@ -90,10 +91,12 @@ public: // from LLPanel virtual void refresh(); - static void requestRegionInfo(); + void requestRegionInfo(); protected: LLFloaterRegionInfo(const LLSD& seed); + ~LLFloaterRegionInfo(); + void refreshFromRegion(LLViewerRegion* region); // member data @@ -109,10 +112,11 @@ protected: class LLPanelRegionInfo : public LLPanel { public: - LLPanelRegionInfo() : LLPanel(std::string("Region Info Panel")) {} - static void onBtnSet(void* user_data); - static void onChangeChildCtrl(LLUICtrl* ctrl, void* user_data); - static void onChangeAnything(LLUICtrl* ctrl, void* user_data); + LLPanelRegionInfo(); + + void onBtnSet(); + void onChangeChildCtrl(LLUICtrl* ctrl); + void onChangeAnything(); static void onChangeText(LLLineEditor* caller, void* user_data); virtual bool refreshFromRegion(LLViewerRegion* region); @@ -124,12 +128,14 @@ public: void enableButton(const std::string& btn_name, BOOL enable = TRUE); void disableButton(const std::string& btn_name); + void onClickManageTelehub(); + protected: void initCtrl(const std::string& name); void initHelpBtn(const std::string& name, const std::string& xml_alert); - // Callback for all help buttons, data is name of XML alert to show. - static void onClickHelp(void* data); + // Callback for all help buttons, xml_alert is the name of XML alert to show. + void onClickHelp(const std::string& xml_alert); // Returns TRUE if update sent and apply button should be // disabled. @@ -153,6 +159,7 @@ protected: class LLPanelRegionGeneralInfo : public LLPanelRegionInfo { + public: LLPanelRegionGeneralInfo() : LLPanelRegionInfo() {} @@ -162,16 +169,16 @@ public: // LLPanel virtual BOOL postBuild(); + protected: virtual BOOL sendUpdate(); - - static void onClickKick(void* userdata); + void onClickKick(); void onKickCommit(const uuid_vec_t& ids); static void onClickKickAll(void* userdata); bool onKickAllCommit(const LLSD& notification, const LLSD& response); static void onClickMessage(void* userdata); bool onMessageCommit(const LLSD& notification, const LLSD& response); - static void onClickManageTelehub(void* data); + }; ///////////////////////////////////////////////////////////////////////////// @@ -190,14 +197,14 @@ public: protected: virtual BOOL sendUpdate(); - static void onClickChooseAvatar(void*); + void onClickChooseAvatar(); void callbackAvatarID(const uuid_vec_t& ids, const std::vector& names); static void onClickReturn(void *); bool callbackReturn(const LLSD& notification, const LLSD& response); static void onClickTopColliders(void*); static void onClickTopScripts(void*); static void onClickRestart(void* data); - bool callbackRestart(const LLSD& notification, const LLSD& response, S32 seconds); + bool callbackRestart(const LLSD& notification, const LLSD& response); static void onClickCancelRestart(void* data); private: @@ -212,15 +219,12 @@ public: LLPanelRegionTextureInfo(); ~LLPanelRegionTextureInfo() {} - virtual bool refreshFromRegion(LLViewerRegion* region); - - // LLPanel && LLView - virtual BOOL postBuild(); + virtual BOOL postBuild(); // LLPanel + + virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator protected: virtual BOOL sendUpdate(); - - static void onClickDump(void* data); BOOL validateTextureSizes(); }; @@ -228,21 +232,20 @@ protected: class LLPanelRegionTerrainInfo : public LLPanelRegionInfo { + LOG_CLASS(LLPanelRegionTerrainInfo); + public: - LLPanelRegionTerrainInfo() - : LLPanelRegionInfo() {} + LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {} ~LLPanelRegionTerrainInfo() {} - // LLPanel - virtual BOOL postBuild(); + + virtual BOOL postBuild(); // LLPanel - virtual bool refreshFromRegion(LLViewerRegion* region); + virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator protected: virtual BOOL sendUpdate(); static void onChangeUseEstateTime(LLUICtrl* ctrl, void* user_data); - static void onChangeFixedSun(LLUICtrl* ctrl, void* user_data); - static void onChangeSunHour(LLUICtrl* ctrl, void*); static void onClickDownloadRaw(void*); void onClickDownloadRaw_continued(AIFilePicker* filepicker); @@ -259,27 +262,27 @@ class LLPanelEstateInfo : public LLPanelRegionInfo public: static void initDispatch(LLDispatcher& dispatch); - static void onChangeFixedSun(LLUICtrl* ctrl, void* user_data); - static void onChangeUseGlobalTime(LLUICtrl* ctrl, void* user_data); + void onChangeFixedSun(); + void onChangeUseGlobalTime(); - static void onClickEditSky(void* userdata); - static void onClickEditSkyHelp(void* userdata); - static void onClickEditDayCycle(void* userdata); - static void onClickEditDayCycleHelp(void* userdata); + void onClickEditSky(); + void onClickEditSkyHelp(); + void onClickEditDayCycle(); + void onClickEditDayCycleHelp(); - static void onClickAddAllowedAgent(void* user_data); - static void onClickRemoveAllowedAgent(void* user_data); - static void onClickAddAllowedGroup(void* user_data); - static void onClickRemoveAllowedGroup(void* user_data); - static void onClickAddBannedAgent(void* user_data); - static void onClickRemoveBannedAgent(void* user_data); - static void onClickAddEstateManager(void* user_data); - static void onClickRemoveEstateManager(void* user_data); - static void onClickKickUser(void* userdata); + void onClickAddAllowedAgent(); + void onClickRemoveAllowedAgent(); + void onClickAddAllowedGroup(); + void onClickRemoveAllowedGroup(); + void onClickAddBannedAgent(); + void onClickRemoveBannedAgent(); + void onClickAddEstateManager(); + void onClickRemoveEstateManager(); + void onClickKickUser(); // Group picker callback is different, can't use core methods below bool addAllowedGroup(const LLSD& notification, const LLSD& response); - static void addAllowedGroup2(LLUUID id, void* data); + static void addAllowedGroup2(LLUUID id, void*); // Core methods for all above add/remove button clicks static void accessAddCore(U32 operation_flag, const std::string& dialog_name); @@ -334,9 +337,6 @@ public: const std::string getOwnerName() const; void setOwnerName(const std::string& name); - const std::string getAbuseEmailAddress() const; - void setAbuseEmailAddress(const std::string& address); - // If visible from mainland, allowed agent and allowed groups // are ignored, so must disable UI. void setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban); diff --git a/indra/newview/skins/default/xui/en-us/panel_region_estate.xml b/indra/newview/skins/default/xui/en-us/panel_region_estate.xml index 84ce9d050..8aa042e3c 100644 --- a/indra/newview/skins/default/xui/en-us/panel_region_estate.xml +++ b/indra/newview/skins/default/xui/en-us/panel_region_estate.xml @@ -69,15 +69,6 @@ regions in the estate. left="12" name="allow_direct_teleport" width="80" />