From b3590c5ae669219310b4bf17198155d25953e7e0 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 31 Jul 2014 14:45:27 -0400 Subject: [PATCH] Add Default Avatar Picker Floater (World->Default Avatars) Default Avatars button option added to Toolbar prefs. Adds debug setting ToolbarVisibleAvatar Hooks into "avatar_picker_url" login response on opensim. Also includes hooking up of DestinationGuideShown to startup, which was left unstaged from the initial commit of the Destination Guide. --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 38 ++++++++++ .../newview/app_settings/settings_ascent.xml | 11 +++ indra/newview/llfloateravatar.cpp | 65 ++++++++++++++++++ indra/newview/llfloateravatar.h | 44 ++++++++++++ indra/newview/llmarketplacefunctions.cpp | 2 +- indra/newview/llmenucommands.cpp | 2 + indra/newview/llstartup.cpp | 14 ++++ indra/newview/llweb.cpp | 27 ++++---- .../default/textures/icn_toolbar_avatar.tga | Bin 0 -> 22 bytes .../default/xui/en-us/floater_avatar.xml | 26 +++++++ .../xui/en-us/floater_toolbar_prefs.xml | 5 +- .../skins/default/xui/en-us/menu_viewer.xml | 5 ++ .../skins/default/xui/en-us/panel_toolbar.xml | 5 ++ 14 files changed, 230 insertions(+), 16 deletions(-) create mode 100644 indra/newview/llfloateravatar.cpp create mode 100644 indra/newview/llfloateravatar.h create mode 100644 indra/newview/skins/default/textures/icn_toolbar_avatar.tga create mode 100644 indra/newview/skins/default/xui/en-us/floater_avatar.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 018a69664..4668e2c97 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -183,6 +183,7 @@ set(viewer_SOURCE_FILES llfloateractivespeakers.cpp llfloaterauction.cpp llfloaterautoreplacesettings.cpp + llfloateravatar.cpp llfloateravatarinfo.cpp llfloateravatarlist.cpp llfloateravatarpicker.cpp @@ -711,6 +712,7 @@ set(viewer_HEADER_FILES llfloateractivespeakers.h llfloaterauction.h llfloaterautoreplacesettings.h + llfloateravatar.h llfloateravatarinfo.h llfloateravatarlist.h llfloateravatarpicker.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 423456538..51d8095d3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -243,6 +243,22 @@ Value 0 + FloaterAvatarRect + + Comment + Avatar picker floater position + Persist + 1 + Type + Rect + Value + + 0 + 0 + 0 + 0 + + FloaterAvatarTextRect Comment @@ -3128,6 +3144,17 @@ This should be as low as possible, but too low may break functionality Value 2 + AvatarPickerURL + + Comment + Avatar picker contents + Persist + 0 + Type + String + Value + http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/[GRID_LOWERCASE]/avatars.html + AvatarRotateThresholdSlow Comment @@ -14716,6 +14743,17 @@ This should be as low as possible, but too low may break functionality Value 0 + ShowAvatarFloater + + Comment + Display avatar picker floater on login + Persist + 1 + Type + Boolean + Value + 0 + ShowAxes Comment diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index 97b67e15e..8be48da2d 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -1019,6 +1019,17 @@ Value 0 + ToolbarVisibleAvatar + + Comment + Whether or not the button for default avatars is on the toolbar + Persist + 1 + Type + Boolean + Value + 0 + ToolbarVisibleBeacons Comment diff --git a/indra/newview/llfloateravatar.cpp b/indra/newview/llfloateravatar.cpp new file mode 100644 index 000000000..15033c997 --- /dev/null +++ b/indra/newview/llfloateravatar.cpp @@ -0,0 +1,65 @@ +/** + * @file llfloateravatar.h + * @author Leyla Farazha + * @brief floater for the avatar changer + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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$ + */ + +/** + * Floater that appears when buying an object, giving a preview + * of its contents and their permissions. + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloateravatar.h" +#include "llmediactrl.h" +#include "lluictrlfactory.h" +#include "llweb.h" + + +LLFloaterAvatar::LLFloaterAvatar(const LLSD& key) + : LLFloater(key) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar.xml", NULL, false); +} + +LLFloaterAvatar::~LLFloaterAvatar() +{ +} + +BOOL LLFloaterAvatar::postBuild() +{ + enableResizeCtrls(true, true, false); + LLMediaCtrl* avatar_picker = findChild("avatar_picker_contents"); + if (avatar_picker) + { + avatar_picker->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL")); + std::string url = gSavedSettings.getString("AvatarPickerURL"); + url = LLWeb::expandURLSubstitutions(url, LLSD()); + avatar_picker->navigateTo(url, "text/html"); + } + return TRUE; +} + + diff --git a/indra/newview/llfloateravatar.h b/indra/newview/llfloateravatar.h new file mode 100644 index 000000000..10327cf1f --- /dev/null +++ b/indra/newview/llfloateravatar.h @@ -0,0 +1,44 @@ +/** + * @file llfloateravatar.h + * @author Leyla Farazha + * @brief floater for the avatar changer + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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_FLOATER_AVATAR_H +#define LL_FLOATER_AVATAR_H + +#include "llfloater.h" + +class LLFloaterAvatar: + public LLFloater +, public LLFloaterSingleton +{ + friend class LLUISingleton >; +private: + LLFloaterAvatar(const LLSD& key); + /*virtual*/ ~LLFloaterAvatar(); + /*virtual*/ BOOL postBuild(); +}; + +#endif diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index c0ec144ce..3fc5a166e 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -41,7 +41,7 @@ // Helpers // -static std::string getLoginUriDomain() +std::string getLoginUriDomain() { LLURI uri(gHippoGridManager->getConnectedGrid()->getLoginUri()); std::string hostname = uri.hostName(); // Ie, "login..lindenlab.com" diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 7c60f66cb..e6c07b754 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -47,6 +47,7 @@ #include "llfloaterabout.h" #include "llfloateractivespeakers.h" #include "llfloaterautoreplacesettings.h" +#include "llfloateravatar.h" #include "llfloateravatarlist.h" #include "llfloaterbeacons.h" #include "llfloaterblacklist.h" @@ -221,6 +222,7 @@ struct MenuFloaterDict : public LLSingleton registerFloater ("active speakers"); registerFloater ("areasearch"); registerFloater ("autoreplace"); + registerFloater ("avatar"); registerFloater ("beacons"); registerFloater ("camera controls"); registerFloater ("chat history"); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index de3a8b4f8..3621179de 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -116,9 +116,11 @@ #include "llfeaturemanager.h" #include "llfirstuse.h" #include "llfloateractivespeakers.h" +#include "llfloateravatar.h" #include "llfloaterbeacons.h" #include "llfloatercamera.h" #include "llfloaterchat.h" +#include "llfloaterdestinations.h" #include "llfloatergesture.h" #include "llfloaterhud.h" #include "llfloaterinventory.h" @@ -1265,6 +1267,7 @@ bool idle_startup() requested_options.push_back("login-flags"); requested_options.push_back("global-textures"); // Opensim requested options + requested_options.push_back("avatar_picker_url"); requested_options.push_back("destination_guide_url"); // if(gSavedSettings.getBOOL("ConnectAsGod")) @@ -2439,6 +2442,14 @@ bool idle_startup() { LLFloaterBeacons::showInstance(); } + if (gSavedSettings.getBOOL("ShowAvatarFloater")) + { + LLFloaterAvatar::showInstance(); + } + if (gSavedSettings.getBOOL("DestinationGuideShown")) + { + LLFloaterDestinations::showInstance(); + } LLMessageSystem* msg = gMessageSystem; msg->setHandlerFuncFast(_PREHASH_SoundTrigger, hooked_process_sound_trigger); @@ -4199,6 +4210,9 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x if (opensim) { gSavedSettings.setString("SearchURL", tmp); // Singu Note: For web search purposes, always set this setting + tmp = response["avatar_picker_url"].asString(); + gSavedSettings.setString("AvatarPickerURL", tmp); + gMenuBarView->getChildView("Avatar Picker")->setVisible(!tmp.empty()); gSavedSettings.setString("DestinationGuideURL", response["destination_guide_url"].asString()); } tmp = response["currency"].asString(); diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 514db939c..29a498777 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -41,23 +41,23 @@ #include "llagent.h" #include "llappviewer.h" #include "llfloaterwebcontent.h" +#include "hippogridmanager.h" #include "llparcel.h" #include "llsd.h" +#include "llalertdialog.h" #include "llui.h" #include "lluri.h" +#include "sgversion.h" #include "llviewercontrol.h" -#include "llviewermedia.h" #include "llviewernetwork.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llnotificationsutil.h" -#include "llalertdialog.h" - -#include "sgversion.h" bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async ); + class URLLoader : public LLAlertDialog::URLLoader { virtual void load(const std::string& url , bool force_open_externally) @@ -208,17 +208,11 @@ std::string LLWeb::escapeURL(const std::string& url) return escaped_url; } +std::string getLoginUriDomain(); //static std::string LLWeb::expandURLSubstitutions(const std::string &url, const LLSD &default_subs) { - gCurrentVersion = llformat("%s %d.%d.%d.%d", - gVersionChannel, - gVersionMajor, - gVersionMinor, - gVersionPatch, - gVersionBuild ); - LLSD substitution = default_subs; substitution["VERSION"] = gCurrentVersion; substitution["VERSION_MAJOR"] = gVersionMajor; @@ -226,8 +220,15 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url, substitution["VERSION_PATCH"] = gVersionPatch; substitution["VERSION_BUILD"] = gVersionBuild; substitution["CHANNEL"] = gVersionChannel; - substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel(); - substitution["GRID_LOWERCASE"] = utf8str_tolower(LLViewerLogin::getInstance()->getGridLabel()); + const HippoGridInfo* grid(gHippoGridManager->getCurrentGrid()); + std::string gridId(grid->isSecondLife() ? getLoginUriDomain() : grid->getGridName()); + if (grid->isSecondLife()) + { + gridId = gridId.substr(0, gridId.find('.')); + } + + substitution["GRID"] = gridId; + substitution["GRID_LOWERCASE"] = utf8str_tolower(gridId); substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple(); substitution["SESSION_ID"] = gAgent.getSessionID(); substitution["FIRST_LOGIN"] = gAgent.isFirstLogin(); diff --git a/indra/newview/skins/default/textures/icn_toolbar_avatar.tga b/indra/newview/skins/default/textures/icn_toolbar_avatar.tga new file mode 100644 index 0000000000000000000000000000000000000000..0a1a235f352f836cc45efc94d8c745f1829bca07 GIT binary patch literal 22 XcmZQzU}As)Mg~R(1&;s!|1$sp3NHgH literal 0 HcmV?d00001 diff --git a/indra/newview/skins/default/xui/en-us/floater_avatar.xml b/indra/newview/skins/default/xui/en-us/floater_avatar.xml new file mode 100644 index 000000000..ba3c3536d --- /dev/null +++ b/indra/newview/skins/default/xui/en-us/floater_avatar.xml @@ -0,0 +1,26 @@ + + + + diff --git a/indra/newview/skins/default/xui/en-us/floater_toolbar_prefs.xml b/indra/newview/skins/default/xui/en-us/floater_toolbar_prefs.xml index 9f3fc4f91..9068855cc 100644 --- a/indra/newview/skins/default/xui/en-us/floater_toolbar_prefs.xml +++ b/indra/newview/skins/default/xui/en-us/floater_toolbar_prefs.xml @@ -75,9 +75,10 @@ + - - + + diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 47311ad33..458bb96c8 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -590,6 +590,11 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en-us/panel_toolbar.xml b/indra/newview/skins/default/xui/en-us/panel_toolbar.xml index ca33bd396..1c4d8b23b 100644 --- a/indra/newview/skins/default/xui/en-us/panel_toolbar.xml +++ b/indra/newview/skins/default/xui/en-us/panel_toolbar.xml @@ -384,6 +384,11 @@ + + +