summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-08-21 19:25:06 +0100
committerGraham Linden <graham@lindenlab.com>2018-08-21 19:25:06 +0100
commit67d880781ee2463522edd11f9286635414aa46eb (patch)
tree3146816bbc9f0f1db1c9dc6eff2c6e22713bcd5c /indra/newview/llfloaterregioninfo.cpp
parente3c2d3fd5138fa79946734e61b34d38e98c6a493 (diff)
parent163ae605be8871f37f19d94b71ec4370aadf9a49 (diff)
Merge
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp158
1 files changed, 81 insertions, 77 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 5112ff11bf..11bbd2c6fa 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -179,23 +179,32 @@ void unpack_request_params(
class LLPanelRegionEnvironment : public LLPanelEnvironmentInfo
{
public:
- LLPanelRegionEnvironment();
+ LLPanelRegionEnvironment();
- void refresh();
+ virtual void refresh() override;
- bool refreshFromRegion(LLViewerRegion* region);
- void refreshFromEstate();
+ virtual bool isRegion() const override { return true; }
+ virtual LLParcel * getParcel() override { return nullptr; }
+ virtual bool canEdit() override { return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); }
- virtual BOOL postBuild();
+ bool refreshFromRegion(LLViewerRegion* region);
+ void refreshFromEstate();
+
+ virtual BOOL postBuild() override;
protected:
- virtual void doApply();
+ static const U32 DIRTY_FLAG_OVERRIDE;
+
+ virtual void doApply() override;
+
- virtual void doEditCommited(LLSettingsDay::ptr_t &newday);
- BOOL sendUpdate();
+ bool doUpdateEstate(const LLSD& notification, const LLSD& response);
+
+ void onChkAllowOverride(bool value);
private:
- LLViewerRegion * mLastRegion;
+ bool mAllowOverride;
+
};
@@ -246,6 +255,7 @@ BOOL LLFloaterRegionInfo::postBuild()
mEnvironmentPanel = new LLPanelRegionEnvironment;
mEnvironmentPanel->buildFromFile("panel_region_environment.xml");
+// mEnvironmentPanel->configureForRegion();
mTab->addTabPanel(mEnvironmentPanel);
panel = new LLPanelRegionDebugInfo;
@@ -3366,9 +3376,11 @@ void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id )
}
//=========================================================================
+const U32 LLPanelRegionEnvironment::DIRTY_FLAG_OVERRIDE(0x01 << 3);
+
LLPanelRegionEnvironment::LLPanelRegionEnvironment():
LLPanelEnvironmentInfo(),
- mLastRegion(NULL)
+ mAllowOverride(false)
{
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this));
@@ -3381,48 +3393,31 @@ BOOL LLPanelRegionEnvironment::postBuild()
if (!LLPanelEnvironmentInfo::postBuild())
return FALSE;
+ getChild<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT));
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(TRUE);
+
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); });
return TRUE;
}
void LLPanelRegionEnvironment::refresh()
{
- refreshFromRegion(mLastRegion);
+ if (!mCurrentEnvironment)
+ {
+ refreshFromSource();
+ return;
+ }
+
refreshFromEstate();
+ LLPanelEnvironmentInfo::refresh();
+
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride);
}
bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region)
{
- BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID()));
- BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager());
-
- F64Hours daylength;
- F64Hours dayoffset;
-
- daylength = LLEnvironment::instance().getEnvironmentDayLength(LLEnvironment::ENV_REGION);
- dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(LLEnvironment::ENV_REGION);
-
- if (dayoffset.value() > 12.0)
- dayoffset = dayoffset - F64Hours(24.0f);
-
- mDayLengthSlider->setValue(daylength.value());
- mDayOffsetSlider->setValue(dayoffset.value());
-
- setControlsEnabled(owner_or_god_or_manager);
- mLastRegion = region;
-
- LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_REGION);
-
- if (pday)
- {
- mRegionSettingsRadioGroup->setSelectedIndex((pday->getAssetId() == LLSettingsDay::GetDefaultAssetId()) ? 0 : 1);
- mEditingDayCycle = std::static_pointer_cast<LLSettingsDay>(pday->buildDerivedClone());
- }
- else
- {
- mRegionSettingsRadioGroup->setSelectedIndex(1);
- }
-
+ refreshFromSource();
return true;
}
@@ -3430,56 +3425,65 @@ void LLPanelRegionEnvironment::refreshFromEstate()
{
const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
- getChild<LLUICtrl>("allow_override_chk")->setValue(estate_info.getAllowEnvironmentOverride());
-
+ mAllowOverride = estate_info.getAllowEnvironmentOverride();
}
void LLPanelRegionEnvironment::doApply()
{
- if (mRegionSettingsRadioGroup->getSelectedIndex() == 0)
- {
- LLEnvironment::instance().resetRegion();
- }
- else
- {
- LLSettingsDay::Seconds daylength;
- F32Hours dayoffset_h;
+ LLPanelEnvironmentInfo::doApply();
- daylength = F32Hours(mDayLengthSlider->getValueF32());
- dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32());
+ if (getIsDirtyFlag(DIRTY_FLAG_OVERRIDE))
+ {
+ LLNotification::Params params("ChangeLindenEstate");
+ //params.functor.function(boost::bind(&LLPanelEstateInfo::doUpdateEstate, this, _1, _2));
+ params.functor.function([this](const LLSD& notification, const LLSD& response) { doUpdateEstate(notification, response); });
- if (dayoffset_h.value() < 0)
+ if (LLPanelEstateInfo::isLindenEstate())
{
- dayoffset_h = F32Hours(24.0f) + dayoffset_h;
+ // trying to change reserved estate, warn
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ // for normal estates, just make the change
+ LLNotifications::instance().forceResponse(params, 0);
}
- LLSettingsDay::Seconds dayoffset_s = dayoffset_h;
-
- LLEnvironment::instance().updateRegion(mEditingDayCycle, daylength.value(), dayoffset_s.value());
}
}
-void LLPanelRegionEnvironment::doEditCommited(LLSettingsDay::ptr_t &newday)
+bool LLPanelRegionEnvironment::doUpdateEstate(const LLSD& notification, const LLSD& response)
{
- mEditingDayCycle = newday;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ switch (option)
+ {
+ case 0:
+ {
+ LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
+
+ // update model
+ estate_info.setAllowEnvironmentOverride(mAllowOverride);
+ // send the update to sim
+ estate_info.sendEstateInfo();
+ clearDirtyFlag(DIRTY_FLAG_OVERRIDE);
+ }
+ break;
+
+ case 1:
+ default:
+ break;
+ }
+ return false;
}
-BOOL LLPanelRegionEnvironment::sendUpdate()
+void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
{
-// LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL;
-//
-// LLNotification::Params params("ChangeLindenEstate");
-// params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2));
-//
-// if (isLindenEstate())
-// {
-// // trying to change reserved estate, warn
-// LLNotifications::instance().add(params);
-// }
-// else
-// {
-// // for normal estates, just make the change
-// LLNotifications::instance().forceResponse(params, 0);
-// }
- return TRUE;
+ if (!value)
+ {
+ LLNotificationsUtil::add("EstateParcelEnvironmentOverride");
+ }
+
+ setDirtyFlag(DIRTY_FLAG_OVERRIDE);
+ mAllowOverride = value;
}