diff options
Diffstat (limited to 'indra')
19 files changed, 434 insertions, 17 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 6a7075301b..8d522cd2e3 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -77,6 +77,7 @@ LLNotificationForm::FormButton::FormButton() text("text"), ignore("ignore"), is_default("default"), + width("width", 0), type("type") { // set type here so it gets serialized diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index cac687f53d..048f07de9e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -191,6 +191,7 @@ public: Mandatory<std::string> text; Optional<std::string> ignore; Optional<bool> is_default; + Optional<S32> width; Mandatory<std::string> type; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 88667bdc11..8bb5126b91 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -209,6 +209,7 @@ set(viewer_SOURCE_FILES llflexibleobject.cpp llfloaterabout.cpp llfloaterbvhpreview.cpp + llfloateraddpaymentmethod.cpp llfloaterauction.cpp llfloaterautoreplacesettings.cpp llfloateravatar.cpp @@ -839,6 +840,7 @@ set(viewer_HEADER_FILES llflexibleobject.h llfloaterabout.h llfloaterbvhpreview.h + llfloateraddpaymentmethod.h llfloaterauction.h llfloaterautoreplacesettings.h llfloateravatar.h diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 856eb3414e..f41eb3daf4 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -253,6 +253,19 @@ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_ return LLTrans::getString(payment_text); } +//static +bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avatar_data) +{ + // Special accounts like M Linden don't have payment info revealed. + if (!avatar_data->caption_text.empty()) return true; + + // Linden employees don't have payment info revealed + const S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true; + + return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED)); +} + void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) { LLAvatarData avatar_data; diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index d5c5c75c69..b063048c26 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -232,6 +232,8 @@ public: // Used for profiles, inspectors. static std::string paymentInfo(const LLAvatarData* avatar_data); + static bool hasPaymentInfoOnFile(const LLAvatarData* avatar_data); + static void processAvatarPropertiesReply(LLMessageSystem* msg, void**); static void processAvatarInterestsReply(LLMessageSystem* msg, void**); diff --git a/indra/newview/llfloateraddpaymentmethod.cpp b/indra/newview/llfloateraddpaymentmethod.cpp new file mode 100644 index 0000000000..3952b48229 --- /dev/null +++ b/indra/newview/llfloateraddpaymentmethod.cpp @@ -0,0 +1,81 @@ +/** + * @file llfloateraddpaymentmethod.cpp + * @brief LLFloaterAddPaymentMethod class implementation + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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 + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloateraddpaymentmethod.h" +#include "llnotificationsutil.h" +#include "lluictrlfactory.h" +#include "llweb.h" + + +LLFloaterAddPaymentMethod::LLFloaterAddPaymentMethod(const LLSD& key) + : LLFloater(key) +{ +} + +LLFloaterAddPaymentMethod::~LLFloaterAddPaymentMethod() +{ +} + +BOOL LLFloaterAddPaymentMethod::postBuild() +{ + setCanDrag(FALSE); + getChild<LLButton>("continue_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onContinueBtn, this)); + getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterAddPaymentMethod::onCloseBtn, this)); + return TRUE; +} + +void LLFloaterAddPaymentMethod::onOpen(const LLSD& key) +{ + centerOnScreen(); +} + +void LLFloaterAddPaymentMethod::onContinueBtn() +{ + closeFloater(); + LLNotificationsUtil::add("AddPaymentMethod", LLSD(), LLSD(), + [this](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + LLWeb::loadURL(this->getString("continue_url")); + } + }); +} + +void LLFloaterAddPaymentMethod::onCloseBtn() +{ + closeFloater(); +} + +void LLFloaterAddPaymentMethod::centerOnScreen() +{ + LLVector2 window_size = LLUI::getInstance()->getWindowSize(); + centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY]))); +} + diff --git a/indra/newview/llfloateraddpaymentmethod.h b/indra/newview/llfloateraddpaymentmethod.h new file mode 100644 index 0000000000..b3bb624484 --- /dev/null +++ b/indra/newview/llfloateraddpaymentmethod.h @@ -0,0 +1,52 @@ +/** + * @file llfloateraddpaymentmethod.h + * @brief LLFloaterAddPaymentMethod class definition + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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 + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_FLOATER_ADDPAYMENTMETHOD_H +#define LL_FLOATER_ADDPAYMENTMETHOD_H + +#include "llfloater.h" + +class LLFloaterAddPaymentMethod: + public LLFloater +{ + friend class LLFloaterReg; +public: + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + +private: + LLFloaterAddPaymentMethod(const LLSD& key); + + void centerOnScreen(); + + void onCloseBtn(); + void onContinueBtn(); + + /*virtual*/ ~LLFloaterAddPaymentMethod(); + +}; + +#endif diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index dfc755c370..a3e9161ee8 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -290,22 +290,72 @@ void LLFloaterBuyCurrencyUI::onClickCancel() LLStatusBar::sendMoneyBalanceRequest(); } +LLFetchAvatarPaymentInfo* LLFloaterBuyCurrency::sPropertiesRequest = NULL; + // static void LLFloaterBuyCurrency::buyCurrency() { - LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency"); - ui->noTarget(); - ui->updateUI(); - ui->collapsePanels(true); + delete sPropertiesRequest; + sPropertiesRequest = new LLFetchAvatarPaymentInfo(false); } // static void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) { - LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency"); - ui->target(name, price); - ui->updateUI(); - ui->collapsePanels(false); + delete sPropertiesRequest; + sPropertiesRequest = new LLFetchAvatarPaymentInfo(true, name, price); } +// static +void LLFloaterBuyCurrency::handleBuyCurrency(bool has_piof, bool has_target, const std::string& name, S32 price) +{ + delete sPropertiesRequest; + sPropertiesRequest = NULL; + if (has_piof) + { + LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency"); + if (has_target) + { + ui->target(name, price); + } + else + { + ui->noTarget(); + } + ui->updateUI(); + ui->collapsePanels(!has_target); + } + else + { + LLFloaterReg::showInstance("add_payment_method"); + } +} + +LLFetchAvatarPaymentInfo::LLFetchAvatarPaymentInfo(bool has_target, const std::string& name, S32 price) +: mAvatarID(gAgent.getID()), + mHasTarget(has_target), + mPrice(price), + mName(name) +{ + LLAvatarPropertiesProcessor* processor = LLAvatarPropertiesProcessor::getInstance(); + // register ourselves as an observer + processor->addObserver(mAvatarID, this); + // send a request (duplicates will be suppressed inside the avatar + // properties processor) + processor->sendAvatarPropertiesRequest(mAvatarID); +} + +LLFetchAvatarPaymentInfo::~LLFetchAvatarPaymentInfo() +{ + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); +} + +void LLFetchAvatarPaymentInfo::processProperties(void* data, EAvatarProcessorType type) +{ + if (data && type == APT_PROPERTIES) + { + LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data); + LLFloaterBuyCurrency::handleBuyCurrency(LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(avatar_data), mHasTarget, mName, mPrice); + } +} diff --git a/indra/newview/llfloaterbuycurrency.h b/indra/newview/llfloaterbuycurrency.h index 7ff6c42384..1722f56dc1 100644 --- a/indra/newview/llfloaterbuycurrency.h +++ b/indra/newview/llfloaterbuycurrency.h @@ -27,15 +27,34 @@ #ifndef LL_LLFLOATERBUYCURRENCY_H #define LL_LLFLOATERBUYCURRENCY_H +#include "llavatarpropertiesprocessor.h" #include "stdtypes.h" - +#include "llagent.h" class LLFloater; +class LLFetchAvatarPaymentInfo : public LLAvatarPropertiesObserver +{ +public: + LLFetchAvatarPaymentInfo(bool has_target, const std::string& name = std::string(), S32 price = 0); + ~LLFetchAvatarPaymentInfo(); + + void processProperties(void* data, EAvatarProcessorType type); + +private: + LLUUID mAvatarID; + bool mHasTarget; + std::string mName; + S32 mPrice; +}; + + class LLFloaterBuyCurrency { public: static void buyCurrency(); static void buyCurrency(const std::string& name, S32 price); + + static void handleBuyCurrency(bool has_piof, bool has_target, const std::string& name, S32 price); /* name should be a noun phrase of the object or service being bought: "That object costs" "Trying to give" @@ -44,7 +63,8 @@ public: */ static LLFloater* buildFloater(const LLSD& key); -}; + static LLFetchAvatarPaymentInfo* sPropertiesRequest; +}; #endif diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index 6a29be4aa1..af8cb8b5cb 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -121,6 +121,15 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal data.mURLExternal = mNotification->getURLOpenExternally(); } + if((*it).has("width")) + { + data.mWidth = (*it)["width"].asInteger(); + } + else + { + data.mWidth = 0; + } + mButtonData.push_back(data); option_index++; } @@ -159,15 +168,29 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); + S32 btn_total_width = 0; + S32 default_size_btns = 0; for( S32 i = 0; i < num_options; i++ ) - { + { S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; - button_width = llmax( w, button_width ); + if (mButtonData[i].mWidth > w) + { + btn_total_width += mButtonData[i].mWidth; + } + else + { + button_width = llmax(w, button_width); + default_size_btns++; + } } - S32 btn_total_width = button_width; + if( num_options > 1 ) { - btn_total_width = (num_options * button_width) + ((num_options - 1) * BTN_HPAD); + btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD); + } + else + { + btn_total_width = llmax(btn_total_width, button_width); } // Message: create text box using raw string, as text has been structure deliberately @@ -333,7 +356,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal if(btn) { btn->setName(options[i].first); - btn->setRect(button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT )); + btn->setRect(button_rect.setOriginAndSize( button_left, VPAD, (mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth, BTN_HEIGHT )); btn->setLabel(options[i].second); btn->setFont(font); @@ -348,7 +371,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal btn->setFocus(TRUE); } } - button_left += button_width + BTN_HPAD; + button_left += ((mButtonData[i].mWidth == 0) ? button_width : mButtonData[i].mWidth) + BTN_HPAD; } setCheckBoxes(HPAD, VPAD); diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h index 9b4e054bf1..7ffe328439 100644 --- a/indra/newview/lltoastalertpanel.h +++ b/indra/newview/lltoastalertpanel.h @@ -85,6 +85,7 @@ private: LLButton* mButton; std::string mURL; U32 mURLExternal; + S32 mWidth; }; std::vector<ButtonData> mButtonData; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 414ae1fad6..06587d6025 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -34,6 +34,7 @@ #include "llcompilequeue.h" #include "llfasttimerview.h" #include "llfloaterabout.h" +#include "llfloateraddpaymentmethod.h" #include "llfloaterauction.h" #include "llfloaterautoreplacesettings.h" #include "llfloateravatar.h" @@ -194,6 +195,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterAboutUtil::registerFloater(); LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>); + LLFloaterReg::add("add_payment_method", "floater_add_payment_method.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAddPaymentMethod>); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAssociateListing>); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index e0da7f5d9e..57325739e4 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -957,4 +957,7 @@ <color name="OutfitGalleryItemUnselected" value="0.4 0.4 0.4 1" /> + <color + name="AddPaymentPanel" + value="0.27 0.27 0.27 1" /> </colors> diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 1302edda7a..f906843ef1 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -45,6 +45,10 @@ with the same filename but different name <texture name="AddItem_Off" file_name="icons/AddItem_Off.png" preload="false" /> <texture name="AddItem_Press" file_name="icons/AddItem_Press.png" preload="false" /> + <texture name="add_payment_image_center" file_name="windows/add_payment_image_center.png" preload="true" /> + <texture name="add_payment_image_left" file_name="windows/add_payment_image_left.png" preload="true" /> + <texture name="add_payment_image_right" file_name="windows/add_payment_image_right.png" preload="true" /> + <texture name="Arrow_Left_Off" file_name="navbar/Arrow_Left_Off.png" preload="true" /> <texture name="Arrow_Right_Off" file_name="navbar/Arrow_Right_Off.png" preload="true" /> diff --git a/indra/newview/skins/default/textures/windows/add_payment_image_center.png b/indra/newview/skins/default/textures/windows/add_payment_image_center.png Binary files differnew file mode 100644 index 0000000000..b5459136cb --- /dev/null +++ b/indra/newview/skins/default/textures/windows/add_payment_image_center.png diff --git a/indra/newview/skins/default/textures/windows/add_payment_image_left.png b/indra/newview/skins/default/textures/windows/add_payment_image_left.png Binary files differnew file mode 100644 index 0000000000..7fb65e724a --- /dev/null +++ b/indra/newview/skins/default/textures/windows/add_payment_image_left.png diff --git a/indra/newview/skins/default/textures/windows/add_payment_image_right.png b/indra/newview/skins/default/textures/windows/add_payment_image_right.png Binary files differnew file mode 100644 index 0000000000..f1937b6318 --- /dev/null +++ b/indra/newview/skins/default/textures/windows/add_payment_image_right.png diff --git a/indra/newview/skins/default/xui/en/floater_add_payment_method.xml b/indra/newview/skins/default/xui/en/floater_add_payment_method.xml new file mode 100644 index 0000000000..5296719339 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_add_payment_method.xml @@ -0,0 +1,141 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + height="405" + width="900" + layout="topleft" + name="floater_add_payment_method" + single_instance="true" + show_title="false" + legacy_header_height="0" + header_height="0" + background_visible="false" + can_resize="false" + can_drag_on_left="false" + can_minimize="false" + can_close="false"> + <floater.string + name="continue_url"> + https://secondlife.com/my/lindex/buy.php?associate_for_viewer=1 + </floater.string> + <panel + background_opaque="false" + bg_alpha_color="AddPaymentPanel" + border_visible="false" + background_visible="true" + label="wrapper_panel" + layout="topleft" + left="0" + name="wrapper_panel" + top="0" + height="405" + width="900" + follows="all" + translate="false"> + <text + type="string" + length="1" + follows="top|left|right" + font="SansSerifLargeBold" + text_color="White" + layout="topleft" + left="0" + height="14" + top_pad="30" + width="900" + halign="center" + name="title_txt"> + Add a payment method to buy Linden dollars and enjoy more of Second Life. + </text> + <button + follows="top|left|right" + height="24" + label="Get started" + font="SansSerifMedium" + font.style="BOLD" + layout="topleft" + left="320" + name="continue_btn" + image_unselected="PushButton_Login" + image_pressed="PushButton_Login_Pressed" + image_hover_unselected="PushButton_Login_Over" + label_color="White" + top_pad ="15" + width="140"/> + <button + follows="top|left|right" + height="24" + label="Later" + layout="topleft" + left_pad="9" + name="close_btn" + width="90"/> + <icon + height="195" + width="260" + image_name="add_payment_image_left" + layout="topleft" + left="30" + name="image_left" + top_pad="30" + use_draw_context_alpha="false"/> + <icon + height="195" + width="260" + image_name="add_payment_image_center" + layout="topleft" + left_pad="30" + name="image_center" + use_draw_context_alpha="false"/> + <icon + height="195" + width="260" + image_name="add_payment_image_right" + layout="topleft" + left_pad="30" + name="image_right" + use_draw_context_alpha="false"/> + <text + type="string" + length="1" + follows="top|left" + font="SansSerifMedium" + text_color="White" + height="75" + width="260" + top_pad="15" + layout="topleft" + word_wrap="true" + left="30" + name="image_left_desc"> + Create an avatar you love. Choose from millions of items in stores and the Second Life Marketplace. Your style is here. + </text> + <text + type="string" + length="1" + follows="top|left" + font="SansSerifMedium" + text_color="White" + height="75" + width="260" + layout="topleft" + word_wrap="true" + left_pad="30" + name="image_center_desc"> + Donate to your favorite performers and hosts. Your support helps them create great experiences. + </text> + <text + type="string" + length="1" + follows="top|left" + font="SansSerifMedium" + text_color="White" + height="75" + width="260" + layout="topleft" + word_wrap="true" + left_pad="30" + name="image_right_desc"> + Make the home of your dreams. With millions of items available to purchase, you can make your retreat unique. + </text> + </panel> +</floater> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3228603f45..c53b4ca800 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -11446,7 +11446,28 @@ Cannot create large prims that intersect other residents. Please re-try when ot name="okbutton" yestext="OK"/> </notification> - + + <notification + icon="alertmodal.tga" + name="AddPaymentMethod" + type="alertmodal"> +On the following page, choose a L$ amount +and click a place Order button. You will be +able to add a payment method at checkout. + <tag>confirm</tag> + <form name="form"> + <button + default="true" + index="0" + width="120" + name="Continue" + text="Continue"/> + <button + index="1" + name="Cancel" + text="Cancel"/> + </form> + </notification> <notification icon="alert.tga" |