diff options
author | Jonathan Yap <none@none> | 2013-11-15 11:49:35 -0500 |
---|---|---|
committer | Jonathan Yap <none@none> | 2013-11-15 11:49:35 -0500 |
commit | 1e9cfd39c8441fad71ed7171ac93bdeb1d02e54b (patch) | |
tree | e0a489e1a6e6e94421090ef8871aae70d1c6b080 /indra/newview | |
parent | 8298e5e558fb6236fc32feb60fe097cee1751d7c (diff) |
STORM-1980 Added a floater displaying a countdown timer.
Removed most of the previous changes.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterregionrestarting.cpp | 119 | ||||
-rw-r--r-- | indra/newview/llfloaterregionrestarting.h | 55 | ||||
-rwxr-xr-x | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llviewermessage.cpp | 41 | ||||
-rwxr-xr-x | indra/newview/skins/default/colors.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_region_restarting.xml | 62 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 6 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 3 |
10 files changed, 280 insertions, 14 deletions
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<LLTextBox>("region_name"); + textbox->setValue(text); + + refresh(); + + LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this)); + + LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("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<LLTextBox>("restart_seconds"); + textbox->setValue(text); + + mSeconds = mSeconds - 1; + if(mSeconds < 0.0) + { + mSeconds = 0; + } +} + +void LLFloaterRegionRestarting::close() +{ + LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("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<LLFloaterResetQueue>); LLFloaterReg::add("region_debug_console", "floater_region_debug_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionDebugConsole>); LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionInfo>); + LLFloaterReg::add("region_restarting", "floater_region_restarting.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionRestarting>); LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebug>); LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebugOutput>); 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 <boost/algorithm/string/split.hpp> // #include <boost/regex.hpp> @@ -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<U32>(llsdBlock["MINUTES"].asInteger()); + } + else + { + seconds = static_cast<U32>(llsdBlock["SECONDS"].asInteger()); + } + + LLSD params; + params["NAME"] = llsdBlock["NAME"]; + params["SECONDS"] = (LLSD::Integer)seconds; + + LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("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 @@ <color name="Blue_80" value="0 0 1 0.8" /> + <color + name="Orange" + value="1 .82 .46 1" /> <!-- This color name makes potentially unused colors show up bright purple. Leave this here until all Unused? are removed below, otherwise diff --git a/indra/newview/skins/default/xui/en/floater_region_restarting.xml b/indra/newview/skins/default/xui/en/floater_region_restarting.xml new file mode 100644 index 0000000000..1bf5884653 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_region_restarting.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + height="245" + width="500" + layout="topleft" + name="region_restarting" + help_topic="floater_region_restarting" + single_instance="true" + reuse_instance="false" + title="REGION RESTARTING"> + <string name="RegionName"> + The region you are in now ([NAME]) is about to restart. + +If you stay in this region you will be logged out. + </string> + <string name="RestartSeconds"> + Seconds until restart +[SECONDS] + </string> + <panel + name="layout_panel_1" + height="245" + width="500" + follows="right|top" + top="0" + left="0" + background_visible="true" + bg_alpha_color="Orange"> + <text + type="string" + length="1" + follows="top|left" + layout="topleft" + name="region_name" + text_color="Black" + font="SansSerifLarge" + word_wrap="true" + height="100" + top="30" + left="10" + width="480"> + The region you are in now (-The longest region name-) is about to restart. + +If you stay in this region you will be logged out. + </text> + <text + type="string" + length="1" + follows="top|left" + layout="topleft" + name="restart_seconds" + text_color="Black" + font="SansSerifHuge" + height="100" + left="0" + halign="center" + width="500"> + Seconds until restart + 32767 + </text> + </panel> + </floater> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f3917f66d9..81e1025f13 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6884,8 +6884,9 @@ This will add a bookmark in your inventory so you can quickly IM this Resident. <notification icon="notify.tga" name="RegionRestartMinutes" + show_toast="false" priority="high" - type="alert"> + type="notify"> [TIME] The region [NAME] will restart in [MINUTES] minutes. If you stay in this region you will be logged out. </notification> @@ -6893,8 +6894,9 @@ If you stay in this region you will be logged out. <notification icon="notify.tga" name="RegionRestartSeconds" + show_toast="false" priority="high" - type="alert"> + type="notify"> [TIME] The region [NAME] will restart in [SECONDS] seconds. If you stay in this region you will be logged out. </notification> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 4534434c46..8ac95beddb 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2551,9 +2551,6 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale <!-- panel preferences general --> <string name="DoNotDisturbModeResponseDefault">This resident has turned on 'Do Not Disturb' and will see your message later.</string> - <!-- viewermessage --> - <string name="HMSTime">[hour12, datetime, slt]:[min, datetime, slt]:[second, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt]</string> - <!-- Mute --> <string name="MuteByName">(By name)</string> <string name="MuteAgent">(Resident)</string> |