From 052c0bc37883ee3e4695eb2d67ef823e7ed6ab6f Mon Sep 17 00:00:00 2001 From: Vladimir Pchelko Date: Tue, 29 Jun 2010 22:07:52 +0300 Subject: EXT-7648 FIXED Added handler for "PreferredMaturity" property which updates visibility and values for mature/adults check_box/icon/label. Reviewed by Sergey Litovchuk and Mike Antipov at https://codereview.productengine.com/secondlife/r/633/ --HG-- branch : product-engine --- indra/newview/llfloaterworldmap.cpp | 47 ++++++++++++++-------- indra/newview/llfloaterworldmap.h | 2 +- .../skins/default/xui/en/floater_world_map.xml | 8 ++-- 3 files changed, 35 insertions(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index fbe77047e3..983fd97b0b 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -216,6 +216,8 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key) mCommitCallbackRegistrar.add("WMap.ShowAgent", boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this)); mCommitCallbackRegistrar.add("WMap.Clear", boost::bind(&LLFloaterWorldMap::onClearBtn, this)); mCommitCallbackRegistrar.add("WMap.CopySLURL", boost::bind(&LLFloaterWorldMap::onCopySLURL, this)); + + gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this)); } // static @@ -251,6 +253,8 @@ BOOL LLFloaterWorldMap::postBuild() mZoomTimer.stop(); + onChangeMaturity(); + return TRUE; } @@ -378,21 +382,6 @@ void LLFloaterWorldMap::draw() static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white); static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white); - // Hide/Show Mature Events controls - childSetVisible("events_mature_icon", gAgent.canAccessMature()); - childSetVisible("events_mature_label", gAgent.canAccessMature()); - childSetVisible("event_mature_chk", gAgent.canAccessMature()); - - childSetVisible("events_adult_icon", gAgent.canAccessMature()); - childSetVisible("events_adult_label", gAgent.canAccessMature()); - childSetVisible("event_adult_chk", gAgent.canAccessMature()); - bool adult_enabled = gAgent.canAccessAdult(); - if (!adult_enabled) - { - childSetValue("event_adult_chk", FALSE); - } - childSetEnabled("event_adult_chk", adult_enabled); - // On orientation island, users don't have a home location yet, so don't // let them teleport "home". It dumps them in an often-crowed welcome // area (infohub) and they get confused. JC @@ -480,8 +469,8 @@ void LLFloaterWorldMap::draw() childSetEnabled("telehub_chk", enable); childSetEnabled("land_for_sale_chk", enable); childSetEnabled("event_chk", enable); - childSetEnabled("event_mature_chk", enable); - childSetEnabled("event_adult_chk", enable); + childSetEnabled("events_mature_chk", enable); + childSetEnabled("events_adult_chk", enable); LLFloater::draw(); } @@ -1480,3 +1469,27 @@ void LLFloaterWorldMap::onCommitSearchResult() onShowTargetBtn(); } + +void LLFloaterWorldMap::onChangeMaturity() +{ + bool can_access_mature = gAgent.canAccessMature(); + bool can_access_adult = gAgent.canAccessAdult(); + + childSetVisible("events_mature_icon", can_access_mature); + childSetVisible("events_mature_label", can_access_mature); + childSetVisible("events_mature_chk", can_access_mature); + + childSetVisible("events_adult_icon", can_access_adult); + childSetVisible("events_adult_label", can_access_adult); + childSetVisible("events_adult_chk", can_access_adult); + + // disable mature / adult events. + if (!can_access_mature) + { + gSavedSettings.setBOOL("ShowMatureEvents", FALSE); + } + if (!can_access_adult) + { + gSavedSettings.setBOOL("ShowAdultEvents", FALSE); + } +} diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index de515c689e..550b4ef689 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -112,7 +112,7 @@ public: // teleport to the tracked item, if there is one void teleport(); - + void onChangeMaturity(); protected: void onGoHome(); diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index ece406f9b1..a59db1420f 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -306,7 +306,7 @@ initial_value="true" layout="topleft" left="135" - name="event_mature_chk" + name="events_mature_chk" top_pad="3" width="22" /> Moderate @@ -339,7 +339,7 @@ height="16" layout="topleft" left="135" - name="event_adult_chk" + name="events_adult_chk" top_pad="3" width="22" /> Adult -- cgit v1.2.3