llfloaterabout.cpp

Go to the documentation of this file.
00001 
00033 #include "llviewerprecompiledheaders.h"
00034 
00035 #include "llfloaterabout.h"
00036 
00037 #include "llsys.h"
00038 #include "llgl.h"
00039 #include "llui.h"       // for tr()
00040 #include "v3dmath.h"
00041 
00042 #include "llviewertexteditor.h"
00043 #include "llviewercontrol.h"
00044 #include "llagent.h"
00045 #include "llviewerstats.h"
00046 #include "llviewerregion.h"
00047 #include "llversionviewer.h"
00048 #include "llviewerbuild.h"
00049 #include "llvieweruictrlfactory.h"
00050 #include "viewer.h"     // for gViewerDigest
00051 
00052 #if LL_LIBXUL_ENABLED
00053 #include "llmozlib.h"
00054 #endif // LL_LIBXUL_ENABLED
00055 
00056 #include "llglheaders.h"
00057 
00058 extern LLCPUInfo gSysCPU;
00059 extern LLMemoryInfo gSysMemory;
00060 extern LLOSInfo gSysOS;
00061 extern U32 gPacketsIn;
00062 
00066 
00067 LLFloaterAbout* LLFloaterAbout::sInstance = NULL;
00068 
00072 
00073 // Default constructor
00074 LLFloaterAbout::LLFloaterAbout() 
00075 :       LLFloater("floater_about", "FloaterAboutRect", "")
00076 {
00077         gUICtrlFactory->buildFloater(this, "floater_about.xml");
00078 
00079         // Support for changing product name.
00080         LLString title("About ");
00081         title += gSecondLife;
00082         setTitle(title);
00083 
00084         LLString support;
00085 
00086         // Version string
00087         LLString version = gSecondLife
00088                 + llformat(" %d.%d.%d (%d) Rev. %d %s %s (%s)",
00089                                    LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD, LL_VERSION_REVISION,
00090                                    __DATE__, __TIME__,
00091                                    gChannelName.c_str());
00092         support.append(version);
00093         support.append("\n\n");
00094 
00095         // Position
00096         LLViewerRegion* region = gAgent.getRegion();
00097         if (region)
00098         {
00099                 const LLVector3d &pos = gAgent.getPositionGlobal();
00100                 LLUIString pos_text = childGetText("you_are_at");
00101                 pos_text.setArg("[POSITION]",
00102                                                 llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
00103                 support.append(pos_text);
00104 
00105                 LLString region_text = llformat("in %s located at ",
00106                                 gAgent.getRegion()->getName().c_str());
00107                 support.append(region_text);
00108 
00109                 char buffer[MAX_STRING];                /*Flawfinder: ignore*/
00110                 gAgent.getRegion()->getHost().getHostName(buffer, MAX_STRING);
00111                 support.append(buffer);
00112                 support.append(" (");
00113                 gAgent.getRegion()->getHost().getString(buffer, MAX_STRING);
00114                 support.append(buffer);
00115                 support.append(")\n");
00116                 support.append(gLastVersionChannel);
00117                 support.append("\n\n");
00118         }
00119 
00120         //*NOTE: Do not translate text like GPU, Graphics Card, etc -
00121         //  Most PC users that know what these mean will be used to the english versions,
00122         //  and this info sometimes gets sent to support
00123         
00124         // CPU
00125         support.append("CPU: ");
00126         support.append( gSysCPU.getCPUString() );
00127         support.append("\n");
00128 
00129         U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024;
00130         // Moved hack adjustment to Windows memory size into llsys.cpp
00131 
00132         LLString mem_text = llformat("Memory: %u MB\n", memory );
00133         support.append(mem_text);
00134 
00135         support.append("OS Version: ");
00136         support.append( gSysOS.getOSString().c_str() );
00137         support.append("\n");
00138 
00139         support.append("Graphics Card Vendor: ");
00140         support.append( (const char*) glGetString(GL_VENDOR) );
00141         support.append("\n");
00142 
00143         support.append("Graphics Card: ");
00144         support.append( (const char*) glGetString(GL_RENDERER) );
00145         support.append("\n");
00146 
00147         support.append("OpenGL Version: ");
00148         support.append( (const char*) glGetString(GL_VERSION) );
00149         support.append("\n");
00150 
00151 #if LL_LIBXUL_ENABLED
00152         support.append("LLMozLib Version: ");
00153         support.append( (const char*) LLMozLib::getInstance()->getVersion().c_str() );
00154         support.append("\n");
00155 #endif // LL_LIBXUL_ENABLED
00156 
00157         if (gViewerStats
00158                 && gPacketsIn > 0)
00159         {
00160                 LLString packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", 
00161                         gViewerStats->mPacketsLostStat.getCurrent(),
00162                         F32(gPacketsIn),
00163                         100.f*gViewerStats->mPacketsLostStat.getCurrent() / F32(gPacketsIn) );
00164                 support.append(packet_loss);
00165                 support.append("\n");
00166         }
00167 
00168         // MD5 digest of executable
00169         support.append("Viewer Digest: ");
00170         char viewer_digest_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/
00171         gViewerDigest.toString( viewer_digest_string );
00172         support.append(viewer_digest_string);
00173 
00174         // Fix views
00175         childDisable("credits_editor");
00176 
00177         LLTextEditor * support_widget = (LLTextEditor *) getChildByName("support_editor", true);
00178         if (support_widget)
00179         {
00180                 support_widget->setEnabled( FALSE );
00181                 support_widget->setTakesFocus( TRUE );
00182                 support_widget->setText( support );
00183                 support_widget->setHandleEditKeysDirectly( TRUE );
00184         }
00185 
00186         center();
00187 
00188         sInstance = this;
00189 }
00190 
00191 // Destroys the object
00192 LLFloaterAbout::~LLFloaterAbout()
00193 {
00194         sInstance = NULL;
00195 }
00196 
00197 // static
00198 void LLFloaterAbout::show(void*)
00199 {
00200         if (!sInstance)
00201         {
00202                 sInstance = new LLFloaterAbout();
00203         }
00204 
00205         sInstance->open();       /*Flawfinder: ignore*/
00206 }

Generated on Thu Jul 1 06:08:31 2010 for Second Life Viewer by  doxygen 1.4.7