diff options
-rw-r--r-- | indra/newview/llenvmanager.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llenvmanager.h | 6 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.h | 2 | ||||
-rw-r--r-- | indra/newview/llwlhandlers.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_environment.xml | 7 |
6 files changed, 63 insertions, 0 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 85a7c4d069..a08ca88459 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -796,6 +796,11 @@ boost::signals2::connection LLEnvManagerNew::setRegionChangeCallback(const regio return mRegionChangeSignal.connect(cb); } +boost::signals2::connection LLEnvManagerNew::setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb) +{ + return mRegionSettingsAppliedSignal.connect(cb); +} + void LLEnvManagerNew::onRegionCrossing() { LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL; @@ -830,6 +835,12 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content) mInterpNextChangeMessage = false; } +void LLEnvManagerNew::onRegionSettingsApplyResponse(bool ok) +{ + LL_DEBUGS("Windlight") << "Applying region settings " << (ok ? "succeeded" : "failed") << LL_ENDL; + mRegionSettingsAppliedSignal(ok); +} + //-- private methods ---------------------------------------------------------- // virtual diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index eb678e000e..52b645b535 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -261,6 +261,7 @@ class LLEnvManagerNew : public LLSingleton<LLEnvManagerNew> public: typedef boost::signals2::signal<void()> region_settings_change_signal_t; typedef boost::signals2::signal<void()> region_change_signal_t; + typedef boost::signals2::signal<void(bool)> region_settings_applied_signal_t; LLEnvManagerNew(); @@ -300,11 +301,13 @@ public: bool sendRegionSettings(const LLEnvironmentSettings& new_settings); boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb); boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); + boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); // Public callbacks. void onRegionCrossing(); void onTeleport(); void onRegionSettingsResponse(const LLSD& content); + void onRegionSettingsApplyResponse(bool ok); private: friend class LLSingleton<LLEnvManagerNew>; @@ -320,6 +323,9 @@ private: /// Emitted when agent region changes. Move to LLAgent? region_settings_change_signal_t mRegionChangeSignal; + /// Emitted when agent region changes. Move to LLAgent? + region_settings_applied_signal_t mRegionSettingsAppliedSignal; + LLEnvPrefs mUserPrefs; /// User environment preferences. LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings. bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change. diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 657dd67035..d47fb00060 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -40,6 +40,7 @@ #include "llxfermanager.h" #include "indra_constants.h" #include "message.h" +#include "llloadingindicator.h" #include "llradiogroup.h" #include "llsd.h" #include "llsdserialize.h" @@ -3203,6 +3204,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); + LLEnvManagerNew::instance().setRegionSettingsAppliedCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingsApplied, this, _1)); return TRUE; } @@ -3265,6 +3267,22 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) } } +void LLPanelEnvironmentInfo::setApplyProgress(bool started) +{ + LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("progress_indicator"); + + indicator->setVisible(started); + + if (started) + { + indicator->start(); + } + else + { + indicator->stop(); + } +} + void LLPanelEnvironmentInfo::populateWaterPresetsList() { mWaterPresetCombo->removeall(); @@ -3457,7 +3475,10 @@ void LLPanelEnvironmentInfo::onBtnSave() if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) { llwarns << "Error applying region environment settings" << llendl; + return; } + + setApplyProgress(true); } void LLPanelEnvironmentInfo::onBtnCancel() @@ -3470,4 +3491,18 @@ void LLPanelEnvironmentInfo::onRegionSettingschange() { LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL; refresh(); + + // Stop applying progress indicator (it may be running if it's us who initiated settings update). + setApplyProgress(false); +} + +void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) +{ + LL_DEBUGS("Windlight") << "Applying region settings finished, stopping indicator" << LL_ENDL; + // If applying new settings has failed, stop the indicator right away. + // Otherwise it will be stopped when we receive the updated settings from server. + if (!ok) + { + setApplyProgress(false); + } } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 4dc235ad19..d96ab1339f 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -439,6 +439,7 @@ public: private: void refresh(); void setControlsEnabled(bool enabled); + void setApplyProgress(bool started); void populateWaterPresetsList(); void populateSkyPresetsList(); @@ -451,6 +452,7 @@ private: void onBtnCancel(); void onRegionSettingschange(); + void onRegionSettingsApplied(bool ok); bool mEnableEditing; diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index 32ef4ac6ad..b5f53232cc 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -179,6 +179,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content) else if (content["success"].asBoolean()) { LL_DEBUGS("WindlightCaps") << "Success in applying windlight settings to region " << content["regionID"].asUUID() << LL_ENDL; + LLEnvManagerNew::instance().onRegionSettingsApplyResponse(true); } else { @@ -186,6 +187,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content) LLSD args(LLSD::emptyMap()); args["FAIL_REASON"] = content["fail_reason"].asString(); LLNotificationsUtil::add("WLRegionApplyFail", args); + LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false); } } /*virtual*/ void LLEnvironmentApplyResponder::error(U32 status, const std::string& reason) 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 907a707db8..956ba53a26 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -137,4 +137,11 @@ left_pad="10" name="cancel_btn" width="100" /> + <loading_indicator + height="23" + left="10" + name="progress_indicator" + top_delta="0" + visible="false" + width="23" /> </panel> |