summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authormax nikolenko <maximnproductengine@lindenlab.com>2017-02-15 10:02:02 +0000
committermax nikolenko <maximnproductengine@lindenlab.com>2017-02-15 10:02:02 +0000
commita71ddeafc28dd82cf4284e0608c49c5b83986834 (patch)
treebf8c1761f6dbe7b94e12da3fe10fa517e63ed1ee /indra/newview
parent4524677fe526781e4cb9a987e9504cc3b2edd154 (diff)
parent6e06281477840e2403d52510b54bf2cd99dd8216 (diff)
Merged in MAINT-7104 Quicker and easier access to Grid Status from within the Second Life viewer
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/app_settings/commands.xml11
-rw-r--r--indra/newview/app_settings/settings.xml49
-rw-r--r--indra/newview/llfloatergridstatus.cpp184
-rw-r--r--indra/newview/llfloatergridstatus.h71
-rw-r--r--indra/newview/llstartup.cpp3
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/skins/default/textures/textures.xml1
-rw-r--r--indra/newview/skins/default/textures/toolbar_icons/grid_status.pngbin0 -> 483 bytes
-rw-r--r--indra/newview/skins/default/xui/en/floater_grid_status.xml18
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml2
11 files changed, 343 insertions, 0 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 9ac1c3520d..dbec4b5d65 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -236,6 +236,7 @@ set(viewer_SOURCE_FILES
llfloatergesture.cpp
llfloatergodtools.cpp
llfloatergotoline.cpp
+ llfloatergridstatus.cpp
llfloatergroupbulkban.cpp
llfloatergroupinvite.cpp
llfloatergroups.cpp
@@ -852,6 +853,7 @@ set(viewer_HEADER_FILES
llfloatergesture.h
llfloatergodtools.h
llfloatergotoline.h
+ llfloatergridstatus.h
llfloatergroupbulkban.h
llfloatergroupinvite.h
llfloatergroups.h
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml
index 9bc0a7c701..412d3a53b3 100644
--- a/indra/newview/app_settings/commands.xml
+++ b/indra/newview/app_settings/commands.xml
@@ -292,4 +292,15 @@
is_running_function="Floater.IsOpen"
is_running_parameters="reporter"
/>
+ <command name="gridstatus"
+ available_in_toybox="true"
+ is_flashing_allowed="true"
+ icon="Command_Grid_Status_Icon"
+ label_ref="Command_Grid_Status_Label"
+ tooltip_ref="Command_Grid_Status_Tooltip"
+ execute_function="Floater.ToggleOrBringToFront"
+ execute_parameters="grid_status"
+ is_running_function="Floater.IsOpen"
+ is_running_parameters="grid_status"
+ />
</commands>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 717deba8c7..fb644d3d5a 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5163,6 +5163,39 @@
<key>Value</key>
<string>http://wiki.secondlife.com/wiki/[LSL_STRING]</string>
</map>
+ <key>GridStatusRSS</key>
+ <map>
+ <key>Comment</key>
+ <string>URL that points to SL Grid Status RSS</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>https://secondlife-status.statuspage.io/history.atom</string>
+ </map>
+ <key>GridStatusUpdateDelay</key>
+ <map>
+ <key>Comment</key>
+ <string>Timer delay for updating Grid Status RSS.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>60.0</real>
+ </map>
+ <key>TestGridStatusRSSFromFile</key>
+ <map>
+ <key>Comment</key>
+ <string>For testing only: Don't update rss xml file from server.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>LagMeterShrunk</key>
<map>
<key>Comment</key>
@@ -15125,6 +15158,22 @@
<integer>0</integer>
</array>
</map>
+ <key>GridStatusFloaterRect</key>
+ <map>
+ <key>Comment</key>
+ <string>Web profile floater dimensions</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Rect</string>
+ <key>Value</key>
+ <array>
+ <integer>0</integer>
+ <integer>520</integer>
+ <integer>625</integer>
+ <integer>0</integer>
+ </array>
+ </map>
<key>HelpFloaterOpen</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llfloatergridstatus.cpp b/indra/newview/llfloatergridstatus.cpp
new file mode 100644
index 0000000000..c47ff1c1d9
--- /dev/null
+++ b/indra/newview/llfloatergridstatus.cpp
@@ -0,0 +1,184 @@
+/**
+ * @file llfloatergridstatus.cpp
+ * @brief Grid status floater - uses an embedded web browser to show Grid status info
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2017, 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 "llfloatergridstatus.h"
+
+#include "llcallbacklist.h"
+#include "llcorehttputil.h"
+#include "llfloaterreg.h"
+#include "llhttpconstants.h"
+#include "llmediactrl.h"
+#include "llsdserialize.h"
+#include "lltoolbarview.h"
+#include "llviewercontrol.h"
+#include "llxmltree.h"
+
+std::map<std::string, std::string> LLFloaterGridStatus::sItemsMap;
+const std::string DEFAULT_GRID_STATUS_URL = "http://secondlife-status.statuspage.io/";
+
+LLFloaterGridStatus::LLFloaterGridStatus(const Params& key) :
+ LLFloaterWebContent(key),
+ mIsFirstUpdate(TRUE)
+{
+}
+
+BOOL LLFloaterGridStatus::postBuild()
+{
+ LLFloaterWebContent::postBuild();
+ mWebBrowser->addObserver(this);
+
+ return TRUE;
+}
+
+void LLFloaterGridStatus::onOpen(const LLSD& key)
+{
+ Params p(key);
+ p.trusted_content = true;
+ p.allow_address_entry = false;
+
+ LLFloaterWebContent::onOpen(p);
+ applyPreferredRect();
+ if (mWebBrowser)
+ {
+ mWebBrowser->navigateTo(DEFAULT_GRID_STATUS_URL, HTTP_CONTENT_TEXT_HTML);
+ }
+}
+
+void LLFloaterGridStatus::startGridStatusTimer()
+{
+ checkGridStatusRSS();
+ doPeriodically(boost::bind(&LLFloaterGridStatus::checkGridStatusRSS), gSavedSettings.getF32("GridStatusUpdateDelay"));
+}
+
+bool LLFloaterGridStatus::checkGridStatusRSS()
+{
+ if(gToolBarView->hasCommand(LLCommandId("gridstatus")))
+ {
+ LLCoros::instance().launch("LLFloaterGridStatus::getGridStatusRSSCoro",
+ boost::bind(&LLFloaterGridStatus::getGridStatusRSSCoro));
+ }
+ return false;
+}
+
+void LLFloaterGridStatus::getGridStatusRSSCoro()
+{
+
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getGridStatusRSSCoro", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
+ LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders);
+
+ httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_TEXT_XML);
+ std::string url = gSavedSettings.getString("GridStatusRSS");
+
+ LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts, httpHeaders);
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ if (!status)
+ {
+ return;
+ }
+
+ const LLSD::Binary &rawBody = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary();
+ std::string body(rawBody.begin(), rawBody.end());
+
+ std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"grid_status_rss.xml");
+ if(!gSavedSettings.getBOOL("TestGridStatusRSSFromFile"))
+ {
+ llofstream custom_file_out(fullpath.c_str(), std::ios::trunc);
+ if (custom_file_out.is_open())
+ {
+ custom_file_out << body;
+ custom_file_out.close();
+ }
+ }
+ LLXmlTree grid_status_xml;
+ if (!grid_status_xml.parseFile(fullpath))
+ {
+ return ;
+ }
+ bool new_entries = false;
+ LLXmlTreeNode* rootp = grid_status_xml.getRoot();
+ for (LLXmlTreeNode* item = rootp->getChildByName( "entry" ); item; item = rootp->getNextNamedChild())
+ {
+ LLXmlTreeNode* id_node = item->getChildByName("id");
+ LLXmlTreeNode* updated_node = item->getChildByName("updated");
+ if (!id_node || !updated_node)
+ {
+ continue;
+ }
+ std::string guid = id_node->getContents();
+ std::string date = updated_node->getContents();
+ if(sItemsMap.find( guid ) == sItemsMap.end())
+ {
+ new_entries = true;
+ }
+ else
+ {
+ if(sItemsMap[guid] != date)
+ {
+ new_entries = true;
+ }
+ }
+ sItemsMap[guid] = date;
+ }
+ if(new_entries && !getInstance()->isFirstUpdate())
+ {
+ gToolBarView->flashCommand(LLCommandId("gridstatus"), true);
+ }
+ getInstance()->setFirstUpdate(FALSE);
+}
+
+// virtual
+void LLFloaterGridStatus::handleReshape(const LLRect& new_rect, bool by_user)
+{
+ if (by_user && !isMinimized())
+ {
+ gSavedSettings.setRect("GridStatusFloaterRect", new_rect);
+ }
+
+ LLFloaterWebContent::handleReshape(new_rect, by_user);
+}
+
+void LLFloaterGridStatus::applyPreferredRect()
+{
+ const LLRect preferred_rect = gSavedSettings.getRect("GridStatusFloaterRect");
+
+ LLRect new_rect = getRect();
+ new_rect.setLeftTopAndSize(
+ new_rect.mLeft, new_rect.mTop,
+ preferred_rect.getWidth(), preferred_rect.getHeight());
+ setShape(new_rect);
+}
+
+LLFloaterGridStatus* LLFloaterGridStatus::getInstance()
+{
+ return LLFloaterReg::getTypedInstance<LLFloaterGridStatus>("grid_status");
+}
diff --git a/indra/newview/llfloatergridstatus.h b/indra/newview/llfloatergridstatus.h
new file mode 100644
index 0000000000..0c3deb7d4c
--- /dev/null
+++ b/indra/newview/llfloatergridstatus.h
@@ -0,0 +1,71 @@
+/**
+ * @file llfloatergridstatus.h
+ * @brief Grid status floater - uses an embedded web browser to show Grid status info
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2017, 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_LLFLOATERGRIDSTATUS_H
+#define LL_LLFLOATERGRIDSTATUS_H
+
+#include "llfloaterwebcontent.h"
+#include "llviewermediaobserver.h"
+
+#include <string>
+
+class LLMediaCtrl;
+
+
+class LLFloaterGridStatus :
+ public LLFloaterWebContent
+{
+public:
+ typedef LLSDParamAdapter<_Params> Params;
+
+ LLFloaterGridStatus(const Params& key);
+
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
+
+ static bool checkGridStatusRSS();
+ static void getGridStatusRSSCoro();
+
+ void startGridStatusTimer();
+ BOOL isFirstUpdate() { return mIsFirstUpdate; }
+ void setFirstUpdate(BOOL first_update) { mIsFirstUpdate = first_update; }
+
+ static LLFloaterGridStatus* getInstance();
+
+
+private:
+ /*virtual*/ BOOL postBuild();
+
+ void applyPreferredRect();
+
+ static std::map<std::string, std::string> sItemsMap;
+
+ LLFrameTimer mGridStatusTimer;
+ BOOL mIsFirstUpdate;
+};
+
+#endif // LL_LLFLOATERGRIDSTATUS_H
+
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index b762b2ae1c..347409fcab 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -56,6 +56,7 @@
#include "llerrorcontrol.h"
#include "llfloaterreg.h"
#include "llfocusmgr.h"
+#include "llfloatergridstatus.h"
#include "llfloaterimsession.h"
#include "lllocationhistory.h"
#include "llimageworker.h"
@@ -1875,6 +1876,8 @@ bool idle_startup()
LLFloaterReg::showInitialVisibleInstances();
+ LLFloaterGridStatus::getInstance()->startGridStatusTimer();
+
display_startup();
display_startup();
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index ec7a81584a..46525e8455 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -70,6 +70,7 @@
#include "llfloaterfonttest.h"
#include "llfloatergesture.h"
#include "llfloatergodtools.h"
+#include "llfloatergridstatus.h"
#include "llfloatergroups.h"
#include "llfloaterhelpbrowser.h"
#include "llfloaterhoverheight.h"
@@ -231,6 +232,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGesture>);
LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGodTools>);
+ LLFloaterReg::add("grid_status", "floater_grid_status.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGridStatus>);
LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupPicker>);
LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHelpBrowser>);
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 760c294f90..d757e39366 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -136,6 +136,7 @@ with the same filename but different name
<texture name="Command_Facebook_Icon" file_name="toolbar_icons/facebook.png" preload="true" />
<texture name="Command_Flickr_Icon" file_name="toolbar_icons/flickr.png" preload="true" />
<texture name="Command_Gestures_Icon" file_name="toolbar_icons/gestures.png" preload="true" />
+ <texture name="Command_Grid_Status_Icon" file_name="toolbar_icons/grid_status.png" preload="true" />
<texture name="Command_HowTo_Icon" file_name="toolbar_icons/howto.png" preload="true" />
<texture name="Command_Inventory_Icon" file_name="toolbar_icons/inventory.png" preload="true" />
<texture name="Command_Map_Icon" file_name="toolbar_icons/map.png" preload="true" />
diff --git a/indra/newview/skins/default/textures/toolbar_icons/grid_status.png b/indra/newview/skins/default/textures/toolbar_icons/grid_status.png
new file mode 100644
index 0000000000..b92b93cfb4
--- /dev/null
+++ b/indra/newview/skins/default/textures/toolbar_icons/grid_status.png
Binary files differ
diff --git a/indra/newview/skins/default/xui/en/floater_grid_status.xml b/indra/newview/skins/default/xui/en/floater_grid_status.xml
new file mode 100644
index 0000000000..b97bd8056d
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_grid_status.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ positioning="cascading"
+ legacy_header_height="18"
+ can_resize="true"
+ height="775"
+ layout="topleft"
+ min_height="485"
+ min_width="485"
+ name="floater_grid_status"
+ help_topic="floater_grid_status"
+ save_rect="true"
+ save_visibility="true"
+ title=""
+ initial_mime_type="text/html"
+ width="780"
+ tab_stop="true"
+ filename="floater_web_content.xml"/>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index b75f631799..6f00f1731e 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -4070,6 +4070,7 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Facebook_Label">Facebook</string>
<string name="Command_Flickr_Label">Flickr</string>
<string name="Command_Gestures_Label">Gestures</string>
+ <string name="Command_Grid_Status_Label">Grid status</string>
<string name="Command_HowTo_Label">How to</string>
<string name="Command_Inventory_Label">Inventory</string>
<string name="Command_Map_Label">Map</string>
@@ -4102,6 +4103,7 @@ Try enclosing path to the editor with double quotes.
<string name="Command_Facebook_Tooltip">Post to Facebook</string>
<string name="Command_Flickr_Tooltip">Upload to Flickr</string>
<string name="Command_Gestures_Tooltip">Gestures for your avatar</string>
+ <string name="Command_Grid_Status_Tooltip">Show current Grid status</string>
<string name="Command_HowTo_Tooltip">How to do common tasks</string>
<string name="Command_Inventory_Tooltip">View and use your belongings</string>
<string name="Command_Map_Tooltip">Map of the world</string>