From 3b8cfc9fbbb8ede46b9bd34b0ad1c59a8d047e9e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Wed, 28 Jul 2010 04:02:47 -0500 Subject: Added confirmation dialog before applying LightShare settings. If you are using a preset other than the default preset or the LightShare preset, the viewer will now ask you whether to apply settings received from the server. --- linden/indra/newview/lightshare.cpp | 37 ++++++++++++++++++++-- linden/indra/newview/lightshare.h | 4 +++ .../skins/default/xui/en-us/notifications.xml | 19 +++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp index 24d4139..aa5443b 100644 --- a/linden/indra/newview/lightshare.cpp +++ b/linden/indra/newview/lightshare.cpp @@ -100,14 +100,45 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) { if( gSavedSettings.getBOOL("UseServersideWindlightSettings") ) { - WindlightMessage wl = WindlightMessage(msg); - if( wl.isValid() ) + WindlightMessage* wl = new WindlightMessage(msg); + if( wl->isValid() ) { - wl.apply(); + std::string water = LLWaterParamManager::instance()->mCurParams.mName; + std::string sky = LLWLParamManager::instance()->mCurParams.mName; + + // If they are using the default or region settings, just apply + // the new settings, don't bother asking. + if((sky == "Default" || sky == sSkyPresetName) && + (water == "Default" || water == sWaterPresetName)) + { + wl->apply(); + delete wl; + } + else + { + LLNotifications::instance() + .add("ConfirmLightShare", + LLSD(), LLSD(), + boost::bind(&applyCallback, _1, _2, wl)); + } } } } +// static +bool WindlightMessage::applyCallback(const LLSD& notification, + const LLSD& response, + WindlightMessage* wl) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + if( option == 0 ) + { + wl->apply(); + } + delete wl; + return false; +} + bool WindlightMessage::apply() { diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h index a76cd1b..2bf95c6 100644 --- a/linden/indra/newview/lightshare.h +++ b/linden/indra/newview/lightshare.h @@ -48,6 +48,10 @@ class WindlightMessage WindlightMessage( LLMessageSystem* msg ); ~WindlightMessage(); static void processWindlight(LLMessageSystem* msg, void**); + static bool applyCallback(const LLSD& notification, + const LLSD& response, + WindlightMessage* wl); + bool apply(); bool isValid(); diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml index 975f10b..2a0af02 100644 --- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml @@ -6992,6 +6992,25 @@ Shadows cannot be enabled due to your graphics settings being set too low. Make Note: To comply with the Second Life Terms of Service, Imprudence did not download any texture files for the exported object(s). + +This region has custom sky and water settings. + +Apply region settings now? +
+