diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2009-08-05 16:10:15 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2009-08-05 16:10:15 -0400 |
commit | 07129bf928f79246849e66b396fab44a7a228216 (patch) | |
tree | e4e19b342540450ff84dad75f90d5acb5b3d6269 /indra/newview/llfloaterhud.cpp | |
parent | 03ebc43132331b9a8dcb3c418ec9c319a6beddda (diff) | |
parent | dc62495da6e5c153c0df57fdbce6b0f40c0208f2 (diff) |
Merge recent changes
Diffstat (limited to 'indra/newview/llfloaterhud.cpp')
-rw-r--r-- | indra/newview/llfloaterhud.cpp | 59 |
1 files changed, 18 insertions, 41 deletions
diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index 4379d25a66..dd70560bb7 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -42,8 +42,6 @@ // Linden libs #include "lluictrlfactory.h" -// statics -LLFloaterHUD* LLFloaterHUD::sInstance = 0; ///---------------------------------------------------------------------------- /// Class LLFloaterHUD @@ -51,12 +49,18 @@ LLFloaterHUD* LLFloaterHUD::sInstance = 0; #define super LLFloater /* superclass */ // Default constructor -LLFloaterHUD::LLFloaterHUD() -: LLFloater(), +LLFloaterHUD::LLFloaterHUD(const LLSD& key) +: LLFloater(key), mWebBrowser(0) { - // Create floater from its XML definition - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hud.xml"); + // do not build the floater if there the url is empty + if (gSavedSettings.getString("TutorialURL") == "") + { + LLNotifications::instance().add("TutorialNotFound"); + return; + } + + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hud.xml"); // Don't grab the focus as it will impede performing in-world actions // while using the HUD @@ -68,62 +72,35 @@ LLFloaterHUD::LLFloaterHUD() // Opaque background since we never get the focus setBackgroundOpaque(TRUE); +} +BOOL LLFloaterHUD::postBuild() +{ mWebBrowser = getChild<LLWebBrowserCtrl>("floater_hud_browser" ); if (mWebBrowser) { // Open links in internal browser mWebBrowser->setOpenInExternalBrowser(false); - + // This is a "chrome" floater, so we don't want anything to // take focus (as the user needs to be able to walk with // arrow keys during tutorial). mWebBrowser->setTakeFocusOnClick(false); - + std::string language = LLUI::getLanguage(); std::string base_url = gSavedSettings.getString("TutorialURL"); - + std::string url = base_url + language + "/"; mWebBrowser->navigateTo(url); } -} - -// Get the instance -LLFloaterHUD* LLFloaterHUD::getInstance() -{ - if (!sInstance) - { - sInstance = new LLFloaterHUD(); - } - return sInstance; + + return TRUE; } // Destructor LLFloaterHUD::~LLFloaterHUD() { - // Clear out the one instance if it's ours - if (sInstance == this) - { - sInstance = NULL; - } } - -// Show the HUD -void LLFloaterHUD::showHUD() -{ - // do not build the floater if there the url is empty - if (gSavedSettings.getString("TutorialURL") == "") - { - LLNotifications::instance().add("TutorialNotFound"); - return; - } - - // Create the instance if necessary - LLFloaterHUD* hud = getInstance(); - hud->openFloater(); - hud->setFrontmost(FALSE); -} - // Save our visibility state on close in case the user accidentally // quit the application while the tutorial was visible. // virtual |