From 14833e7f291985f722a5ed8a12f799e9c2a35078 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 26 Aug 2026 20:09:25 +0300 Subject: [PATCH 1/2] #6174 Allow changing maturity preference on maturity error dialog --- indra/llui/lltextbase.cpp | 8 ++ indra/llui/lltextbase.h | 5 +- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloatermaturitydialog.cpp | 91 ++++++++++++++ indra/newview/llfloatermaturitydialog.h | 48 +++++++ indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermessage.cpp | 24 ++-- .../xui/en/floater_maturity_dialog.xml | 119 ++++++++++++++++++ 8 files changed, 291 insertions(+), 8 deletions(-) create mode 100644 indra/newview/llfloatermaturitydialog.cpp create mode 100644 indra/newview/llfloatermaturitydialog.h create mode 100644 indra/newview/skins/default/xui/en/floater_maturity_dialog.xml diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 802367720fa..06645df2030 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -158,6 +158,7 @@ LLTextBase::Params::Params() track_end("track_end", false), read_only("read_only", false), skip_link_underline("skip_link_underline", false), + link_color("link_color"), spellcheck("spellcheck", false), v_pad("v_pad", 0), h_pad("h_pad", 0), @@ -196,6 +197,8 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mReadOnly(p.read_only), mSkipTripleClick(false), mSkipLinkUnderline(p.skip_link_underline), + mHasLinkColor(p.link_color.isProvided()), + mLinkColor(p.link_color.isProvided() ? p.link_color() : LLUIColor()), mSpellCheck(p.spellcheck), mSpellCheckStart(-1), mSpellCheckEnd(-1), @@ -2426,6 +2429,11 @@ void LLTextBase::appendTextImpl(const std::string& new_text, const LLStyle::Para LLStyle::Params link_params(style_params); link_params.overwriteFrom(match.getStyle()); + if (mHasLinkColor) + { + link_params.color = mLinkColor; + link_params.readonly_color = mLinkColor; + } // output the text before the Url if (start > 0) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 62f984b8fc9..d3edd17dcaf 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -351,7 +351,8 @@ class LLTextBase bg_writeable_color, bg_focus_color, text_selected_color, - bg_selected_color; + bg_selected_color, + link_color; Optional bg_visible, border_visible, @@ -777,6 +778,8 @@ class LLTextBase bool mAlwaysShowIcons; bool mSkipLinkUnderline; + bool mHasLinkColor; + LLUIColor mLinkColor; // support widgets LLHandle mPopupMenuHandle; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 7aa255c5dac..c9db55c52d6 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -260,6 +260,7 @@ set(viewer_SOURCE_FILES llfloaterloadprefpreset.cpp llfloatermarketplacelistings.cpp llfloatermap.cpp + llfloatermaturitydialog.cpp llfloatermediasettings.cpp llfloatermemleak.cpp llfloatermodelpreview.cpp @@ -948,6 +949,7 @@ set(viewer_HEADER_FILES llfloatermap.h llfloatermarketplace.h llfloatermarketplacelistings.h + llfloatermaturitydialog.h llfloatermediasettings.h llfloatermemleak.h llfloatermodelpreview.h diff --git a/indra/newview/llfloatermaturitydialog.cpp b/indra/newview/llfloatermaturitydialog.cpp new file mode 100644 index 00000000000..c93ce88fbae --- /dev/null +++ b/indra/newview/llfloatermaturitydialog.cpp @@ -0,0 +1,91 @@ +/** + * @file llfloatermaturitydialog.cpp + * @brief LLFloaterMaturityDialog class implementation + * + * $LicenseInfo:firstyear=2026&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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 + * 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 "llfloatermaturitydialog.h" + +#include "llbutton.h" +#include "llcombobox.h" +#include "llagent.h" +#include "lltextbox.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" + +LLFloaterMaturityDialog::LLFloaterMaturityDialog(const LLSD& key) + : LLModalDialog(key, true) +{ +} + +bool LLFloaterMaturityDialog::postBuild() +{ + setCanDrag(false); + LLComboBox* combo = getChild("maturity_combo"); + combo->setCommitCallback([this](LLUICtrl*, const LLSD&) { updateContinueButton(); }); + // Ensure the dropdown list renders on top of buttons and labels below the combo + sendChildToFront(combo); + getChild("continue_btn")->setCommitCallback( + [this](LLUICtrl*, const LLSD&) { onContinue(); }); + getChild("cancel_btn")->setCommitCallback( + [this](LLUICtrl*, const LLSD&) { onCancel(); }); + + return true; +} + +void LLFloaterMaturityDialog::onOpen(const LLSD& key) +{ + LLModalDialog::onOpen(key); + + mPreviousMaturity = gSavedSettings.getU32("PreferredMaturity"); + mRegionAccess = static_cast(key.asInteger()); + + LLStringUtil::format_map_t args; + args["[MATURITY]"] = LLViewerRegion::accessToString(mRegionAccess); + getChild("location_rated_lbl")->setText(getString("location_rated_string", args)); + getChild("include_adult_lbl")->setText(getString("update_maturity_string", args)); + + updateContinueButton(); + centerOnScreen(); +} + +void LLFloaterMaturityDialog::onContinue() +{ + gAgent.restartFailedTeleportRequest(); + closeFloater(); +} + +void LLFloaterMaturityDialog::onCancel() +{ + gSavedSettings.setU32("PreferredMaturity", mPreviousMaturity); + gAgent.clearTeleportRequest(); + closeFloater(); +} + +void LLFloaterMaturityDialog::updateContinueButton() +{ + U32 current = gSavedSettings.getU32("PreferredMaturity"); + getChild("continue_btn")->setEnabled(current >= mRegionAccess); +} diff --git a/indra/newview/llfloatermaturitydialog.h b/indra/newview/llfloatermaturitydialog.h new file mode 100644 index 00000000000..9b888bed225 --- /dev/null +++ b/indra/newview/llfloatermaturitydialog.h @@ -0,0 +1,48 @@ +/** + * @file llfloatermaturitydialog.h + * @brief LLFloaterMaturityDialog class definition + * + * $LicenseInfo:firstyear=2026&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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 + * 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$ + */ + +#pragma once + +#include "llmodaldialog.h" + +class LLFloaterMaturityDialog : public LLModalDialog +{ + friend class LLFloaterReg; +public: + bool postBuild() override; + void onOpen(const LLSD& key) override; + +private: + LLFloaterMaturityDialog(const LLSD& key); + ~LLFloaterMaturityDialog() = default; + + void onContinue(); + void onCancel(); + void updateContinueButton(); + + U8 mRegionAccess = SIM_ACCESS_ADULT; + U32 mPreviousMaturity = SIM_ACCESS_PG; +}; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 54a8b22a5ac..0cfbcc06c06 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -101,6 +101,7 @@ #include "llfloatermap.h" #include "llfloatermarketplace.h" #include "llfloatermarketplacelistings.h" +#include "llfloatermaturitydialog.h" #include "llfloatermediasettings.h" #include "llfloatermemleak.h" #include "llfloatermodelpreview.h" @@ -424,6 +425,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("marketplace", "floater_marketplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("marketplace_listings", "floater_marketplace_listings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("maturity_dialog", "floater_maturity_dialog.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 1f76914335c..059a71c0440 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4932,6 +4932,7 @@ bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notific llsdBlock["REGIONMATURITY"] = regionMaturity; LLNotificationPtr tp_failure_notification; + bool skip_notif = false; std::string notifySuffix; if (notificationID == std::string("TeleportEntryAccessBlocked")) @@ -5001,21 +5002,30 @@ bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notific } } // End of special handling for "TeleportEntryAccessBlocked" else - { // Normal case, no message munging - gAgent.clearTeleportRequest(); - if (LLNotifications::getInstance()->templateExists(notificationID)) + { + if (notificationID == "RegionTPAccessBlocked") { - tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock); + LLFloaterReg::showInstance("maturity_dialog", LLSD((S32)regionAccess)); + skip_notif = true; } else { - llsdBlock["MESSAGE"] = defaultMessage; - tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock); + // Normal case, no message munging + gAgent.clearTeleportRequest(); + if (LLNotifications::getInstance()->templateExists(notificationID)) + { + tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock); + } + else + { + llsdBlock["MESSAGE"] = defaultMessage; + tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock); + } } returnValue = true; } - if ((tp_failure_notification == NULL) || tp_failure_notification->isIgnored()) + if (((tp_failure_notification == NULL) || tp_failure_notification->isIgnored()) && !skip_notif) { // Given a simple notification if no tp_failure_notification is set or it is ignore LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock); diff --git a/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml b/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml new file mode 100644 index 00000000000..2ad39c683fa --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml @@ -0,0 +1,119 @@ + + + + + + +Your current maturity preference: + + + + + + + + + + +