From b60c63bf075a92084ba94459a840decba846a916 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 23 May 2011 19:26:17 +0300 Subject: STORM-1256 WIP Implemented editing region environment settings via the Region/Estate floater. --- indra/newview/llwlhandlers.cpp | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/newview/llwlhandlers.cpp') diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index 905b8d83a8..32ef4ac6ad 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -127,21 +127,20 @@ LLEnvironmentRequestResponder::LLEnvironmentRequestResponder() LLEnvManagerNew::getInstance()->onRegionSettingsResponse(LLSD()); } - /**** - * LLEnvironmentApplyResponder + * LLEnvironmentApply ****/ -clock_t LLEnvironmentApplyResponder::UPDATE_WAIT_SECONDS = clock_t(3.f); -clock_t LLEnvironmentApplyResponder::sLastUpdate = clock_t(0.f); -bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) +clock_t LLEnvironmentApply::UPDATE_WAIT_SECONDS = clock_t(3.f); +clock_t LLEnvironmentApply::sLastUpdate = clock_t(0.f); + +// static +bool LLEnvironmentApply::initiateRequest(const LLSD& content) { clock_t current = clock(); - if(current >= sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC)) - { - sLastUpdate = current; - } - else + + // Make sure we don't update too frequently. + if (current < sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC)) { LLSD args(LLSD::emptyMap()); args["WAIT"] = (F64)UPDATE_WAIT_SECONDS; @@ -149,20 +148,25 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) return false; } + sLastUpdate = current; + + // Send update request. std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings"); - if (!url.empty()) - { - LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL; - LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL; - LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder()); - return true; - } - else + if (url.empty()) { LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL; + return false; } - return false; + + LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL; + LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL; + LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder()); + return true; } + +/**** + * LLEnvironmentApplyResponder + ****/ /*virtual*/ void LLEnvironmentApplyResponder::result(const LLSD& content) { if (content["regionID"].asUUID() != gAgent.getRegion()->getRegionID()) @@ -183,8 +187,6 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) args["FAIL_REASON"] = content["fail_reason"].asString(); LLNotificationsUtil::add("WLRegionApplyFail", args); } - - LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION); } /*virtual*/ void LLEnvironmentApplyResponder::error(U32 status, const std::string& reason) { @@ -196,6 +198,4 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) LLSD args(LLSD::emptyMap()); args["FAIL_REASON"] = msg.str(); LLNotificationsUtil::add("WLRegionApplyFail", args); - - LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION); } -- cgit v1.2.3 From d755605f8dc5bba0abdb87f075db2b6a5ed4ecad Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 24 May 2011 20:21:23 +0300 Subject: STORM-1256 WIP Added perpetual indicator for progress of applying changes. --- indra/newview/llwlhandlers.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llwlhandlers.cpp') 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) -- cgit v1.2.3