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/llviewermessage.cpp | 41 ++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') 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); -- cgit v1.2.3