From 14833e7f291985f722a5ed8a12f799e9c2a35078 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 26 Aug 2026 20:09:25 +0300 Subject: #6174 Allow changing maturity preference on maturity error dialog --- indra/newview/llfloatermaturitydialog.cpp | 91 +++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 indra/newview/llfloatermaturitydialog.cpp (limited to 'indra/newview/llfloatermaturitydialog.cpp') diff --git a/indra/newview/llfloatermaturitydialog.cpp b/indra/newview/llfloatermaturitydialog.cpp new file mode 100644 index 0000000000..c93ce88fba --- /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); +} -- cgit v1.3 From 6d7abb3f97d64d0232e6499cd1e05baa31d73e5c Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 28 Aug 2026 14:03:48 +0300 Subject: #6174 Update and simplify UI --- indra/newview/llfloatermaturitydialog.cpp | 23 +++--- indra/newview/llfloatermaturitydialog.h | 3 +- indra/newview/llviewermessage.cpp | 14 +++- .../default/xui/en/floater_maturity_dialog.xml | 91 +++++++++------------- .../newview/skins/default/xui/en/notifications.xml | 11 +++ 5 files changed, 69 insertions(+), 73 deletions(-) (limited to 'indra/newview/llfloatermaturitydialog.cpp') diff --git a/indra/newview/llfloatermaturitydialog.cpp b/indra/newview/llfloatermaturitydialog.cpp index c93ce88fba..afa9a70024 100644 --- a/indra/newview/llfloatermaturitydialog.cpp +++ b/indra/newview/llfloatermaturitydialog.cpp @@ -29,7 +29,6 @@ #include "llfloatermaturitydialog.h" #include "llbutton.h" -#include "llcombobox.h" #include "llagent.h" #include "lltextbox.h" #include "llviewercontrol.h" @@ -43,10 +42,6 @@ LLFloaterMaturityDialog::LLFloaterMaturityDialog(const LLSD& key) 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( @@ -59,33 +54,33 @@ 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)); + getChild("current_maturity_lbl")->setText(getString("update_maturity_string", args)); + getChild("continue_btn")->setLabel(getString("allow_maturity_string", args)); - updateContinueButton(); centerOnScreen(); } +void LLFloaterMaturityDialog::draw() +{ + // Skip floater shadow/background; icon child provides the visual background + LLView::draw(); +} + void LLFloaterMaturityDialog::onContinue() { + gSavedSettings.setU32("PreferredMaturity", static_cast(mRegionAccess)); 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 index 9b888bed22..4ca1a53c2a 100644 --- a/indra/newview/llfloatermaturitydialog.h +++ b/indra/newview/llfloatermaturitydialog.h @@ -34,6 +34,7 @@ class LLFloaterMaturityDialog : public LLModalDialog public: bool postBuild() override; void onOpen(const LLSD& key) override; + void draw() override; private: LLFloaterMaturityDialog(const LLSD& key); @@ -41,8 +42,6 @@ private: void onContinue(); void onCancel(); - void updateContinueButton(); U8 mRegionAccess = SIM_ACCESS_ADULT; - U32 mPreviousMaturity = SIM_ACCESS_PG; }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 059a71c044..240de962e6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4928,6 +4928,7 @@ bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notific { U8 regionAccess = static_cast(llsdBlock["_region_access"].asInteger()); std::string regionMaturity = LLViewerRegion::accessToString(regionAccess); + llsdBlock["REGIONMATURITY_CAP"] = regionMaturity; LLStringUtil::toLower(regionMaturity); llsdBlock["REGIONMATURITY"] = regionMaturity; @@ -5005,8 +5006,17 @@ bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notific { if (notificationID == "RegionTPAccessBlocked") { - LLFloaterReg::showInstance("maturity_dialog", LLSD((S32)regionAccess)); - skip_notif = true; + bool can_change_maturity = (regionAccess == SIM_ACCESS_MATURE) ? gAgent.isMature() : gAgent.isAdult(); + if (can_change_maturity) + { + LLFloaterReg::showInstance("maturity_dialog", LLSD((S32)regionAccess)); + skip_notif = true; + } + else + { + gAgent.clearTeleportRequest(); + tp_failure_notification = LLNotificationsUtil::add("RegionTPAccessBlocked_NotifyAdultsOnly", llsdBlock); + } } else { diff --git a/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml b/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml index 2ad39c683f..35769534ac 100644 --- a/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml +++ b/indra/newview/skins/default/xui/en/floater_maturity_dialog.xml @@ -1,7 +1,7 @@ + can_close="false" + background_visible="false"> + value="Your current maturity preference doesn't include [MATURITY] content. Allowing it will update your preference."/> + + + name="location_rated_lbl"> + The location you've chosen is rated Adult. + -Your current maturity preference: - - - - - - - - - + Your current maturity preference doesn't include Adult content. Allowing it will update your preference. +