diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 67 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 109 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 16 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_environment.xml | 25 |
6 files changed, 61 insertions, 165 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 21a062184c..380302b51e 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3376,7 +3376,8 @@ bool LLPanelLandEnvironment::canEdit() LLParcel *parcel = getParcel(); if (!parcel) return false; - return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel); + + return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel) && mAllowOverride; } S32 LLPanelLandEnvironment::getParcelId() diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index e52ba38080..3e07c4abc7 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -188,7 +188,6 @@ public: virtual bool canEdit() override { return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); } bool refreshFromRegion(LLViewerRegion* region); - void refreshFromEstate(); virtual BOOL postBuild() override; virtual void onOpen(const LLSD& key) override {}; @@ -198,16 +197,14 @@ public: protected: static const U32 DIRTY_FLAG_OVERRIDE; - virtual void doApply() override; - virtual void refreshFromSource() override; - bool doUpdateEstate(const LLSD& notification, const LLSD& response); + bool confirmUpdateEstateEnvironment(const LLSD& notification, const LLSD& response); void onChkAllowOverride(bool value); private: - bool mAllowOverride; + bool mAllowOverrideRestore; }; @@ -3403,7 +3400,7 @@ const U32 LLPanelRegionEnvironment::DIRTY_FLAG_OVERRIDE(0x01 << 4); LLPanelRegionEnvironment::LLPanelRegionEnvironment(): LLPanelEnvironmentInfo(), - mAllowOverride(false) + mAllowOverrideRestore(false) { LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this)); @@ -3436,7 +3433,6 @@ void LLPanelRegionEnvironment::refresh() return; } - refreshFromEstate(); LLPanelEnvironmentInfo::refresh(); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); @@ -3463,13 +3459,6 @@ bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) return true; } -void LLPanelRegionEnvironment::refreshFromEstate() -{ - const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); - - mAllowOverride = estate_info.getAllowEnvironmentOverride(); -} - void LLPanelRegionEnvironment::refreshFromSource() { LL_DEBUGS("ENVIRONMENT") << "Requesting environment for region, known version " << mCurEnvVersion << LL_ENDL; @@ -3487,31 +3476,7 @@ void LLPanelRegionEnvironment::refreshFromSource() setControlsEnabled(false); } -void LLPanelRegionEnvironment::doApply() -{ - LLPanelEnvironmentInfo::doApply(); - - 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 (LLPanelEstateInfo::isLindenEstate()) - { - // trying to change reserved estate, warn - LLNotifications::instance().add(params); - } - else - { - // for normal estates, just make the change - LLNotifications::instance().forceResponse(params, 0); - } - - } -} - -bool LLPanelRegionEnvironment::doUpdateEstate(const LLSD& notification, const LLSD& response) +bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -3530,6 +3495,9 @@ bool LLPanelRegionEnvironment::doUpdateEstate(const LLSD& notification, const LL break; case 1: + mAllowOverride = mAllowOverrideRestore; + getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride); + break; default: break; } @@ -3538,11 +3506,24 @@ bool LLPanelRegionEnvironment::doUpdateEstate(const LLSD& notification, const LL void LLPanelRegionEnvironment::onChkAllowOverride(bool value) { - if (!value) + setDirtyFlag(DIRTY_FLAG_OVERRIDE); + mAllowOverrideRestore = mAllowOverride; + mAllowOverride = value; + + LLNotification::Params params("ChangeLindenEstate"); + params.functor.function([this](const LLSD& notification, const LLSD& response) { confirmUpdateEstateEnvironment(notification, response); }); + + std::string notification("EstateParcelEnvironmentOverride"); + if (LLPanelEstateInfo::isLindenEstate()) + notification = "ChangeLindenEstate"; + + if (!value || LLPanelEstateInfo::isLindenEstate()) + { // warn if turning off or a Linden Estate + LLNotifications::instance().add(params); + } + else { - LLNotificationsUtil::add("EstateParcelEnvironmentOverride"); + LLNotifications::instance().forceResponse(params, 0); } - setDirtyFlag(DIRTY_FLAG_OVERRIDE); - mAllowOverride = value; } diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 6465c25716..79e3d61014 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -73,8 +73,6 @@ const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); const std::string LLPanelEnvironmentInfo::ICN_GROUND("icon_ground"); const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override"); -const std::string LLPanelEnvironmentInfo::BTN_APPLY("btn_apply"); -const std::string LLPanelEnvironmentInfo::BTN_CANCEL("btn_cancel"); const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time"); const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config"); const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environment_altitudes"); @@ -90,6 +88,7 @@ const std::string LLPanelEnvironmentInfo::STR_ALTITUDE_DESCRIPTION("str_altitude const std::string LLPanelEnvironmentInfo::STR_NO_PARCEL("str_no_parcel"); const std::string LLPanelEnvironmentInfo::STR_CROSS_REGION("str_cross_region"); const std::string LLPanelEnvironmentInfo::STR_LEGACY("str_legacy"); +const std::string LLPanelEnvironmentInfo::STR_DISALLOWED("str_disallowed"); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); @@ -130,7 +129,8 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mNoEnvironment(false), mCurEnvVersion(INVALID_PARCEL_ENVIRONMENT_VERSION), mSettingsFloater(), - mEditFloater() + mEditFloater(), + mAllowOverride(false) { } @@ -147,8 +147,6 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild<LLUICtrl>(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); getChild<LLUICtrl>(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); getChild<LLUICtrl>(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); - getChild<LLUICtrl>(BTN_APPLY)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnApply(); }); - getChild<LLUICtrl>(BTN_CANCEL)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnReset(); }); getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); @@ -283,6 +281,13 @@ void LLPanelEnvironmentInfo::refresh() } +void LLPanelEnvironmentInfo::refreshFromEstate() +{ + const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + + mAllowOverride = estate_info.getAllowEnvironmentOverride(); +} + std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) { std::string name(LLFloaterSettingsPicker::findItemName(asset_id, false, false)); @@ -406,6 +411,11 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) is_unavailable = true; getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_CROSS_REGION)); } + else if (!isRegion() && !mAllowOverride) + { + is_unavailable = true; + getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_DISALLOWED)); + } if (is_unavailable) { @@ -426,6 +436,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); + getChild<LLUICtrl>(BTN_USEDEFAULT)->setEnabled(can_enable && !is_legacy); getChild<LLUICtrl>(BTN_EDIT)->setEnabled(can_enable); getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_enable && !is_legacy); getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); @@ -433,8 +444,6 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); - getChild<LLUICtrl>(BTN_APPLY)->setEnabled(can_enable && (mDirtyFlag != 0)); - getChild<LLUICtrl>(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); @@ -459,18 +468,12 @@ void LLPanelEnvironmentInfo::setApplyProgress(bool started) void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag) { - bool can_edit = canEdit(); mDirtyFlag |= flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); - getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && can_edit); } void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) { - bool can_edit = canEdit(); mDirtyFlag &= ~flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); - getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && can_edit); } void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value) @@ -591,18 +594,6 @@ void LLPanelEnvironmentInfo::readjustAltLabels() #endif } -#if 0 -void LLPanelEnvironmentInfo::onSwitchDefaultSelection() -{ -// bool can_edit = canEdit(); - setDirtyFlag(DIRTY_FLAG_DAYCYCLE); - -// S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); -// getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); -// getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); -} -#endif - void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { F32Hours daylength(value); @@ -699,17 +690,6 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp() } } -void LLPanelEnvironmentInfo::onBtnApply() -{ - doApply(); -} - -void LLPanelEnvironmentInfo::onBtnReset() -{ - mCurrentEnvironment.reset(); - refreshFromSource(); -} - void LLPanelEnvironmentInfo::onBtnDefault() { LLHandle<LLPanel> that_h = getHandle(); @@ -759,62 +739,6 @@ void LLPanelEnvironmentInfo::onBtnSelect() } -void LLPanelEnvironmentInfo::doApply() -{ -// S32 parcel_id = getParcelId(); - -// if (getIsDirtyFlag(DIRTY_FLAG_MASK)) -// { -// LLHandle<LLPanel> that_h = getHandle(); -// LLEnvironment::altitudes_vect_t alts; -// -// // S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); -// -// if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) -// { -// altitudes_data_t::iterator it; -// for (auto alt : mAltitudes) -// { -// alts.push_back(alt.second.mAltitude); -// } -// } - -// if (rdo_selection == 0) -// { -// LLEnvironment::instance().resetParcel(parcel_id, -// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); -// } -// else if (rdo_selection == 1) -// { -// if (!mCurrentEnvironment) -// { -// // Attempting to save mid update? -// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; -// return; -// } -// LLEnvironment::instance().updateParcel(parcel_id, -// mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), -// mCurrentEnvironment->mDayOffset.value(), alts, -// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); -// } -// else -// { -// if (!mCurrentEnvironment) -// { -// // Attempting to save mid update? -// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; -// return; -// } -// LLEnvironment::instance().updateParcel(parcel_id, -// mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, -// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); -// } - -// setControlsEnabled(false); -// } -} - - void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() { static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0); @@ -990,6 +914,7 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment: LL_WARNS("ENVPANEL") << " Environment version was not provided for " << parcel_id << ", old env version: " << mCurEnvVersion << LL_ENDL; } + refreshFromEstate(); refresh(); // todo: we have envifo and parcel env version, should we just setEnvironment() and parcel's property to prevent dupplicate requests? diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index a0a60a2bf9..3649abe939 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -36,6 +36,7 @@ #include "llparcel.h" #include "llsettingspicker.h" #include "llfloatereditextdaycycle.h" +#include "llestateinfomodel.h" class LLViewerRegion; @@ -87,6 +88,7 @@ protected: static const std::string STR_NO_PARCEL; static const std::string STR_CROSS_REGION; static const std::string STR_LEGACY; + static const std::string STR_DISALLOWED; static const U32 DIRTY_FLAG_DAYCYCLE; static const U32 DIRTY_FLAG_DAYLENGTH; @@ -110,14 +112,10 @@ protected: void onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data); void onAltSliderMouseUp(); - void onBtnApply(); - void onBtnReset(); void onBtnEdit(); void onBtnSelect(); void onBtnDefault(); - virtual void doApply(); - void udpateApparentTimeOfDay(); void onPickerCommitted(LLUUID item_id); @@ -162,12 +160,15 @@ protected: F32 mAltitude; }; typedef std::map<std::string, AltitudeData> altitudes_data_t; - altitudes_data_t mAltitudes; - S32 mCurEnvVersion; // used to filter duplicate callbacks/refreshes + altitudes_data_t mAltitudes; + S32 mCurEnvVersion; // used to filter duplicate callbacks/refreshes +protected: + void refreshFromEstate(); + bool mAllowOverride; private: - static void onIdlePlay(void *); + static void onIdlePlay(void *); typedef boost::signals2::connection connection_t; @@ -181,6 +182,7 @@ private: bool mCrossRegion; bool mNoSelection; bool mNoEnvironment; + }; class LLSettingsDropTarget : public LLView diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 5c08bf50f6..b4cfe9d1b5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4811,10 +4811,12 @@ Unchecking this option may remove restrictions that parcel owners have added to icon="alertmodal.tga" name="EstateParcelEnvironmentOverride" type="alertmodal"> -Unchecking this option may remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed. +Unchecking this option will remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed. +Do you wish to proceed? <tag>confirm</tag> <usetemplate - name="okbutton" + name="okcancelbuttons" + notext="Cancel" yestext="OK"/> </notification> diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index 1c2657ea60..7c08262d50 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -16,6 +16,7 @@ <string name="str_no_parcel">No parcel is selected. Environmental settings are disabled.</string> <string name="str_cross_region">Environmental settings are not available across region boundries.</string> <string name="str_legacy">Environmental settings are not available on this region.</string> + <string name="str_disallowed">The estate manager does not allow changing parcel environments in this region.</string> <string name="str_empty">(empty)</string> <layout_stack width="530" @@ -383,7 +384,7 @@ name="sld_day_length" min_val="4" max_val="168" - width="240" /> + width="237" /> <text type="string" length="1" @@ -408,7 +409,7 @@ name="sld_day_offset" min_val="-11.5" max_val="12" - width="240" /> + width="237" /> <text type="string" length="1" @@ -432,30 +433,14 @@ width="200"> [HH]:[MM][AP] ([PRC]%) </text> - </layout_panel> <layout_panel follows="bottom" border="true" bevel_style="in" name="pnl_environment_buttons"> - <button - follows="bottom|right" - height="23" - label="Apply" - top="-60" - left="-220" - name="btn_apply" - width="100" /> - <button - follows="bottom|right" - height="23" - label="Reset" - layout="topleft" - left_pad="10" - top_delta="0" - name="btn_cancel" - width="100" /> +<!-- used to be buttons, but now spacer. +--> </layout_panel> </layout_stack> </layout_panel> |