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 "lluictrlfactory.h"
00050 #include "llappviewer.h" 
00051 #include "llglheaders.h"
00052 #include "llmediamanager.h"
00053 
00054 
00055 extern LLCPUInfo gSysCPU;
00056 extern LLMemoryInfo gSysMemory;
00057 extern U32 gPacketsIn;
00058 
00062 
00063 LLFloaterAbout* LLFloaterAbout::sInstance = NULL;
00064 
00068 
00069 // Default constructor
00070 LLFloaterAbout::LLFloaterAbout() 
00071 :       LLFloater("floater_about", "FloaterAboutRect", "")
00072 {
00073         LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml");
00074 
00075         // Support for changing product name.
00076         LLString title("About ");
00077         title += LLAppViewer::instance()->getSecondLifeTitle();
00078         setTitle(title);
00079 
00080         LLString support;
00081 
00082         // Version string
00083         LLString version = LLAppViewer::instance()->getSecondLifeTitle()
00084                 + llformat(" %d.%d.%d (%d) %s %s (%s)",
00085                                    LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD,
00086                                    __DATE__, __TIME__,
00087                                    gSavedSettings.getString("VersionChannelName").c_str());
00088         support.append(version);
00089         support.append("\n\n");
00090 
00091         // Position
00092         LLViewerRegion* region = gAgent.getRegion();
00093         if (region)
00094         {
00095                 const LLVector3d &pos = gAgent.getPositionGlobal();
00096                 LLUIString pos_text = getUIString("you_are_at");
00097                 pos_text.setArg("[POSITION]",
00098                                                 llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
00099                 support.append(pos_text);
00100 
00101                 LLString region_text = llformat("in %s located at ",
00102                                 gAgent.getRegion()->getName().c_str());
00103                 support.append(region_text);
00104 
00105                 char buffer[MAX_STRING];                /*Flawfinder: ignore*/
00106                 gAgent.getRegion()->getHost().getHostName(buffer, MAX_STRING);
00107                 support.append(buffer);
00108                 support.append(" (");
00109                 gAgent.getRegion()->getHost().getString(buffer, MAX_STRING);
00110                 support.append(buffer);
00111                 support.append(")\n");
00112                 support.append(gLastVersionChannel);
00113                 support.append("\n\n");
00114         }
00115 
00116         //*NOTE: Do not translate text like GPU, Graphics Card, etc -
00117         //  Most PC users that know what these mean will be used to the english versions,
00118         //  and this info sometimes gets sent to support
00119         
00120         // CPU
00121         support.append("CPU: ");
00122         support.append( gSysCPU.getCPUString() );
00123         support.append("\n");
00124 
00125         U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024;
00126         // Moved hack adjustment to Windows memory size into llsys.cpp
00127 
00128         LLString mem_text = llformat("Memory: %u MB\n", memory );
00129         support.append(mem_text);
00130 
00131         support.append("OS Version: ");
00132         support.append( LLAppViewer::instance()->getOSInfo().getOSString().c_str() );
00133         support.append("\n");
00134 
00135         support.append("Graphics Card Vendor: ");
00136         support.append( (const char*) glGetString(GL_VENDOR) );
00137         support.append("\n");
00138 
00139         support.append("Graphics Card: ");
00140         support.append( (const char*) glGetString(GL_RENDERER) );
00141         support.append("\n");
00142 
00143         support.append("OpenGL Version: ");
00144         support.append( (const char*) glGetString(GL_VERSION) );
00145         support.append("\n");
00146 
00147         LLMediaManager *mgr = LLMediaManager::getInstance();
00148         if (mgr)
00149         {
00150                 LLMediaBase *media_source = mgr->createSourceFromMimeType("http", "text/html");
00151                 if (media_source)
00152                 {
00153                         support.append("LLMozLib Version: ");
00154                         support.append((const char*) media_source->getVersion().c_str());
00155                         support.append("\n");
00156                         mgr->destroySource(media_source);
00157                 }
00158         }
00159 
00160         if (gPacketsIn > 0)
00161         {
00162                 LLString packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", 
00163                         LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(),
00164                         F32(gPacketsIn),
00165                         100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) );
00166                 support.append(packet_loss);
00167                 support.append("\n");
00168         }
00169 
00170         // Fix views
00171         childDisable("credits_editor");
00172 
00173         LLTextEditor * support_widget = getChild<LLTextEditor>("support_editor", true);
00174         if (support_widget)
00175         {
00176                 support_widget->setEnabled( FALSE );
00177                 support_widget->setTakesFocus( TRUE );
00178                 support_widget->setText( support );
00179                 support_widget->setHandleEditKeysDirectly( TRUE );
00180         }
00181 
00182         center();
00183 
00184         sInstance = this;
00185 }
00186 
00187 // Destroys the object
00188 LLFloaterAbout::~LLFloaterAbout()
00189 {
00190         sInstance = NULL;
00191 }
00192 
00193 // static
00194 void LLFloaterAbout::show(void*)
00195 {
00196         if (!sInstance)
00197         {
00198                 sInstance = new LLFloaterAbout();
00199         }
00200 
00201         sInstance->open();       /*Flawfinder: ignore*/
00202 }

Generated on Fri May 16 08:33:22 2008 for SecondLife by  doxygen 1.5.5