From caaaa1e5e6444fa7d96a5bda792cea797b716282 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 5 Nov 2013 10:01:41 -0500 Subject: STORM-1980 Play sound for region restarting message --- indra/newview/llviewermessage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ab9ea5618e..ebc6ff8165 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6085,6 +6085,7 @@ void process_alert_core(const std::string& message, BOOL modal) LLStringUtil::convertToS32(text.substr(18), mins); args["MINUTES"] = llformat("%d",mins); LLNotificationsUtil::add("RegionRestartMinutes", args); + send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); } else if (text.substr(0,17) == "RESTART_X_SECONDS") { @@ -6092,6 +6093,7 @@ void process_alert_core(const std::string& message, BOOL modal) LLStringUtil::convertToS32(text.substr(18), secs); args["SECONDS"] = llformat("%d",secs); LLNotificationsUtil::add("RegionRestartSeconds", args); + send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); } else { -- cgit v1.3 From ceb15e6edeed5d0e1fb7eaab9bc5b1592a252303 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 5 Nov 2013 15:45:48 -0500 Subject: STORM-1980/1983 Add time to region restarting message --- indra/newview/llviewermessage.cpp | 48 ++++++++++------------ .../newview/skins/default/xui/en/notifications.xml | 4 +- indra/newview/skins/default/xui/en/strings.xml | 3 ++ 3 files changed, 27 insertions(+), 28 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ebc6ff8165..bcd535bb90 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5748,7 +5748,6 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock) std::string regionMaturity = LLViewerRegion::accessToString(regionAccess); LLStringUtil::toLower(regionMaturity); llsdBlock["REGIONMATURITY"] = regionMaturity; - bool returnValue = false; LLNotificationPtr maturityLevelNotification; std::string notifySuffix = "_Notify"; @@ -5918,6 +5917,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) (notificationID == "RegionEntryAccessBlocked") || (notificationID == "LandClaimAccessBlocked") || (notificationID == "LandBuyAccessBlocked") + ) { /*--------------------------------------------------------------------- @@ -5959,7 +5959,23 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) snap_filename += SCREEN_HOME_FILENAME; gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE); } - + + if (notificationID == "RegionRestartMinutes" || + notificationID == "RegionRestartSeconds") + { + // Get current UTC time, adjusted for the user's clock + // being off. + time_t utc_time; + utc_time = time_corrected(); + std::string timeStr = LLTrans::getString("ViewerMessageTime"); + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format(timeStr, substitution); + llsdBlock["TIME"] = timeStr; + + send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); + } + LLNotificationsUtil::add(notificationID, llsdBlock); return true; } @@ -6019,7 +6035,6 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data) std::string message; msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message); - process_special_alert_messages(message); if (!attempt_standard_notification(msgsystem)) @@ -6043,7 +6058,6 @@ bool handle_not_age_verified_alert(const std::string &pAlertName) bool handle_special_alerts(const std::string &pAlertName) { bool isHandled = false; - if (LLStringUtil::compareStrings(pAlertName, "NotAgeVerified") == 0) { @@ -6079,28 +6093,10 @@ void process_alert_core(const std::string& message, BOOL modal) // System message is important, show in upper-right box not tip std::string text(message.substr(1)); LLSD args; - if (text.substr(0,17) == "RESTART_X_MINUTES") - { - S32 mins = 0; - LLStringUtil::convertToS32(text.substr(18), mins); - args["MINUTES"] = llformat("%d",mins); - LLNotificationsUtil::add("RegionRestartMinutes", args); - send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); - } - else if (text.substr(0,17) == "RESTART_X_SECONDS") - { - S32 secs = 0; - LLStringUtil::convertToS32(text.substr(18), secs); - args["SECONDS"] = llformat("%d",secs); - LLNotificationsUtil::add("RegionRestartSeconds", args); - send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); - } - else - { - std::string new_msg =LLNotifications::instance().getGlobalString(text); - args["MESSAGE"] = new_msg; - LLNotificationsUtil::add("SystemMessage", args); - } + + std::string new_msg =LLNotifications::instance().getGlobalString(text); + args["MESSAGE"] = new_msg; + LLNotificationsUtil::add("SystemMessage", args); } else if (modal) { diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index e7c89db069..a0a5a0395a 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6887,7 +6887,7 @@ This will add a bookmark in your inventory so you can quickly IM this Resident. priority="high" sound="UISndAlert" type="notify"> -This region will restart in [MINUTES] minutes. +[TIME] This region will restart in [MINUTES] minutes. If you stay in this region you will be logged out. @@ -6897,7 +6897,7 @@ If you stay in this region you will be logged out. priority="high" sound="UISndAlert" type="notify"> -This region will restart in [SECONDS] seconds. +[TIME] This region will restart in [SECONDS] seconds. If you stay in this region you will be logged out. diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 8ac95beddb..3fc1609cd4 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2551,6 +2551,9 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale This resident has turned on 'Do Not Disturb' and will see your message later. + + [hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] + (By name) (Resident) -- cgit v1.3 From 7d4deed8bef62cee1fc782a9676505136b231412 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 5 Nov 2013 17:47:00 -0500 Subject: STORM-1980/1983 Attempt to test alert message with a new uploaded sound --- indra/newview/llviewermessage.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index bcd535bb90..51260c98cd 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5960,21 +5960,21 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE); } - if (notificationID == "RegionRestartMinutes" || - notificationID == "RegionRestartSeconds") - { - // Get current UTC time, adjusted for the user's clock - // being off. - time_t utc_time; - utc_time = time_corrected(); - std::string timeStr = LLTrans::getString("ViewerMessageTime"); - LLSD substitution; - substitution["datetime"] = (S32) utc_time; - LLStringUtil::format(timeStr, substitution); - llsdBlock["TIME"] = timeStr; + if (notificationID == "RegionRestartMinutes" || + notificationID == "RegionRestartSeconds") + { + // Get current UTC time, adjusted for the user's clock + // being off. + time_t utc_time; + utc_time = time_corrected(); + std::string timeStr = LLTrans::getString("ViewerMessageTime"); + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format(timeStr, substitution); + llsdBlock["TIME"] = timeStr; - send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); - } + send_sound_trigger(LLUUID("4b315701-1972-9e23-cdd8-23cbc8cb0f42"), 1.0f); + } LLNotificationsUtil::add(notificationID, llsdBlock); return true; -- cgit v1.3 From 21ff4de02669f04ca9afec8d3f5aa0b68864fd13 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 5 Nov 2013 17:57:56 -0500 Subject: STORM-1980/1983 Revert previous change --- indra/newview/llviewermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 51260c98cd..f66b3ba805 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5973,7 +5973,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) LLStringUtil::format(timeStr, substitution); llsdBlock["TIME"] = timeStr; - send_sound_trigger(LLUUID("4b315701-1972-9e23-cdd8-23cbc8cb0f42"), 1.0f); + send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); } LLNotificationsUtil::add(notificationID, llsdBlock); -- cgit v1.3 From 662efccfb821c2bf61c286aeec97563d7f95a9f8 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 6 Nov 2013 15:11:11 -0500 Subject: STORM-1980/1983 Add debug setting UISndRestart and value. This UUID will need to be replaced with an official UUID once one has been established. --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llviewermessage.cpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 41aac583d7..be5f81e7e7 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12621,6 +12621,17 @@ Value 00000000-0000-0000-0000-000000000000 + UISndRestart + + Comment + Sound file for region restarting (uuid for sound asset) + Persist + 1 + Type + String + Value + 4b315701-1972-9e23-cdd8-23cbc8cb0f42 + UISndSnapshot Comment diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f66b3ba805..48bfdc03ac 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5973,7 +5973,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) LLStringUtil::format(timeStr, substitution); llsdBlock["TIME"] = timeStr; - send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f); + send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 1.0f); } LLNotificationsUtil::add(notificationID, llsdBlock); -- cgit v1.3 From 3e429c1e11ab5d9a3279598fd671cee230d40afd Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 8 Nov 2013 16:15:36 -0500 Subject: STORM-1980/1983 Small XML cleanup. Changed notification type to Alert. Addes seconds field to notification message. --- indra/newview/llviewermessage.cpp | 2 +- indra/newview/skins/default/xui/en/notifications.xml | 6 ++---- indra/newview/skins/default/xui/en/strings.xml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 48bfdc03ac..805b3aab18 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5967,7 +5967,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) // being off. time_t utc_time; utc_time = time_corrected(); - std::string timeStr = LLTrans::getString("ViewerMessageTime"); + std::string timeStr = LLTrans::getString("HMSTime"); LLSD substitution; substitution["datetime"] = (S32) utc_time; LLStringUtil::format(timeStr, substitution); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a0a5a0395a..083ff46ebb 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6885,8 +6885,7 @@ This will add a bookmark in your inventory so you can quickly IM this Resident. icon="notify.tga" name="RegionRestartMinutes" priority="high" - sound="UISndAlert" - type="notify"> + type="alert"> [TIME] This region will restart in [MINUTES] minutes. If you stay in this region you will be logged out. @@ -6895,8 +6894,7 @@ If you stay in this region you will be logged out. icon="notify.tga" name="RegionRestartSeconds" priority="high" - sound="UISndAlert" - type="notify"> + type="alert"> [TIME] This region will restart in [SECONDS] seconds. If you stay in this region you will be logged out. diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 3fc1609cd4..4534434c46 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2552,7 +2552,7 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale This resident has turned on 'Do Not Disturb' and will see your message later. - [hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] + [hour12, datetime, slt]:[min, datetime, slt]:[second, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] (By name) -- cgit v1.3 From 1e9cfd39c8441fad71ed7171ac93bdeb1d02e54b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 15 Nov 2013 11:49:35 -0500 Subject: STORM-1980 Added a floater displaying a countdown timer. Removed most of the previous changes. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterregioninfo.cpp | 1 + indra/newview/llfloaterregionrestarting.cpp | 119 +++++++++++++++++++++ indra/newview/llfloaterregionrestarting.h | 55 ++++++++++ indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermessage.cpp | 41 +++++-- indra/newview/skins/default/colors.xml | 3 + .../default/xui/en/floater_region_restarting.xml | 62 +++++++++++ .../newview/skins/default/xui/en/notifications.xml | 6 +- indra/newview/skins/default/xui/en/strings.xml | 3 - 10 files changed, 280 insertions(+), 14 deletions(-) create mode 100644 indra/newview/llfloaterregionrestarting.cpp create mode 100644 indra/newview/llfloaterregionrestarting.h create mode 100644 indra/newview/skins/default/xui/en/floater_region_restarting.xml (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1fea6dea9f..34c3489f9f 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -267,6 +267,7 @@ set(viewer_SOURCE_FILES llfloaterregiondebugconsole.cpp llfloaterregioninfo.cpp llfloaterreporter.cpp + llfloaterregionrestarting.cpp llfloaterscriptdebug.cpp llfloaterscriptlimits.cpp llfloatersearch.cpp @@ -855,6 +856,7 @@ set(viewer_HEADER_FILES llfloaterregiondebugconsole.h llfloaterregioninfo.h llfloaterreporter.h + llfloaterregionrestarting.h llfloaterscriptdebug.h llfloaterscriptlimits.h llfloatersearch.h diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 66bf49331b..cc0053cb99 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -91,6 +91,7 @@ #include "lltrans.h" #include "llagentui.h" #include "llmeshrepository.h" +#include "llfloaterregionrestarting.h" const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp new file mode 100644 index 0000000000..62bce27d09 --- /dev/null +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -0,0 +1,119 @@ +/** + * @file llfloaterregionrestarting.cpp + * @brief Shows countdown timer during region restart + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterregionrestarting.h" + +#include "llfloaterreg.h" +#include "lluictrl.h" +#include "llenvmanager.h" + + +static S32 mSeconds; + +LLFloaterRegionRestarting::LLFloaterRegionRestarting(const LLSD& key) : + LLFloater(key), + LLEventTimer(1) +{ + mName = key["NAME"]; + mSeconds = (LLSD::Integer)key["SECONDS"]; +} + +LLFloaterRegionRestarting::~LLFloaterRegionRestarting() +{ +} + +BOOL LLFloaterRegionRestarting::postBuild() +{ + LLStringUtil::format_map_t args; + std::string text; + + args["[NAME]"] = mName; + text = getString("RegionName", args); + LLTextBox* textbox = getChild("region_name"); + textbox->setValue(text); + + refresh(); + + LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); + + LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance("region_restarting"); + + if (floaterp) + { +llwarns << "DBG setting color" << llendl; + LLColor4 bg_color; + bg_color = LLUIColorTable::instance().getColor("LtOrange"); + floaterp->setBackgroundColor(bg_color); + } + + return TRUE; +} + +void LLFloaterRegionRestarting::regionChange() +{ + close(); +} + +BOOL LLFloaterRegionRestarting::tick() +{ + refresh(); + + return FALSE; +} + +void LLFloaterRegionRestarting::refresh() +{ + LLStringUtil::format_map_t args; + std::string text; + + args["[SECONDS]"] = llformat("%d", mSeconds); + text = getString("RestartSeconds", args); + LLTextBox* textbox = getChild("restart_seconds"); + textbox->setValue(text); + + mSeconds = mSeconds - 1; + if(mSeconds < 0.0) + { + mSeconds = 0; + } +} + +void LLFloaterRegionRestarting::close() +{ + LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance("region_restarting"); + + if (floaterp) + { + floaterp->closeFloater(); + } +} + +void LLFloaterRegionRestarting::updateTime(U32 time) +{ + mSeconds = time; +} diff --git a/indra/newview/llfloaterregionrestarting.h b/indra/newview/llfloaterregionrestarting.h new file mode 100644 index 0000000000..84f1bc65fb --- /dev/null +++ b/indra/newview/llfloaterregionrestarting.h @@ -0,0 +1,55 @@ +/** + * @file llfloaterregionrestarting.h + * @brief Shows countdown timer during region restart + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERREGIONRESTARTING_H +#define LL_LLFLOATERREGIONRESTARTING_H + +#include "llfloater.h" +#include "lltextbox.h" +#include "lleventtimer.h" + +class LLFloaterRegionRestarting : public LLFloater, public LLEventTimer +{ + friend class LLFloaterReg; + +public: + static void close(); + static void updateTime(U32 time); + +private: + LLFloaterRegionRestarting(const LLSD& key); + virtual ~LLFloaterRegionRestarting(); + virtual BOOL postBuild(); + virtual BOOL tick(); + virtual void refresh(); + virtual void regionChange(); + + LLTextBox* mRestartSeconds; + + std::string mName; +}; + +#endif // LL_LLFLOATERREGIONRESTARTING_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 4ce049df03..a8eeddb798 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -95,6 +95,7 @@ #include "llfloaterproperties.h" #include "llfloaterregiondebugconsole.h" #include "llfloaterregioninfo.h" +#include "llfloaterregionrestarting.h" #include "llfloaterreporter.h" #include "llfloaterscriptdebug.h" #include "llfloaterscriptlimits.h" @@ -296,6 +297,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 805b3aab18..ac652ef329 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -110,6 +110,7 @@ #include "llpanelblockedlist.h" #include "llpanelplaceprofile.h" #include "llviewerregion.h" +#include "llfloaterregionrestarting.h" #include // #include @@ -5963,15 +5964,30 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) if (notificationID == "RegionRestartMinutes" || notificationID == "RegionRestartSeconds") { - // Get current UTC time, adjusted for the user's clock - // being off. - time_t utc_time; - utc_time = time_corrected(); - std::string timeStr = LLTrans::getString("HMSTime"); - LLSD substitution; - substitution["datetime"] = (S32) utc_time; - LLStringUtil::format(timeStr, substitution); - llsdBlock["TIME"] = timeStr; + U32 seconds; + if (notificationID == "RegionRestartMinutes") + { + seconds = 60 * static_cast(llsdBlock["MINUTES"].asInteger()); + } + else + { + seconds = static_cast(llsdBlock["SECONDS"].asInteger()); + } + + LLSD params; + params["NAME"] = llsdBlock["NAME"]; + params["SECONDS"] = (LLSD::Integer)seconds; + + LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance("region_restarting"); + + if (floaterp) + { + LLFloaterRegionRestarting::updateTime(seconds); + } + else + { + LLFloaterReg::showInstance("region_restarting", params); + } send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 1.0f); } @@ -6094,6 +6110,13 @@ void process_alert_core(const std::string& message, BOOL modal) std::string text(message.substr(1)); LLSD args; + // *NOTE: If the text from the server ever changes this line will need to be adjusted. + std::string restart_cancelled = "Region restart cancelled."; + if (text.substr(0, restart_cancelled.length()) == restart_cancelled) + { + LLFloaterRegionRestarting::close(); + } + std::string new_msg =LLNotifications::instance().getGlobalString(text); args["MESSAGE"] = new_msg; LLNotificationsUtil::add("SystemMessage", args); diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index f53995732f..1587e6124d 100755 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -122,6 +122,9 @@ + This resident has turned on 'Do Not Disturb' and will see your message later. - - [hour12, datetime, slt]:[min, datetime, slt]:[second, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt] - (By name) (Resident) -- cgit v1.3 From 590630a32fee3205861e61438a88de0944d9c996 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 16 Nov 2013 10:54:30 -0500 Subject: STORM-1980 Code cleanup and an attempt to fix a mac/linux compile error --- indra/newview/llfloaterregionrestarting.cpp | 18 +++--------------- indra/newview/llfloaterregionrestarting.h | 4 +--- indra/newview/llviewermessage.cpp | 6 +++--- 3 files changed, 7 insertions(+), 21 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 62bce27d09..09518fff2d 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -39,7 +39,7 @@ LLFloaterRegionRestarting::LLFloaterRegionRestarting(const LLSD& key) : LLFloater(key), LLEventTimer(1) { - mName = key["NAME"]; + mName = (std::string)key["NAME"]; mSeconds = (LLSD::Integer)key["SECONDS"]; } @@ -61,16 +61,6 @@ BOOL LLFloaterRegionRestarting::postBuild() LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); - LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance("region_restarting"); - - if (floaterp) - { -llwarns << "DBG setting color" << llendl; - LLColor4 bg_color; - bg_color = LLUIColorTable::instance().getColor("LtOrange"); - floaterp->setBackgroundColor(bg_color); - } - return TRUE; } @@ -92,9 +82,7 @@ void LLFloaterRegionRestarting::refresh() std::string text; args["[SECONDS]"] = llformat("%d", mSeconds); - text = getString("RestartSeconds", args); - LLTextBox* textbox = getChild("restart_seconds"); - textbox->setValue(text); + getChild("restart_seconds")->setValue(getString("RestartSeconds", args)); mSeconds = mSeconds - 1; if(mSeconds < 0.0) @@ -113,7 +101,7 @@ void LLFloaterRegionRestarting::close() } } -void LLFloaterRegionRestarting::updateTime(U32 time) +void LLFloaterRegionRestarting::updateTime(S32 time) { mSeconds = time; } diff --git a/indra/newview/llfloaterregionrestarting.h b/indra/newview/llfloaterregionrestarting.h index 84f1bc65fb..fef0dcddfe 100644 --- a/indra/newview/llfloaterregionrestarting.h +++ b/indra/newview/llfloaterregionrestarting.h @@ -37,7 +37,7 @@ class LLFloaterRegionRestarting : public LLFloater, public LLEventTimer public: static void close(); - static void updateTime(U32 time); + static void updateTime(S32 time); private: LLFloaterRegionRestarting(const LLSD& key); @@ -47,8 +47,6 @@ private: virtual void refresh(); virtual void regionChange(); - LLTextBox* mRestartSeconds; - std::string mName; }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ac652ef329..0ce8585c15 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5964,14 +5964,14 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) if (notificationID == "RegionRestartMinutes" || notificationID == "RegionRestartSeconds") { - U32 seconds; + S32 seconds; if (notificationID == "RegionRestartMinutes") { - seconds = 60 * static_cast(llsdBlock["MINUTES"].asInteger()); + seconds = 60 * static_cast(llsdBlock["MINUTES"].asInteger()); } else { - seconds = static_cast(llsdBlock["SECONDS"].asInteger()); + seconds = static_cast(llsdBlock["SECONDS"].asInteger()); } LLSD params; -- cgit v1.3 From d15cc2dadc34c757d1ac6aef66d5baa38fb80968 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 3 Jan 2014 13:31:51 -0500 Subject: STORM-1980 Add shake effect --- indra/newview/llfloaterregionrestarting.cpp | 83 +++++++++++++++++++++++++---- indra/newview/llfloaterregionrestarting.h | 13 +++++ indra/newview/llviewermessage.cpp | 7 ++- 3 files changed, 90 insertions(+), 13 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 003ed488c6..111daf93eb 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -31,15 +31,18 @@ #include "llfloaterreg.h" #include "lluictrl.h" #include "llagent.h" +#include "llagentcamera.h" +#include "llviewerwindow.h" -static S32 mSeconds; +static S32 sSeconds; +static U32 sShakeState; LLFloaterRegionRestarting::LLFloaterRegionRestarting(const LLSD& key) : LLFloater(key), LLEventTimer(1) { mName = (std::string)key["NAME"]; - mSeconds = (LLSD::Integer)key["SECONDS"]; + sSeconds = (LLSD::Integer)key["SECONDS"]; } LLFloaterRegionRestarting::~LLFloaterRegionRestarting() @@ -49,6 +52,8 @@ LLFloaterRegionRestarting::~LLFloaterRegionRestarting() BOOL LLFloaterRegionRestarting::postBuild() { + mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); + LLStringUtil::format_map_t args; std::string text; @@ -57,9 +62,9 @@ BOOL LLFloaterRegionRestarting::postBuild() LLTextBox* textbox = getChild("region_name"); textbox->setValue(text); - refresh(); + sShakeState = SHAKE_START; - mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); + refresh(); return TRUE; } @@ -81,13 +86,72 @@ void LLFloaterRegionRestarting::refresh() LLStringUtil::format_map_t args; std::string text; - args["[SECONDS]"] = llformat("%d", mSeconds); + args["[SECONDS]"] = llformat("%d", sSeconds); getChild("restart_seconds")->setValue(getString("RestartSeconds", args)); - mSeconds = mSeconds - 1; - if(mSeconds < 0.0) + sSeconds = sSeconds - 1; + if(sSeconds < 0.0) + { + sSeconds = 0; + } +} + +void LLFloaterRegionRestarting::draw() +{ + LLFloater::draw(); + + const F32 SHAKE_INTERVAL = 0.05; + const U32 SHAKE_ITERATIONS = 4; + + if(SHAKE_START == sShakeState) + { + mShakeTimer.setTimerExpirySec(SHAKE_INTERVAL); + sShakeState = SHAKE_LEFT; + mIterations = 0; + } + + if(SHAKE_DONE != sShakeState && mShakeTimer.hasExpired()) { - mSeconds = 0; + gAgentCamera.unlockView(); + + switch(sShakeState) + { + case SHAKE_LEFT: + gAgentCamera.setPanLeftKey(1.0); + gAgentCamera.setPanLeftKey(1.0); + sShakeState = SHAKE_UP; + break; + + case SHAKE_UP: + gAgentCamera.setPanUpKey(1.0); + gAgentCamera.setPanUpKey(1.0); + sShakeState = SHAKE_RIGHT; + break; + + case SHAKE_RIGHT: + gAgentCamera.setPanRightKey(1.0); + gAgentCamera.setPanRightKey(1.0); + sShakeState = SHAKE_DOWN; + break; + + case SHAKE_DOWN: + gAgentCamera.setPanDownKey(1.0); + gAgentCamera.setPanDownKey(1.0); + mIterations = mIterations + 1; + if(SHAKE_ITERATIONS == mIterations) + { + sShakeState = SHAKE_DONE; + } + else + { + sShakeState = SHAKE_LEFT; + } + break; + + default: + break; + } + mShakeTimer.setTimerExpirySec(SHAKE_INTERVAL); } } @@ -103,5 +167,6 @@ void LLFloaterRegionRestarting::close() void LLFloaterRegionRestarting::updateTime(S32 time) { - mSeconds = time; + sSeconds = time; + sShakeState = SHAKE_START; } diff --git a/indra/newview/llfloaterregionrestarting.h b/indra/newview/llfloaterregionrestarting.h index 6ff067e0a8..95fe772a28 100644 --- a/indra/newview/llfloaterregionrestarting.h +++ b/indra/newview/llfloaterregionrestarting.h @@ -45,11 +45,24 @@ private: virtual BOOL postBuild(); virtual BOOL tick(); virtual void refresh(); + virtual void draw(); virtual void regionChange(); std::string mName; + U32 mIterations; + LLTimer mShakeTimer; boost::signals2::connection mRegionChangedConnection; + + enum + { + SHAKE_START, + SHAKE_LEFT, + SHAKE_UP, + SHAKE_RIGHT, + SHAKE_DOWN, + SHAKE_DONE + }; }; #endif // LL_LLFLOATERREGIONRESTARTING_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e81de844d1..076419e96a 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5967,10 +5967,6 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) seconds = static_cast(llsdBlock["SECONDS"].asInteger()); } - LLSD params; - params["NAME"] = llsdBlock["NAME"]; - params["SECONDS"] = (LLSD::Integer)seconds; - LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance("region_restarting"); if (floaterp) @@ -5979,6 +5975,9 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) } else { + LLSD params; + params["NAME"] = llsdBlock["NAME"]; + params["SECONDS"] = (LLSD::Integer)seconds; LLFloaterReg::showInstance("region_restarting", params); } -- cgit v1.3 From 24c5ac7417f8b32c39dd5defec21845bd03786c4 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 4 Jan 2014 10:40:20 -0500 Subject: STORM-1980 Center floater on screen. Tweak shaking parameters. --- indra/newview/llfloaterregionrestarting.cpp | 7 ++++--- indra/newview/llviewermessage.cpp | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 94c805205a..95d4265bb4 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -100,9 +100,10 @@ void LLFloaterRegionRestarting::draw() { LLFloater::draw(); - const F32 SHAKE_INTERVAL = 0.04; + const F32 SHAKE_INTERVAL = 0.025; const F32 SHAKE_TOTAL_DURATION = 1.8; // the length of the default alert tone for this const F32 SHAKE_INITIAL_MAGNITUDE = 1.5; + const F32 SHAKE_HORIZONTAL_BIAS = 0.25; F32 time_shaking; if(SHAKE_START == sShakeState) @@ -120,7 +121,7 @@ void LLFloaterRegionRestarting::draw() switch(sShakeState) { case SHAKE_LEFT: - gAgentCamera.setPanLeftKey(mShakeMagnitude); + gAgentCamera.setPanLeftKey(mShakeMagnitude * SHAKE_HORIZONTAL_BIAS); sShakeState = SHAKE_UP; break; @@ -130,7 +131,7 @@ void LLFloaterRegionRestarting::draw() break; case SHAKE_RIGHT: - gAgentCamera.setPanRightKey(mShakeMagnitude); + gAgentCamera.setPanRightKey(mShakeMagnitude * SHAKE_HORIZONTAL_BIAS); sShakeState = SHAKE_DOWN; break; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 076419e96a..267aa9532c 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5978,7 +5978,11 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) LLSD params; params["NAME"] = llsdBlock["NAME"]; params["SECONDS"] = (LLSD::Integer)seconds; - LLFloaterReg::showInstance("region_restarting", params); + LLFloaterRegionRestarting* restarting_floater = dynamic_cast(LLFloaterReg::showInstance("region_restarting", params)); + if(restarting_floater) + { + restarting_floater->center(); + } } send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 1.0f); -- cgit v1.3