diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-05-08 07:43:08 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-05-08 07:43:08 +0000 |
commit | a4000c3744e42fcbb638e742f3b63fa31a0dee15 (patch) | |
tree | 7f472c30e65bbfa04ee9bc06631a1af305cc31fb /indra/newview/llappviewer.cpp | |
parent | 6c4cadbb04d633ad7b762058bdeba6e1f650dafd (diff) |
merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 351 |
1 files changed, 154 insertions, 197 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f2154a05dc..a613e6a14b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -30,9 +30,10 @@ * $/LicenseInfo$ */ - #include "llviewerprecompiledheaders.h" + #include "llappviewer.h" + #include "llprimitive.h" #include "llversionviewer.h" @@ -50,13 +51,12 @@ #include "llpumpio.h" #include "llimpanel.h" #include "llmimetypes.h" +#include "llslurl.h" #include "llstartup.h" #include "llfocusmgr.h" #include "llviewerjoystick.h" -#include "llfloaterjoystick.h" #include "llares.h" #include "llcurl.h" -#include "llfloatersnapshot.h" #include "llviewerwindow.h" #include "llviewerdisplay.h" #include "llviewermedia.h" @@ -68,10 +68,15 @@ #include "llurlhistory.h" #include "llfirstuse.h" #include "llrender.h" - +#include "llteleporthistory.h" +#include "lllocationhistory.h" #include "llweb.h" #include "llsecondlifeurls.h" +// Linden library includes +#include "llmemory.h" + +// Third party library includes #include <boost/bind.hpp> #if LL_WINDOWS @@ -104,7 +109,6 @@ #include "llviewermenu.h" #include "llselectmgr.h" #include "lltrans.h" -#include "lluitrans.h" #include "lltracker.h" #include "llviewerparcelmgr.h" #include "llworldmapview.h" @@ -115,9 +119,7 @@ #include "lldebugview.h" #include "llconsole.h" #include "llcontainerview.h" -#include "llfloaterstats.h" #include "llhoverview.h" -#include "llfloatermemleak.h" #include "llsdserialize.h" @@ -138,12 +140,16 @@ #include "llvoavatar.h" #include "llfolderview.h" #include "lltoolbar.h" -#include "llframestats.h" #include "llagentpilot.h" #include "llsrv.h" #include "llvovolume.h" #include "llflexibleobject.h" #include "llvosurfacepatch.h" +#include "llviewerfloaterreg.h" +#include "llcommandlineparser.h" +#include "llfloatermemleak.h" +#include "llfloatersnapshot.h" +#include "llinventoryview.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -160,11 +166,6 @@ #include "llviewerthrottle.h" #include "llparcel.h" - -#include "llinventoryview.h" - -#include "llcommandlineparser.h" - // *FIX: These extern globals should be cleaned up. // The globals either represent state/config/resource-storage of either // this app, or another 'component' of the viewer. App globals should be @@ -180,10 +181,6 @@ ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor // -#if LL_WINDOWS && LL_LCD_COMPILE - #include "lllcd.h" -#endif - //---------------------------------------------------------------------------- // viewer.cpp - these are only used in viewer, should be easily moved. @@ -284,11 +281,22 @@ static std::string gLaunchFileOnQuit; const char* const VIEWER_WINDOW_CLASSNAME = "Second Life"; //---------------------------------------------------------------------------- + +// List of entries from strings.xml to always replace +static std::set<std::string> default_trans_args; +void init_default_trans_args() +{ + default_trans_args.insert("SECOND_LIFE"); // World + default_trans_args.insert("SECOND_LIFE_VIEWER"); + default_trans_args.insert("SECOND_LIFE_GRID"); + default_trans_args.insert("SECOND_LIFE_SUPPORT"); +} + +//---------------------------------------------------------------------------- // File scope definitons const char *VFS_DATA_FILE_BASE = "data.db2.x."; const char *VFS_INDEX_FILE_BASE = "index.db2.x."; -static std::string gSecondLife; static std::string gWindowTitle; std::string gLoginPage; @@ -387,7 +395,6 @@ static void settings_to_globals() LLSelectMgr::sRenderHiddenSelections = gSavedSettings.getBOOL("RenderHiddenSelections"); LLSelectMgr::sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius"); - gFrameStats.setTrackStats(gSavedSettings.getBOOL("StatsSessionTrackFrameStats")); gAgentPilot.mNumRuns = gSavedSettings.getS32("StatsNumRuns"); gAgentPilot.mQuitAfterRuns = gSavedSettings.getBOOL("StatsQuitAfterRuns"); gAgent.mHideGroupTitle = gSavedSettings.getBOOL("RenderHideGroupTitle"); @@ -496,8 +503,6 @@ bool LLAppViewer::sendURLToOtherInstance(const std::string& url) LLAppViewer* LLAppViewer::sInstance = NULL; const std::string LLAppViewer::sGlobalSettingsName = "Global"; -const std::string LLAppViewer::sPerAccountSettingsName = "PerAccount"; -const std::string LLAppViewer::sCrashSettingsName = "CrashSettings"; LLTextureCache* LLAppViewer::sTextureCache = NULL; LLWorkerThread* LLAppViewer::sImageDecodeThread = NULL; @@ -516,7 +521,9 @@ LLAppViewer::LLAppViewer() : mLogoutRequestSent(false), mYieldTime(-1), mMainloopTimeout(NULL), - mAgentRegionLastAlive(false) + mAgentRegionLastAlive(false), + mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", FALSE)), + mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)) { if(NULL != sInstance) { @@ -556,9 +563,12 @@ bool LLAppViewer::init() // // OK to write stuff to logs now, we've now crash reported if necessary // - if (!initConfiguration()) + + init_default_trans_args(); + + if (!initConfiguration()) return false; - + // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. LLCurl::initClass(); @@ -610,35 +620,36 @@ bool LLAppViewer::init() LLError::setPrintLocation(true); } - // Load art UUID information, don't require these strings to be declared in code. - std::string colors_base_filename = gDirUtilp->findSkinnedFilename("colors_base.xml"); - LL_DEBUGS("InitInfo") << "Loading base colors from " << colors_base_filename << LL_ENDL; - gColors.loadFromFileLegacy(colors_base_filename, FALSE, TYPE_COL4U); - - // Load overrides from user colors file - std::string user_colors_filename = gDirUtilp->findSkinnedFilename("colors.xml"); - LL_DEBUGS("InitInfo") << "Loading user colors from " << user_colors_filename << LL_ENDL; - if (gColors.loadFromFileLegacy(user_colors_filename, FALSE, TYPE_COL4U) == 0) - { - LL_DEBUGS("InitInfo") << "Cannot load user colors from " << user_colors_filename << LL_ENDL; - } - // Widget construction depends on LLUI being initialized - LLUI::initClass(&gSavedSettings, - &gSavedSettings, - &gColors, + LLUI::settings_map_t settings_map; + settings_map["config"] = &gSavedSettings; + settings_map["color"] = &gSavedSkinSettings; + settings_map["ignores"] = &gWarningSettings; + settings_map["floater"] = &gSavedSettings; // *TODO: New settings file + + LLUI::initClass(settings_map, LLUIImageList::getInstance(), ui_audio_callback, &LLUI::sGLScaleFactor); + + // Setup paths and LLTrans after LLUI::initClass has been called + LLUI::setupPaths(); + LLTrans::parseStrings("strings.xml", default_trans_args); + LLWeb::initClass(); // do this after LLUI LLTextEditor::setURLCallbacks(&LLWeb::loadURL, &LLURLDispatcher::dispatchFromTextEditor, &LLURLDispatcher::dispatchFromTextEditor); - LLUICtrlFactory::getInstance()->setupPaths(); // update paths with correct language set ///////////////////////////////////////////////// + + LLToolMgr::getInstance(); // Initialize tool manager if not already instantiated + + LLViewerFloaterReg::registerFloaters(); + + ///////////////////////////////////////////////// // // Load settings files // @@ -690,18 +701,8 @@ bool LLAppViewer::init() if (!initCache()) { std::ostringstream msg; - msg << - gSecondLife << " is unable to access a file that it needs.\n" - "\n" - "This can be because you somehow have multiple copies running, " - "or your system incorrectly thinks a file is open. " - "If this message persists, restart your computer and try again. " - "If it continues to persist, you may need to completely uninstall " << - gSecondLife << " and reinstall it."; - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); + msg << LLTrans::getString("MBUnableToAccessFile"); + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return 1; } @@ -849,7 +850,8 @@ bool LLAppViewer::mainLoop() { LLFastTimer t(LLFastTimer::FTM_FRAME); pingMainloopTimeout("Main:MiscNativeWindowEvents"); - + + if (gViewerWindow) { LLFastTimer t2(LLFastTimer::FTM_MESSAGES); gViewerWindow->mWindow->processMiscNativeEvents(); @@ -857,6 +859,7 @@ bool LLAppViewer::mainLoop() pingMainloopTimeout("Main:GatherInput"); + if (gViewerWindow) { LLFastTimer t2(LLFastTimer::FTM_MESSAGES); if (!restoreErrorTrap()) @@ -935,12 +938,6 @@ bool LLAppViewer::mainLoop() pingMainloopTimeout("Main:Snapshot"); LLFloaterSnapshot::update(); // take snapshots - -#if LL_LCD_COMPILE - // update LCD Screen - pingMainloopTimeout("Main:LCD"); - gLcdScreen->UpdateDisplay(); -#endif } } @@ -962,7 +959,7 @@ bool LLAppViewer::mainLoop() // yield cooperatively when not running as foreground window if ( gNoRender - || !gViewerWindow->mWindow->getVisible() + || (gViewerWindow && !gViewerWindow->mWindow->getVisible()) || !gFocusMgr.getAppHasFocus()) { // Sleep if we're not rendering, or the window is minimized. @@ -978,12 +975,12 @@ bool LLAppViewer::mainLoop() } } - if (gRandomizeFramerate) + if (mRandomizeFramerate) { ms_sleep(rand() % 200); } - if (gPeriodicSlowFrame + if (mPeriodicSlowFrame && (gFrameCount % 10 == 0)) { llinfos << "Periodic slow frame - sleeping 500 ms" << llendl; @@ -1209,22 +1206,26 @@ bool LLAppViewer::cleanup() llinfos << "Shutting down." << llendflush; // Destroy the UI - gViewerWindow->shutdownViews(); + if( gViewerWindow) + gViewerWindow->shutdownViews(); // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); // Shut down OpenGL - gViewerWindow->shutdownGL(); + if( gViewerWindow) + { + gViewerWindow->shutdownGL(); + + // Destroy window, and make sure we're not fullscreen + // This may generate window reshape and activation events. + // Therefore must do this before destroying the message system. + delete gViewerWindow; + gViewerWindow = NULL; + llinfos << "ViewerWindow deleted" << llendflush; + } - // Destroy window, and make sure we're not fullscreen - // This may generate window reshape and activation events. - // Therefore must do this before destroying the message system. - delete gViewerWindow; - gViewerWindow = NULL; - llinfos << "ViewerWindow deleted" << llendflush; - // viewer UI relies on keyboard so keep it aound until viewer UI isa gone delete gKeyboard; gKeyboard = NULL; @@ -1244,12 +1245,6 @@ bool LLAppViewer::cleanup() // gDXHardware.cleanup(); //#endif // LL_WINDOWS -#if LL_LCD_COMPILE - // shut down the LCD window on a logitech keyboard, if there is one - delete gLcdScreen; - gLcdScreen = NULL; -#endif - LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager(); if (!volume_manager->cleanup()) { @@ -1291,8 +1286,10 @@ bool LLAppViewer::cleanup() // Must do this after all panels have been deleted because panels that have persistent rects // save their rects on delete. - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + + //*FIX: don't overwrite user color tweaks with *all* colors + gSavedSkinSettings.saveToFile(gSavedSettings.getString("SkinningSettingsFile"), TRUE); // PerAccountSettingsFile should be empty if no use has been logged on. // *FIX:Mani This should get really saved in a "logoff" mode. gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); @@ -1302,8 +1299,11 @@ bool LLAppViewer::cleanup() // save all settings, even if equals defaults gCrashSettings.saveToFile(crash_settings_filename, FALSE); + std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings")); + gWarningSettings.saveToFile(warnings_settings_filename, TRUE); + gSavedSettings.cleanup(); - gColors.cleanup(); + gSavedSkinSettings.cleanup(); gCrashSettings.cleanup(); // Save URL history file @@ -1464,7 +1464,7 @@ bool LLAppViewer::initThreads() void errorCallback(const std::string &error_string) { #ifndef LL_RELEASE_FOR_DOWNLOAD - OSMessageBox(error_string, "Fatal Error", OSMB_OK); + OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK); #endif //Set the ErrorActivated global so we know to create a marker file @@ -1532,7 +1532,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, llinfos << "Attempting to load settings for the group " << settings_group << " - from location " << location_key << llendl; - if(gSettings.find(settings_group) == gSettings.end()) + if(!LLControlGroup::getInstance(settings_group)) { llwarns << "No matching settings group for name " << settings_group << llendl; continue; @@ -1546,10 +1546,10 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string custom_name_setting = file.get("NameFromSetting"); // *NOTE: Regardless of the group currently being lodaed, // this setting is always read from the Global settings. - if(gSettings[sGlobalSettingsName]->controlExists(custom_name_setting)) + if(LLControlGroup::getInstance(sGlobalSettingsName)->controlExists(custom_name_setting)) { std::string file_name = - gSettings[sGlobalSettingsName]->getString(custom_name_setting); + LLControlGroup::getInstance(sGlobalSettingsName)->getString(custom_name_setting); full_settings_path = file_name; } } @@ -1566,7 +1566,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, requirement = file.get("Requirement").asInteger(); } - if(!gSettings[settings_group]->loadFromFile(full_settings_path, set_defaults)) + if(!LLControlGroup::getInstance(settings_group)->loadFromFile(full_settings_path, set_defaults)) { if(requirement == 1) { @@ -1606,17 +1606,22 @@ std::string LLAppViewer::getSettingsFilename(const std::string& location_key, return std::string(); } +void LLAppViewer::loadColorSettings() +{ + gSavedSkinSettings.cleanup(); + + loadSettingsFromDirectory("DefaultSkin"); + loadSettingsFromDirectory("CurrentSkin", true); + loadSettingsFromDirectory("UserSkin"); + +} + bool LLAppViewer::initConfiguration() { - //Set up internal pointers - gSettings[sGlobalSettingsName] = &gSavedSettings; - gSettings[sPerAccountSettingsName] = &gSavedPerAccountSettings; - gSettings[sCrashSettingsName] = &gCrashSettings; - //Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); - LLControlGroup settings_control; - llinfos << "Loading settings file list" << settings_file_list << llendl; + LLControlGroup settings_control("SettingsFiles"); + llinfos << "Loading settings file list " << settings_file_list << llendl; if (0 == settings_control.loadFromFile(settings_file_list)) { llerrs << "Cannot load default configuration file " << settings_file_list << llendl; @@ -1639,21 +1644,22 @@ bool LLAppViewer::initConfiguration() if(!loadSettingsFromDirectory("Default", set_defaults)) { std::ostringstream msg; - msg << "Second Life could not load its default settings file. \n" - << "The installation may be corrupted. \n"; - - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); - + msg << "Unable to load default settings file. The installation may be corrupted."; + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return false; } - - // - set procedural settings + + LLUI::setupPaths(); // setup paths for LLTrans based on settings files only + LLTrans::parseStrings("strings.xml", default_trans_args); + + // - set procedural settings + // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet gSavedSettings.setString("ClientSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); + gSavedSettings.setString("SkinningSettingsFile", + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("UserSkin", "Skinning"))); + gSavedSettings.setString("VersionChannelName", LL_CHANNEL); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -1673,7 +1679,7 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setBOOL("WatchdogEnabled", FALSE); #endif - gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _1)); + gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _2)); // These are warnings that appear on the first experience of that condition. // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse @@ -1707,22 +1713,13 @@ bool LLAppViewer::initConfiguration() if(!initParseCommandLine(clp)) { - llwarns - << "Error parsing command line options. Command Line options ignored." - << llendl; - + llwarns << "Error parsing command line options. Command Line options ignored." << llendl; + llinfos << "Command line usage:\n" << clp << llendl; std::ostringstream msg; - msg << "Second Life found an error parsing the command line. \n" - << "Please see: http://wiki.secondlife.com/wiki/Client_parameters \n" - << "Error: " << clp.getErrorMessage(); - - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); - + msg << LLTrans::getString("MBCmdLineError") << clp.getErrorMessage(); + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return false; } @@ -1742,7 +1739,6 @@ bool LLAppViewer::initConfiguration() // - load overrides from user_settings loadSettingsFromDirectory("User"); - // - apply command line settings clp.notify(); @@ -1756,7 +1752,7 @@ bool LLAppViewer::initConfiguration() if(clp.hasOption("help")) { std::ostringstream msg; - msg << "Command line usage:\n" << clp; + msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp; llinfos << msg.str() << llendl; OSMessageBox( @@ -1767,36 +1763,6 @@ bool LLAppViewer::initConfiguration() return false; } - ////////////////////////// - // Apply settings... - if(clp.hasOption("setdefault")) - { - //const LLCommandLineParser::token_vector_t& setdefault = clp.getOption("setdefault"); - //if(0x1 & setdefault.size()) - //{ - // llwarns << "Invalid '--setdefault' parameter count." << llendl; - //} - //else - //{ - // LLCommandLineParser::token_vector_t::const_iterator itr = setdefault.begin(); - // for(; itr != setdefault.end(); ++itr) - // { - // const std::string& name = *itr; - // const std::string& value = *(++itr); - // LLControlVariable* c = gSettings[sGlobalSettingsName]->getControl(name); - // if(c) - // { - // c->setDefault(value); - // } - // else - // { - // llwarns << "'--setdefault' specified with unknown setting: '" - // << name << "'." << llendl; - // } - // } - //} - } - if(clp.hasOption("set")) { const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); @@ -1811,7 +1777,7 @@ bool LLAppViewer::initConfiguration() { const std::string& name = *itr; const std::string& value = *(++itr); - LLControlVariable* c = gSettings[sGlobalSettingsName]->getControl(name); + LLControlVariable* c = LLControlGroup::getInstance(sGlobalSettingsName)->getControl(name); if(c) { c->setValue(value, false); @@ -1853,7 +1819,7 @@ bool LLAppViewer::initConfiguration() if(clp.hasOption("url")) { std::string slurl = clp.getOption("url")[0]; - if (LLURLDispatcher::isSLURLCommand(slurl)) + if (LLSLURL::isSLURLCommand(slurl)) { LLStartUp::sSLURLCommand = slurl; } @@ -1865,9 +1831,9 @@ bool LLAppViewer::initConfiguration() else if(clp.hasOption("slurl")) { std::string slurl = clp.getOption("slurl")[0]; - if(LLURLDispatcher::isSLURL(slurl)) + if(LLSLURL::isSLURL(slurl)) { - if (LLURLDispatcher::isSLURLCommand(slurl)) + if (LLSLURL::isSLURLCommand(slurl)) { LLStartUp::sSLURLCommand = slurl; } @@ -1882,12 +1848,12 @@ bool LLAppViewer::initConfiguration() if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) { gDirUtilp->setSkinFolder(skinfolder->getValue().asString()); + + gSavedSettings.setString("SkinningSettingsFile", + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("UserSkin", "Skinning"))); } mYieldTime = gSavedSettings.getS32("YieldTime"); - - // XUI:translate - gSecondLife = "Second Life"; // Read skin/branding settings if specified. //if (! gDirUtilp->getSkinDir().empty() ) @@ -1904,7 +1870,7 @@ bool LLAppViewer::initConfiguration() #if LL_DARWIN // Initialize apple menubar and various callbacks - init_apple_menu(gSecondLife.c_str()); + init_apple_menu(LLTrans::getString("SECOND_LIFE_VIEWER").c_str()); #if __ppc__ // If the CPU doesn't have Altivec (i.e. it's not at least a G4), don't go any further. @@ -1912,7 +1878,7 @@ bool LLAppViewer::initConfiguration() if(!gSysCPU.hasAltivec()) { std::ostringstream msg; - msg << gSecondLife << " requires a processor with AltiVec (G4 or later)."; + msg << LLTrans::getString("MBRequiresAltiVec"); OSMessageBox( msg.str(), LLStringUtil::null, @@ -1927,7 +1893,7 @@ bool LLAppViewer::initConfiguration() // Display splash screen. Must be after above check for previous // crash as this dialog is always frontmost. std::ostringstream splash_msg; - splash_msg << "Loading " << gSecondLife << "..."; + splash_msg << "Loading " << LLTrans::getString("SECOND_LIFE") << "..."; LLSplashScreen::show(); LLSplashScreen::update(splash_msg.str()); @@ -1943,12 +1909,11 @@ bool LLAppViewer::initConfiguration() // // Set the name of the window // -#if LL_RELEASE_FOR_DOWNLOAD - gWindowTitle = gSecondLife; -#elif LL_DEBUG - gWindowTitle = gSecondLife + std::string(" [DEBUG] ") + gArgs; + gWindowTitle = LLTrans::getString("SECOND_LIFE_VIEWER"); +#if LL_DEBUG + gWindowTitle += std::string(" [DEBUG] ") + gArgs; #else - gWindowTitle = gSecondLife + std::string(" ") + gArgs; + gWindowTitle += std::string(" ") + gArgs; #endif LLStringUtil::truncate(gWindowTitle, 255); @@ -1985,11 +1950,7 @@ bool LLAppViewer::initConfiguration() if (mSecondInstance) { std::ostringstream msg; - msg << - gSecondLife << " is already running.\n" - "\n" - "Check your task bar for a minimized copy of the program.\n" - "If this message persists, restart your computer.", + msg << LLTrans::getString("MBAlreadyRunning"); OSMessageBox( msg.str(), LLStringUtil::null, @@ -2034,6 +1995,8 @@ bool LLAppViewer::initConfiguration() gLastRunVersion = gSavedSettings.getString("LastRunVersion"); + loadColorSettings(); + return true; // Config was successful. } @@ -2048,13 +2011,9 @@ void LLAppViewer::checkForCrash(void) // // Pop up a freeze or crash warning dialog // - std::ostringstream msg; - msg << gSecondLife - << " appears to have frozen or crashed on the previous run.\n" - << "Would you like to send a crash report?"; - std::string alert; - alert = gSecondLife; - alert += " Alert"; + std::ostringstream msg; + msg << LLTrans::getString("MBFrozenCrashed"); + std::string alert = LLTrans::getString("SECOND_LIFE_VIEWER") + " " + LLTrans::getString("MBAlert"); S32 choice = OSMessageBox(msg.str(), alert, OSMB_YESNO); @@ -2130,9 +2089,6 @@ bool LLAppViewer::initWindow() LLUI::sWindow = gViewerWindow->getWindow(); - LLTrans::parseStrings("strings.xml"); - LLUITrans::parseStrings("ui_strings.xml"); - // Show watch cursor gViewerWindow->setCursor(UI_CURSOR_WAIT); @@ -2252,7 +2208,7 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; // Dump some debugging info - LL_INFOS("SystemInfo") << gSecondLife + LL_INFOS("SystemInfo") << LLTrans::getString("SECOND_LIFE_VIEWER") << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << LL_ENDL; @@ -2330,7 +2286,7 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); gDebugInfo["SessionLength"] = F32(LLFrameTimer::getElapsedSeconds()); gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); - gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer) getCurrentRSS() >> 10; + gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer) LLMemory::getCurrentRSS() >> 10; if(gLogoutInProgress) { @@ -2924,12 +2880,12 @@ void LLAppViewer::purgeCache() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); } -const std::string& LLAppViewer::getSecondLifeTitle() const +std::string LLAppViewer::getSecondLifeTitle() const { - return gSecondLife; + return LLTrans::getString("SECOND_LIFE_VIEWER"); } -const std::string& LLAppViewer::getWindowTitle() const +std::string LLAppViewer::getWindowTitle() const { return gWindowTitle; } @@ -2963,7 +2919,7 @@ void LLAppViewer::forceDisconnect(const std::string& mesg) return; } - // Translate the message if possible + // *TODO: Translate the message if possible std::string big_reason = LLAgent::sTeleportErrorMessages[mesg]; if ( big_reason.size() == 0 ) { @@ -3235,7 +3191,6 @@ void LLAppViewer::idle() gObjectList.mNumUnknownUpdates = 0; } } - gFrameStats.addFrameData(); } if (!gDisconnected) @@ -3250,12 +3205,10 @@ void LLAppViewer::idle() // floating throughout the various object lists. // - gFrameStats.start(LLFrameStats::IDLE_NETWORK); stop_glerror(); idleNetwork(); stop_glerror(); - gFrameStats.start(LLFrameStats::AGENT_MISC); // Check for away from keyboard, kick idle agents. idle_afk_check(); @@ -3284,7 +3237,7 @@ void LLAppViewer::idle() return; } - gViewerWindow->handlePerFrameHover(); + gViewerWindow->updateUI(); /////////////////////////////////////// // Agent and camera movement @@ -3307,7 +3260,6 @@ void LLAppViewer::idle() { LLFastTimer t(LLFastTimer::FTM_OBJECTLIST_UPDATE); // Actually "object update" - gFrameStats.start(LLFrameStats::OBJECT_UPDATE); if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { @@ -3323,7 +3275,6 @@ void LLAppViewer::idle() { LLFastTimer t(LLFastTimer::FTM_CLEANUP); - gFrameStats.start(LLFrameStats::CLEAN_DEAD); gObjectList.cleanDeadObjects(); LLDrawable::cleanupDeadDrawables(); } @@ -3342,7 +3293,6 @@ void LLAppViewer::idle() // { - gFrameStats.start(LLFrameStats::UPDATE_EFFECTS); LLSelectMgr::getInstance()->updateEffects(); LLHUDManager::getInstance()->cleanupEffects(); LLHUDManager::getInstance()->sendEffects(); @@ -3416,10 +3366,8 @@ void LLAppViewer::idle() if (!gNoRender) { LLFastTimer t(LLFastTimer::FTM_WORLD_UPDATE); - gFrameStats.start(LLFrameStats::UPDATE_MOVE); gPipeline.updateMove(); - gFrameStats.start(LLFrameStats::UPDATE_PARTICLES); LLWorld::getInstance()->updateParticles(); } stop_glerror(); @@ -3445,7 +3393,6 @@ void LLAppViewer::idle() } { - gFrameStats.start(LLFrameStats::AUDIO); LLFastTimer t(LLFastTimer::FTM_AUDIO_UPDATE); if (gAudiop) @@ -3491,6 +3438,17 @@ void LLAppViewer::idleShutdown() { return; } + + // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() + // *TODO: ugly + static bool saved_teleport_history = false; + if (!saved_teleport_history) + { + saved_teleport_history = true; + LLTeleportHistory::getInstance()->save(); + LLLocationHistory::getInstance()->save(); // *TODO: find a better place for doing this + return; + } static bool saved_snapshot = false; if (!saved_snapshot) @@ -3674,7 +3632,7 @@ void LLAppViewer::idleNetwork() } } llpushcallstacks ; - gObjectList.mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects); + LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects); // Retransmit unacknowledged packets. gXferManager->retransmitUnackedPackets(); @@ -3715,7 +3673,6 @@ void LLAppViewer::disconnectViewer() llinfos << "Disconnecting viewer!" << llendl; // Dump our frame statistics - gFrameStats.dump(); // Remember if we were flying gSavedSettings.setBOOL("FlyingAtExit", gAgent.getFlying() ); |