From 9dada6bcc42dff7d7c6e17b7e65a6841b14b405b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 May 2010 14:14:50 -0600 Subject: EXT-7145: FIXED: make viewer to handle "URL redirect " for http texture. --- indra/llmessage/llcurl.cpp | 7 +++++++ indra/newview/lltexturefetch.cpp | 20 ++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 91e11b8c0d..36874a5d48 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -365,6 +365,13 @@ U32 LLCurl::Easy::report(CURLcode code) responseReason = strerror(code) + " : " + mErrorBuffer; } + if(responseCode >= 300 && responseCode < 400) //redirect + { + char new_url[512] ; + curl_easy_getinfo(mCurlEasyHandle, CURLINFO_REDIRECT_URL, new_url); + responseReason = new_url ; //get the new URL. + } + if (mResponder) { mResponder->completedRaw(responseCode, responseReason, mChannels, mOutput); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7fa04ce574..913a0b92c2 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -328,11 +328,7 @@ public: partial = true; } } - else - { - worker->setGetStatus(status, reason); -// llwarns << status << ": " << reason << llendl; - } + if (!success) { worker->setGetStatus(status, reason); @@ -904,7 +900,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mGetStatus == HTTP_NOT_FOUND) { mHTTPFailCount = max_attempts = 1; // Don't retry - //llinfos << "Texture missing from server (404): " << mUrl << llendl; + llwarns << "Texture missing from server (404): " << mUrl << llendl; //roll back to try UDP mState = INIT ; @@ -921,6 +917,17 @@ bool LLTextureFetchWorker::doWork(S32 param) max_attempts = mHTTPFailCount+1; // Keep retrying LL_INFOS_ONCE("Texture") << "Texture server busy (503): " << mUrl << LL_ENDL; } + else if(mGetStatus >= HTTP_MULTIPLE_CHOICES && mGetStatus < HTTP_BAD_REQUEST) //http re-direct + { + ++mHTTPFailCount; + max_attempts = 5 ; //try at most 5 times to avoid infinite redirection loop. + + llwarns << "HTTP GET failed because of redirection: " << mUrl + << " Status: " << mGetStatus << " Reason: '" << mGetReason << llendl ; + + //assign to the new url + mUrl = mGetReason ; + } else { const S32 HTTP_MAX_RETRY_COUNT = 3; @@ -930,6 +937,7 @@ bool LLTextureFetchWorker::doWork(S32 param) << " Status: " << mGetStatus << " Reason: '" << mGetReason << "'" << " Attempt:" << mHTTPFailCount+1 << "/" << max_attempts << llendl; } + if (mHTTPFailCount >= max_attempts) { if (cur_size > 0) -- cgit v1.2.3 From 46309f558ed1ce459d11aa76de35679fa81a4823 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 20 May 2010 14:33:11 -0600 Subject: EXT-7309: PARTIAL FIXED: Investigate turning RenderAvatarMaxVisible down to 1 or 2 on low end hardware. added a slider in "preferences -> graphics -> Advanced" to change RenderAvatarMaxVisible value. --- .../default/xui/en/panel_preferences_graphics1.xml | 40 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 0a56f711dd..7b76abb671 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -160,7 +160,7 @@ layout="topleft" left="5" name="CustomGraphics Panel" - top="124" + top="76" width="485"> m - + + + + m + Low @@ -607,7 +635,7 @@ layout="topleft" left="200" name="LightingDetailText" - top_pad="8" + top_pad="18" width="140"> Lighting detail: @@ -644,7 +672,7 @@ layout="topleft" left_pad="-30" name="TerrainDetailText" - top="465" + top="497" width="155"> Terrain detail: -- cgit v1.2.3 From 11623453784d5e27df13a1a4efaab3f23ebe2de5 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 20 May 2010 17:31:27 -0600 Subject: More for EXT-7309: Investigate turning RenderAvatarMaxVisible down to 1 or 2 on low end hardware. adjust the arrangements of the panel "preferences -> graphics -> Advanced". --- indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 7b76abb671..10beb89940 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -381,7 +381,7 @@ max_val="65" min_val="1" name="MaxAvatarDrawDistance" - top_pad="7" + top_pad="4" width="290" /> Low @@ -672,7 +672,7 @@ layout="topleft" left_pad="-30" name="TerrainDetailText" - top="497" + top="226" width="155"> Terrain detail: -- cgit v1.2.3 From 517e8914f8825051988755a903c5c2d131559db3 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 21 May 2010 10:15:56 -0600 Subject: More for EXT-7309: Investigate turning RenderAvatarMaxVisible down to 1 or 2 on low end hardware. set RenderAvatarMaxVisible to be 3 by default for low-end settings. --- indra/newview/app_settings/low_graphics.xml | 2 ++ indra/newview/featuretable.txt | 1 + indra/newview/featuretable_linux.txt | 1 + indra/newview/featuretable_mac.txt | 1 + indra/newview/featuretable_solaris.txt | 1 + 5 files changed, 6 insertions(+) diff --git a/indra/newview/app_settings/low_graphics.xml b/indra/newview/app_settings/low_graphics.xml index 3f67a70d7a..d02a13a671 100644 --- a/indra/newview/app_settings/low_graphics.xml +++ b/indra/newview/app_settings/low_graphics.xml @@ -4,6 +4,8 @@ + + diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 5f31ccbb19..f1c1a142ad 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -65,6 +65,7 @@ list Low RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 +RenderAvatarMaxVisible 1 3 RenderAvatarVP 1 0 RenderFarClip 1 64 RenderFlexTimeFactor 1 0.5 diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 61a8e51c50..d1d11ee173 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -63,6 +63,7 @@ list Low RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 +RenderAvatarMaxVisible 1 3 RenderAvatarVP 1 0 RenderFarClip 1 64 RenderFlexTimeFactor 1 0.5 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 12d47a904c..efd7ec7a91 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -65,6 +65,7 @@ list Low RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 +RenderAvatarMaxVisible 1 3 RenderAvatarVP 1 0 RenderFarClip 1 64 RenderFlexTimeFactor 1 0.5 diff --git a/indra/newview/featuretable_solaris.txt b/indra/newview/featuretable_solaris.txt index f24cbde5e2..6edd280686 100644 --- a/indra/newview/featuretable_solaris.txt +++ b/indra/newview/featuretable_solaris.txt @@ -117,6 +117,7 @@ UseOcclusion 0 0 list low RenderVBO 1 0 RenderAniso 1 0 +RenderAvatarMaxVisible 1 3 RenderLighting 1 0 list medium -- cgit v1.2.3 From d84990307b78695b2239e09ea7df42c64002bcf7 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Fri, 21 May 2010 15:22:32 -0700 Subject: VI-65 - Addition of Quick/Eazy Buy Web based floater. Switched off by default for now until Web content ready - turn on with Debug Settings - 'QuickBuyCurrency' Reviewed by Sam/Richard --- indra/newview/CMakeLists.txt | 4 + indra/newview/app_settings/settings.xml | 11 ++ indra/newview/llassetuploadresponders.cpp | 4 +- indra/newview/llbuycurrencyhtml.cpp | 165 +++++++++++++++++++++ indra/newview/llbuycurrencyhtml.h | 57 +++++++ indra/newview/llfloaterbuycurrencyhtml.cpp | 119 +++++++++++++++ indra/newview/llfloaterbuycurrencyhtml.h | 65 ++++++++ indra/newview/llpanelobjectinventory.cpp | 4 +- indra/newview/llpanelplaceprofile.cpp | 4 +- indra/newview/llstatusbar.cpp | 5 +- indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermenu.cpp | 9 +- indra/newview/llviewermenufile.cpp | 4 +- indra/newview/llviewermessage.cpp | 5 +- .../default/xui/en/floater_buy_currency_html.xml | 27 ++++ 15 files changed, 468 insertions(+), 17 deletions(-) create mode 100644 indra/newview/llbuycurrencyhtml.cpp create mode 100644 indra/newview/llbuycurrencyhtml.h create mode 100644 indra/newview/llfloaterbuycurrencyhtml.cpp create mode 100644 indra/newview/llfloaterbuycurrencyhtml.h create mode 100644 indra/newview/skins/default/xui/en/floater_buy_currency_html.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d77d53f6af..28a5555ca2 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -91,6 +91,7 @@ set(viewer_SOURCE_FILES llbottomtray.cpp llbox.cpp llbreadcrumbview.cpp + llbuycurrencyhtml.cpp llcallbacklist.cpp llcallfloater.cpp llcallingcard.cpp @@ -159,6 +160,7 @@ set(viewer_SOURCE_FILES llfloaterbuy.cpp llfloaterbuycontents.cpp llfloaterbuycurrency.cpp + llfloaterbuycurrencyhtml.cpp llfloaterbuyland.cpp llfloatercamera.cpp llfloatercolorpicker.cpp @@ -604,6 +606,7 @@ set(viewer_HEADER_FILES llbottomtray.h llbox.h llbreadcrumbview.h + llbuycurrencyhtml.h llcallbacklist.h llcallfloater.h llcallingcard.h @@ -674,6 +677,7 @@ set(viewer_HEADER_FILES llfloaterbuy.h llfloaterbuycontents.h llfloaterbuycurrency.h + llfloaterbuycurrencyhtml.h llfloaterbuyland.h llfloatercamera.h llfloatercolorpicker.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 418032c554..1d27d00451 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6028,6 +6028,17 @@ Value 0 + QuickBuyCurrency + + Comment + Toggle between HTML based currency purchase floater and legacy XUI version + Persist + 1 + Type + Boolean + Value + 0 + RegionTextureSize Comment diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 2f90d652e4..27dcb9f1c7 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -37,7 +37,7 @@ // viewer includes #include "llagent.h" #include "llcompilequeue.h" -#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llfilepicker.h" #include "llinventorydefines.h" #include "llinventoryobserver.h" @@ -186,7 +186,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content) S32 price = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", price); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs", args), price); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("uploading_costs", args), price ); } else { diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp new file mode 100644 index 0000000000..cb06f487e6 --- /dev/null +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -0,0 +1,165 @@ +/** + * @file llbuycurrencyhtml.cpp + * @brief Manages Buy Currency HTML floater + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" +#include "llfloaterbuycurrencyhtml.h" + +#include "llfloaterreg.h" +#include "llcommandhandler.h" +#include "llviewercontrol.h" + +// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps +class LLBuyCurrencyHTMLHandler : + public LLCommandHandler +{ +public: + // requests will be throttled from a non-trusted browser + LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_ALLOW ) {} + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + std::string action( "" ); + if ( params.size() >= 1 ) + { + action = params[ 0 ].asString(); + }; + + std::string next_action( "" ); + if ( params.size() >= 2 ) + { + next_action = params[ 1 ].asString(); + }; + + int result_code = 0; + if ( params.size() >= 3 ) + { + result_code = params[ 2 ].asInteger(); + }; + + // open the legacy XUI based currency floater + if ( "open_legacy" == next_action ) + { + LLFloaterBuyCurrency::buyCurrency(); + }; + + // ask the Buy Currency floater to close + // note: this is the last thing we can do so make + // sure any other actions are processed before this. + if ( "close" == action ) + { + LLBuyCurrencyHTML::closeDialog(); + }; + + return true; + }; +}; +LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler; + +//////////////////////////////////////////////////////////////////////////////// +// static +// Opens the legacy XUI based floater or new HTML based one based on +// the QuickBuyCurrency value in settings.xml - this overload is for +// the case where the amount is not requested. +void LLBuyCurrencyHTML::openCurrencyFloater() +{ + if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) + { + // HTML version + LLBuyCurrencyHTML::showDialog( false, "", 0 ); + } + else + { + // legacy version + LLFloaterBuyCurrency::buyCurrency(); + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// static +// Opens the legacy XUI based floater or new HTML based one based on +// the QuickBuyCurrency value in settings.xml - this overload is for +// the case where the amount and a string to display are requested. +void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum ) +{ + if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) + { + // HTML version + LLBuyCurrencyHTML::showDialog( true, message, sum ); + } + else + { + // legacy version + LLFloaterBuyCurrency::buyCurrency( message, sum ); + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// static +void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::string& message, S32 sum ) +{ + LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >( LLFloaterReg::getInstance( "buy_currency_html" ) ); + if ( buy_currency_floater ) + { + // pass on flag indicating if we want to buy specific amount and if so, how much + buy_currency_floater->setParams( specific_sum_requested, message, sum ); + + // force navigate to new URL + buy_currency_floater->navigateToFinalURL(); + + // make it visible and raise to front + BOOL visible = TRUE; + buy_currency_floater->setVisible( visible ); + BOOL take_focus = TRUE; + buy_currency_floater->setFrontmost( take_focus ); + + // spec calls for floater to be centered on client window + buy_currency_floater->center(); + } + else + { + llwarns << "Buy Currency (HTML) Floater not found" << llendl; + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLBuyCurrencyHTML::closeDialog() +{ + LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >(LLFloaterReg::getInstance( "buy_currency_html" ) ); + if ( buy_currency_floater ) + { + buy_currency_floater->closeFloater(); + }; +} diff --git a/indra/newview/llbuycurrencyhtml.h b/indra/newview/llbuycurrencyhtml.h new file mode 100644 index 0000000000..dbb2281343 --- /dev/null +++ b/indra/newview/llbuycurrencyhtml.h @@ -0,0 +1,57 @@ +/** + * @file llbuycurrencyhtml.h + * @brief Manages Buy Currency HTML floater + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLBUYCURRENCYHTML_H +#define LL_LLBUYCURRENCYHTML_H + +#include "llsingleton.h" + +class LLFloaterBuyCurrencyHTML; + +class LLBuyCurrencyHTML +{ + public: + // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is not required + static void openCurrencyFloater(); + + // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is required + static void openCurrencyFloater( const std::string& message, S32 sum ); + + // show and give focus to actual currency floater - this is used for both cases + // where the sum is required and where it is not + static void showDialog( bool specific_sum_requested, const std::string& message, S32 sum ); + + // close (and destroy) the currency floater + static void closeDialog(); +}; + +#endif // LL_LLBUYCURRENCYHTML_H diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp new file mode 100644 index 0000000000..e4be706ac4 --- /dev/null +++ b/indra/newview/llfloaterbuycurrencyhtml.cpp @@ -0,0 +1,119 @@ +/** + * @file llfloaterbuycurrencyhtml.cpp + * @brief buy currency implemented in HTML floater - uses embedded media browser control + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterbuycurrencyhtml.h" +#include "llstatusbar.h" + +//////////////////////////////////////////////////////////////////////////////// +// +LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ): + LLFloater( key ), + mSpecificSumRequested( false ), + mMessage( "" ), + mSum( 0 ) +{ +} + +//////////////////////////////////////////////////////////////////////////////// +// +BOOL LLFloaterBuyCurrencyHTML::postBuild() +{ + // observer media events + mBrowser = getChild( "browser" ); + mBrowser->addObserver( this ); + + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::navigateToFinalURL() +{ + // URL for actual currency buy contents is in XUI file + std::string buy_currency_url = getString( "buy_currency_url" ); + + // replace [LANGUAGE] meta-tag with view language + LLStringUtil::format_map_t replace; + + // viewer language + replace[ "[LANGUAGE]" ] = LLUI::getLanguage(); + + // flag that specific amount requested + replace[ "[SPECIFIC_AMOUNT]" ] = ( mSpecificSumRequested ? "y":"n" ); + + // amount requested + std::ostringstream codec( "" ); + codec << mSum; + replace[ "[SUM]" ] = codec.str(); + + // users' current balance + codec.clear(); + codec.str( "" ); + codec << gStatusBar->getBalance(); + replace[ "[BAL]" ] = codec.str(); + + // message - "This cost L$x,xxx for example + replace[ "[MSG]" ] = LLURI::escape( mMessage ); + LLStringUtil::format( buy_currency_url, replace ); + + // kick off the navigation + mBrowser->navigateTo( buy_currency_url ); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event ) +{ + // placeholder for now - just in case we want to catch media events + if ( LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE == event ) + { + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting ) +{ + destroy(); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::setParams( bool specific_sum_requested, const std::string& message, S32 sum ) +{ + // save these away - used to construct URL later + mSpecificSumRequested = specific_sum_requested; + mMessage = message; + mSum = sum; +} diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h new file mode 100644 index 0000000000..daee5d6f75 --- /dev/null +++ b/indra/newview/llfloaterbuycurrencyhtml.h @@ -0,0 +1,65 @@ +/** + * @file llfloaterbuycurrencyhtml.h + * @brief buy currency implemented in HTML floater - uses embedded media browser control + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERBUYCURRENCYHTML_H +#define LL_LLFLOATERBUYCURRENCYHTML_H + +#include "llfloater.h" +#include "llmediactrl.h" + +class LLFloaterBuyCurrencyHTML : + public LLFloater, + public LLViewerMediaObserver +{ + public: + LLFloaterBuyCurrencyHTML( const LLSD& key ); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onClose( bool app_quitting ); + + // inherited from LLViewerMediaObserver + /*virtual*/ void handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event ); + + // allow our controlling parent to tell us paramters + void setParams( bool specific_sum_requested, const std::string& message, S32 sum ); + + // parse and construct URL and set browser to navigate there. + void navigateToFinalURL(); + + private: + LLMediaCtrl* mBrowser; + bool mSpecificSumRequested; + std::string mMessage; + S32 mSum; +}; + +#endif // LL_LLFLOATERBUYCURRENCYHTML_H diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index de16f9d343..39ade40967 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -48,7 +48,7 @@ #include "llagent.h" #include "llavataractions.h" #include "llcallbacklist.h" -#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llfloaterreg.h" #include "llinventorybridge.h" #include "llinventorydefines.h" @@ -616,7 +616,7 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio { LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", price); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_costs", args), price); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_costs", args), price ); } else { diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 1a1650c38b..c8abcc83c4 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -50,7 +50,7 @@ #include "llagentui.h" #include "llappviewer.h" #include "llcallbacklist.h" -#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llstatusbar.h" #include "llviewercontrol.h" #include "llviewerparcelmgr.h" @@ -573,7 +573,7 @@ void LLPanelPlaceProfile::onForSaleBannerClick() { LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", price); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("buying_selected_land", args), price); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("buying_selected_land", args), price ); } else { diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index b660a2b8ea..5628205dd4 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -41,6 +41,7 @@ #include "llcommandhandler.h" #include "llviewercontrol.h" #include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llfloaterlagmeter.h" #include "llpanelnearbymedia.h" #include "llpanelvolumepulldown.h" @@ -509,7 +510,9 @@ S32 LLStatusBar::getSquareMetersLeft() const void LLStatusBar::onClickBuyCurrency() { - LLFloaterBuyCurrency::buyCurrency(); + // open a currency floater - actual one open depends on + // value specified in settings.xml + LLBuyCurrencyHTML::openCurrencyFloater(); } static void onClickHealth(void* ) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 506cebfe73..49ea0348f9 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -49,6 +49,7 @@ #include "llfloaterbuy.h" #include "llfloaterbuycontents.h" #include "llfloaterbuycurrency.h" +#include "llfloaterbuycurrencyhtml.h" #include "llfloaterbuyland.h" #include "llfloaterbulkpermission.h" #include "llfloaterbump.h" @@ -141,6 +142,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater); + LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater); LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4bfb87343c..10ceab2656 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -53,7 +53,7 @@ //#include "llfirstuse.h" #include "llfloaterbuy.h" #include "llfloaterbuycontents.h" -#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llfloatercustomize.h" #include "llfloatergodtools.h" #include "llfloaterinventory.h" @@ -3288,7 +3288,7 @@ void handle_buy_object(LLSaleInfo sale_info) { LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", price); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs", args), price); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_object_costs", args), price ); return; } @@ -4430,8 +4430,7 @@ void handle_buy_or_take() { LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", total_price); - LLFloaterBuyCurrency::buyCurrency( - LLTrans::getString("BuyingCosts", args), total_price); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString( "BuyingCosts", args ), total_price ); } } else @@ -5631,7 +5630,7 @@ void handle_report_abuse() void handle_buy_currency() { - LLFloaterBuyCurrency::buyCurrency(); + LLBuyCurrencyHTML::openCurrencyFloater(); } class LLFloaterVisible : public view_listener_t diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index c415d89e9c..5570fe5fec 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -39,7 +39,7 @@ #include "llagentcamera.h" #include "llfilepicker.h" #include "llfloaterreg.h" -#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llfloatersnapshot.h" #include "llimage.h" #include "llimagebmp.h" @@ -811,7 +811,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt LLStringUtil::format_map_t args; args["NAME"] = data->mAssetInfo.getName(); args["AMOUNT"] = llformat("%d", expected_upload_cost); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("UploadingCosts", args), expected_upload_cost); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); is_balance_sufficient = FALSE; } else if(region) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5b0b603d63..5836aff4e7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -55,8 +55,7 @@ #include "llagent.h" #include "llagentcamera.h" #include "llcallingcard.h" -//#include "llfirstuse.h" -#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" #include "llfloaterbuyland.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" @@ -283,7 +282,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_ { LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", amount); - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving", args), amount); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount ); } } diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml new file mode 100644 index 0000000000..ab44082070 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml @@ -0,0 +1,27 @@ + + + + http://user.lindenlab.com/~callum/ez/index.php?lang=[LANGUAGE]&sa=[SPECIFIC_AMOUNT]&sum=[SUM]&msg=[MSG]&bal=[BAL] + + + -- cgit v1.2.3 From 9add3aa8cb60b925fcc50e333ac7d5afd5522df1 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Fri, 21 May 2010 15:27:27 -0700 Subject: Fixed Windows line endings that crept in --- indra/newview/llbuycurrencyhtml.cpp | 330 ++++++++++++++--------------- indra/newview/llbuycurrencyhtml.h | 114 +++++----- indra/newview/llfloaterbuycurrencyhtml.cpp | 238 ++++++++++----------- indra/newview/llfloaterbuycurrencyhtml.h | 130 ++++++------ 4 files changed, 406 insertions(+), 406 deletions(-) diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp index cb06f487e6..163829a1ea 100644 --- a/indra/newview/llbuycurrencyhtml.cpp +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -1,165 +1,165 @@ -/** - * @file llbuycurrencyhtml.cpp - * @brief Manages Buy Currency HTML floater - * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2006-2010, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterbuycurrency.h" -#include "llbuycurrencyhtml.h" -#include "llfloaterbuycurrencyhtml.h" - -#include "llfloaterreg.h" -#include "llcommandhandler.h" -#include "llviewercontrol.h" - -// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps -class LLBuyCurrencyHTMLHandler : - public LLCommandHandler -{ -public: - // requests will be throttled from a non-trusted browser - LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_ALLOW ) {} - - bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) - { - std::string action( "" ); - if ( params.size() >= 1 ) - { - action = params[ 0 ].asString(); - }; - - std::string next_action( "" ); - if ( params.size() >= 2 ) - { - next_action = params[ 1 ].asString(); - }; - - int result_code = 0; - if ( params.size() >= 3 ) - { - result_code = params[ 2 ].asInteger(); - }; - - // open the legacy XUI based currency floater - if ( "open_legacy" == next_action ) - { - LLFloaterBuyCurrency::buyCurrency(); - }; - - // ask the Buy Currency floater to close - // note: this is the last thing we can do so make - // sure any other actions are processed before this. - if ( "close" == action ) - { - LLBuyCurrencyHTML::closeDialog(); - }; - - return true; - }; -}; -LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler; - -//////////////////////////////////////////////////////////////////////////////// -// static -// Opens the legacy XUI based floater or new HTML based one based on -// the QuickBuyCurrency value in settings.xml - this overload is for -// the case where the amount is not requested. -void LLBuyCurrencyHTML::openCurrencyFloater() -{ - if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) - { - // HTML version - LLBuyCurrencyHTML::showDialog( false, "", 0 ); - } - else - { - // legacy version - LLFloaterBuyCurrency::buyCurrency(); - }; -} - -//////////////////////////////////////////////////////////////////////////////// -// static -// Opens the legacy XUI based floater or new HTML based one based on -// the QuickBuyCurrency value in settings.xml - this overload is for -// the case where the amount and a string to display are requested. -void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum ) -{ - if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) - { - // HTML version - LLBuyCurrencyHTML::showDialog( true, message, sum ); - } - else - { - // legacy version - LLFloaterBuyCurrency::buyCurrency( message, sum ); - }; -} - -//////////////////////////////////////////////////////////////////////////////// -// static -void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::string& message, S32 sum ) -{ - LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >( LLFloaterReg::getInstance( "buy_currency_html" ) ); - if ( buy_currency_floater ) - { - // pass on flag indicating if we want to buy specific amount and if so, how much - buy_currency_floater->setParams( specific_sum_requested, message, sum ); - - // force navigate to new URL - buy_currency_floater->navigateToFinalURL(); - - // make it visible and raise to front - BOOL visible = TRUE; - buy_currency_floater->setVisible( visible ); - BOOL take_focus = TRUE; - buy_currency_floater->setFrontmost( take_focus ); - - // spec calls for floater to be centered on client window - buy_currency_floater->center(); - } - else - { - llwarns << "Buy Currency (HTML) Floater not found" << llendl; - }; -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLBuyCurrencyHTML::closeDialog() -{ - LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >(LLFloaterReg::getInstance( "buy_currency_html" ) ); - if ( buy_currency_floater ) - { - buy_currency_floater->closeFloater(); - }; -} +/** + * @file llbuycurrencyhtml.cpp + * @brief Manages Buy Currency HTML floater + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterbuycurrency.h" +#include "llbuycurrencyhtml.h" +#include "llfloaterbuycurrencyhtml.h" + +#include "llfloaterreg.h" +#include "llcommandhandler.h" +#include "llviewercontrol.h" + +// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps +class LLBuyCurrencyHTMLHandler : + public LLCommandHandler +{ +public: + // requests will be throttled from a non-trusted browser + LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_ALLOW ) {} + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + std::string action( "" ); + if ( params.size() >= 1 ) + { + action = params[ 0 ].asString(); + }; + + std::string next_action( "" ); + if ( params.size() >= 2 ) + { + next_action = params[ 1 ].asString(); + }; + + int result_code = 0; + if ( params.size() >= 3 ) + { + result_code = params[ 2 ].asInteger(); + }; + + // open the legacy XUI based currency floater + if ( "open_legacy" == next_action ) + { + LLFloaterBuyCurrency::buyCurrency(); + }; + + // ask the Buy Currency floater to close + // note: this is the last thing we can do so make + // sure any other actions are processed before this. + if ( "close" == action ) + { + LLBuyCurrencyHTML::closeDialog(); + }; + + return true; + }; +}; +LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler; + +//////////////////////////////////////////////////////////////////////////////// +// static +// Opens the legacy XUI based floater or new HTML based one based on +// the QuickBuyCurrency value in settings.xml - this overload is for +// the case where the amount is not requested. +void LLBuyCurrencyHTML::openCurrencyFloater() +{ + if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) + { + // HTML version + LLBuyCurrencyHTML::showDialog( false, "", 0 ); + } + else + { + // legacy version + LLFloaterBuyCurrency::buyCurrency(); + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// static +// Opens the legacy XUI based floater or new HTML based one based on +// the QuickBuyCurrency value in settings.xml - this overload is for +// the case where the amount and a string to display are requested. +void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum ) +{ + if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) + { + // HTML version + LLBuyCurrencyHTML::showDialog( true, message, sum ); + } + else + { + // legacy version + LLFloaterBuyCurrency::buyCurrency( message, sum ); + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// static +void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::string& message, S32 sum ) +{ + LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >( LLFloaterReg::getInstance( "buy_currency_html" ) ); + if ( buy_currency_floater ) + { + // pass on flag indicating if we want to buy specific amount and if so, how much + buy_currency_floater->setParams( specific_sum_requested, message, sum ); + + // force navigate to new URL + buy_currency_floater->navigateToFinalURL(); + + // make it visible and raise to front + BOOL visible = TRUE; + buy_currency_floater->setVisible( visible ); + BOOL take_focus = TRUE; + buy_currency_floater->setFrontmost( take_focus ); + + // spec calls for floater to be centered on client window + buy_currency_floater->center(); + } + else + { + llwarns << "Buy Currency (HTML) Floater not found" << llendl; + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLBuyCurrencyHTML::closeDialog() +{ + LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >(LLFloaterReg::getInstance( "buy_currency_html" ) ); + if ( buy_currency_floater ) + { + buy_currency_floater->closeFloater(); + }; +} diff --git a/indra/newview/llbuycurrencyhtml.h b/indra/newview/llbuycurrencyhtml.h index dbb2281343..3435bb0451 100644 --- a/indra/newview/llbuycurrencyhtml.h +++ b/indra/newview/llbuycurrencyhtml.h @@ -1,57 +1,57 @@ -/** - * @file llbuycurrencyhtml.h - * @brief Manages Buy Currency HTML floater - * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2006-2010, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLBUYCURRENCYHTML_H -#define LL_LLBUYCURRENCYHTML_H - -#include "llsingleton.h" - -class LLFloaterBuyCurrencyHTML; - -class LLBuyCurrencyHTML -{ - public: - // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is not required - static void openCurrencyFloater(); - - // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is required - static void openCurrencyFloater( const std::string& message, S32 sum ); - - // show and give focus to actual currency floater - this is used for both cases - // where the sum is required and where it is not - static void showDialog( bool specific_sum_requested, const std::string& message, S32 sum ); - - // close (and destroy) the currency floater - static void closeDialog(); -}; - -#endif // LL_LLBUYCURRENCYHTML_H +/** + * @file llbuycurrencyhtml.h + * @brief Manages Buy Currency HTML floater + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLBUYCURRENCYHTML_H +#define LL_LLBUYCURRENCYHTML_H + +#include "llsingleton.h" + +class LLFloaterBuyCurrencyHTML; + +class LLBuyCurrencyHTML +{ + public: + // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is not required + static void openCurrencyFloater(); + + // choke point for opening a legacy or new currency floater - this overload is when the L$ sum is required + static void openCurrencyFloater( const std::string& message, S32 sum ); + + // show and give focus to actual currency floater - this is used for both cases + // where the sum is required and where it is not + static void showDialog( bool specific_sum_requested, const std::string& message, S32 sum ); + + // close (and destroy) the currency floater + static void closeDialog(); +}; + +#endif // LL_LLBUYCURRENCYHTML_H diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp index e4be706ac4..5815df36d1 100644 --- a/indra/newview/llfloaterbuycurrencyhtml.cpp +++ b/indra/newview/llfloaterbuycurrencyhtml.cpp @@ -1,119 +1,119 @@ -/** - * @file llfloaterbuycurrencyhtml.cpp - * @brief buy currency implemented in HTML floater - uses embedded media browser control - * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2006-2010, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterbuycurrencyhtml.h" -#include "llstatusbar.h" - -//////////////////////////////////////////////////////////////////////////////// -// -LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ): - LLFloater( key ), - mSpecificSumRequested( false ), - mMessage( "" ), - mSum( 0 ) -{ -} - -//////////////////////////////////////////////////////////////////////////////// -// -BOOL LLFloaterBuyCurrencyHTML::postBuild() -{ - // observer media events - mBrowser = getChild( "browser" ); - mBrowser->addObserver( this ); - - return TRUE; -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLFloaterBuyCurrencyHTML::navigateToFinalURL() -{ - // URL for actual currency buy contents is in XUI file - std::string buy_currency_url = getString( "buy_currency_url" ); - - // replace [LANGUAGE] meta-tag with view language - LLStringUtil::format_map_t replace; - - // viewer language - replace[ "[LANGUAGE]" ] = LLUI::getLanguage(); - - // flag that specific amount requested - replace[ "[SPECIFIC_AMOUNT]" ] = ( mSpecificSumRequested ? "y":"n" ); - - // amount requested - std::ostringstream codec( "" ); - codec << mSum; - replace[ "[SUM]" ] = codec.str(); - - // users' current balance - codec.clear(); - codec.str( "" ); - codec << gStatusBar->getBalance(); - replace[ "[BAL]" ] = codec.str(); - - // message - "This cost L$x,xxx for example - replace[ "[MSG]" ] = LLURI::escape( mMessage ); - LLStringUtil::format( buy_currency_url, replace ); - - // kick off the navigation - mBrowser->navigateTo( buy_currency_url ); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLFloaterBuyCurrencyHTML::handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event ) -{ - // placeholder for now - just in case we want to catch media events - if ( LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE == event ) - { - }; -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting ) -{ - destroy(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLFloaterBuyCurrencyHTML::setParams( bool specific_sum_requested, const std::string& message, S32 sum ) -{ - // save these away - used to construct URL later - mSpecificSumRequested = specific_sum_requested; - mMessage = message; - mSum = sum; -} +/** + * @file llfloaterbuycurrencyhtml.cpp + * @brief buy currency implemented in HTML floater - uses embedded media browser control + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterbuycurrencyhtml.h" +#include "llstatusbar.h" + +//////////////////////////////////////////////////////////////////////////////// +// +LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ): + LLFloater( key ), + mSpecificSumRequested( false ), + mMessage( "" ), + mSum( 0 ) +{ +} + +//////////////////////////////////////////////////////////////////////////////// +// +BOOL LLFloaterBuyCurrencyHTML::postBuild() +{ + // observer media events + mBrowser = getChild( "browser" ); + mBrowser->addObserver( this ); + + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::navigateToFinalURL() +{ + // URL for actual currency buy contents is in XUI file + std::string buy_currency_url = getString( "buy_currency_url" ); + + // replace [LANGUAGE] meta-tag with view language + LLStringUtil::format_map_t replace; + + // viewer language + replace[ "[LANGUAGE]" ] = LLUI::getLanguage(); + + // flag that specific amount requested + replace[ "[SPECIFIC_AMOUNT]" ] = ( mSpecificSumRequested ? "y":"n" ); + + // amount requested + std::ostringstream codec( "" ); + codec << mSum; + replace[ "[SUM]" ] = codec.str(); + + // users' current balance + codec.clear(); + codec.str( "" ); + codec << gStatusBar->getBalance(); + replace[ "[BAL]" ] = codec.str(); + + // message - "This cost L$x,xxx for example + replace[ "[MSG]" ] = LLURI::escape( mMessage ); + LLStringUtil::format( buy_currency_url, replace ); + + // kick off the navigation + mBrowser->navigateTo( buy_currency_url ); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event ) +{ + // placeholder for now - just in case we want to catch media events + if ( LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE == event ) + { + }; +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting ) +{ + destroy(); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterBuyCurrencyHTML::setParams( bool specific_sum_requested, const std::string& message, S32 sum ) +{ + // save these away - used to construct URL later + mSpecificSumRequested = specific_sum_requested; + mMessage = message; + mSum = sum; +} diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h index daee5d6f75..be7a4d3dd6 100644 --- a/indra/newview/llfloaterbuycurrencyhtml.h +++ b/indra/newview/llfloaterbuycurrencyhtml.h @@ -1,65 +1,65 @@ -/** - * @file llfloaterbuycurrencyhtml.h - * @brief buy currency implemented in HTML floater - uses embedded media browser control - * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2006-2010, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERBUYCURRENCYHTML_H -#define LL_LLFLOATERBUYCURRENCYHTML_H - -#include "llfloater.h" -#include "llmediactrl.h" - -class LLFloaterBuyCurrencyHTML : - public LLFloater, - public LLViewerMediaObserver -{ - public: - LLFloaterBuyCurrencyHTML( const LLSD& key ); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose( bool app_quitting ); - - // inherited from LLViewerMediaObserver - /*virtual*/ void handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event ); - - // allow our controlling parent to tell us paramters - void setParams( bool specific_sum_requested, const std::string& message, S32 sum ); - - // parse and construct URL and set browser to navigate there. - void navigateToFinalURL(); - - private: - LLMediaCtrl* mBrowser; - bool mSpecificSumRequested; - std::string mMessage; - S32 mSum; -}; - -#endif // LL_LLFLOATERBUYCURRENCYHTML_H +/** + * @file llfloaterbuycurrencyhtml.h + * @brief buy currency implemented in HTML floater - uses embedded media browser control + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2006-2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERBUYCURRENCYHTML_H +#define LL_LLFLOATERBUYCURRENCYHTML_H + +#include "llfloater.h" +#include "llmediactrl.h" + +class LLFloaterBuyCurrencyHTML : + public LLFloater, + public LLViewerMediaObserver +{ + public: + LLFloaterBuyCurrencyHTML( const LLSD& key ); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onClose( bool app_quitting ); + + // inherited from LLViewerMediaObserver + /*virtual*/ void handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event ); + + // allow our controlling parent to tell us paramters + void setParams( bool specific_sum_requested, const std::string& message, S32 sum ); + + // parse and construct URL and set browser to navigate there. + void navigateToFinalURL(); + + private: + LLMediaCtrl* mBrowser; + bool mSpecificSumRequested; + std::string mMessage; + S32 mSum; +}; + +#endif // LL_LLFLOATERBUYCURRENCYHTML_H -- cgit v1.2.3 From 79f697ad513525893fe9ebab62bf2a61186342ec Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 21 May 2010 15:36:12 -0700 Subject: Fix for EXT-5667 (support window.open() in shared media so google docs will work). Moved the processing of clicks on _external and _blank targeted links from LLMediaCtrl to LLViewerMediaImpl. Removed LLMediaCtrl::setOpenInExternalBrowser() since that functionality is available through the use of the _external target attribute in web content. Removed LLMediaCtrl:: setOpenInInternalBrowser() since it was unimplemented and not used. Made the webkit media plugin set llqtwebkit's window open behavior to WOB_SIMULATE_BLANK_HREF_CLICK. This is #ifdefed out on Linux until we get a new Linux build of llqtwebkit. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 8 +- indra/newview/llfloaterhud.cpp | 3 - indra/newview/llmediactrl.cpp | 106 --------------------- indra/newview/llmediactrl.h | 9 -- indra/newview/llpanellogin.cpp | 16 +--- indra/newview/llviewermedia.cpp | 61 ++++++++++++ indra/newview/llviewermedia.h | 2 + 7 files changed, 71 insertions(+), 134 deletions(-) diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 47766a24cb..0cd6e48d14 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -297,11 +297,17 @@ private: // append details to agent string LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); + // TODO: Remove this ifdef when the Linux version of llqtwebkit gets updated with the new WOB constant. +#if !LL_LINUX + // Set up window open behavior + LLQtWebKit::getInstance()->setWindowOpenBehavior(mBrowserWindowId, LLQtWebKit::WOB_SIMULATE_BLANK_HREF_CLICK); +#endif + #if !LL_QTWEBKIT_USES_PIXMAPS // don't flip bitmap LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true ); #endif // !LL_QTWEBKIT_USES_PIXMAPS - + // set background color // convert background color channels from [0.0, 1.0] to [0, 255]; LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) ); diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index d2ee3e44c5..930bbe9e6b 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -79,9 +79,6 @@ BOOL LLFloaterHUD::postBuild() mWebBrowser = getChild("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). diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 05cb6ddc4a..7a4ed74c4c 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -78,8 +78,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mBorder(NULL), mFrequentUpdates( true ), mForceUpdate( false ), - mOpenLinksInExternalBrowser( false ), - mOpenLinksInInternalBrowser( false ), mHomePageUrl( "" ), mTrusted(false), mIgnoreUIScale( true ), @@ -166,20 +164,6 @@ void LLMediaCtrl::setTakeFocusOnClick( bool take_focus ) mTakeFocusOnClick = take_focus; } -//////////////////////////////////////////////////////////////////////////////// -// set flag that forces the embedded browser to open links in the external system browser -void LLMediaCtrl::setOpenInExternalBrowser( bool valIn ) -{ - mOpenLinksInExternalBrowser = valIn; -}; - -//////////////////////////////////////////////////////////////////////////////// -// set flag that forces the embedded browser to open links in the internal browser floater -void LLMediaCtrl::setOpenInInternalBrowser( bool valIn ) -{ - mOpenLinksInInternalBrowser = valIn; -}; - //////////////////////////////////////////////////////////////////////////////// void LLMediaCtrl::setTrusted( bool valIn ) { @@ -944,7 +928,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) case MEDIA_EVENT_CLICK_LINK_HREF: { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL; - onClickLinkHref(self); }; break; @@ -977,95 +960,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) emitEvent(self, event); } -//////////////////////////////////////////////////////////////////////////////// -// -void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self ) -{ - // retrieve the event parameters - std::string url = self->getClickURL(); - U32 target_type = self->getClickTargetType(); - - // is there is a target specified for the link? - if (target_type == LLPluginClassMedia::TARGET_EXTERNAL || - target_type == LLPluginClassMedia::TARGET_BLANK ) - { - if (gSavedSettings.getBOOL("UseExternalBrowser")) - { - LLSD payload; - payload["url"] = url; - payload["target_type"] = LLSD::Integer(target_type); - LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget); - } - else - { - clickLinkWithTarget(url, target_type); - } - } - else { - const std::string protocol1( "http://" ); - const std::string protocol2( "https://" ); - if( mOpenLinksInExternalBrowser ) - { - if ( !url.empty() ) - { - if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 || - LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 ) - { - LLWeb::loadURLExternal( url ); - } - } - } - else - if( mOpenLinksInInternalBrowser ) - { - if ( !url.empty() ) - { - if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 || - LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 ) - { - llwarns << "Dead, unimplemented path that we used to send to the built-in browser long ago." << llendl; - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// static -bool LLMediaCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response ) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( 0 == option ) - { - LLSD payload = notification["payload"]; - std::string url = payload["url"].asString(); - S32 target_type = payload["target_type"].asInteger(); - clickLinkWithTarget(url, target_type); - } - return false; -} - - -//////////////////////////////////////////////////////////////////////////////// -// static -void LLMediaCtrl::clickLinkWithTarget(const std::string& url, const S32& target_type ) -{ - if (target_type == LLPluginClassMedia::TARGET_EXTERNAL) - { - // load target in an external browser - LLWeb::loadURLExternal(url); - } - else if (target_type == LLPluginClassMedia::TARGET_BLANK) - { - // load target in the user's preferred browser - LLWeb::loadURL(url); - } - else { - // unsupported link target - shouldn't happen - LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL; - } -} - //////////////////////////////////////////////////////////////////////////////// // std::string LLMediaCtrl::getCurrentNavUrl() diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index e55d2f7cd0..310492fe02 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -99,8 +99,6 @@ public: void navigateToLocalPage( const std::string& subdir, const std::string& filename_in ); bool canNavigateBack(); bool canNavigateForward(); - void setOpenInExternalBrowser( bool valIn ); - void setOpenInInternalBrowser( bool valIn ); std::string getCurrentNavUrl(); // By default, we do not handle "secondlife:///app/" SLURLs, because @@ -162,24 +160,17 @@ public: // Incoming media event dispatcher virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); - // handlers for individual events (could be done inside the switch in handleMediaEvent, they're just individual functions for clarity) - void onClickLinkHref( LLPluginClassMedia* self ); - protected: void convertInputCoords(S32& x, S32& y); private: void onVisibilityChange ( const LLSD& new_visibility ); - static bool onClickLinkExternalTarget( const LLSD&, const LLSD& ); - static void clickLinkWithTarget(const std::string& url, const S32& target_type ); const S32 mTextureDepthBytes; LLUUID mMediaTextureID; LLViewBorder* mBorder; bool mFrequentUpdates; bool mForceUpdate; - bool mOpenLinksInExternalBrowser; - bool mOpenLinksInInternalBrowser; bool mTrusted; std::string mHomePageUrl; std::string mCurrentNavUrl; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 508a58e74f..0009f7203a 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -270,20 +270,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, web_browser->setTabStop(FALSE); // web_browser->navigateToLocalPage( "loading", "loading.html" ); - if (gSavedSettings.getBOOL("RegInClient")) - { - // need to follow links in the internal browser - web_browser->setOpenInExternalBrowser( false ); - - getChild("login_widgets")->setVisible(false); - } - else - { - // make links open in external browser - web_browser->setOpenInExternalBrowser( true ); - - reshapeBrowser(); - } + reshapeBrowser(); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); @@ -487,7 +474,6 @@ void LLPanelLogin::showLoginWidgets() { sInstance->childSetVisible("login_widgets", true); LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - web_browser->setOpenInExternalBrowser( true ); sInstance->reshapeBrowser(); // *TODO: Append all the usual login parameters, like first_login=Y etc. std::string splash_screen_url = sInstance->getString("real_url"); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 4db05e8a98..7429a49ccf 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2795,6 +2795,42 @@ bool LLViewerMediaImpl::isPlayable() const return false; } +//////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMediaImpl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response ) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( 0 == option ) + { + LLSD payload = notification["payload"]; + std::string url = payload["url"].asString(); + S32 target_type = payload["target_type"].asInteger(); + clickLinkWithTarget(url, target_type); + } + return false; +} + + +//////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMediaImpl::clickLinkWithTarget(const std::string& url, const S32& target_type ) +{ + if (target_type == LLPluginClassMedia::TARGET_EXTERNAL) + { + // load target in an external browser + LLWeb::loadURLExternal(url); + } + else if (target_type == LLPluginClassMedia::TARGET_BLANK) + { + // load target in the user's preferred browser + LLWeb::loadURL(url); + } + else { + // unsupported link target - shouldn't happen + LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL; + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent event) { @@ -2808,6 +2844,31 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla } break; + case MEDIA_EVENT_CLICK_LINK_HREF: + { + LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL; + // retrieve the event parameters + std::string url = plugin->getClickURL(); + U32 target_type = plugin->getClickTargetType(); + + // is there is a target specified for the link? + if (target_type == LLPluginClassMedia::TARGET_EXTERNAL || + target_type == LLPluginClassMedia::TARGET_BLANK ) + { + if (gSavedSettings.getBOOL("UseExternalBrowser")) + { + LLSD payload; + payload["url"] = url; + payload["target_type"] = LLSD::Integer(target_type); + LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget); + } + else + { + clickLinkWithTarget(url, target_type); + } + } + }; + break; case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH: { // The plugin failed to load properly. Make sure the timer doesn't retry. diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 8626f4469e..754d0851c3 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -391,6 +391,8 @@ private: bool shouldShowBasedOnClass() const; static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj); static bool isObjectInAgentParcel(LLVOVolume *obj); + static bool onClickLinkExternalTarget( const LLSD&, const LLSD& ); + static void clickLinkWithTarget(const std::string& url, const S32& target_type ); private: // a single media url with some data and an impl. -- cgit v1.2.3 From 81e6f6131bdc0d0c42dc9a21b7842c911f4dd81d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 21 May 2010 18:04:32 -0600 Subject: EXT-7394: FIXED: Trees have more polys at low detail than at high detail. --- indra/newview/lldrawpooltree.cpp | 15 +++++++++++---- indra/newview/llvotree.cpp | 38 ++++++++++++++++++++++---------------- indra/newview/llvotree.h | 1 + 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 1a5d55d793..1571415e63 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -113,9 +113,12 @@ void LLDrawPoolTree::render(S32 pass) iter != mDrawFace.end(); iter++) { LLFace *face = *iter; - face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); - face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); - gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()); + if(face->mVertexBuffer.notNull()) + { + face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); + face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); + gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()); + } } } } @@ -333,7 +336,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting) S32 stop_depth = 0; F32 app_angle = treep->getAppAngle()*LLVOTree::sTreeFactor; F32 alpha = 1.0; - S32 trunk_LOD = 0; + S32 trunk_LOD = LLVOTree::sMAX_NUM_TREE_LOD_LEVELS; for (S32 j = 0; j < 4; j++) { @@ -344,6 +347,10 @@ void LLDrawPoolTree::renderTree(BOOL selecting) break; } } + if(trunk_LOD >= LLVOTree::sMAX_NUM_TREE_LOD_LEVELS) + { + continue ; //do not render. + } if (app_angle < (THRESH_ANGLE_FOR_BILLBOARD - BLEND_RANGE_FOR_BILLBOARD)) { diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index b89c0cd638..eb5b6c6618 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -66,12 +66,14 @@ const F32 LEAF_TOP = 1.0f; const F32 LEAF_BOTTOM = 0.52f; const F32 LEAF_WIDTH = 1.f; -S32 LLVOTree::sLODVertexOffset[4]; -S32 LLVOTree::sLODVertexCount[4]; -S32 LLVOTree::sLODIndexOffset[4]; -S32 LLVOTree::sLODIndexCount[4]; -S32 LLVOTree::sLODSlices[4] = {10, 5, 4, 3}; -F32 LLVOTree::sLODAngles[4] = {30.f, 20.f, 15.f, 0.f}; +const S32 LLVOTree::sMAX_NUM_TREE_LOD_LEVELS = 4 ; + +S32 LLVOTree::sLODVertexOffset[sMAX_NUM_TREE_LOD_LEVELS]; +S32 LLVOTree::sLODVertexCount[sMAX_NUM_TREE_LOD_LEVELS]; +S32 LLVOTree::sLODIndexOffset[sMAX_NUM_TREE_LOD_LEVELS]; +S32 LLVOTree::sLODIndexCount[sMAX_NUM_TREE_LOD_LEVELS]; +S32 LLVOTree::sLODSlices[sMAX_NUM_TREE_LOD_LEVELS] = {10, 5, 4, 3}; +F32 LLVOTree::sLODAngles[sMAX_NUM_TREE_LOD_LEVELS] = {30.f, 20.f, 15.f, 0.00001f}; F32 LLVOTree::sTreeFactor = 1.f; @@ -373,12 +375,11 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } } - S32 trunk_LOD = 0; + S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor; - for (S32 j = 0; j < 4; j++) + for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++) { - if (app_angle > LLVOTree::sLODAngles[j]) { trunk_LOD = j; @@ -445,16 +446,15 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) // This should be the camera's center, as soon as we move to all region-local. LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent(); - F32 range = relative_position.length(); // ugh, square root + F32 range_squared = relative_position.lengthSquared() ; F32 max_scale = mBillboardScale * getMaxScale(); F32 area = max_scale * (max_scale*mBillboardRatio); // Compute pixels per meter at the given range - F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / - (tan(LLViewerCamera::getInstance()->getView()) * range); + F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / tan(LLViewerCamera::getInstance()->getView()); - mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area; + mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area / range_squared; #if 0 // mAppAngle is a bit of voodoo; // use the one calculated LLViewerObject::setPixelAreaAndAngle above @@ -506,6 +506,13 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) { LLFastTimer ftm(FTM_UPDATE_TREE); + if(mTrunkLOD >= sMAX_NUM_TREE_LOD_LEVELS) //do not display the tree. + { + mReferenceBuffer = NULL ; + mDrawable->getFace(0)->mVertexBuffer = NULL ; + return TRUE ; + } + if (mReferenceBuffer.isNull() || mDrawable->getFace(0)->mVertexBuffer.isNull()) { const F32 SRR3 = 0.577350269f; // sqrt(1/3) @@ -523,7 +530,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) face->mCenterAgent = getPositionAgent(); face->mCenterLocal = face->mCenterAgent; - for (lod = 0; lod < 4; lod++) + for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++) { slices = sLODSlices[lod]; sLODVertexOffset[lod] = max_vertices; @@ -700,7 +707,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) // Generate the vertices // Generate the indices - for (lod = 0; lod < 4; lod++) + for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++) { slices = sLODSlices[lod]; F32 base_radius = 0.65f; @@ -892,7 +899,6 @@ void LLVOTree::updateMesh() S32 stop_depth = 0; F32 alpha = 1.0; - U32 vert_count = 0; U32 index_count = 0; diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index feac9e0675..036ad692b1 100644 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -152,6 +152,7 @@ public: }; static F32 sTreeFactor; // Tree level of detail factor + static const S32 sMAX_NUM_TREE_LOD_LEVELS ; friend class LLDrawPoolTree; protected: -- cgit v1.2.3