diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6980ec0b313983b65bb01345b01df2ede1fc9c03..cb466bbb9d3e95481a1976daefe0f31be527f387 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -196,8 +196,6 @@ typedef struct skin_t // if creating/destroying these is too slow, we'll need to create // a static member and update all our static callbacks -void handleNameTagOptionChanged(const LLSD& newvalue); -void handleDisplayNamesOptionChanged(const LLSD& newvalue); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); bool callback_clear_cache(const LLSD& notification, const LLSD& response); @@ -247,26 +245,7 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response return false; } -void handleNameTagOptionChanged(const LLSD& newvalue) -{ - LLAvatarNameCache::getInstance()->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames")); - LLVOAvatar::invalidateNameTags(); -} -void handleDisplayNamesOptionChanged(const LLSD& newvalue) -{ - LLAvatarNameCache::getInstance()->setUseDisplayNames(newvalue.asBoolean()); - LLVOAvatar::invalidateNameTags(); -} - -void handleAppearanceCameraMovementChanged(const LLSD& newvalue) -{ - if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } -} void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { @@ -378,12 +357,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this)); - gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); - gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); - gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); - - gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2)); - LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreference::updateComplexityText, this)); @@ -948,6 +921,7 @@ LLFloaterPreference::~LLFloaterPreference() LLAvatarPropertiesProcessor::getInstance()->removeObserver(gAgent.getID(), this); LLConversationLog::instance().removeObserver(this); mComplexityChangedSignal.disconnect(); + mDnDModeConnection.disconnect(); } void LLFloaterPreference::draw() @@ -1097,9 +1071,8 @@ void LLFloaterPreference::onOpen(const LLSD& key) { // this variable and if that follows it are used to properly handle do not disturb mode response message - static bool initialized = FALSE; // if user is logged in and we haven't initialized do not disturb mode response yet, do it - if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) + if (!mDnDInit && LLStartUp::getStartupState() == STATE_STARTED) { // Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized. @@ -1107,10 +1080,10 @@ void LLFloaterPreference::onOpen(const LLSD& key) // was added into per account settings. // initialization should happen once,so setting variable to TRUE - initialized = TRUE; + mDnDInit = true; // this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in // do not disturb response message. - gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); + mDnDModeConnection = gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this)); } gAgent.sendAgentUserInfoRequest(); @@ -2470,7 +2443,7 @@ BOOL LLPanelPreference::postBuild() if (hasChild("max_bandwidth", TRUE)) { mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT); - gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); + mBandwithConnection = gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2)); } #ifndef LL_LINUX @@ -2497,6 +2470,7 @@ BOOL LLPanelPreference::postBuild() LLPanelPreference::~LLPanelPreference() { + mBandwithConnection.disconnect(); if (mBandWidthUpdater) { delete mBandWidthUpdater; diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 133674b1035c70d28dd623b41e52c44004de34e0..f2dcc37b943e766bd37a536b773214c105280898 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -262,6 +262,11 @@ class LLFloaterPreference final : public LLFloater, public LLAvatarPropertiesObs bool mSearchDataDirty; boost::signals2::connection mComplexityChangedSignal; + boost::signals2::connection mDnDModeConnection; + boost::signals2::connection mChatBubbleOpacityConnection; + boost::signals2::connection mPreferredMaturityConnection; + + bool mDnDInit = false; void onUpdateFilterTerm( bool force = false ); void collectSearchableItems(); @@ -314,6 +319,7 @@ class LLPanelPreference : public LLPanel string_color_map_t mSavedColors; Updater* mBandWidthUpdater; + boost::signals2::connection mBandwithConnection; LOG_CLASS(LLPanelPreference); }; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index a15a4531f532f175842df369ef03d2a86ba1f8ca..23fa6e4014bff1abbcdc77e51b035380255fa3a9 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -673,6 +673,27 @@ void handleFPSTuningStrategyChanged(const LLSD& newValue) const auto newval = gSavedSettings.getU32("TuningFPSStrategy"); LLPerfStats::tunables.userFPSTuningStrategy = newval; } + +void handleNameTagOptionChanged(const LLSD& newvalue) +{ + LLAvatarNameCache::getInstance()->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames")); + LLVOAvatar::invalidateNameTags(); +} + +void handleDisplayNamesOptionChanged(const LLSD& newvalue) +{ + LLAvatarNameCache::getInstance()->setUseDisplayNames(newvalue.asBoolean()); + LLVOAvatar::invalidateNameTags(); +} + +void handleAppearanceCameraMovementChanged(const LLSD& newvalue) +{ + if (!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } +} //////////////////////////////////////////////////////////////////////////// LLPointer<LLControlVariable> setting_get_control(LLControlGroup& group, const std::string& setting) @@ -867,7 +888,12 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "AlchemyHudTextFadeDistance", LLHUDText::onFadeSettingsChanged); setting_setup_signal_listener(gSavedSettings, "AlchemyHudTextFadeRange", LLHUDText::onFadeSettingsChanged); setting_setup_signal_listener(gSavedSettings, "RenderAnisotropicLevel", handleAnisotropicFilteringChanged); - gSavedSettings.getControl("RenderAnisotropicLevel")->getValidateSignal()->connect(boost::bind(&validateAnisotropicFiltering, _2)); + gSavedSettings.getControl("RenderAnisotropicLevel")->getValidateSignal()->connect(boost::bind(&validateAnisotropicFiltering, _2)); + + setting_setup_signal_listener(gSavedSettings, "NameTagShowUsernames", handleNameTagOptionChanged); + setting_setup_signal_listener(gSavedSettings, "NameTagShowFriends", handleNameTagOptionChanged); + setting_setup_signal_listener(gSavedSettings, "UseDisplayNames", handleDisplayNamesOptionChanged); + setting_setup_signal_listener(gSavedSettings, "AppearanceCameraMovement", handleAppearanceCameraMovementChanged); } #if TEST_CACHED_CONTROL