summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2016-05-10 16:09:25 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2016-05-10 16:09:25 +0300
commitb1243c55e5579f72e3dd9dafe2b53173349a047f (patch)
tree9d9e0b018059483973a8e6f76644b0875d2534a3 /indra/newview/llfloaterregioninfo.cpp
parent042930b59a82f706f16e4b67a683697aed65112f (diff)
parent7f5e6cea124e1193b199a3eabd50bdab96340c13 (diff)
Merged in oz_linden/maint-5974
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rwxr-xr-xindra/newview/llfloaterregioninfo.cpp203
1 files changed, 104 insertions, 99 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 16566bea73..4eacd728c3 100755
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -97,6 +97,7 @@
#include "llpanelexperiencepicker.h"
#include "llexperiencecache.h"
#include "llpanelexperiences.h"
+#include "llcorehttputil.h"
const S32 TERRAIN_TEXTURE_COUNT = 4;
const S32 CORNER_COUNT = 4;
@@ -232,6 +233,11 @@ BOOL LLFloaterRegionInfo::postBuild()
panel->buildFromFile("panel_region_debug.xml");
mTab->addTabPanel(panel);
+ if(gDisconnected)
+ {
+ return TRUE;
+ }
+
if(!gAgent.getRegion()->getCapability("RegionExperiences").empty())
{
panel = new LLPanelRegionExperiences;
@@ -255,6 +261,11 @@ LLFloaterRegionInfo::~LLFloaterRegionInfo()
void LLFloaterRegionInfo::onOpen(const LLSD& key)
{
+ if(gDisconnected)
+ {
+ disableTabCtrls();
+ return;
+ }
refreshFromRegion(gAgent.getRegion());
requestRegionInfo();
requestMeshRezInfo();
@@ -478,7 +489,16 @@ LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences()
return (LLPanelRegionExperiences*)tab->getChild<LLPanel>("Experiences");
}
+void LLFloaterRegionInfo::disableTabCtrls()
+{
+ LLTabContainer* tab = getChild<LLTabContainer>("region_panels");
+ tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
+}
void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
{
@@ -803,30 +823,6 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L
return false;
}
-class ConsoleRequestResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(ConsoleRequestResponder);
-protected:
- /*virtual*/
- void httpFailure()
- {
- LL_WARNS() << "error requesting mesh_rez_enabled " << dumpResponse() << LL_ENDL;
- }
-};
-
-
-// called if this request times out.
-class ConsoleUpdateResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(ConsoleUpdateResponder);
-protected:
- /* virtual */
- void httpFailure()
- {
- LL_WARNS() << "error updating mesh enabled region setting " << dumpResponse() << LL_ENDL;
- }
-};
-
void LLFloaterRegionInfo::requestMeshRezInfo()
{
std::string sim_console_url = gAgent.getRegion()->getCapability("SimConsoleAsync");
@@ -835,10 +831,8 @@ void LLFloaterRegionInfo::requestMeshRezInfo()
{
std::string request_str = "get mesh_rez_enabled";
- LLHTTPClient::post(
- sim_console_url,
- LLSD(request_str),
- new ConsoleRequestResponder);
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(sim_console_url, LLSD(request_str),
+ "Requested mesh_rez_enabled", "Error requesting mesh_rez_enabled");
}
}
@@ -874,7 +868,8 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate()
body["allow_parcel_changes"] = getChild<LLUICtrl>("allow_parcel_changes_check")->getValue();
body["block_parcel_search"] = getChild<LLUICtrl>("block_parcel_search_check")->getValue();
- LLHTTPClient::post(url, body, new LLHTTPClient::Responder());
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
+ "Region info update posted.", "Region info update not posted.");
}
else
{
@@ -1184,6 +1179,22 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes()
return TRUE;
}
+BOOL LLPanelRegionTerrainInfo::validateTextureHeights()
+{
+ for (S32 i = 0; i < CORNER_COUNT; ++i)
+ {
+ std::string low = llformat("height_start_spin_%d", i);
+ std::string high = llformat("height_range_spin_%d", i);
+
+ if (getChild<LLUICtrl>(low)->getValue().asReal() > getChild<LLUICtrl>(high)->getValue().asReal())
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
/////////////////////////////////////////////////////////////////////////////
// LLPanelRegionTerrainInfo
/////////////////////////////////////////////////////////////////////////////
@@ -1216,6 +1227,9 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
childSetAction("upload_raw_btn", onClickUploadRaw, this);
childSetAction("bake_terrain_btn", onClickBakeTerrain, this);
+ mAskedTextureHeights = false;
+ mConfirmedTextureHeights = false;
+
return LLPanelRegionInfo::postBuild();
}
@@ -1298,6 +1312,21 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
return FALSE;
}
+ // Check if terrain Elevation Ranges are correct
+ if (gSavedSettings.getBOOL("RegionCheckTextureHeights") && !validateTextureHeights())
+ {
+ if (!mAskedTextureHeights)
+ {
+ LLNotificationsUtil::add("ConfirmTextureHeights", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackTextureHeights, this, _1, _2));
+ mAskedTextureHeights = true;
+ return FALSE;
+ }
+ else if (!mConfirmedTextureHeights)
+ {
+ return FALSE;
+ }
+ }
+
LLTextureCtrl* texture_ctrl;
std::string id_str;
LLMessageSystem* msg = gMessageSystem;
@@ -1338,6 +1367,29 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
return TRUE;
}
+bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0) // ok
+ {
+ mConfirmedTextureHeights = true;
+ }
+ else if (option == 1) // cancel
+ {
+ mConfirmedTextureHeights = false;
+ }
+ else if (option == 2) // don't ask
+ {
+ gSavedSettings.setBOOL("RegionCheckTextureHeights", FALSE);
+ mConfirmedTextureHeights = true;
+ }
+
+ onBtnSet();
+
+ mAskedTextureHeights = false;
+ return false;
+}
+
// static
void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data)
{
@@ -2305,36 +2357,6 @@ void LLPanelEstateInfo::getEstateOwner()
}
*/
-class LLEstateChangeInfoResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(LLEstateChangeInfoResponder);
-public:
- LLEstateChangeInfoResponder(LLPanelEstateInfo* panel)
- {
- mpPanel = panel->getHandle();
- }
-
-protected:
- // if we get a normal response, handle it here
- virtual void httpSuccess()
- {
- LL_INFOS("Windlight") << "Successfully committed estate info" << LL_ENDL;
-
- // refresh the panel from the database
- LLPanelEstateInfo* panel = dynamic_cast<LLPanelEstateInfo*>(mpPanel.get());
- if (panel)
- panel->refresh();
- }
-
- // if we get an error response
- virtual void httpFailure()
- {
- LL_WARNS("Windlight") << dumpResponse() << LL_ENDL;
- }
-private:
- LLHandle<LLPanel> mpPanel;
-};
-
const std::string LLPanelEstateInfo::getOwnerName() const
{
return getChild<LLUICtrl>("estate_owner")->getValue().asString();
@@ -3072,6 +3094,11 @@ bool LLPanelEnvironmentInfo::refreshFromRegion(LLViewerRegion* region)
void LLPanelEnvironmentInfo::refresh()
{
+ if(gDisconnected)
+ {
+ return;
+ }
+
populateWaterPresetsList();
populateSkyPresetsList();
populateDayCyclesList();
@@ -3642,29 +3669,6 @@ void LLPanelRegionExperiences::processResponse( const LLSD& content )
}
-
-class LLRegionExperienceResponder : public LLHTTPClient::Responder
-{
-public:
- typedef boost::function<void (const LLSD&)> callback_t;
-
- callback_t mCallback;
-
- LLRegionExperienceResponder(callback_t callback) : mCallback(callback) { }
-
-protected:
- /*virtual*/ void httpSuccess()
- {
- mCallback(getContent());
- }
-
- /*virtual*/ void httpFailure()
- {
- LL_WARNS() << "experience responder failed [status:" << getStatus() << "]: " << getContent() << LL_ENDL;
- }
-};
-
-
// Used for both access add and remove operations, depending on the flag
// passed in (ESTATE_EXPERIENCE_ALLOWED_ADD, ESTATE_EXPERIENCE_ALLOWED_REMOVE, etc.)
// static
@@ -3747,6 +3751,13 @@ void LLPanelRegionExperiences::infoCallback(LLHandle<LLPanelRegionExperiences> h
}
}
+/*static*/
+std::string LLPanelRegionExperiences::regionCapabilityQuery(LLViewerRegion* region, const std::string &cap)
+{
+ // region->getHandle() How to get a region * from a handle?
+
+ return region->getCapability(cap);
+}
bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)
{
@@ -3771,13 +3782,10 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)
mTrusted->loading();
mTrusted->setReadonly(!allow_modify);
- std::string url = region->getCapability("RegionExperiences");
- if (!url.empty())
- {
- LLHTTPClient::get(url, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::infoCallback,
- getDerivedHandle<LLPanelRegionExperiences>(), _1)));
- }
- return LLPanelRegionInfo::refreshFromRegion(region);
+ LLExperienceCache::instance().getRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
+ boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
+
+ return LLPanelRegionInfo::refreshFromRegion(region);
}
LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel)
@@ -3795,18 +3803,15 @@ LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel)
BOOL LLPanelRegionExperiences::sendUpdate()
{
LLViewerRegion* region = gAgent.getRegion();
- std::string url = region->getCapability("RegionExperiences");
- if (!url.empty())
- {
- LLSD content;
- content["allowed"]=addIds(mAllowed);
- content["blocked"]=addIds(mBlocked);
- content["trusted"]=addIds(mTrusted);
+ LLSD content;
- LLHTTPClient::post(url, content, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::infoCallback,
- getDerivedHandle<LLPanelRegionExperiences>(), _1)));
- }
+ content["allowed"]=addIds(mAllowed);
+ content["blocked"]=addIds(mBlocked);
+ content["trusted"]=addIds(mTrusted);
+
+ LLExperienceCache::instance().setRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
+ content, boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
return TRUE;
}