diff options
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r-- | linden/indra/newview/llpanellogin.cpp | 96 |
1 files changed, 83 insertions, 13 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index 23b7785..d09875b 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp | |||
@@ -305,17 +305,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
305 | // make links open in external browser | 305 | // make links open in external browser |
306 | web_browser->setOpenInExternalBrowser( true ); | 306 | web_browser->setOpenInExternalBrowser( true ); |
307 | 307 | ||
308 | // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) | ||
309 | LLRect htmlRect = getRect(); | ||
310 | #if USE_VIEWER_AUTH | ||
311 | htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); | ||
312 | #else | ||
313 | htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); | ||
314 | #endif | ||
315 | web_browser->setRect( htmlRect ); | ||
316 | web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); | ||
317 | reshape( getRect().getWidth(), getRect().getHeight(), 1 ); | ||
318 | |||
319 | // kick off a request to grab the url manually | 308 | // kick off a request to grab the url manually |
320 | gResponsePtr = LLIamHereLogin::build( this ); | 309 | gResponsePtr = LLIamHereLogin::build( this ); |
321 | std::string login_page = gSavedSettings.getString("LoginPage"); | 310 | std::string login_page = gSavedSettings.getString("LoginPage"); |
@@ -330,6 +319,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
330 | refreshLocation( false ); | 319 | refreshLocation( false ); |
331 | #endif | 320 | #endif |
332 | 321 | ||
322 | loadNewsBar(); | ||
323 | |||
333 | LLFirstUse::useLoginScreen(); | 324 | LLFirstUse::useLoginScreen(); |
334 | } | 325 | } |
335 | 326 | ||
@@ -417,13 +408,20 @@ void LLPanelLogin::draw() | |||
417 | S32 width = getRect().getWidth(); | 408 | S32 width = getRect().getWidth(); |
418 | S32 height = getRect().getHeight(); | 409 | S32 height = getRect().getHeight(); |
419 | 410 | ||
411 | S32 news_bar_height = 0; | ||
412 | LLWebBrowserCtrl* news_bar = getChild<LLWebBrowserCtrl>("news_bar"); | ||
413 | if (news_bar) | ||
414 | { | ||
415 | news_bar_height = news_bar->getRect().getHeight(); | ||
416 | } | ||
417 | |||
420 | if ( mHtmlAvailable ) | 418 | if ( mHtmlAvailable ) |
421 | { | 419 | { |
422 | #if !USE_VIEWER_AUTH | 420 | #if !USE_VIEWER_AUTH |
423 | // draw a background box in black | 421 | // draw a background box in black |
424 | gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); | 422 | gl_rect_2d( 0, height - 264 + news_bar_height, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); |
425 | // draw the bottom part of the background image - just the blue background to the native client UI | 423 | // draw the bottom part of the background image - just the blue background to the native client UI |
426 | mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight()); | 424 | mLogoImage->draw(0, -264 + news_bar_height, width + 8, mLogoImage->getHeight()); |
427 | #endif | 425 | #endif |
428 | } | 426 | } |
429 | else | 427 | else |
@@ -1146,3 +1144,75 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) | |||
1146 | } | 1144 | } |
1147 | } | 1145 | } |
1148 | */ | 1146 | */ |
1147 | |||
1148 | |||
1149 | bool LLPanelLogin::loadNewsBar() | ||
1150 | { | ||
1151 | std::string news_url = gSavedSettings.getString("NewsBarURL"); | ||
1152 | |||
1153 | if (news_url.empty()) | ||
1154 | { | ||
1155 | return false; | ||
1156 | } | ||
1157 | |||
1158 | LLWebBrowserCtrl* news_bar = getChild<LLWebBrowserCtrl>("news_bar"); | ||
1159 | |||
1160 | if (!news_bar) | ||
1161 | { | ||
1162 | return false; | ||
1163 | } | ||
1164 | |||
1165 | // *HACK: Not sure how else to make LLWebBrowserCtrl respect user's | ||
1166 | // preference when opening links with target="_blank". -Jacek | ||
1167 | if (gSavedSettings.getBOOL("UseExternalBrowser")) | ||
1168 | { | ||
1169 | news_bar->setOpenInExternalBrowser( true ); | ||
1170 | news_bar->setOpenInInternalBrowser( false ); | ||
1171 | } | ||
1172 | else | ||
1173 | { | ||
1174 | news_bar->setOpenInExternalBrowser( false ); | ||
1175 | news_bar->setOpenInInternalBrowser( true ); | ||
1176 | } | ||
1177 | |||
1178 | |||
1179 | std::ostringstream full_url; | ||
1180 | |||
1181 | full_url << news_url; | ||
1182 | |||
1183 | // Append a "?" if the URL doesn't already have query params. | ||
1184 | if (LLURI(news_url).queryMap().size() == 0) | ||
1185 | { | ||
1186 | full_url << "?"; | ||
1187 | } | ||
1188 | |||
1189 | std::string channel = gSavedSettings.getString("VersionChannelName"); | ||
1190 | std::string skin = gSavedSettings.getString("SkinCurrent"); | ||
1191 | |||
1192 | std::string version = | ||
1193 | llformat("%d.%d.%d", | ||
1194 | ViewerVersion::getImpMajorVersion(), | ||
1195 | ViewerVersion::getImpMinorVersion(), | ||
1196 | ViewerVersion::getImpPatchVersion()); | ||
1197 | if (!ViewerVersion::getImpTestVersion().empty()) | ||
1198 | { | ||
1199 | version += " " + ViewerVersion::getImpTestVersion(); | ||
1200 | } | ||
1201 | |||
1202 | char* curl_channel = curl_escape(channel.c_str(), 0); | ||
1203 | char* curl_version = curl_escape(version.c_str(), 0); | ||
1204 | char* curl_skin = curl_escape(skin.c_str(), 0); | ||
1205 | |||
1206 | full_url << "&channel=" << curl_channel; | ||
1207 | full_url << "&version=" << curl_version; | ||
1208 | full_url << "&skin=" << curl_skin; | ||
1209 | |||
1210 | curl_free(curl_channel); | ||
1211 | curl_free(curl_version); | ||
1212 | curl_free(curl_skin); | ||
1213 | |||
1214 | news_bar->navigateTo( full_url.str() ); | ||
1215 | |||
1216 | |||
1217 | return true; | ||
1218 | } | ||