diff options
Diffstat (limited to 'linden/indra/newview/lightshare.cpp')
-rw-r--r-- | linden/indra/newview/lightshare.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
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 @@ | |||
45 | const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; | 45 | const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; |
46 | const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; | 46 | const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; |
47 | 47 | ||
48 | |||
48 | WindlightMessage* WindlightMessage::sMostRecent = NULL; | 49 | WindlightMessage* WindlightMessage::sMostRecent = NULL; |
50 | LLTimer* WindlightMessage::sIgnoreTimer = new LLTimer(); | ||
49 | 51 | ||
50 | 52 | ||
51 | WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : | 53 | WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : |
@@ -116,6 +118,13 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) | |||
116 | wl->apply(); | 118 | wl->apply(); |
117 | delete wl; | 119 | delete wl; |
118 | } | 120 | } |
121 | else if( !ignoreTimerHasExpired() ) | ||
122 | { | ||
123 | // The user recently ignored a windlight message, so ignore | ||
124 | // this one too, and reset the timer. | ||
125 | resetIgnoreTimer(); | ||
126 | delete wl; | ||
127 | } | ||
119 | else | 128 | else |
120 | { | 129 | { |
121 | if( sMostRecent == NULL ) | 130 | if( sMostRecent == NULL ) |
@@ -145,10 +154,15 @@ bool WindlightMessage::applyCallback(const LLSD& notification, | |||
145 | const LLSD& response) | 154 | const LLSD& response) |
146 | { | 155 | { |
147 | S32 option = LLNotification::getSelectedOption(notification, response); | 156 | S32 option = LLNotification::getSelectedOption(notification, response); |
148 | if( option == 0 ) | 157 | |
158 | if( option == 0 ) // "Apply" | ||
149 | { | 159 | { |
150 | sMostRecent->apply(); | 160 | sMostRecent->apply(); |
151 | } | 161 | } |
162 | else if( option == 2 ) // "Ignore" | ||
163 | { | ||
164 | resetIgnoreTimer(); | ||
165 | } | ||
152 | 166 | ||
153 | delete sMostRecent; | 167 | delete sMostRecent; |
154 | sMostRecent = NULL; | 168 | sMostRecent = NULL; |
@@ -157,6 +171,21 @@ bool WindlightMessage::applyCallback(const LLSD& notification, | |||
157 | } | 171 | } |
158 | 172 | ||
159 | 173 | ||
174 | // static | ||
175 | void WindlightMessage::resetIgnoreTimer() | ||
176 | { | ||
177 | F32 time = gSavedSettings.getF32("LightShareIgnoreTimer"); | ||
178 | sIgnoreTimer->start(); | ||
179 | sIgnoreTimer->setTimerExpirySec( (time < 0) ? 0 : time ); | ||
180 | } | ||
181 | |||
182 | // static | ||
183 | bool WindlightMessage::ignoreTimerHasExpired() | ||
184 | { | ||
185 | return sIgnoreTimer->hasExpired(); | ||
186 | } | ||
187 | |||
188 | |||
160 | bool WindlightMessage::apply() | 189 | bool WindlightMessage::apply() |
161 | { | 190 | { |
162 | LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); | 191 | LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); |