Support Legacy Region/Estate Environment

Also Disable Environment Tab when the cap required to use it isn't supported.
This commit is contained in:
Lirusaito
2013-04-17 19:42:56 -04:00
committed by Latif Khalifa
parent ceade84fb0
commit b51615be20
5 changed files with 172 additions and 24 deletions

View File

@@ -56,7 +56,8 @@ public:
const std::string& getName() const { return mName; }
const LLUUID& getOwnerID() const { return mOwnerID; }
U32 getID() const { return mID; }
F32 getSunHour() const { return getUseFixedSun() ? mSunHour : 0.f; }
F32 getSunHour() const { return mSunHour; }
bool getGlobalTime() const { return !(mSunHour || getUseFixedSun()); }
// setters
void setUseFixedSun(bool val);

View File

@@ -160,6 +160,39 @@ void unpack_request_params(
*/
namespace
{
void on_caps_received(LLTabContainer* tab)
{
if (!tab) return;
const LLViewerRegion* region = gAgent.getRegion();
tab->enableTabButton(tab->getIndexForPanel(tab->getPanelByName("panel_env_info")), region && !region->getCapability("EnvironmentSettings").empty());
}
void handle_opposite(const bool& off, LLUICtrl* opposite)
{
opposite->setEnabled(!off);
if (off) opposite->setValue(false);
}
void on_change_use_other_sun(const LLSD& param, LLUICtrl* opposite, LLUICtrl* slider)
{
handle_opposite(param.asBoolean(), opposite);
slider->setEnabled(false);
}
void on_change_fixed_sun(const LLSD& param, LLUICtrl* opposite, LLUICtrl* slider)
{
bool fixed_sun = param.asBoolean();
handle_opposite(fixed_sun, opposite);
slider->setEnabled(fixed_sun);
}
const float get_sun_hour(const LLUICtrl* sun_hour)
{
return sun_hour->getEnabled() ? sun_hour->getValue().asFloat() : 0.f;
}
}
bool estate_dispatch_initialized = false;
@@ -352,6 +385,15 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
LLTrans::findString(sim_type, sim_type); // try localizing sim product name
}
// Disable Environment Tab when not supported
if (region)
{
if (region->capabilitiesReceived())
on_caps_received(tab);
else
region->setCapabilitiesReceivedCallback(boost::bind(on_caps_received, tab));
}
// GENERAL PANEL
panel = tab->getChild<LLPanel>("General");
panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
@@ -629,6 +671,27 @@ bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region)
getChildView("im_btn")->setEnabled(allow_modify);
getChildView("manage_telehub_btn")->setEnabled(allow_modify);
// Support Legacy Region Environment
{
const LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
bool estate_sun = region_info.mUseEstateSun;
getChild<LLUICtrl>("use_estate_sun_check")->setValue(estate_sun);
getChild<LLUICtrl>("fixed_sun_check")->setEnabled(allow_modify && !estate_sun);
getChild<LLUICtrl>("sun_hour_slider")->setEnabled(allow_modify && !estate_sun);
if (estate_sun)
{
getChild<LLUICtrl>("use_estate_sun_check")->setEnabled(allow_modify);
getChild<LLUICtrl>("fixed_sun_check")->setValue(false);
}
else
{
bool fixed_sun = region_info.getUseFixedSun();
getChild<LLUICtrl>("use_estate_sun_check")->setEnabled(allow_modify && !fixed_sun);
getChild<LLUICtrl>("fixed_sun_check")->setValue(fixed_sun);
getChild<LLUICtrl>("sun_hour_slider")->setValue(region_info.mSunHour);
}
}
// Data gets filled in by processRegionInfo
return LLPanelRegionInfo::refreshFromRegion(region);
@@ -647,6 +710,9 @@ BOOL LLPanelRegionGeneralInfo::postBuild()
initCtrl("access_combo");
initCtrl("restrict_pushobject");
initCtrl("block_parcel_search_check");
initCtrl("use_estate_sun_check");
initCtrl("fixed_sun_check");
initCtrl("sun_hour_slider");
initHelpBtn("terraform_help", "HelpRegionBlockTerraform");
initHelpBtn("fly_help", "HelpRegionBlockFly");
@@ -658,12 +724,23 @@ BOOL LLPanelRegionGeneralInfo::postBuild()
initHelpBtn("land_resell_help", "HelpRegionLandResell");
initHelpBtn("parcel_changes_help", "HelpParcelChanges");
initHelpBtn("parcel_search_help", "HelpRegionSearch");
initHelpBtn("use_estate_sun_help", "HelpRegionUseEstateSun");
initHelpBtn("fixed_sun_help", "HelpRegionFixedSun");
childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this));
childSetAction("kick_all_btn", onClickKickAll, this);
childSetAction("im_btn", onClickMessage, this);
childSetAction("manage_telehub_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickManageTelehub, this));
// Set up the Legacy Region Environment checkboxes
{
LLUICtrl* estate_sun = getChild<LLUICtrl>("use_estate_sun_check");
LLUICtrl* fixed_sun = getChild<LLUICtrl>("fixed_sun_check");
LLUICtrl* hour_slider = getChild<LLUICtrl>("sun_hour_slider");
estate_sun->setCommitCallback(boost::bind(on_change_use_other_sun, _2, fixed_sun, hour_slider));
fixed_sun->setCommitCallback(boost::bind(on_change_fixed_sun, _2, estate_sun, hour_slider));
}
return LLPanelRegionInfo::postBuild();
}
@@ -839,6 +916,13 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate()
sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings);
}
// Send the Legacy Region Environment
LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
region_info.mUseEstateSun = getChild<LLUICtrl>("use_estate_sun_check")->getValue().asBoolean();
region_info.setUseFixedSun(getChild<LLUICtrl>("fixed_sun_check")->getValue().asBoolean());
region_info.mSunHour = get_sun_hour(getChild<LLUICtrl>("sun_hour_slider"));
region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice());
// if we changed access levels, tell user about it
LLViewerRegion* region = gAgent.getRegion();
if (region && (getChild<LLUICtrl>("access_combo")->getValue().asInteger() != region->getSimAccess()) )
@@ -2015,11 +2099,16 @@ BOOL LLPanelEstateInfo::postBuild()
{
// set up the callbacks for the generic controls
initCtrl("externally_visible_check");
initCtrl("use_global_time_check");
initCtrl("fixed_sun_check");
initCtrl("sun_hour_slider");
initCtrl("allow_direct_teleport");
initCtrl("limit_payment");
initCtrl("limit_age_verified");
initCtrl("voice_chat_check");
initHelpBtn("estate_manager_help", "HelpEstateEstateManager");
initHelpBtn("use_global_time_help", "HelpEstateUseGlobalTime");
initHelpBtn("fixed_sun_help", "HelpEstateFixedSun");
initHelpBtn("externally_visible_help", "HelpEstateExternallyVisible");
initHelpBtn("allow_direct_teleport_help", "HelpEstateAllowDirectTeleport");
initHelpBtn("allow_resident_help", "HelpEstateAllowResident");
@@ -2027,6 +2116,15 @@ BOOL LLPanelEstateInfo::postBuild()
initHelpBtn("ban_resident_help", "HelpEstateBanResident");
initHelpBtn("voice_chat_help", "HelpEstateVoiceChat");
// Set up the Legacy Estate Environment checkboxes
{
LLUICtrl* global_time = getChild<LLUICtrl>("use_global_time_check");
LLUICtrl* fixed_sun = getChild<LLUICtrl>("fixed_sun_check");
LLUICtrl* hour_slider = getChild<LLUICtrl>("sun_hour_slider");
global_time->setCommitCallback(boost::bind(on_change_use_other_sun, _2, fixed_sun, hour_slider));
fixed_sun->setCommitCallback(boost::bind(on_change_fixed_sun, _2, global_time, hour_slider));
}
getChild<LLUICtrl>("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
if (avatar_name_list)
@@ -2106,14 +2204,36 @@ void LLPanelEstateInfo::refreshFromEstate()
getChild<LLUICtrl>("limit_payment")->setValue(estate_info.getDenyAnonymous());
getChild<LLUICtrl>("limit_age_verified")->setValue(estate_info.getDenyAgeUnverified());
// Ensure appriopriate state of the management UI
// Ensure appropriate state of the management UI
updateControls(gAgent.getRegion());
// Support Legacy Estate Environment
{
const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
bool global_time = estate_info.getGlobalTime();
getChild<LLUICtrl>("use_global_time_check")->setValue(global_time);
getChild<LLUICtrl>("fixed_sun_check")->setEnabled(!global_time);
getChild<LLUICtrl>("sun_hour_slider")->setEnabled(!global_time);
if (global_time)
{
getChild<LLUICtrl>("use_global_time_check")->setEnabled(true);
getChild<LLUICtrl>("fixed_sun_check")->setValue(false);
}
else
{
bool fixed_sun = estate_info.getUseFixedSun();
getChild<LLUICtrl>("use_global_time_check")->setEnabled(!fixed_sun);
getChild<LLUICtrl>("fixed_sun_check")->setValue(fixed_sun);
F32 sun_hour = estate_info.getSunHour();
if (sun_hour < 6.0f) sun_hour += 24.0f;
getChild<LLUICtrl>("sun_hour_slider")->setValue(sun_hour);
}
}
refresh();
}
BOOL LLPanelEstateInfo::sendUpdate()
{
llinfos << "LLPanelEsateInfo::sendUpdate()" << llendl;
llinfos << "LLPanelEstateInfo::sendUpdate()" << llendl;
LLNotification::Params params("ChangeLindenEstate");
params.functor(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2));
@@ -2141,8 +2261,9 @@ bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, con
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
// update model
estate_info.setUseFixedSun(false); // we don't support fixed sun estates anymore
estate_info.setIsExternallyVisible(getChild<LLUICtrl>("externally_visible_check")->getValue().asBoolean());
estate_info.setUseFixedSun(getChild<LLUICtrl>("fixed_sun_check")->getValue().asBoolean());
estate_info.setSunHour(get_sun_hour(getChild<LLUICtrl>("sun_hour_slider")));
estate_info.setAllowDirectTeleport(getChild<LLUICtrl>("allow_direct_teleport")->getValue().asBoolean());
estate_info.setDenyAnonymous(getChild<LLUICtrl>("limit_payment")->getValue().asBoolean());
estate_info.setDenyAgeUnverified(getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean());

View File

@@ -35,6 +35,7 @@
// viewer
#include "llagent.h"
#include "llviewerregion.h"
#include "llestateinfomodel.h" // For supporting legacy environment
void LLRegionInfoModel::reset()
{
@@ -107,6 +108,17 @@ void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const
strings.push_back(buffer);
buffer = llformat("%f", mSunHour);
strings.push_back(buffer);
if (mUseEstateSun)
{
// Grab estate info, the user decided to set the region back to estate time. JC
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
estate_global_time = estate_info.getGlobalTime();
if (!estate_global_time)
{
estate_fixed_sun = estate_info.getUseFixedSun();
estate_sun_hour = estate_info.getSunHour();
}
}
buffer = llformat("%s", (estate_global_time ? "Y" : "N") );
strings.push_back(buffer);
buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") );

View File

@@ -82,10 +82,10 @@
<view_border
bevel_style="none"
follows="top|left"
height="95"
height="110"
layout="topleft"
left="10"
bottom_delta="-100"
bottom_delta="-115"
width="460" />
<check_box
@@ -95,7 +95,7 @@
layout="topleft"
left="20"
name="externally_visible_check"
bottom_delta="70"
bottom_delta="90"
width="200" />
<button
bottom_delta="0"
@@ -112,9 +112,9 @@
height="20"
label="Allow Voice Chat"
layout="topleft"
left="250"
left_delta="-200"
name="voice_chat_check"
bottom_delta="0"
bottom_delta="-18"
width="200" />
<button
bottom_delta="0"
@@ -133,7 +133,7 @@
layout="topleft"
left_delta="-200"
name="allow_direct_teleport"
bottom_delta="-20"
bottom_delta="-18"
width="80" />
<button
bottom_delta="0"
@@ -144,6 +144,13 @@
name="allow_direct_teleport_help"
left_delta="200"
width="18" />
<check_box bottom_delta="36" follows="left|top" height="20" label="Use Global Time" left="250" name="use_global_time_check" width="200" />
<button bottom_delta="0" follows="left|top" font="SansSerifSmall" height="18" label="?" name="use_global_time_help" left_delta="200" width="18" />
<check_box bottom_delta="-18" follows="left|top" height="20" label="Fixed Sun" left_delta="-200" name="fixed_sun_check" width="100" />
<button bottom_delta="0" follows="left|top" font="SansSerifSmall" height="18" label="?" name="fixed_sun_help" left_delta="200" width="18" />
<icon bottom_delta="-27" follows="left|top" height="20" image_name="icon_day_cycle.tga" left_delta="-160" name="daycycle" width="160"/>
<slider bottom_delta="-16" follows="left|top" height="20" increment="0.001"
label="Phase" left_delta="-35" max_val="30" min_val="6" name="sun_hour_slider" show_text="false" width="200" />
<button
enabled="false"
follows="left|top"
@@ -151,9 +158,9 @@
label="Apply"
layout="topleft"
name="apply_btn"
bottom_delta="-38"
left_delta="-200"
width="97" />
bottom_delta="-23"
left_delta="90"
width="120" />
<text
type="string"
@@ -164,7 +171,7 @@
layout="topleft"
left="20"
name="Only Allow"
bottom_delta="38"
bottom_delta="28"
width="278">
Allow access only to Residents who:
</text>
@@ -177,7 +184,7 @@
left_delta="0"
name="limit_payment"
tool_tip="Residents must have payment information on file to access this estate."
bottom_delta="-18"
bottom_delta="-16"
width="278" />
<check_box
follows="top|left"
@@ -188,7 +195,7 @@
left_delta="0"
name="limit_age_verified"
tool_tip="Residents must be age 18 or older to access this estate. See support.secondlife.com for more information."
bottom_delta="-18"
bottom_delta="-16"
width="278" />
<text
@@ -198,7 +205,7 @@
height="20"
layout="topleft"
name="estate_manager_label"
bottom_delta="-40"
bottom_delta="-28"
left="10"
width="200">
Estate Managers:
@@ -220,7 +227,7 @@
layout="topleft"
left="250"
name="allow_resident_label"
bottom_delta="0"
bottom_delta="-4"
width="200">
Allowed Residents:
</text>
@@ -241,7 +248,7 @@
height="71"
layout="topleft"
left="10"
bottom_delta="-76"
bottom_delta="-72"
width="220" />
<name_list
follows="left|top"
@@ -320,7 +327,7 @@
layout="topleft"
left="10"
name="allow_group_label"
bottom_delta="-30"
bottom_delta="-28"
width="200">
Allowed Groups:
</text>
@@ -341,7 +348,7 @@
layout="topleft"
left="250"
name="ban_resident_label"
bottom_delta="0"
bottom_delta="-4"
width="200">
Banned Residents:
</text>
@@ -362,7 +369,7 @@
height="71"
layout="topleft"
left="10"
bottom_delta="-76"
bottom_delta="-72"
width="220" />
<name_list
follows="left|top"
@@ -440,7 +447,7 @@
layout="topleft"
left="10"
name="message_estate_btn"
bottom_delta="-43"
bottom_delta="-28"
width="220" />
<button
follows="left|top"

View File

@@ -85,7 +85,14 @@
</combo_box>
<button bottom_delta="0" follows="left|top" font="SansSerifSmall" height="18" label="?"
left="205" name="access_help" width="18" />
<button bottom_delta="-30" enabled="false" follows="left|top" height="20" label="Apply"
<check_box bottom_delta="52" follows="left|top" height="20" label="Use Estate Sun" left="250" name="use_estate_sun_check" width="200" />
<button bottom_delta="-2" follows="left|top" font="SansSerifSmall" height="18" label="?" name="use_estate_sun_help" left_delta="200" width="18" />
<check_box bottom_delta="-18" follows="left|top" height="20" label="Fixed Sun" left_delta="-200" name="fixed_sun_check" width="100" />
<button bottom_delta="-2" follows="left|top" font="SansSerifSmall" height="18" label="?" name="fixed_sun_help" left_delta="200" width="18" />
<icon bottom_delta="-23" follows="left|top" height="20" image_name="icon_day_cycle.tga" left_delta="-160" name="daycycle" width="160"/>
<slider bottom_delta="-15" follows="left|top" height="20" increment="0.001"
label="Phase" left_delta="-35" max_val="30" min_val="6" name="sun_hour_slider" show_text="false" width="200" />
<button bottom_delta="-20" enabled="false" follows="left|top" height="20" label="Apply"
left="108" name="apply_btn" width="100" />
<button bottom_delta="-60" follows="left|top" height="20"
label="Teleport Home One User..." left="10" name="kick_btn" width="250" />