PageRenderTime 223ms CodeModel.GetById 80ms app.highlight 4ms RepoModel.GetById 137ms app.codeStats 0ms

/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
27#include "llviewerprecompiledheaders.h"
28
29#include "llfloaterhud.h"
30
31// Viewer libs
32#include "llviewercontrol.h"
33#include "llmediactrl.h"
34
35// Linden libs
36#include "llnotificationsutil.h"
37#include "lluictrlfactory.h"
38
39
40///----------------------------------------------------------------------------
41/// Class LLFloaterHUD
42///----------------------------------------------------------------------------
43#define super LLFloater	/* superclass */
44
45// Default constructor
46LLFloaterHUD::LLFloaterHUD(const LLSD& key)
47:	LLFloater(key),
48	mWebBrowser(0)
49{
50	// do not build the floater if there the url is empty
51	if (gSavedSettings.getString("TutorialURL") == "")
52	{
53		LLNotificationsUtil::add("TutorialNotFound");
54		return;
55	}
56	
57	// Opaque background since we never get the focus
58	setBackgroundOpaque(TRUE);
59}
60
61BOOL LLFloaterHUD::postBuild()
62{
63	mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" );
64	if (mWebBrowser)
65	{
66		// This is a "chrome" floater, so we don't want anything to
67		// take focus (as the user needs to be able to walk with 
68		// arrow keys during tutorial).
69		mWebBrowser->setTakeFocusOnClick(false);
70		
71		std::string language = LLUI::getLanguage();
72		std::string base_url = gSavedSettings.getString("TutorialURL");
73		
74		std::string url = base_url + language + "/";
75		mWebBrowser->navigateTo(url);
76	}
77	
78	return TRUE;
79}
80
81// Destructor
82LLFloaterHUD::~LLFloaterHUD()
83{
84}