diff options
-rw-r--r-- | linden/indra/newview/lightshare.cpp | 33 | ||||
-rw-r--r-- | linden/indra/newview/lightshare.h | 5 |
2 files changed, 28 insertions, 10 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 @@ | |||
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 | WindlightMessage* WindlightMessage::sMostRecent = NULL; | ||
49 | |||
48 | 50 | ||
49 | WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : | 51 | WindlightMessage::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 |
129 | bool WindlightMessage::applyCallback(const LLSD& notification, | 144 | bool 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 | ||
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h index 2bf95c6..cbc03ad 100644 --- a/linden/indra/newview/lightshare.h +++ b/linden/indra/newview/lightshare.h | |||
@@ -49,14 +49,15 @@ class WindlightMessage | |||
49 | ~WindlightMessage(); | 49 | ~WindlightMessage(); |
50 | static void processWindlight(LLMessageSystem* msg, void**); | 50 | static void processWindlight(LLMessageSystem* msg, void**); |
51 | static bool applyCallback(const LLSD& notification, | 51 | static bool applyCallback(const LLSD& notification, |
52 | const LLSD& response, | 52 | const LLSD& response); |
53 | WindlightMessage* wl); | ||
54 | 53 | ||
55 | bool apply(); | 54 | bool apply(); |
56 | bool isValid(); | 55 | bool isValid(); |
57 | 56 | ||
58 | private: | 57 | private: |
59 | 58 | ||
59 | static WindlightMessage* sMostRecent; | ||
60 | |||
60 | Meta7WindlightPacket* mPacket; | 61 | Meta7WindlightPacket* mPacket; |
61 | LLWaterParamSet* mWater; | 62 | LLWaterParamSet* mWater; |
62 | LLWLParamSet* mSky; | 63 | LLWLParamSet* mSky; |