diff options
Diffstat (limited to 'indra/newview/llfloaterregiondebugconsole.cpp')
-rw-r--r-- | indra/newview/llfloaterregiondebugconsole.cpp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index 058f894800..159dee7631 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -55,11 +55,8 @@ public: /*virtual*/ void result(const LLSD& content) { - std::string text = mOutput->getText(); - text += '\n'; - text += content.asString(); - text += '\n'; - mOutput->setText(text); + std::string text = content.asString() + "\n\n> "; + mOutput->appendText(text, false); }; LLTextEditor * mOutput; @@ -72,22 +69,47 @@ LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key) BOOL LLFloaterRegionDebugConsole::postBuild() { - getChild<LLLineEditor>("region_debug_console_input")->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2)); + LLLineEditor* input = getChild<LLLineEditor>("region_debug_console_input"); + input->setEnableLineHistory(true); + input->setCommitCallback(boost::bind(&LLFloaterRegionDebugConsole::onInput, this, _1, _2)); + input->setFocus(true); + input->setCommitOnFocusLost(false); + mOutput = getChild<LLTextEditor>("region_debug_console_output"); + + std::string url = gAgent.getRegion()->getCapability("SimConsole"); + if ( url.size() == 0 ) + { + mOutput->appendText("This region does not support the simulator console.\n\n> ", false); + } + else + { + mOutput->appendText("> ", false); + } + + return TRUE; } void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param) { - LLLineEditor * input = static_cast<LLLineEditor*>(ctrl); - std::string text = mOutput->getText(); - text += "\n\POST: "; - text += input->getText(); - mOutput->setText(text); + LLLineEditor* input = static_cast<LLLineEditor*>(ctrl); + std::string text = input->getText() + "\n"; + std::string url = gAgent.getRegion()->getCapability("SimConsole"); - LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput)); - input->setText(std::string("")); + if ( url.size() > 0 ) + { + LLHTTPClient::post(url, LLSD(input->getText()), new ::Responder(mOutput)); + } + else + { + text += "\nError: No console available for this region/simulator.\n\n> "; + } + + mOutput->appendText(text, false); + + input->clear(); } |