diff options
Diffstat (limited to 'linden/indra/newview/llfloaterreleasemsg.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterreleasemsg.cpp | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterreleasemsg.cpp b/linden/indra/newview/llfloaterreleasemsg.cpp new file mode 100644 index 0000000..50df25a --- /dev/null +++ b/linden/indra/newview/llfloaterreleasemsg.cpp | |||
@@ -0,0 +1,152 @@ | |||
1 | /** | ||
2 | * @file llfloaterreleasemsg.cpp | ||
3 | * @brief In-world HTML dialog | ||
4 | * | ||
5 | * Copyright (c) 2005-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #include "llviewerprecompiledheaders.h" | ||
30 | |||
31 | #include "llvieweruictrlfactory.h" | ||
32 | #include "llviewerwindow.h" | ||
33 | #include "llviewercontrol.h" | ||
34 | #include "llfloaterreleasemsg.h" | ||
35 | #include "llagent.h" | ||
36 | #include "llviewerregion.h" | ||
37 | |||
38 | extern LLAgent gAgent; | ||
39 | extern LLString gLastVersionChannel; | ||
40 | |||
41 | LLFloaterReleaseMsg* LLFloaterReleaseMsg::sInstance = 0; | ||
42 | |||
43 | |||
44 | //////////////////////////////////////////////////////////////////////////////// | ||
45 | // | ||
46 | LLFloaterReleaseMsg* LLFloaterReleaseMsg::getInstance() | ||
47 | { | ||
48 | if ( ! sInstance ) | ||
49 | sInstance = new LLFloaterReleaseMsg; | ||
50 | |||
51 | return sInstance; | ||
52 | } | ||
53 | |||
54 | //////////////////////////////////////////////////////////////////////////////// | ||
55 | // | ||
56 | LLFloaterReleaseMsg::LLFloaterReleaseMsg() | ||
57 | : LLFloater( "Release Message Floater" ) | ||
58 | |||
59 | #if LL_LIBXUL_ENABLED | ||
60 | , | ||
61 | mWebBrowser( 0 ) | ||
62 | #endif // LL_LIBXUL_ENABLED | ||
63 | { | ||
64 | // create floater from its XML definition | ||
65 | gUICtrlFactory->buildFloater( this, "floater_sim_release_message.xml" ); | ||
66 | |||
67 | mTitleBase = getTitle(); | ||
68 | |||
69 | // reposition floater from saved settings | ||
70 | LLRect rect = gSavedSettings.getRect( "HtmlReleaseMessage" ); | ||
71 | reshape( rect.getWidth(), rect.getHeight(), FALSE ); | ||
72 | setRect( rect ); | ||
73 | |||
74 | #if LL_LIBXUL_ENABLED | ||
75 | mWebBrowser = LLViewerUICtrlFactory::getWebBrowserByName(this, "release_message_floater_browser" ); | ||
76 | if ( mWebBrowser ) | ||
77 | { | ||
78 | // observe browser events | ||
79 | mWebBrowser->addObserver( this ); | ||
80 | |||
81 | // make links open in external browser | ||
82 | mWebBrowser->setOpenInExternalBrowser( true ); | ||
83 | |||
84 | // don't automatically open secondlife links since we want to catch | ||
85 | // special ones that do other stuff (like open F1 Help) | ||
86 | //mWebBrowser->setOpenSecondLifeLinksInMap( false ); | ||
87 | } | ||
88 | #endif // LL_LIBXUL_ENABLED | ||
89 | |||
90 | childSetAction("close_btn", onClickClose, this); | ||
91 | setDefaultBtn("close_btn"); | ||
92 | } | ||
93 | |||
94 | //////////////////////////////////////////////////////////////////////////////// | ||
95 | // | ||
96 | LLFloaterReleaseMsg::~LLFloaterReleaseMsg() | ||
97 | { | ||
98 | #if LL_LIBXUL_ENABLED | ||
99 | // stop observing browser events | ||
100 | if ( mWebBrowser ) | ||
101 | mWebBrowser->remObserver( this ); | ||
102 | #endif // LL_LIBXUL_ENABLED | ||
103 | |||
104 | // save position of floater | ||
105 | gSavedSettings.setRect( "HtmlReleaseMessage", mRect ); | ||
106 | |||
107 | sInstance = 0; | ||
108 | } | ||
109 | |||
110 | //////////////////////////////////////////////////////////////////////////////// | ||
111 | // | ||
112 | void LLFloaterReleaseMsg::show() | ||
113 | { | ||
114 | |||
115 | std::string url = gAgent.getRegion()->getCapability("ServerReleaseNotes"); | ||
116 | |||
117 | if (url.empty()) return; | ||
118 | |||
119 | llinfos << "Release message url: " << url << llendl; | ||
120 | |||
121 | if (!sInstance) | ||
122 | { | ||
123 | sInstance = new LLFloaterReleaseMsg(); | ||
124 | sInstance->center(); | ||
125 | } | ||
126 | |||
127 | sInstance->setTitle(sInstance->mTitleBase + " " + gLastVersionChannel); | ||
128 | sInstance->open(); | ||
129 | |||
130 | #if LL_LIBXUL_ENABLED | ||
131 | // navigate to the URL | ||
132 | if ( sInstance->mWebBrowser ) | ||
133 | sInstance->mWebBrowser->navigateTo( url ); | ||
134 | #endif // LL_LIBXUL_ENABLED | ||
135 | |||
136 | // make floater appear | ||
137 | sInstance->setVisibleAndFrontmost(); | ||
138 | |||
139 | sInstance->draw(); | ||
140 | } | ||
141 | |||
142 | |||
143 | //////////////////////////////////////////////////////////////////////////////// | ||
144 | // | ||
145 | void LLFloaterReleaseMsg::onClickClose( void* data ) | ||
146 | { | ||
147 | LLFloaterReleaseMsg* self = ( LLFloaterReleaseMsg* )data; | ||
148 | |||
149 | self->setVisible( false ); | ||
150 | } | ||
151 | |||
152 | |||