/indra/newview/llfloaterhud.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 84 lines · 34 code · 13 blank · 37 comment · 3 complexity · 5ef44cf24fce0c4d7c5895a755854985 MD5 · raw file

  1. /**
  2. * @file llfloaterhud.cpp
  3. * @brief Implementation of HUD floater
  4. *
  5. * $LicenseInfo:firstyear=2008&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llfloaterhud.h"
  28. // Viewer libs
  29. #include "llviewercontrol.h"
  30. #include "llmediactrl.h"
  31. // Linden libs
  32. #include "llnotificationsutil.h"
  33. #include "lluictrlfactory.h"
  34. ///----------------------------------------------------------------------------
  35. /// Class LLFloaterHUD
  36. ///----------------------------------------------------------------------------
  37. #define super LLFloater /* superclass */
  38. // Default constructor
  39. LLFloaterHUD::LLFloaterHUD(const LLSD& key)
  40. : LLFloater(key),
  41. mWebBrowser(0)
  42. {
  43. // do not build the floater if there the url is empty
  44. if (gSavedSettings.getString("TutorialURL") == "")
  45. {
  46. LLNotificationsUtil::add("TutorialNotFound");
  47. return;
  48. }
  49. // Opaque background since we never get the focus
  50. setBackgroundOpaque(TRUE);
  51. }
  52. BOOL LLFloaterHUD::postBuild()
  53. {
  54. mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" );
  55. if (mWebBrowser)
  56. {
  57. // This is a "chrome" floater, so we don't want anything to
  58. // take focus (as the user needs to be able to walk with
  59. // arrow keys during tutorial).
  60. mWebBrowser->setTakeFocusOnClick(false);
  61. std::string language = LLUI::getLanguage();
  62. std::string base_url = gSavedSettings.getString("TutorialURL");
  63. std::string url = base_url + language + "/";
  64. mWebBrowser->navigateTo(url);
  65. }
  66. return TRUE;
  67. }
  68. // Destructor
  69. LLFloaterHUD::~LLFloaterHUD()
  70. {
  71. }