diff options
| author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2026-08-10 20:56:05 +0300 |
|---|---|---|
| committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2026-09-04 14:44:29 +0300 |
| commit | 09cdedb147db175e38d08b9a6020b8bd3d07dc91 (patch) | |
| tree | 16a37f2c38416316e2e64f68c60de7f7a3540922 | |
| parent | 0c922b6351fa7c777077f9e3a1c7e0a84ef7200c (diff) | |
Replace LLFloaterBuyCurrencyHTML with new L$ packs web floater
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 24 | ||||
| -rw-r--r-- | indra/newview/llbuycurrencyhtml.cpp | 19 | ||||
| -rw-r--r-- | indra/newview/llbuycurrencyhtml.h | 6 | ||||
| -rw-r--r-- | indra/newview/llfloaterbuycurrencyhtml.cpp | 103 | ||||
| -rw-r--r-- | indra/newview/llfloaterbuycurrencyhtml.h | 39 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_buy_currency_html.xml | 17 |
6 files changed, 81 insertions, 127 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ad307f9648..459f8c1b42 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1172,6 +1172,28 @@ <key>Value</key> <integer>1</integer> </map> + <key>BuyCurrencyHTML</key> + <map> + <key>Comment</key> + <string>Use HTML based L$ packs floater instead of legacy XUI version</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>BuyCurrencyPacksURL</key> + <map> + <key>Comment</key> + <string>URL for the L$ packs purchase floater</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string>https://accounts.secondlife.com/packs/floater?lang=[LANGUAGE]&shortfall=[SHORTFALL]</string> + </map> <key>EnableButtonFlashing</key> <map> <key>Comment</key> @@ -7182,7 +7204,7 @@ <key>QuickBuyCurrency</key> <map> <key>Comment</key> - <string>Toggle between HTML based currency purchase floater and legacy XUI version</string> + <string>(Deprecated) Use BuyCurrencyHTML instead</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp index e6c4d44573..8469eaa6ff 100644 --- a/indra/newview/llbuycurrencyhtml.cpp +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -89,14 +89,14 @@ 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 BuyCurrencyHTML value in settings.xml - this overload is for // the case where the amount is not requested. void LLBuyCurrencyHTML::openCurrencyFloater() { - if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) ) + if ( gSavedSettings.getBOOL( "BuyCurrencyHTML" ) ) { // HTML version - LLBuyCurrencyHTML::showDialog( false, "", 0 ); + LLBuyCurrencyHTML::showDialog(); } else { @@ -108,14 +108,13 @@ void LLBuyCurrencyHTML::openCurrencyFloater() //////////////////////////////////////////////////////////////////////////////// // 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 BuyCurrencyHTML 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" ) ) + if ( gSavedSettings.getBOOL( "BuyCurrencyHTML" ) ) { - // HTML version - LLBuyCurrencyHTML::showDialog( true, message, sum ); + LLBuyCurrencyHTML::showDialog(sum - gStatusBar->getBalance()); } else { @@ -126,13 +125,13 @@ void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum //////////////////////////////////////////////////////////////////////////////// // static -void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::string& message, S32 sum ) +void LLBuyCurrencyHTML::showDialog(S32 shortfall) { 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 ); + buy_currency_floater->setShortfall(shortfall); // force navigate to new URL buy_currency_floater->navigateToFinalURL(); @@ -144,7 +143,7 @@ void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::stri buy_currency_floater->setFrontmost( take_focus ); // spec calls for floater to be centered on client window - buy_currency_floater->center(); + //buy_currency_floater->center(); } else { diff --git a/indra/newview/llbuycurrencyhtml.h b/indra/newview/llbuycurrencyhtml.h index 5e3d30dcd0..54ee82159d 100644 --- a/indra/newview/llbuycurrencyhtml.h +++ b/indra/newview/llbuycurrencyhtml.h @@ -29,8 +29,6 @@ #include "llsingleton.h" -class LLFloaterBuyCurrencyHTML; - class LLBuyCurrencyHTML { public: @@ -41,8 +39,8 @@ class LLBuyCurrencyHTML 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 ); + // where the shortfall is required and where it is not + static void showDialog( S32 shortfall = 0 ); // close (and destroy) the currency floater static void closeDialog(); diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp index d3712869b0..24ec43e7e4 100644 --- a/indra/newview/llfloaterbuycurrencyhtml.cpp +++ b/indra/newview/llfloaterbuycurrencyhtml.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2026, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,97 +27,46 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterbuycurrencyhtml.h" -#include "llhttpconstants.h" -#include "llstatusbar.h" +#include "llmediactrl.h" +#include "llviewercontrol.h" +#include "llweb.h" -//////////////////////////////////////////////////////////////////////////////// -// -LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ): - LLFloater( key ), - mSpecificSumRequested( false ), - mMessage( "" ), - mSum( 0 ) + +LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML(const LLSD& key) + : LLFloater(key), + mBrowser(nullptr) { } -//////////////////////////////////////////////////////////////////////////////// -// -bool LLFloaterBuyCurrencyHTML::postBuild() +LLFloaterBuyCurrencyHTML::~LLFloaterBuyCurrencyHTML() { - // observer media events - mBrowser = getChild<LLMediaCtrl>( "browser" ); - mBrowser->addObserver( this ); +} +bool LLFloaterBuyCurrencyHTML::postBuild() +{ + mBrowser = getChild<LLMediaCtrl>("browser"); + mBrowser->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL")); + LLViewerMedia::getInstance()->getOpenIDCookie(mBrowser); return true; } -//////////////////////////////////////////////////////////////////////////////// -// void LLFloaterBuyCurrencyHTML::navigateToFinalURL() { - // URL for actual currency buy contents is in XUI file - std::string buy_currency_url = getString( "buy_currency_url" ); + std::string buy_currency_url = gSavedSettings.getString("BuyCurrencyPacksURL"); - // 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 ); - - // write final URL to debug console - LL_INFOS() << "Buy currency HTML parsed URL is " << buy_currency_url << LL_ENDL; - - // kick off the navigation - mBrowser->navigateTo( buy_currency_url, HTTP_CONTENT_TEXT_HTML ); -} - -//////////////////////////////////////////////////////////////////////////////// -// -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 ) + replace["[LANGUAGE]"] = LLUI::getLanguage(); + if (mShortfall > 0) { - // update currency after we complete a navigation since there are many ways - // this can result in a different L$ balance - LLStatusBar::sendMoneyBalanceRequest(); - }; -} + replace["[SHORTFALL]"] = std::to_string(mShortfall); + } -//////////////////////////////////////////////////////////////////////////////// -// -void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting ) -{ - // Update L$ balance one more time - LLStatusBar::sendMoneyBalanceRequest(); + LLStringUtil::format(buy_currency_url, replace); - destroy(); -} + if (mShortfall <= 0) + { + LLStringUtil::replaceString(buy_currency_url, "&shortfall=[SHORTFALL]", ""); + } -//////////////////////////////////////////////////////////////////////////////// -// -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; + mBrowser->navigateTo(buy_currency_url, HTTP_CONTENT_TEXT_HTML); } diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h index 23a29cae4c..e8dbd0a716 100644 --- a/indra/newview/llfloaterbuycurrencyhtml.h +++ b/indra/newview/llfloaterbuycurrencyhtml.h @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2026, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,36 +24,25 @@ * $/LicenseInfo$ */ -#ifndef LL_LLFLOATERBUYCURRENCYHTML_H -#define LL_LLFLOATERBUYCURRENCYHTML_H +#pragma once #include "llfloater.h" #include "llmediactrl.h" -class LLFloaterBuyCurrencyHTML : - public LLFloater, - public LLViewerMediaObserver +class LLFloaterBuyCurrencyHTML: + public LLFloater { - public: - LLFloaterBuyCurrencyHTML( const LLSD& key ); + friend class LLFloaterReg; - /*virtual*/ bool postBuild(); - /*virtual*/ void onClose( bool app_quitting ); +public: + LLFloaterBuyCurrencyHTML(const LLSD& key); + ~LLFloaterBuyCurrencyHTML(); + bool postBuild() override; + void navigateToFinalURL(); + void setShortfall(S32 shortfall) { mShortfall = shortfall; } - // 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; +private: + LLMediaCtrl* mBrowser; + S32 mShortfall{0}; }; -#endif // LL_LLFLOATERBUYCURRENCYHTML_H 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 index 996937cd45..782d45120b 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml @@ -1,20 +1,17 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <floater - can_resize="false" + can_resize="true" + can_minimize="false" can_close="true" - width="422" - height="202" + min_width="360" + min_height="400" + width="450" + height="650" layout="topleft" name="floater_buy_currency_html" - help_topic="floater_buy_currency_html" save_rect="true" single_instance="true" - title="BUY CURRENCY" -> - <floater.string - name="buy_currency_url" translate="false"> - https://quick-buy.secondlife.com/[LANGUAGE]/display/?sa=[SPECIFIC_AMOUNT]&sum=[SUM]&msg=[MSG]&bal=[BAL] - </floater.string> + title="BUY L$"> <web_browser trusted_content="true" follows="all" |
