Added option for console background image and URL parsing; Disabled URL parsing for debug view console

meow-7.2.2
Ansariel 2012-01-06 16:31:38 +01:00
parent adcf55f20b
commit 176f020bb3
3 changed files with 24 additions and 11 deletions

View File

@ -63,7 +63,9 @@ LLConsole::LLConsole(const LLConsole::Params& p)
mLinePersistTime(p.persist_time), // seconds
mFont(p.font),
mConsoleWidth(0),
mConsoleHeight(0)
mConsoleHeight(0),
mParseUrls(p.parse_urls), // Ansariel: If lines should be parsed for URLs
mBackgroundImage(p.background_image) // Ansariel: Configurable background for different console types
{
if (p.font_size_index.isProvided())
{
@ -187,7 +189,7 @@ void LLConsole::draw()
//[FIX FIRE-2822 SJ] Start a little bit higher with the Console not to let it blend with the stand button when Avatar is sitting
F32 y_pos = 10.f;
LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
LLUIImagePtr imagep = LLUI::getUIImage(mBackgroundImage);
//AO: Unify colors and opacity with the color preferences control for all onscreen overlay background
// console/bubblechat/tag backgrounds. FIRE-969
@ -271,16 +273,19 @@ void LLConsole::addConsoleLine(const LLWString& wline, const LLColor4 &color, LL
removeExtraLines();
// <Ansariel> Parse SLURLs
LLUrlMatch urlMatch;
LLWString newLine = wline;
LLWString workLine = wline;
while (LLUrlRegistry::instance().findUrl(workLine, urlMatch))
if (mParseUrls)
{
LLWStringUtil::replaceString(newLine, utf8str_to_wstring(urlMatch.getUrl()), utf8str_to_wstring(urlMatch.getLabel()));
LLUrlMatch urlMatch;
LLWString workLine = wline;
while (LLUrlRegistry::instance().findUrl(workLine, urlMatch))
{
LLWStringUtil::replaceString(newLine, utf8str_to_wstring(urlMatch.getUrl()), utf8str_to_wstring(urlMatch.getLabel()));
// Remove the URL from the work line so we don't end in a loop in case of regular URLs!
// findUrl will always return the very first URL in a string
workLine = workLine.erase(0, urlMatch.getEnd() + 1);
// Remove the URL from the work line so we don't end in a loop in case of regular URLs!
// findUrl will always return the very first URL in a string
workLine = workLine.erase(0, urlMatch.getEnd() + 1);
}
}
// </Ansariel> Parse SLURLs

View File

@ -49,10 +49,15 @@ public:
Optional<U32> max_lines;
Optional<F32> persist_time;
Optional<S32> font_size_index;
Optional<bool> parse_urls; // Ansariel: If lines should be parsed for URLs
Optional<std::string> background_image; // Ansariel: Configurable background for different console types
Params()
: max_lines("max_lines", LLUI::sSettingGroups["config"]->getS32("ConsoleMaxLines")),
persist_time("persist_time", 0.f), // forever
font_size_index("font_size_index")
font_size_index("font_size_index"),
parse_urls("parse_urls", false), // Ansariel: If lines should be parsed for URLs
background_image("background_image", "transparent") // Ansariel: Configurable background for different console types
{
changeDefault(mouse_opaque, false);
}
@ -163,7 +168,8 @@ private:
const LLFontGL* mFont;
S32 mConsoleWidth;
S32 mConsoleHeight;
bool mParseUrls; // Ansariel: If lines should be parsed for URLs
std::string mBackgroundImage; // Ansariel: Configurable background for different console types
};
extern LLConsole* gConsole;

View File

@ -1781,6 +1781,8 @@ void LLViewerWindow::initBase()
cp.name("console");
cp.max_lines(gSavedSettings.getS32("ConsoleBufferSize"));
cp.rect(getChatConsoleRect());
cp.parse_urls(true); // Ansariel: Enable URL parsing for the chat console
cp.background_image("Rounded_Square"); // Ansariel: Configurable background for different console types
// AO, have console respect/reuse NearbyToastLifeTime for the length popup chat messages are displayed.
//cp.persist_time(gSavedSettings.getF32("ChatPersistTime"));
cp.persist_time((F32)gSavedSettings.getS32("NearbyToastLifeTime"));