diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-08-31 13:47:47 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-08-31 13:47:47 -0700 |
commit | 30ff6cabd61f2f083df5df1e6e70cc94742af477 (patch) | |
tree | 631935f1cf59d19a91cdad65e9a75fe825afda7d /indra/newview/llfloaterabout.cpp | |
parent | ff11d74820c89822cd067b51727d9df1dc87d0d0 (diff) | |
parent | 3ac3a4b206c08ed06b889bdaa24074b6aa0e020a (diff) |
Merge with trunk
Diffstat (limited to 'indra/newview/llfloaterabout.cpp')
-rw-r--r-- | indra/newview/llfloaterabout.cpp | 171 |
1 files changed, 65 insertions, 106 deletions
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 810799d27c..56c5eaa70e 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -42,7 +42,7 @@ #include "llcurl.h" #include "llimagej2c.h" -#include "audioengine.h" +#include "llaudioengine.h" #include "llviewertexteditor.h" #include "llviewercontrol.h" @@ -58,9 +58,10 @@ #include "lltrans.h" #include "llappviewer.h" #include "llglheaders.h" -#include "llmediamanager.h" #include "llwindow.h" +#include "llbutton.h" + #if LL_WINDOWS #include "lldxhardware.h" #endif @@ -69,59 +70,51 @@ extern LLCPUInfo gSysCPU; extern LLMemoryInfo gSysMemory; extern U32 gPacketsIn; -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - -LLFloaterAbout* LLFloaterAbout::sInstance = NULL; - static std::string get_viewer_release_notes_url(); + ///---------------------------------------------------------------------------- /// Class LLFloaterAbout ///---------------------------------------------------------------------------- // Default constructor -LLFloaterAbout::LLFloaterAbout() -: LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null) +LLFloaterAbout::LLFloaterAbout(const LLSD& key) +: LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); + +} - // Support for changing product name. - std::string title("About "); - title += LLAppViewer::instance()->getSecondLifeTitle(); - setTitle(title); +// Destroys the object +LLFloaterAbout::~LLFloaterAbout() +{ +} +BOOL LLFloaterAbout::postBuild() +{ + center(); LLViewerTextEditor *support_widget = getChild<LLViewerTextEditor>("support_editor", true); LLViewerTextEditor *credits_widget = getChild<LLViewerTextEditor>("credits_editor", true); - - if (!support_widget || !credits_widget) - { - return; - } - // For some reason, adding style doesn't work unless this is true. support_widget->setParseHTML(TRUE); // Text styles for release notes hyperlinks - LLStyleSP viewer_link_style(new LLStyle); - viewer_link_style->setVisible(true); - viewer_link_style->setFontName(LLStringUtil::null); - viewer_link_style->setLinkHREF(get_viewer_release_notes_url()); - viewer_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + LLStyle::Params link_style_params; + link_style_params.color.control = "HTMLLinkColor"; + link_style_params.link_href = get_viewer_release_notes_url(); // Version string - std::string version = LLAppViewer::instance()->getSecondLifeTitle() + std::string version = LLTrans::getString("APP_NAME") + llformat(" %d.%d.%d (%d) %s %s (%s)\n", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD, __DATE__, __TIME__, gSavedSettings.getString("VersionChannelName").c_str()); - support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); - support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style); + support_widget->appendColoredText(version, FALSE, FALSE, LLUIColorTable::instance().getColor("TextFgReadOnlyColor")); + support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, link_style_params); std::string support; support.append("\n\n"); @@ -138,11 +131,9 @@ LLFloaterAbout::LLFloaterAbout() LLViewerRegion* region = gAgent.getRegion(); if (region) { - LLStyleSP server_link_style(new LLStyle); - server_link_style->setVisible(true); - server_link_style->setFontName(LLStringUtil::null); - server_link_style->setLinkHREF(region->getCapability("ServerReleaseNotes")); - server_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + LLStyle::Params server_link_style_params; + server_link_style_params.color.control = "HTMLLinkColor"; + server_link_style_params.link_href = region->getCapability("ServerReleaseNotes"); const LLVector3d &pos = gAgent.getPositionGlobal(); LLUIString pos_text = getString("you_are_at"); @@ -150,8 +141,8 @@ LLFloaterAbout::LLFloaterAbout() llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ])); support.append(pos_text); - std::string region_text = llformat("in %s located at ", - gAgent.getRegion()->getName().c_str()); + LLUIString region_text = getString ("in_region") + " "; + region_text.setArg("[REGION]", llformat ("%s", gAgent.getRegion()->getName().c_str())); support.append(region_text); std::string buffer; @@ -164,8 +155,8 @@ LLFloaterAbout::LLFloaterAbout() support.append(gLastVersionChannel); support.append("\n"); - support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); - support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style); + support_widget->appendColoredText(support, FALSE, FALSE, LLUIColorTable::instance().getColor("TextFgReadOnlyColor")); + support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style_params); support = "\n\n"; } @@ -175,25 +166,26 @@ LLFloaterAbout::LLFloaterAbout() // and this info sometimes gets sent to support // CPU - support.append("CPU: "); + support.append(getString("CPU") + " "); support.append( gSysCPU.getCPUString() ); support.append("\n"); U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024; // Moved hack adjustment to Windows memory size into llsys.cpp - std::string mem_text = llformat("Memory: %u MB\n", memory ); - support.append(mem_text); + LLStringUtil::format_map_t args; + args["[MEM]"] = llformat ("%u", memory); + support.append(getString("Memory", args) + "\n"); - support.append("OS Version: "); + support.append(getString("OSVersion") + " "); support.append( LLAppViewer::instance()->getOSInfo().getOSString() ); support.append("\n"); - support.append("Graphics Card Vendor: "); + support.append(getString("GraphicsCardVendor") + " "); support.append( (const char*) glGetString(GL_VENDOR) ); support.append("\n"); - support.append("Graphics Card: "); + support.append(getString("GraphicsCard") + " "); support.append( (const char*) glGetString(GL_RENDERER) ); support.append("\n"); @@ -211,98 +203,65 @@ LLFloaterAbout::LLFloaterAbout() getWindow()->setCursor(UI_CURSOR_ARROW); #endif - support.append("OpenGL Version: "); + support.append(getString("OpenGLVersion") + " "); support.append( (const char*) glGetString(GL_VERSION) ); support.append("\n"); support.append("\n"); - support.append("libcurl Version: "); + support.append(getString("LibCurlVersion") + " "); support.append( LLCurl::getVersionString() ); support.append("\n"); - support.append("J2C Decoder Version: "); + support.append(getString("J2CDecoderVersion") + " "); support.append( LLImageJ2C::getEngineInfo() ); support.append("\n"); - support.append("Audio Driver Version: "); + support.append(getString("AudioDriverVersion") + " "); bool want_fullname = true; - support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : "(none)" ); + support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : getString("none") ); support.append("\n"); - LLMediaManager *mgr = LLMediaManager::getInstance(); - if (mgr) - { - LLMediaBase *media_source = mgr->createSourceFromMimeType("http", "text/html"); - if (media_source) - { - support.append("LLMozLib Version: "); - support.append(media_source->getVersion()); - support.append("\n"); - mgr->destroySource(media_source); - } - } + // TODO: Implement media plugin version query + + support.append(getString("LLQtWebkitVersion") + " "); + support.append("\n"); if (gPacketsIn > 0) { - std::string packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", - LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(), - F32(gPacketsIn), - 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); - support.append(packet_loss); - support.append("\n"); + args["[LOST]"] = llformat ("%.0f", LLViewerStats::getInstance()->mPacketsLostStat.getCurrent()); + args["[IN]"] = llformat ("%.0f", F32(gPacketsIn)); + args["[PCT]"] = llformat ("%.1f", 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); + support.append(getString ("PacketsLost", args) + "\n"); } - support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); + support_widget->appendColoredText(support, FALSE, FALSE, LLUIColorTable::instance().getColor("TextFgReadOnlyColor")); // Fix views support_widget->setCursorPos(0); support_widget->setEnabled(FALSE); - support_widget->setTakesFocus(TRUE); - support_widget->setHandleEditKeysDirectly(TRUE); credits_widget->setCursorPos(0); credits_widget->setEnabled(FALSE); - credits_widget->setTakesFocus(TRUE); - credits_widget->setHandleEditKeysDirectly(TRUE); - - center(); - sInstance = this; + return TRUE; } -// Destroys the object -LLFloaterAbout::~LLFloaterAbout() -{ - sInstance = NULL; -} -// static -void LLFloaterAbout::show(void*) -{ - if (!sInstance) - { - sInstance = new LLFloaterAbout(); - } + static std::string get_viewer_release_notes_url() + { + std::ostringstream version; + version << LL_VERSION_MAJOR << "." + << LL_VERSION_MINOR << "." + << LL_VERSION_PATCH << "." + << LL_VERSION_BUILD; - sInstance->open(); /*Flawfinder: ignore*/ -} + LLSD query; + query["channel"] = gSavedSettings.getString("VersionChannelName"); + query["version"] = version.str(); + std::ostringstream url; + url << LLTrans::getString("RELEASE_NOTES_BASE_URL") << LLURI::mapToQueryString(query); -static std::string get_viewer_release_notes_url() -{ - std::ostringstream version; - version << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; - - LLSD query; - query["channel"] = gSavedSettings.getString("VersionChannelName"); - query["version"] = version.str(); - - std::ostringstream url; - url << RELEASE_NOTES_BASE_URL << LLURI::mapToQueryString(query); - - return url.str(); -} + return url.str(); + } |