From c80bc0e259ddf4afe6e8811684ffb505edf6d2a8 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 29 Jul 2010 21:01:21 -0500 Subject: Added a timer after ignoring LightShare settings. If you ignore a LightShare setting, all settings for the next 30 seconds will be ignored. The timer resets each time a new message is ignored. Customize with LightShareIgnoreTimer in Debug Settings. --- linden/indra/newview/app_settings/settings.xml | 11 +++++++++ linden/indra/newview/lightshare.cpp | 31 +++++++++++++++++++++++++- linden/indra/newview/lightshare.h | 7 ++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index a59fac6..e2871ad 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -310,6 +310,17 @@ Value 0 + LightShareIgnoreTimer + + Comment + After ignoring a region Windlight settings message, new messages are ignored for this many seconds. The timer starts again each time a message is ignored. + Persist + 1 + Type + F32 + Value + 30 + MapShowAgentCount Comment diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp index c9f34ee..29eab07 100644 --- a/linden/indra/newview/lightshare.cpp +++ b/linden/indra/newview/lightshare.cpp @@ -45,7 +45,9 @@ const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; + WindlightMessage* WindlightMessage::sMostRecent = NULL; +LLTimer* WindlightMessage::sIgnoreTimer = new LLTimer(); WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : @@ -116,6 +118,13 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) wl->apply(); delete wl; } + else if( !ignoreTimerHasExpired() ) + { + // The user recently ignored a windlight message, so ignore + // this one too, and reset the timer. + resetIgnoreTimer(); + delete wl; + } else { if( sMostRecent == NULL ) @@ -145,10 +154,15 @@ bool WindlightMessage::applyCallback(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); - if( option == 0 ) + + if( option == 0 ) // "Apply" { sMostRecent->apply(); } + else if( option == 2 ) // "Ignore" + { + resetIgnoreTimer(); + } delete sMostRecent; sMostRecent = NULL; @@ -157,6 +171,21 @@ bool WindlightMessage::applyCallback(const LLSD& notification, } +// static +void WindlightMessage::resetIgnoreTimer() +{ + F32 time = gSavedSettings.getF32("LightShareIgnoreTimer"); + sIgnoreTimer->start(); + sIgnoreTimer->setTimerExpirySec( (time < 0) ? 0 : time ); +} + +// static +bool WindlightMessage::ignoreTimerHasExpired() +{ + return sIgnoreTimer->hasExpired(); +} + + bool WindlightMessage::apply() { LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h index cbc03ad..5b24ae3 100644 --- a/linden/indra/newview/lightshare.h +++ b/linden/indra/newview/lightshare.h @@ -31,6 +31,7 @@ #include "message.h" #include "meta7windlight.h" +#include "lltimer.h" #include "llwaterparamset.h" #include "llwlparamset.h" @@ -54,9 +55,15 @@ class WindlightMessage bool apply(); bool isValid(); + protected: + + static void resetIgnoreTimer(); + static bool ignoreTimerHasExpired(); + private: static WindlightMessage* sMostRecent; + static LLTimer* sIgnoreTimer; Meta7WindlightPacket* mPacket; LLWaterParamSet* mWater; -- cgit v1.1