From 1a6908a2d97380d8a625bb8d8797599c6f3dce7a Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 13 Apr 2011 16:31:16 -0700 Subject: SH-1299 and SH-1300 Adding mesh enabled checkbox to region floater --- indra/newview/llfloaterregiondebugconsole.cpp | 7 +- indra/newview/llfloaterregiondebugconsole.h | 5 ++ indra/newview/llfloaterregioninfo.cpp | 81 ++++++++++++++++++++++ indra/newview/llfloaterregioninfo.h | 5 ++ .../skins/default/xui/en/panel_region_general.xml | 15 +++- 5 files changed, 108 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index ada0dcf569..c7fab2573f 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -58,8 +58,6 @@ namespace { // Signal used to notify the floater of responses from the asynchronous // API. - typedef boost::signals2::signal< - void (const std::string& output)> console_reply_signal_t; console_reply_signal_t sConsoleReplySignal; const std::string PROMPT("\n\n> "); @@ -132,6 +130,11 @@ namespace }; } +boost::signals2::connection LLFloaterRegionDebugConsole::setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb) +{ + return sConsoleReplySignal.connect(cb); +} + LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key) : LLFloater(key), mOutput(NULL) { diff --git a/indra/newview/llfloaterregiondebugconsole.h b/indra/newview/llfloaterregiondebugconsole.h index 3aa525724e..fd3af4152e 100644 --- a/indra/newview/llfloaterregiondebugconsole.h +++ b/indra/newview/llfloaterregiondebugconsole.h @@ -35,6 +35,9 @@ class LLTextEditor; +typedef boost::signals2::signal< + void (const std::string& output)> console_reply_signal_t; + class LLFloaterRegionDebugConsole : public LLFloater, public LLHTTPClient::Responder { public: @@ -48,6 +51,8 @@ public: LLTextEditor * mOutput; + static boost::signals2::connection setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb); + private: void onReplyReceived(const std::string& output); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 7792b3fb40..34fda49375 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -53,6 +53,7 @@ #include "llfloatertopobjects.h" // added to fix SL-32336 #include "llfloatergroups.h" #include "llfloaterreg.h" +#include "llfloaterregiondebugconsole.h" #include "llfloatertelehub.h" #include "llfloaterwindlight.h" #include "llinventorymodel.h" @@ -159,9 +160,30 @@ bool estate_dispatch_initialized = false; //S32 LLFloaterRegionInfo::sRequestSerial = 0; LLUUID LLFloaterRegionInfo::sRequestInvoice; + +void LLFloaterRegionInfo::onConsoleReplyReceived(const std::string& output) +{ + llwarns << "here is what they're giving us: " << output << llendl; + + if (output.find("FALSE") != std::string::npos) + { + getChild("mesh_rez_enabled_check")->setValue(FALSE); + } + else + { + getChild("mesh_rez_enabled_check")->setValue(TRUE); + } +} + + LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) : LLFloater(seed) { + mConsoleReplySignalConnection = LLFloaterRegionDebugConsole::setConsoleReplyCallback( + boost::bind( + &LLFloaterRegionInfo::onConsoleReplyReceived, + this, + _1)); } BOOL LLFloaterRegionInfo::postBuild() @@ -211,12 +233,14 @@ BOOL LLFloaterRegionInfo::postBuild() LLFloaterRegionInfo::~LLFloaterRegionInfo() { + mConsoleReplySignalConnection.disconnect(); } void LLFloaterRegionInfo::onOpen(const LLSD& key) { refreshFromRegion(gAgent.getRegion()); requestRegionInfo(); + requestMeshRezInfo(); } // static @@ -584,6 +608,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild() initCtrl("access_combo"); initCtrl("restrict_pushobject"); initCtrl("block_parcel_search_check"); + initCtrl("mesh_rez_enabled_check"); childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this)); childSetAction("kick_all_btn", onClickKickAll, this); @@ -691,7 +716,42 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L return false; } +class ConsoleRequestResponder : public LLHTTPClient::Responder +{ +public: + /*virtual*/ + void error(U32 status, const std::string& reason) + { + llwarns << "requesting mesh_rez_enabled failed" << llendl; + } +}; + + +// called if this request times out. +class ConsoleUpdateResponder : public LLHTTPClient::Responder +{ +public: + /* virtual */ + void error(U32 status, const std::string& reason) + { + llwarns << "Updating mesh enabled region setting failed" << llendl; + } +}; + +void LLFloaterRegionInfo::requestMeshRezInfo() +{ + std::string sim_console_url = gAgent.getRegion()->getCapability("SimConsoleAsync"); + if (!sim_console_url.empty()) + { + std::string request_str = "get mesh_rez_enabled"; + + LLHTTPClient::post( + sim_console_url, + LLSD(request_str), + new ConsoleRequestResponder); + } +} // setregioninfo // strings[0] = 'Y' - block terraform, 'N' - not @@ -764,6 +824,27 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings); } + std::string sim_console_url = gAgent.getRegion()->getCapability("SimConsoleAsync"); + + if (!sim_console_url.empty()) + { + std::string update_str = "set mesh_rez_enabled "; + if (getChild("mesh_rez_enabled_check")->getValue().asBoolean()) + { + update_str += "true"; + } + else + { + update_str += "false"; + } + + LLHTTPClient::post( + sim_console_url, + LLSD(update_str), + new ConsoleUpdateResponder); + } + + // if we changed access levels, tell user about it LLViewerRegion* region = gAgent.getRegion(); if (region && (getChild("access_combo")->getValue().asInteger() != region->getSimAccess()) ) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index c0758fa92d..2b87c27fcf 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -84,11 +84,16 @@ public: virtual void refresh(); void requestRegionInfo(); + void requestMeshRezInfo(); private: LLFloaterRegionInfo(const LLSD& seed); ~LLFloaterRegionInfo(); + + void onConsoleReplyReceived(const std::string& output); + + boost::signals2::connection mConsoleReplySignalConnection;; protected: void refreshFromRegion(LLViewerRegion* region); diff --git a/indra/newview/skins/default/xui/en/panel_region_general.xml b/indra/newview/skins/default/xui/en/panel_region_general.xml index ca9579284b..e0d9f3f714 100644 --- a/indra/newview/skins/default/xui/en/panel_region_general.xml +++ b/indra/newview/skins/default/xui/en/panel_region_general.xml @@ -114,7 +114,7 @@ layout="topleft" left="10" name="allow_land_resell_check" - top="160" + top="150" width="80" /> +