Annotation of /trunk/indra/newview/llfloaterabout.cpp
Parent Directory
|
Revision Log
Revision 138 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llfloaterabout.cpp | ||
| 3 : | * @author James Cook | ||
| 4 : | * @brief The about box from Help->About | ||
| 5 : | * | ||
| 6 : | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
| 7 : | * | ||
| 8 : | mjm | 137 | * Copyright (c) 2001-2010, Linden Research, Inc. |
| 9 : | mjm | 135 | * |
| 10 : | * Second Life Viewer Source Code | ||
| 11 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 12 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 13 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 14 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 15 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 16 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 17 : | * | ||
| 18 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 19 : | * it is applied to this Source Code. View the full text of the exception | ||
| 20 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 21 : | * online at | ||
| 22 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 23 : | * | ||
| 24 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 25 : | * that you have read and understood your obligations described above, | ||
| 26 : | * and agree to abide by those obligations. | ||
| 27 : | * | ||
| 28 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 29 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 30 : | * COMPLETENESS OR PERFORMANCE. | ||
| 31 : | * $/LicenseInfo$ | ||
| 32 : | */ | ||
| 33 : | |||
| 34 : | #include "llviewerprecompiledheaders.h" | ||
| 35 : | |||
| 36 : | #include "llfloaterabout.h" | ||
| 37 : | |||
| 38 : | #include "llsys.h" | ||
| 39 : | #include "llgl.h" | ||
| 40 : | #include "llui.h" // for tr() | ||
| 41 : | #include "v3dmath.h" | ||
| 42 : | |||
| 43 : | #include "llcurl.h" | ||
| 44 : | #include "llimagej2c.h" | ||
| 45 : | #include "audioengine.h" | ||
| 46 : | |||
| 47 : | #include "llviewertexteditor.h" | ||
| 48 : | #include "llviewercontrol.h" | ||
| 49 : | #include "llagent.h" | ||
| 50 : | #include "llviewerstats.h" | ||
| 51 : | #include "llviewerregion.h" | ||
| 52 : | #include "llversionviewer.h" | ||
| 53 : | #include "llviewerbuild.h" | ||
| 54 : | #include "lluictrlfactory.h" | ||
| 55 : | #include "lluri.h" | ||
| 56 : | #include "llweb.h" | ||
| 57 : | #include "llsecondlifeurls.h" | ||
| 58 : | #include "lltrans.h" | ||
| 59 : | #include "llappviewer.h" | ||
| 60 : | #include "llglheaders.h" | ||
| 61 : | #include "llmediamanager.h" | ||
| 62 : | #include "llwindow.h" | ||
| 63 : | |||
| 64 : | #if LL_WINDOWS | ||
| 65 : | #include "lldxhardware.h" | ||
| 66 : | #endif | ||
| 67 : | |||
| 68 : | #include <hippoGridManager.h> | ||
| 69 : | |||
| 70 : | extern LLCPUInfo gSysCPU; | ||
| 71 : | extern LLMemoryInfo gSysMemory; | ||
| 72 : | extern U32 gPacketsIn; | ||
| 73 : | |||
| 74 : | ///---------------------------------------------------------------------------- | ||
| 75 : | /// Local function declarations, constants, enums, and typedefs | ||
| 76 : | ///---------------------------------------------------------------------------- | ||
| 77 : | |||
| 78 : | LLFloaterAbout* LLFloaterAbout::sInstance = NULL; | ||
| 79 : | |||
| 80 : | |||
| 81 : | ///---------------------------------------------------------------------------- | ||
| 82 : | /// Class LLFloaterAbout | ||
| 83 : | ///---------------------------------------------------------------------------- | ||
| 84 : | |||
| 85 : | // Default constructor | ||
| 86 : | LLFloaterAbout::LLFloaterAbout() | ||
| 87 : | : LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null) | ||
| 88 : | { | ||
| 89 : | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); | ||
| 90 : | |||
| 91 : | // Support for changing product name. | ||
| 92 : | std::string title("About "); | ||
| 93 : | title += HIPPO_PRODUCT; | ||
| 94 : | setTitle(title); | ||
| 95 : | |||
| 96 : | LLViewerTextEditor *support_widget = | ||
| 97 : | getChild<LLViewerTextEditor>("support_editor", true); | ||
| 98 : | |||
| 99 : | LLViewerTextEditor *credits_widget = | ||
| 100 : | getChild<LLViewerTextEditor>("credits_editor", true); | ||
| 101 : | |||
| 102 : | |||
| 103 : | if (!support_widget || !credits_widget) | ||
| 104 : | { | ||
| 105 : | return; | ||
| 106 : | } | ||
| 107 : | |||
| 108 : | // For some reason, adding style doesn't work unless this is true. | ||
| 109 : | support_widget->setParseHTML(TRUE); | ||
| 110 : | |||
| 111 : | // Text styles for release notes hyperlinks | ||
| 112 : | LLStyleSP viewer_link_style(new LLStyle); | ||
| 113 : | viewer_link_style->setVisible(true); | ||
| 114 : | viewer_link_style->setFontName(LLStringUtil::null); | ||
| 115 : | viewer_link_style->setLinkHREF("http://mjm-labs.com/viewer/"); | ||
| 116 : | viewer_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); | ||
| 117 : | |||
| 118 : | // Version string | ||
| 119 : | std::string version = HIPPO_PRODUCT | ||
| 120 : | + llformat(" %d.%d.%d (%s) %s %s (%s)\n", | ||
| 121 : | HIPPO_VERSION_MAJOR, HIPPO_VERSION_MINOR, HIPPO_VERSION_PATCH, HIPPO_VERSION_BASE, | ||
| 122 : | __DATE__, __TIME__, | ||
| 123 : | HIPPO_CHANNEL_CSTR); | ||
| 124 : | //MK | ||
| 125 : | if (gRRenabled) | ||
| 126 : | { | ||
| 127 : | mjm | 138 | version += gAgent.mRRInterface.getVersion2 () + "\n"; |
| 128 : | mjm | 135 | } |
| 129 : | //mk | ||
| 130 : | support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); | ||
| 131 : | support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style); | ||
| 132 : | |||
| 133 : | std::string support; | ||
| 134 : | support.append("\n\n"); | ||
| 135 : | |||
| 136 : | support += "Grid: " + gHippoGridManager->getConnectedGrid()->getGridName() | ||
| 137 : | + " (" + gHippoGridManager->getConnectedGrid()->getGridNick() + ")\n\n"; | ||
| 138 : | |||
| 139 : | #if LL_MSVC | ||
| 140 : | support.append(llformat("Built with MSVC version %d\n\n", _MSC_VER)); | ||
| 141 : | #endif | ||
| 142 : | |||
| 143 : | #if LL_GNUC | ||
| 144 : | support.append(llformat("Built with GCC version %d\n\n", GCC_VERSION)); | ||
| 145 : | #endif | ||
| 146 : | |||
| 147 : | // Position | ||
| 148 : | LLViewerRegion* region = gAgent.getRegion(); | ||
| 149 : | if (region) | ||
| 150 : | { | ||
| 151 : | std::string server_release_notes = region->getCapability("ServerReleaseNotes"); | ||
| 152 : | LLStyleSP server_link_style(new LLStyle); | ||
| 153 : | if (!server_release_notes.empty()) { | ||
| 154 : | server_link_style->setVisible(true); | ||
| 155 : | server_link_style->setFontName(LLStringUtil::null); | ||
| 156 : | server_link_style->setLinkHREF(server_release_notes); | ||
| 157 : | server_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); | ||
| 158 : | } | ||
| 159 : | |||
| 160 : | const LLVector3d &pos = gAgent.getPositionGlobal(); | ||
| 161 : | LLUIString pos_text = getString("you_are_at"); | ||
| 162 : | pos_text.setArg("[POSITION]", | ||
| 163 : | llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ])); | ||
| 164 : | //MK | ||
| 165 : | if (gRRenabled && gAgent.mRRInterface.mContainsShowloc) | ||
| 166 : | { | ||
| 167 : | pos_text = "(Position hidden)\n"; | ||
| 168 : | } | ||
| 169 : | //mk | ||
| 170 : | support.append(pos_text); | ||
| 171 : | |||
| 172 : | std::string region_text = llformat("in %s located at ", | ||
| 173 : | gAgent.getRegion()->getName().c_str()); | ||
| 174 : | //MK | ||
| 175 : | if (gRRenabled && gAgent.mRRInterface.mContainsShowloc) | ||
| 176 : | { | ||
| 177 : | region_text = "(Region hidden)\n"; | ||
| 178 : | } | ||
| 179 : | //mk | ||
| 180 : | support.append(region_text); | ||
| 181 : | |||
| 182 : | //MK | ||
| 183 : | if (!gRRenabled || !gAgent.mRRInterface.mContainsShowloc) | ||
| 184 : | { | ||
| 185 : | //mk | ||
| 186 : | std::string buffer; | ||
| 187 : | buffer = gAgent.getRegion()->getHost().getHostName(); | ||
| 188 : | support.append(buffer); | ||
| 189 : | support.append(" ("); | ||
| 190 : | buffer = gAgent.getRegion()->getHost().getString(); | ||
| 191 : | support.append(buffer); | ||
| 192 : | support.append(")\n"); | ||
| 193 : | support.append(gLastVersionChannel); | ||
| 194 : | support.append("\n"); | ||
| 195 : | //MK | ||
| 196 : | } | ||
| 197 : | else | ||
| 198 : | { | ||
| 199 : | support.append ("(Server info hidden)\n\n"); | ||
| 200 : | } | ||
| 201 : | //mk | ||
| 202 : | support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); | ||
| 203 : | support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style); | ||
| 204 : | |||
| 205 : | support = "\n\n"; | ||
| 206 : | } | ||
| 207 : | |||
| 208 : | // *NOTE: Do not translate text like GPU, Graphics Card, etc - | ||
| 209 : | // Most PC users that know what these mean will be used to the english versions, | ||
| 210 : | // and this info sometimes gets sent to support | ||
| 211 : | |||
| 212 : | // CPU | ||
| 213 : | support.append("CPU: "); | ||
| 214 : | support.append( gSysCPU.getCPUString() ); | ||
| 215 : | support.append("\n"); | ||
| 216 : | |||
| 217 : | U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024; | ||
| 218 : | // Moved hack adjustment to Windows memory size into llsys.cpp | ||
| 219 : | |||
| 220 : | std::string mem_text = llformat("Memory: %u MB\n", memory ); | ||
| 221 : | support.append(mem_text); | ||
| 222 : | |||
| 223 : | support.append("OS Version: "); | ||
| 224 : | support.append( LLAppViewer::instance()->getOSInfo().getOSString() ); | ||
| 225 : | support.append("\n"); | ||
| 226 : | |||
| 227 : | support.append("Graphics Card Vendor: "); | ||
| 228 : | support.append( (const char*) glGetString(GL_VENDOR) ); | ||
| 229 : | support.append("\n"); | ||
| 230 : | |||
| 231 : | support.append("Graphics Card: "); | ||
| 232 : | support.append( (const char*) glGetString(GL_RENDERER) ); | ||
| 233 : | support.append("\n"); | ||
| 234 : | |||
| 235 : | #if LL_WINDOWS | ||
| 236 : | getWindow()->incBusyCount(); | ||
| 237 : | getWindow()->setCursor(UI_CURSOR_ARROW); | ||
| 238 : | support.append("Windows Graphics Driver Version: "); | ||
| 239 : | LLSD driver_info = gDXHardware.getDisplayInfo(); | ||
| 240 : | if (driver_info.has("DriverVersion")) | ||
| 241 : | { | ||
| 242 : | support.append(driver_info["DriverVersion"]); | ||
| 243 : | } | ||
| 244 : | support.append("\n"); | ||
| 245 : | getWindow()->decBusyCount(); | ||
| 246 : | getWindow()->setCursor(UI_CURSOR_ARROW); | ||
| 247 : | #endif | ||
| 248 : | |||
| 249 : | support.append("OpenGL Version: "); | ||
| 250 : | support.append( (const char*) glGetString(GL_VERSION) ); | ||
| 251 : | support.append("\n"); | ||
| 252 : | |||
| 253 : | support.append("\n"); | ||
| 254 : | |||
| 255 : | support.append("libcurl Version: "); | ||
| 256 : | support.append( LLCurl::getVersionString() ); | ||
| 257 : | support.append("\n"); | ||
| 258 : | |||
| 259 : | support.append("J2C Decoder Version: "); | ||
| 260 : | support.append( LLImageJ2C::getEngineInfo() ); | ||
| 261 : | support.append("\n"); | ||
| 262 : | |||
| 263 : | support.append("Audio Driver Version: "); | ||
| 264 : | bool want_fullname = true; | ||
| 265 : | support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : "(none)" ); | ||
| 266 : | support.append("\n"); | ||
| 267 : | |||
| 268 : | LLMediaManager *mgr = LLMediaManager::getInstance(); | ||
| 269 : | if (mgr) | ||
| 270 : | { | ||
| 271 : | LLMediaBase *media_source = mgr->createSourceFromMimeType("http", "text/html"); | ||
| 272 : | if (media_source) | ||
| 273 : | { | ||
| 274 : | support.append("LLMozLib Version: "); | ||
| 275 : | support.append(media_source->getVersion()); | ||
| 276 : | support.append("\n"); | ||
| 277 : | mgr->destroySource(media_source); | ||
| 278 : | } | ||
| 279 : | } | ||
| 280 : | |||
| 281 : | if (gPacketsIn > 0) | ||
| 282 : | { | ||
| 283 : | std::string packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", | ||
| 284 : | LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(), | ||
| 285 : | F32(gPacketsIn), | ||
| 286 : | 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); | ||
| 287 : | support.append(packet_loss); | ||
| 288 : | support.append("\n"); | ||
| 289 : | } | ||
| 290 : | |||
| 291 : | support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); | ||
| 292 : | |||
| 293 : | // Fix views | ||
| 294 : | support_widget->setCursorPos(0); | ||
| 295 : | support_widget->setEnabled(FALSE); | ||
| 296 : | support_widget->setTakesFocus(TRUE); | ||
| 297 : | support_widget->setHandleEditKeysDirectly(TRUE); | ||
| 298 : | |||
| 299 : | credits_widget->setCursorPos(0); | ||
| 300 : | credits_widget->setEnabled(FALSE); | ||
| 301 : | credits_widget->setTakesFocus(TRUE); | ||
| 302 : | credits_widget->setHandleEditKeysDirectly(TRUE); | ||
| 303 : | |||
| 304 : | center(); | ||
| 305 : | |||
| 306 : | sInstance = this; | ||
| 307 : | } | ||
| 308 : | |||
| 309 : | // Destroys the object | ||
| 310 : | LLFloaterAbout::~LLFloaterAbout() | ||
| 311 : | { | ||
| 312 : | sInstance = NULL; | ||
| 313 : | } | ||
| 314 : | |||
| 315 : | // static | ||
| 316 : | void LLFloaterAbout::show(void*) | ||
| 317 : | { | ||
| 318 : | if (!sInstance) | ||
| 319 : | { | ||
| 320 : | sInstance = new LLFloaterAbout(); | ||
| 321 : | } | ||
| 322 : | |||
| 323 : | sInstance->open(); /*Flawfinder: ignore*/ | ||
| 324 : | } | ||
| 325 : |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

