aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lightshare.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2010-07-29 04:13:45 -0500
committerJacek Antonelli2010-08-01 00:30:59 -0500
commit8314920310fa11d5974d733da6817176f7cc9b93 (patch)
treed7a415c2e992d4650966f56c722496106e28b4b8 /linden/indra/newview/lightshare.cpp
parentNo longer reset Windlight settings after teleport. (diff)
downloadmeta-impy-8314920310fa11d5974d733da6817176f7cc9b93.zip
meta-impy-8314920310fa11d5974d733da6817176f7cc9b93.tar.gz
meta-impy-8314920310fa11d5974d733da6817176f7cc9b93.tar.bz2
meta-impy-8314920310fa11d5974d733da6817176f7cc9b93.tar.xz
Don't spam user with ConfirmLightShare notifications.
Now only one notification is created, but the class remembers the most recent settings and discards the old ones.
Diffstat (limited to 'linden/indra/newview/lightshare.cpp')
-rw-r--r--linden/indra/newview/lightshare.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp
index aa5443b..c9f34ee 100644
--- a/linden/indra/newview/lightshare.cpp
+++ b/linden/indra/newview/lightshare.cpp
@@ -45,6 +45,8 @@
45const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; 45const std::string WindlightMessage::sWaterPresetName = "(Region settings)";
46const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; 46const std::string WindlightMessage::sSkyPresetName = "(Region settings)";
47 47
48WindlightMessage* WindlightMessage::sMostRecent = NULL;
49
48 50
49WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : 51WindlightMessage::WindlightMessage( LLMessageSystem* msg ) :
50 mPacket(NULL), 52 mPacket(NULL),
@@ -116,10 +118,23 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
116 } 118 }
117 else 119 else
118 { 120 {
119 LLNotifications::instance() 121 if( sMostRecent == NULL )
120 .add("ConfirmLightShare", 122 {
121 LLSD(), LLSD(), 123 // No most recent, so store this and create notification
122 boost::bind(&applyCallback, _1, _2, wl)); 124 // asking the user whether to apply or not.
125 sMostRecent = wl;
126 LLNotifications::instance()
127 .add("ConfirmLightShare",
128 LLSD(), LLSD(),
129 boost::bind(&applyCallback, _1, _2));
130 }
131 else
132 {
133 // No new notification (to avoid spamming the user), just
134 // store this as most recent.
135 delete sMostRecent;
136 sMostRecent = wl;
137 }
123 } 138 }
124 } 139 }
125 } 140 }
@@ -127,15 +142,17 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
127 142
128// static 143// static
129bool WindlightMessage::applyCallback(const LLSD& notification, 144bool WindlightMessage::applyCallback(const LLSD& notification,
130 const LLSD& response, 145 const LLSD& response)
131 WindlightMessage* wl)
132{ 146{
133 S32 option = LLNotification::getSelectedOption(notification, response); 147 S32 option = LLNotification::getSelectedOption(notification, response);
134 if( option == 0 ) 148 if( option == 0 )
135 { 149 {
136 wl->apply(); 150 sMostRecent->apply();
137 } 151 }
138 delete wl; 152
153 delete sMostRecent;
154 sMostRecent = NULL;
155
139 return false; 156 return false;
140} 157}
141 158