From a6c0e4e71de033c8e6798c867c8526261fc96e66 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 12 Jan 2010 16:32:32 -0800 Subject: Change login screen to single "SLID" input field. Use last name "Resident" if none provided. Reviewed with Huseby --- indra/newview/llpanellogin.cpp | 47 ++++++++++++++++------ indra/newview/skins/default/xui/en/panel_login.xml | 18 +++++---- 2 files changed, 46 insertions(+), 19 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 87d101b00f..46420ce503 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -213,7 +213,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } #if !USE_VIEWER_AUTH - childSetPrevalidate("first_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace); + //childSetPrevalidate("login_id_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace); childSetPrevalidate("last_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace); childSetCommitCallback("password_edit", mungePassword, this); @@ -498,7 +498,7 @@ void LLPanelLogin::giveFocus() if( sInstance ) { // Grab focus and move cursor to first blank input field - std::string first = sInstance->childGetText("first_name_edit"); + std::string first = sInstance->childGetText("login_id_edit"); std::string pass = sInstance->childGetText("password_edit"); BOOL have_first = !first.empty(); @@ -514,7 +514,7 @@ void LLPanelLogin::giveFocus() else { // User doesn't have a name, so start there. - edit = sInstance->getChild("first_name_edit"); + edit = sInstance->getChild("login_id_edit"); } if (edit) @@ -536,8 +536,8 @@ void LLPanelLogin::showLoginWidgets() // *TODO: Append all the usual login parameters, like first_login=Y etc. std::string splash_screen_url = sInstance->getString("real_url"); web_browser->navigateTo( splash_screen_url, "text/html" ); - LLUICtrl* first_name_edit = sInstance->getChild("first_name_edit"); - first_name_edit->setFocus(TRUE); + LLUICtrl* login_id_edit = sInstance->getChild("login_id_edit"); + login_id_edit->setFocus(TRUE); } // static @@ -569,8 +569,15 @@ void LLPanelLogin::setFields(const std::string& firstname, return; } - sInstance->childSetText("first_name_edit", firstname); - sInstance->childSetText("last_name_edit", lastname); + std::string login_id = firstname; + if (!lastname.empty()) + { + // support traditional First Last name slurls + login_id += " "; + login_id += lastname; + } + sInstance->childSetText("login_id_edit", login_id); + sInstance->childSetText("last_name_edit", std::string()); // Max "actual" password length is 16 characters. // Hex digests are always 32 characters. @@ -623,10 +630,24 @@ void LLPanelLogin::getFields(std::string *firstname, return; } - *firstname = sInstance->childGetText("first_name_edit"); - LLStringUtil::trim(*firstname); + std::string login_id = sInstance->childGetText("login_id_edit"); + LLStringUtil::trim(login_id); - *lastname = sInstance->childGetText("last_name_edit"); + U32 pos = login_id.find(' '); + if (pos != std::string::npos) + { + // old-style Firstname Lastname + *firstname = login_id.substr(0, pos); + *lastname = login_id.substr(pos+1); + } + else + { + // new-style single SLID string + *firstname = login_id; + *lastname = "Resident"; + } + + LLStringUtil::trim(*firstname); LLStringUtil::trim(*lastname); *password = sInstance->mMungedPassword; @@ -896,8 +917,10 @@ void LLPanelLogin::onClickConnect(void *) // JC - Make sure the fields all get committed. sInstance->setFocus(FALSE); - std::string first = sInstance->childGetText("first_name_edit"); - std::string last = sInstance->childGetText("last_name_edit"); + // Do SLID "Resident" name mangling + std::string first, last, unused_password; + getFields(&first, &last, &unused_password); + LLComboBox* combo = sInstance->getChild("start_location_combo"); std::string combo_text = combo->getSimple(); diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index df942b1a26..30506dcde4 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -60,7 +60,7 @@ name="first_name_text" top="20" left="20" width="150"> -First name: + Second Life ID: + width="200" /> - Last name: + Last name: + -- cgit v1.2.3 From 1d6d3fc5a9698dfd64d5fa778823d38d514ec3b1 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 12 Jan 2010 16:33:08 -0800 Subject: Suppress rendering of last name "Resident" to display only SLIDs. Reviewed with Huseby --- indra/newview/llvoavatar.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4235f97eab..7df24c9ade 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2792,8 +2792,12 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += firstname->getString(); } - line += " "; - line += lastname->getString(); + // Suppress last name "Resident" as this is used for new SLID names + if (strcmp(lastname->getString(), "Resident")) + { + line += " "; + line += lastname->getString(); + } BOOL need_comma = FALSE; if (is_away || is_muted || is_busy) -- cgit v1.2.3 From 48111a2ab847bb3bacf658b3771d0324157fc751 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 22 Jan 2010 16:53:18 -0800 Subject: Converted friend request names to SLID-compatible --- indra/newview/llavataractions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 40c9bb6afa..8c4dfaea50 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -62,6 +62,7 @@ #include "llimfloater.h" #include "lltrans.h" #include "llcallingcard.h" +#include "llslurl.h" // IDEVO // static void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name) @@ -73,7 +74,7 @@ void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::strin } LLSD args; - args["NAME"] = name; + args["NAME"] = LLSLURL::buildCommand("agent", id, "inspect"); LLSD payload; payload["id"] = id; payload["name"] = name; @@ -102,7 +103,7 @@ void LLAvatarActions::requestFriendshipDialog(const LLUUID& id) } std::string full_name; - gCacheName->getFullName(id, full_name); + // IDEVO gCacheName->getFullName(id, full_name); requestFriendshipDialog(id, full_name); } -- cgit v1.2.3 From 830c938ad218f2e5dbe161fa50222a5702ca73cd Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 22 Jan 2010 16:53:29 -0800 Subject: Converted landmark info names to SLID-compatible --- indra/newview/llpanellandmarkinfo.cpp | 39 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index 9654e17659..ae445764cf 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -44,6 +44,7 @@ #include "llagent.h" #include "llagentui.h" #include "lllandmarkactions.h" +#include "llslurl.h" #include "llviewerinventory.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" @@ -230,13 +231,15 @@ void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem) ////////////////// if (pItem->getCreatorUUID().notNull()) { - std::string name; + // IDEVO LLUUID creator_id = pItem->getCreatorUUID(); - if (!gCacheName->getFullName(creator_id, name)) - { - gCacheName->get(creator_id, FALSE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mCreator, _2, _3)); - } + std::string name = + LLSLURL::buildCommand("agent", creator_id, "inspect"); + //if (!gCacheName->getFullName(creator_id, name)) + //{ + // gCacheName->get(creator_id, FALSE, + // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mCreator, _2, _3)); + //} mCreator->setText(name); } else @@ -253,20 +256,24 @@ void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem) if (perm.isGroupOwned()) { LLUUID group_id = perm.getGroup(); - if (!gCacheName->getGroupName(group_id, name)) - { - gCacheName->get(group_id, TRUE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mOwner, _2, _3)); - } + // IDEVO + //if (!gCacheName->getGroupName(group_id, name)) + //{ + // gCacheName->get(group_id, TRUE, + // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mOwner, _2, _3)); + //} + name = LLSLURL::buildCommand("group", group_id, "inspect"); } else { LLUUID owner_id = perm.getOwner(); - if (!gCacheName->getFullName(owner_id, name)) - { - gCacheName->get(owner_id, FALSE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mOwner, _2, _3)); - } + // IDEVO + //if (!gCacheName->getFullName(owner_id, name)) + //{ + // gCacheName->get(owner_id, FALSE, + // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mOwner, _2, _3)); + //} + name = LLSLURL::buildCommand("agent", owner_id, "inspect"); } mOwner->setText(name); } -- cgit v1.2.3 From 1ddd2f2677471cc00465b2a619b138bb054db770 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 22 Jan 2010 16:53:45 -0800 Subject: Converted place info names to SLID-compatible, probably unused --- indra/newview/llpanelplaceprofile.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index d892e2885b..a80b6f2e0e 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -49,6 +49,7 @@ #include "llappviewer.h" #include "llcallbacklist.h" #include "llfloaterbuycurrency.h" +#include "llslurl.h" // IDEVO #include "llstatusbar.h" #include "llviewercontrol.h" #include "llviewerparcelmgr.h" @@ -441,8 +442,12 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, else { // Figure out the owner's name - gCacheName->get(parcel->getOwnerID(), FALSE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3)); + // IDEVO + //gCacheName->get(parcel->getOwnerID(), FALSE, + // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3)); + std::string parcel_owner = + LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect"); + mParcelOwner->setText(parcel_owner); gCacheName->get(region->getOwner(), FALSE, boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionOwnerText, _2, _3)); } -- cgit v1.2.3 From 40907986d4044e2be75f862fac1153f9a14f13ad Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 22 Jan 2010 18:29:29 -0800 Subject: Pull llurlentryagent into newview so I can compile/link faster --- indra/newview/CMakeLists.txt | 2 + indra/newview/llstartup.cpp | 5 ++ indra/newview/llurlentryagent.cpp | 154 ++++++++++++++++++++++++++++++++++++++ indra/newview/llurlentryagent.h | 53 +++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 indra/newview/llurlentryagent.cpp create mode 100644 indra/newview/llurlentryagent.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5373556c20..f4bbe7133f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -445,6 +445,7 @@ set(viewer_SOURCE_FILES llurl.cpp llurldispatcher.cpp llurldispatcherlistener.cpp + llurlentryagent.cpp llurlhistory.cpp llurllineeditorctrl.cpp llurlsimstring.cpp @@ -952,6 +953,7 @@ set(viewer_HEADER_FILES llurl.h llurldispatcher.h llurldispatcherlistener.h + llurlentryagent.h llurlhistory.h llurllineeditorctrl.h llurlsimstring.h diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6b816f8786..a372ab44f2 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -144,7 +144,9 @@ #include "llui.h" #include "llurldispatcher.h" #include "llurlsimstring.h" +#include "llurlentryagent.h" // IDEVO #include "llurlhistory.h" +#include "llurlregistry.h" // IDEVO #include "llurlwhitelist.h" #include "llvieweraudio.h" #include "llviewerassetstorage.h" @@ -1282,6 +1284,9 @@ bool idle_startup() gCacheName->LocalizeCacheName("none", LLTrans::getString("GroupNameNone")); // Load stored cache if possible LLAppViewer::instance()->loadNameCache(); + + // Handle secondlife:///app/agent name lookups IDEVO + LLUrlRegistry::getInstance()->registerUrl(new LLUrlEntryAgent(), true); } // *Note: this is where gWorldMap used to be initialized. diff --git a/indra/newview/llurlentryagent.cpp b/indra/newview/llurlentryagent.cpp new file mode 100644 index 0000000000..d104fdf20d --- /dev/null +++ b/indra/newview/llurlentryagent.cpp @@ -0,0 +1,154 @@ +/** + * @file llurlentry.cpp + * @author Martin Reddy + * @brief Describes the Url types that can be registered in LLUrlRegistry + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llurlentryagent.h" + +#include "llcachename.h" +#include "lltrans.h" +#include "lluicolortable.h" + +// +// LLUrlEntryAgent Describes a Second Life agent Url, e.g., +// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about +// +LLUrlEntryAgent::LLUrlEntryAgent() +{ + mPattern = boost::regex("secondlife:///app/agent/[\\da-f-]+/\\w+", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_agent.xml"; + mIcon = "Generic_Person"; + mColor = LLUIColorTable::instance().getColor("AgentLinkColor"); +} + +// IDEVO demo code +static std::string clean_name(const std::string& first, const std::string& last) +{ + std::string displayname; + if (first == "miyazaki23") // IDEVO demo code + { + // miyazaki + displayname += (char)(0xE5); + displayname += (char)(0xAE); + displayname += (char)(0xAE); + displayname += (char)(0xE5); + displayname += (char)(0xB4); + displayname += (char)(0x8E); + // hayao + displayname += (char)(0xE9); + displayname += (char)(0xA7); + displayname += (char)(0xBF); + // san + displayname += (char)(0xE3); + displayname += (char)(0x81); + displayname += (char)(0x95); + displayname += (char)(0xE3); + displayname += (char)(0x82); + displayname += (char)(0x93); + } + else if (first == "Jim") + { + displayname = "Jos"; + displayname += (char)(0xC3); + displayname += (char)(0xA9); + displayname += " Sanchez"; + } + else if (first == "James") + { + displayname = "James Cook"; + } + + std::string fullname = first; + if (!last.empty()) + { + fullname += ' '; + fullname += last; + } + + std::string final; + if (!displayname.empty()) + { + final = displayname + " (" + fullname + ")"; + } + else + { + final = fullname; + } + return final; +} + +void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id, + const std::string& first, + const std::string& last, + BOOL is_group) +{ + std::string final = clean_name(first, last); + // received the agent name from the server - tell our observers + callObservers(id.asString(), final); +} + +std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + if (!gCacheName) + { + // probably at the login screen, use short string for layout + return LLTrans::getString("LoadingData"); + } + + std::string agent_id_string = getIDStringFromUrl(url); + if (agent_id_string.empty()) + { + // something went wrong, just give raw url + return unescapeUrl(url); + } + + LLUUID agent_id(agent_id_string); + std::string first, last; + if (agent_id.isNull()) + { + return LLTrans::getString("AvatarNameNobody"); + } + else if (gCacheName->getName(agent_id, first, last)) + { + return clean_name(first, last); + } + else + { + gCacheName->get(agent_id, FALSE, + boost::bind(&LLUrlEntryAgent::onAgentNameReceived, + this, _1, _2, _3, _4)); + addObserver(agent_id_string, url, cb); + return LLTrans::getString("LoadingData"); + } +} diff --git a/indra/newview/llurlentryagent.h b/indra/newview/llurlentryagent.h new file mode 100644 index 0000000000..8e5e321a31 --- /dev/null +++ b/indra/newview/llurlentryagent.h @@ -0,0 +1,53 @@ +/** + * @file llurlentryagent.h + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLURLENTRYAGENT_H +#define LL_LLURLENTRYAGENT_H + +#include "llurlentry.h" + +/// +/// LLUrlEntryAgent Describes a Second Life agent Url, e.g., +/// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about +/// +/// IDEVO Pulled this temporarily into newview for faster compile/link +/// times while iterating on UI. +class LLUrlEntryAgent : public LLUrlEntryBase +{ +public: + LLUrlEntryAgent(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); +private: + void onAgentNameReceived(const LLUUID& id, const std::string& first, + const std::string& last, BOOL is_group); +}; + +#endif -- cgit v1.2.3 From e88e1022f804bd23edff73f95e5ac3cec5effcfb Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 11:00:14 -0800 Subject: Show SLIDs in avatar picker --- indra/newview/llfloateravatarpicker.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index a0b2de85f0..50aa70478b 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -370,6 +370,19 @@ void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple) getChild("Friends")->setAllowMultipleSelection(allow_multiple); } +// IDEVO +static std::string clean_name_from_avatar_picker(const std::string& first, const std::string& last) +{ + if (last.empty() || last == "Resident") + { + return first; + } + else + { + return first + " " + last; + } +} + // static void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void**) { @@ -420,7 +433,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* } else { - avatar_name = first_name + " " + last_name; + avatar_name = clean_name_from_avatar_picker(first_name, last_name); search_results->setEnabled(TRUE); found_one = TRUE; } -- cgit v1.2.3 From 660f1a9ecb8204d2f12fa30262955ea45f67a68d Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 11:00:42 -0800 Subject: Fixed typo in SLURL name conversion for "Resident" --- indra/newview/llurlentryagent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llurlentryagent.cpp b/indra/newview/llurlentryagent.cpp index d104fdf20d..6af7c9001d 100644 --- a/indra/newview/llurlentryagent.cpp +++ b/indra/newview/llurlentryagent.cpp @@ -90,7 +90,8 @@ static std::string clean_name(const std::string& first, const std::string& last) } std::string fullname = first; - if (!last.empty()) + if (!last.empty() + && last != "Resident") { fullname += ' '; fullname += last; -- cgit v1.2.3 From 130214c766763855b733c9b5d4e177afe0c39865 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 11:01:00 -0800 Subject: Fix "Resident" names in IM and chat --- indra/newview/llviewermessage.cpp | 70 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0358efc0af..b7d3e407c6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1647,6 +1647,60 @@ bool inspect_remote_object_callback(const LLSD& notification, const LLSD& respon } static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback); +// Strip out "Resident" for display, but only if the message came from a user +// (rather than a script) +static std::string clean_name_from_im(const std::string& name, EInstantMessage type) +{ + U32 pos = 0; + switch(type) + { + case IM_NOTHING_SPECIAL: + case IM_MESSAGEBOX: + case IM_GROUP_INVITATION: + case IM_INVENTORY_OFFERED: + case IM_INVENTORY_ACCEPTED: + case IM_INVENTORY_DECLINED: + case IM_GROUP_VOTE: + case IM_GROUP_MESSAGE_DEPRECATED: + //IM_TASK_INVENTORY_OFFERED + //IM_TASK_INVENTORY_ACCEPTED + //IM_TASK_INVENTORY_DECLINED + case IM_NEW_USER_DEFAULT: + case IM_SESSION_INVITE: + case IM_SESSION_P2P_INVITE: + case IM_SESSION_GROUP_START: + case IM_SESSION_CONFERENCE_START: + case IM_SESSION_SEND: + case IM_SESSION_LEAVE: + //IM_FROM_TASK + case IM_BUSY_AUTO_RESPONSE: + case IM_CONSOLE_AND_CHAT_HISTORY: + case IM_LURE_USER: + case IM_LURE_ACCEPTED: + case IM_LURE_DECLINED: + case IM_GODLIKE_LURE_USER: + case IM_YET_TO_BE_USED: + case IM_GROUP_ELECTION_DEPRECATED: + //IM_GOTO_URL + //IM_FROM_TASK_AS_ALERT + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_INVENTORY_ACCEPTED: + case IM_GROUP_NOTICE_INVENTORY_DECLINED: + case IM_GROUP_INVITATION_ACCEPT: + case IM_GROUP_INVITATION_DECLINE: + case IM_GROUP_NOTICE_REQUESTED: + case IM_FRIENDSHIP_OFFERED: + case IM_FRIENDSHIP_ACCEPTED: + case IM_FRIENDSHIP_DECLINED_DEPRECATED: + //IM_TYPING_START + //IM_TYPING_STOP + pos = name.find(" Resident"); + return name.substr(0, pos); + default: + return name; + } +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -1694,6 +1748,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { name = LLTrans::getString("Unnamed"); } + // IDEVO convert new-style "Resident" names for display + name = clean_name_from_im(name, dialog); BOOL is_busy = gAgent.getBusy(); BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); @@ -2494,6 +2550,15 @@ void process_decline_callingcard(LLMessageSystem* msg, void**) LLNotificationsUtil::add("CallingCardDeclined"); } +static std::string clean_name_from_chat(const std::string& full_name, EChatSourceType type) +{ + if (type == CHAT_SOURCE_AGENT) + { + U32 pos = full_name.find(" Resident"); + return full_name.substr(0, pos); + } + return full_name; +} void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { @@ -2510,7 +2575,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLViewerObject* chatter; msg->getString("ChatData", "FromName", from_name); - chat.mFromName = from_name; + //chat.mFromName = from_name; msg->getUUID("ChatData", "SourceID", from_id); chat.mFromID = from_id; @@ -2529,6 +2594,9 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mTime = LLFrameTimer::getElapsedSeconds(); + // IDEVO Correct for new-style "Resident" names + chat.mFromName = clean_name_from_chat(from_name, chat.mSourceType); + BOOL is_busy = gAgent.getBusy(); BOOL is_muted = FALSE; -- cgit v1.2.3 From 146e9d5e4d9a9a4f33d9ccd47a901980972b7ab9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 17:06:18 -0800 Subject: Support returning full_name (and SLID) for LLCacheName::get() calls Changed callback signature to full_name instead of first_name,last_name Eliminated all calls to legacy (non-signal/non-boost-bind) lookup mechanism Change Pay dialog names to SLURL links Tweaked layout of Pay Resident and Pay via Object floaters to make SLURLs fit Consolidate name first + " " + last concatenation in LLCacheName::buildFullName() Reviewed with Kelly --- indra/newview/llavatariconctrl.cpp | 15 ++++---- indra/newview/llavatariconctrl.h | 11 +++--- indra/newview/llavatarlistitem.cpp | 7 ++-- indra/newview/llavatarlistitem.h | 2 +- indra/newview/llchathistory.cpp | 19 ++++------ indra/newview/llfloaterbump.cpp | 5 ++- indra/newview/llfloaterbuyland.cpp | 16 ++++----- indra/newview/llfloaterpay.cpp | 36 ++++++++----------- indra/newview/llfloaterscriptlimits.cpp | 14 ++++---- indra/newview/llfloaterscriptlimits.h | 4 +-- indra/newview/llimview.cpp | 7 ++-- indra/newview/llimview.h | 2 +- indra/newview/llinspectavatar.cpp | 19 +++++----- indra/newview/llinspectgroup.cpp | 17 ++++----- indra/newview/llinspectremoteobject.cpp | 17 ++++----- indra/newview/llinventorymodel.cpp | 3 +- indra/newview/llmutelist.cpp | 28 ++++++--------- indra/newview/llmutelist.h | 2 +- indra/newview/llnamebox.cpp | 19 +++------- indra/newview/llnamebox.h | 5 ++- indra/newview/llnameeditor.cpp | 19 +++------- indra/newview/llnameeditor.h | 5 ++- indra/newview/llnamelistctrl.cpp | 20 +++-------- indra/newview/llnamelistctrl.h | 5 ++- indra/newview/llpanelavatartag.cpp | 2 +- indra/newview/llpanelimcontrolpanel.cpp | 12 +++---- indra/newview/llpanelimcontrolpanel.h | 2 +- indra/newview/llpanelmediasettingspermissions.cpp | 2 +- indra/newview/llpanelpermissions.cpp | 2 +- indra/newview/llpanelplaceinfo.cpp | 6 ++-- indra/newview/llpanelplaceinfo.h | 4 +-- indra/newview/llpanelplaceprofile.cpp | 16 ++++----- indra/newview/llpanelprofileview.cpp | 8 ++--- indra/newview/llpanelprofileview.h | 7 ++-- indra/newview/llsidepaneltaskinfo.cpp | 2 +- indra/newview/llspeakers.cpp | 7 ++-- indra/newview/llspeakers.h | 2 +- indra/newview/llstartup.cpp | 8 ++--- indra/newview/llurlentryagent.cpp | 41 +++++++++------------- indra/newview/llurlentryagent.h | 3 +- indra/newview/llviewerinventory.cpp | 4 +-- indra/newview/llviewerinventory.h | 2 +- indra/newview/llviewermessage.cpp | 32 ++++++++--------- indra/newview/llvoiceclient.cpp | 14 ++------ indra/newview/llvoiceclient.h | 1 - .../newview/skins/default/xui/en/floater_bumps.xml | 10 +++--- indra/newview/skins/default/xui/en/floater_pay.xml | 17 +++------ .../skins/default/xui/en/floater_pay_object.xml | 26 ++++---------- .../newview/skins/default/xui/en/notifications.xml | 6 ++-- 49 files changed, 201 insertions(+), 332 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 87b8d807c4..11cc456695 100644 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -244,7 +244,8 @@ void LLAvatarIconCtrl::setValue(const LLSD& value) LLIconCtrl::setValue(value); } - gCacheName->get(mAvatarId, FALSE, boost::bind(&LLAvatarIconCtrl::nameUpdatedCallback, this, _1, _2, _3, _4)); + gCacheName->get(mAvatarId, false, + boost::bind(&LLAvatarIconCtrl::nameUpdatedCallback, this, _1, _2, _3)); } bool LLAvatarIconCtrl::updateFromCache() @@ -289,22 +290,20 @@ void LLAvatarIconCtrl::processProperties(void* data, EAvatarProcessorType type) void LLAvatarIconCtrl::nameUpdatedCallback( const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group) + const std::string& name, + bool is_group) { if (id == mAvatarId) { - mFirstName = first; - mLastName = last; + mFullName = name; if (mDrawTooltip) { - setToolTip(mFirstName + " " + mLastName); + setToolTip(name); } else { - setToolTip(std::string("")); + setToolTip(std::string()); } } } diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h index 38616b7852..a5452ee1d3 100644 --- a/indra/newview/llavatariconctrl.h +++ b/indra/newview/llavatariconctrl.h @@ -92,20 +92,17 @@ public: void nameUpdatedCallback( const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group); + const std::string& name, + bool is_group); const LLUUID& getAvatarId() const { return mAvatarId; } - const std::string& getFirstName() const { return mFirstName; } - const std::string& getLastName() const { return mLastName; } + const std::string& getFullName() const { return mFullName; } void setDrawTooltip(bool value) { mDrawTooltip = value;} protected: LLUUID mAvatarId; - std::string mFirstName; - std::string mLastName; + std::string mFullName; bool mDrawTooltip; std::string mDefaultIconName; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 66ab32f3e8..6024dd8a21 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -193,7 +193,7 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes) LLAvatarTracker::instance().addParticularFriendObserver(mAvatarId, this); // Set avatar name. - gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3)); + gCacheName->get(id, false, boost::bind(&LLAvatarListItem::onNameCache, this, _2)); } void LLAvatarListItem::showLastInteractionTime(bool show) @@ -298,10 +298,9 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin mAvatarName->setToolTip(name); } -void LLAvatarListItem::onNameCache(const std::string& first_name, const std::string& last_name) +void LLAvatarListItem::onNameCache(const std::string& fullname) { - std::string name = first_name + " " + last_name; - setName(name); + setName(fullname); } // Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years", diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 479a4833cb..f3c1f0ec01 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -139,7 +139,7 @@ private: } EAvatarListItemChildIndex; void setNameInternal(const std::string& name, const std::string& highlight); - void onNameCache(const std::string& first_name, const std::string& last_name); + void onNameCache(const std::string& fullname); std::string formatSeconds(U32 secs); diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index a46cd84b60..12c8d58976 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -103,11 +103,7 @@ public: } else if (level == "add") { - std::string name; - name.assign(getFirstName()); - name.append(" "); - name.append(getLastName()); - + std::string name = getFullName(); LLAvatarActions::requestFriendshipDialog(getAvatarId(), name); } else if (level == "remove") @@ -177,14 +173,13 @@ public: } const LLUUID& getAvatarId () const { return mAvatarID;} - const std::string& getFirstName() const { return mFirstName; } - const std::string& getLastName () const { return mLastName; } + const std::string& getFullName() const { return mFullName; } void setup(const LLChat& chat,const LLStyle::Params& style_params) { mAvatarID = chat.mFromID; mSourceType = chat.mSourceType; - gCacheName->get(mAvatarID, FALSE, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3, _4)); + gCacheName->get(mAvatarID, false, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3)); if(chat.mFromID.isNull()) { mSourceType = CHAT_SOURCE_SYSTEM; @@ -256,12 +251,11 @@ public: LLPanel::draw(); } - void nameUpdatedCallback(const LLUUID& id,const std::string& first,const std::string& last,BOOL is_group) + void nameUpdatedCallback(const LLUUID& id,const std::string& full_name, bool is_group) { if (id != mAvatarID) return; - mFirstName = first; - mLastName = last; + mFullName = full_name; } protected: static const S32 PADDING = 20; @@ -341,8 +335,7 @@ protected: LLUUID mAvatarID; EChatSourceType mSourceType; - std::string mFirstName; - std::string mLastName; + std::string mFullName; std::string mFrom; S32 mMinUserNameWidth; diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index e925796526..9ccae43a92 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -89,7 +89,7 @@ void LLFloaterBump::onOpen(const LLSD& key) void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { - if (mcd->mFirstName.empty() || list->getItemCount() >= 20) + if (mcd->mFullName.empty() || list->getItemCount() >= 20) { return; } @@ -127,8 +127,7 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) // All above action strings are in XML file LLUIString text = getString(action); text.setArg("[TIME]", timeStr); - text.setArg("[FIRST]", mcd->mFirstName); - text.setArg("[LAST]", mcd->mLastName); + text.setArg("[NAME]", mcd->mFullName); LLSD row; row["id"] = mcd->mPerp; diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 9b88923e7e..47678d1e82 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -182,9 +182,8 @@ public: void updateNames(); // Name cache callback void updateGroupName(const LLUUID& id, - const std::string& first_name, - const std::string& last_name, - BOOL is_group); + const std::string& name, + bool is_group); void refreshUI(); @@ -801,9 +800,9 @@ void LLFloaterBuyLandUI::updateNames() } else if (parcelp->getIsGroupOwned()) { - gCacheName->get(parcelp->getGroupID(), TRUE, + gCacheName->get(parcelp->getGroupID(), true, boost::bind(&LLFloaterBuyLandUI::updateGroupName, this, - _1, _2, _3, _4)); + _1, _2, _3)); } else { @@ -813,16 +812,15 @@ void LLFloaterBuyLandUI::updateNames() } void LLFloaterBuyLandUI::updateGroupName(const LLUUID& id, - const std::string& first_name, - const std::string& last_name, - BOOL is_group) + const std::string& name, + bool is_group) { LLParcel* parcelp = mParcel->getParcel(); if (parcelp && parcelp->getGroupID() == id) { // request is current - mParcelSellerName = first_name; + mParcelSellerName = name; } } diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp index c2389e73a0..b37be3c1bf 100644 --- a/indra/newview/llfloaterpay.cpp +++ b/indra/newview/llfloaterpay.cpp @@ -47,6 +47,7 @@ #include "lllineeditor.h" #include "llmutelist.h" #include "llfloaterreporter.h" +#include "llslurl.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" @@ -102,10 +103,6 @@ private: static void onGive(void* data); void give(S32 amount); static void processPayPriceReply(LLMessageSystem* msg, void **userdata); - void onCacheOwnerName(const LLUUID& owner_id, - const std::string& firstname, - const std::string& lastname, - BOOL is_group); void finishPayUI(const LLUUID& target_id, BOOL is_group); protected: @@ -426,33 +423,28 @@ void LLFloaterPay::payDirectly(money_callback callback, void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group) { - gCacheName->get(target_id, is_group, boost::bind(&LLFloaterPay::onCacheOwnerName, this, _1, _2, _3, _4)); - - // Make sure the amount field has focus - - childSetFocus("amount", TRUE); - - LLLineEditor* amount = getChild("amount"); - amount->selectAll(); - mTargetIsGroup = is_group; -} - -void LLFloaterPay::onCacheOwnerName(const LLUUID& owner_id, - const std::string& firstname, - const std::string& lastname, - BOOL is_group) -{ + // IDEVO + //gCacheName->get(target_id, is_group, boost::bind(&LLFloaterPay::onCacheOwnerName, this, _1, _2, _3, _4)); + std::string slurl; if (is_group) { setTitle(getString("payee_group")); + slurl = LLSLURL::buildCommand("group", target_id, "inspect"); } else { setTitle(getString("payee_resident")); + slurl = LLSLURL::buildCommand("agent", target_id, "inspect"); } + childSetText("payee_name", slurl); + + // Make sure the amount field has focus + + childSetFocus("amount", TRUE); - childSetTextArg("payee_name", "[FIRST]", firstname); - childSetTextArg("payee_name", "[LAST]", lastname); + LLLineEditor* amount = getChild("amount"); + amount->selectAll(); + mTargetIsGroup = is_group; } // static diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 0964ad7f91..4a194217b5 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -335,11 +335,8 @@ void LLPanelScriptLimitsRegionMemory::setErrorStatus(U32 status, const std::stri // callback from the name cache with an owner name to add to the list void LLPanelScriptLimitsRegionMemory::onNameCache( const LLUUID& id, - const std::string& first_name, - const std::string& last_name) + const std::string& name) { - std::string name = first_name + " " + last_name; - LLScrollListCtrl *list = getChild("scripts_list"); std::vector::iterator id_itor; for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor) @@ -421,9 +418,12 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) if(std::find(names_requested.begin(), names_requested.end(), owner_id) == names_requested.end()) { names_requested.push_back(owner_id); - gCacheName->get(owner_id, TRUE, - boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache, - this, _1, _2, _3)); + // Is this a bug? It's trying to look up a GROUP name, not + // an AVATAR name? JC + const bool is_group = true; + gCacheName->get(owner_id, is_group, + boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache, + this, _1, _2)); } } diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h index 7e2b536eb6..77ff496893 100644 --- a/indra/newview/llfloaterscriptlimits.h +++ b/indra/newview/llfloaterscriptlimits.h @@ -166,10 +166,8 @@ public: void returnObjects(); private: - void onNameCache( const LLUUID& id, - const std::string& first_name, - const std::string& last_name); + const std::string& name); LLUUID mParcelId; BOOL mGotParcelMemoryUsed; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index c2a7969c0d..9cc4aefe35 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2556,7 +2556,8 @@ void LLIMMgr::inviteToSession( { if (caller_name.empty()) { - gCacheName->get(caller_id, FALSE, boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2, _3, _4)); + gCacheName->get(caller_id, false, + boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2, _3)); } else { @@ -2566,9 +2567,9 @@ void LLIMMgr::inviteToSession( } } -void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) +void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& name, bool is_group) { - payload["caller_name"] = first + " " + last; + payload["caller_name"] = name; payload["session_name"] = payload["caller_name"].asString(); std::string notify_box_type = payload["notify_box_type"].asString(); diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index a3b4f78af0..4de3d8b9b9 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -456,7 +456,7 @@ private: void processIMTypingCore(const LLIMInfo* im_info, BOOL typing); - static void onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + static void onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& name, bool is_group); void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); void notifyObserverSessionRemoved(const LLUUID& session_id); diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 4b0539337b..c5cf40d7b7 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -138,11 +138,9 @@ private: bool isNotFriend(); // Callback for gCacheName to look up avatar name - void nameUpdatedCallback( - const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group); + void nameUpdatedCallback(const LLUUID& id, + const std::string& name, + bool is_group); private: LLUUID mAvatarID; @@ -359,9 +357,9 @@ void LLInspectAvatar::requestUpdate() childSetValue("avatar_icon", LLSD(mAvatarID) ); - gCacheName->get(mAvatarID, FALSE, + gCacheName->get(mAvatarID, false, boost::bind(&LLInspectAvatar::nameUpdatedCallback, - this, _1, _2, _3, _4)); + this, _1, _2, _3)); } void LLInspectAvatar::processAvatarData(LLAvatarData* data) @@ -597,13 +595,12 @@ void LLInspectAvatar::onVolumeChange(const LLSD& data) void LLInspectAvatar::nameUpdatedCallback( const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group) + const std::string& name, + bool is_group) { if (id == mAvatarID) { - mAvatarName = first + " " + last; + mAvatarName = name; childSetValue("user_name", LLSD(mAvatarName) ); } } diff --git a/indra/newview/llinspectgroup.cpp b/indra/newview/llinspectgroup.cpp index 7fd7b69021..364da3f64c 100644 --- a/indra/newview/llinspectgroup.cpp +++ b/indra/newview/llinspectgroup.cpp @@ -84,9 +84,8 @@ public: // Callback for gCacheName to look up group name // Faster than waiting for group properties to return void nameUpdatedCallback(const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group); + const std::string& name, + bool is_group); // Button/menu callbacks void onClickViewProfile(); @@ -225,21 +224,19 @@ void LLInspectGroup::requestUpdate() mPropertiesRequest = new LLFetchGroupData(mGroupID, this); // Name lookup will be faster out of cache, use that - gCacheName->get(mGroupID, TRUE, + gCacheName->get(mGroupID, true, boost::bind(&LLInspectGroup::nameUpdatedCallback, - this, _1, _2, _3, _4)); + this, _1, _2, _3)); } void LLInspectGroup::nameUpdatedCallback( const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group) + const std::string& name, + bool is_group) { if (id == mGroupID) { - // group names are returned as a first name - childSetValue("group_name", LLSD(first) ); + childSetValue("group_name", LLSD(name) ); } // Otherwise possibly a request for an older inspector, ignore it diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp index e4d2eec242..31f69d21d9 100644 --- a/indra/newview/llinspectremoteobject.cpp +++ b/indra/newview/llinspectremoteobject.cpp @@ -67,7 +67,7 @@ public: private: void update(); - static void nameCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data); + void onNameCache(const LLUUID& id, const std::string& name, bool is_group); private: LLUUID mObjectID; @@ -122,7 +122,8 @@ void LLInspectRemoteObject::onOpen(const LLSD& data) mOwner = ""; if (gCacheName) { - gCacheName->get(mOwnerID, mGroupOwned, nameCallback, this); + gCacheName->get(mOwnerID, mGroupOwned, + boost::bind(&LLInspectRemoteObject::onNameCache, this, _1, _2, _3)); } // update the inspector with the current object state @@ -153,16 +154,10 @@ void LLInspectRemoteObject::onClickClose() closeFloater(); } -//static -void LLInspectRemoteObject::nameCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) +void LLInspectRemoteObject::onNameCache(const LLUUID& id, const std::string& name, bool is_group) { - LLInspectRemoteObject *self = (LLInspectRemoteObject*)data; - self->mOwner = first; - if (!last.empty()) - { - self->mOwner += " " + last; - } - self->update(); + mOwner = name; + update(); } void LLInspectRemoteObject::update() diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 961f7adc0a..eadcfe9f09 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -752,7 +752,8 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) new_item->setCreator(id); std::string avatar_name; // Fetch the currect name - gCacheName->get(id, FALSE, boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), _1, _2, _3)); + gCacheName->get(id, false, + boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), _1, _2, _3)); } } else if (new_item->getType() == LLAssetType::AT_GESTURE) diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 7ee4c64f8f..0b4c07c9ed 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -496,7 +496,7 @@ void LLMuteList::updateRemove(const LLMute& mute) gAgent.sendReliableMessage(); } -void notify_automute_callback(const LLUUID& agent_id, const std::string& first_name, const std::string& last_name, BOOL is_group, LLMuteList::EAutoReason reason) +void notify_automute_callback(const LLUUID& agent_id, const std::string& full_name, bool is_group, LLMuteList::EAutoReason reason) { std::string notif_name; switch (reason) @@ -514,8 +514,7 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& first_n } LLSD args; - args["FIRST"] = first_name; - args["LAST"] = last_name; + args["NAME"] = full_name; LLNotificationPtr notif_ptr = LLNotifications::instance().add(notif_name, args, LLSD()); if (notif_ptr) @@ -536,7 +535,7 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& first_n } -BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, const std::string& first_name, const std::string& last_name) +BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason) { BOOL removed = FALSE; @@ -546,24 +545,17 @@ BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, co removed = TRUE; remove(automute); - if (first_name.empty() && last_name.empty()) + std::string full_name; + if (gCacheName->getFullName(agent_id, full_name)) { - std::string cache_first, cache_last; - if (gCacheName->getName(agent_id, cache_first, cache_last)) - { - // name in cache, call callback directly - notify_automute_callback(agent_id, cache_first, cache_last, FALSE, reason); - } - else - { - // not in cache, lookup name from cache - gCacheName->get(agent_id, FALSE, boost::bind(¬ify_automute_callback, _1, _2, _3, _4, reason)); - } + // name in cache, call callback directly + notify_automute_callback(agent_id, full_name, false, reason); } else { - // call callback directly - notify_automute_callback(agent_id, first_name, last_name, FALSE, reason); + // not in cache, lookup name from cache + gCacheName->get(agent_id, false, + boost::bind(¬ify_automute_callback, _1, _2, _3, reason)); } } diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index 409b637bf2..11a20e015e 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -107,7 +107,7 @@ public: // Remove both normal and legacy mutes, for any or all properties. BOOL remove(const LLMute& mute, U32 flags = 0); - BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason, const std::string& first_name = LLStringUtil::null, const std::string& last_name = LLStringUtil::null); + BOOL autoRemove(const LLUUID& agent_id, const EAutoReason reason); // Name is required to test against legacy text-only mutes. BOOL isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const; diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index cd810b9793..da3e95e947 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -87,26 +87,15 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group) setText(mInitialValue); } -void LLNameBox::refresh(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group) +void LLNameBox::refresh(const LLUUID& id, const std::string& full_name, bool is_group) { if (id == mNameID) { - std::string name; - if (!is_group) - { - name = firstname + " " + lastname; - } - else - { - name = firstname; - } - setName(name, is_group); + setName(full_name, is_group); } } -void LLNameBox::refreshAll(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group) +void LLNameBox::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group) { std::set::iterator it; for (it = LLNameBox::sInstances.begin(); @@ -114,7 +103,7 @@ void LLNameBox::refreshAll(const LLUUID& id, const std::string& firstname, ++it) { LLNameBox* box = *it; - box->refresh(id, firstname, lastname, is_group); + box->refresh(id, full_name, is_group); } } diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index 48b54faec8..2fe8990653 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -59,10 +59,9 @@ public: void setNameID(const LLUUID& name_id, BOOL is_group); - void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + void refresh(const LLUUID& id, const std::string& full_name, bool is_group); - static void refreshAll(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group); + static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group); protected: LLNameBox (const Params&); diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index 65601da7da..0c704a1f56 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -81,26 +81,15 @@ void LLNameEditor::setNameID(const LLUUID& name_id, BOOL is_group) setText(name); } -void LLNameEditor::refresh(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group) +void LLNameEditor::refresh(const LLUUID& id, const std::string& full_name, bool is_group) { if (id == mNameID) { - std::string name; - if (!is_group) - { - name = firstname + " " + lastname; - } - else - { - name = firstname; - } - setText(name); + setText(full_name); } } -void LLNameEditor::refreshAll(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group) +void LLNameEditor::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group) { std::set::iterator it; for (it = LLNameEditor::sInstances.begin(); @@ -108,7 +97,7 @@ void LLNameEditor::refreshAll(const LLUUID& id, const std::string& firstname, ++it) { LLNameEditor* box = *it; - box->refresh(id, firstname, lastname, is_group); + box->refresh(id, full_name, is_group); } } diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index 99e03a1166..a75c492aca 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -65,10 +65,9 @@ public: void setNameID(const LLUUID& name_id, BOOL is_group); - void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + void refresh(const LLUUID& id, const std::string& full_name, bool is_group); - static void refreshAll(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group); + static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group); // Take/return agent UUIDs diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 6375362ae2..c9fbf35033 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -314,22 +314,11 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) } // public -void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, - const std::string& last, BOOL is_group) +void LLNameListCtrl::refresh(const LLUUID& id, const std::string& full_name, bool is_group) { //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " // << last << "'" << llendl; - std::string fullname; - if (!is_group) - { - fullname = first + " " + last; - } - else - { - fullname = first; - } - // TODO: scan items for that ID, fix if necessary item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) @@ -341,7 +330,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, cell = item->getColumn(mNameColumnIndex); if (cell) { - cell->setValue(fullname); + cell->setValue(full_name); } } } @@ -351,14 +340,13 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, // static -void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& first, - const std::string& last, BOOL is_group) +void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group) { LLInstanceTracker::instance_iter it; for (it = beginInstances(); it != endInstances(); ++it) { LLNameListCtrl& ctrl = *it; - ctrl.refresh(id, first, last, is_group); + ctrl.refresh(id, full_name, is_group); } } diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 192a3a5afa..0e8eb39fd6 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -105,10 +105,9 @@ public: void removeNameItem(const LLUUID& agent_id); - void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + void refresh(const LLUUID& id, const std::string& full_name, bool is_group); - static void refreshAll(const LLUUID& id, const std::string& firstname, - const std::string& lastname, BOOL is_group); + static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group); // LLView interface /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp index 7563cc7f61..173fb851ce 100644 --- a/indra/newview/llpanelavatartag.cpp +++ b/indra/newview/llpanelavatartag.cpp @@ -86,7 +86,7 @@ void LLPanelAvatarTag::setAvatarId(const LLUUID& avatar_id) { mIcon->setValue(avatar_id); } - setName(std::string(mIcon->getFirstName()+ " "+ mIcon->getLastName())); + setName(std::string(mIcon->getFullName())); } boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback( diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index a334eb9d68..a39fe64767 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -164,7 +164,7 @@ void LLPanelIMControlPanel::onViewProfileButtonClicked() void LLPanelIMControlPanel::onAddFriendButtonClicked() { LLAvatarIconCtrl* avatar_icon = getChild("avatar_icon"); - std::string full_name = avatar_icon->getFirstName() + " " + avatar_icon->getLastName(); + std::string full_name = avatar_icon->getFullName(); LLAvatarActions::requestFriendshipDialog(mAvatarID, full_name); } @@ -213,7 +213,8 @@ void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id) else { // If the participant is an avatar, fetch the currect name - gCacheName->get(mAvatarID, FALSE, boost::bind(&LLPanelIMControlPanel::nameUpdatedCallback, this, _1, _2, _3, _4)); + gCacheName->get(mAvatarID, false, + boost::bind(&LLPanelIMControlPanel::onNameCache, this, _1, _2, _3)); } } @@ -229,14 +230,11 @@ void LLPanelIMControlPanel::changed(U32 mask) } } -void LLPanelIMControlPanel::nameUpdatedCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) +void LLPanelIMControlPanel::onNameCache(const LLUUID& id, const std::string& full_name, bool is_group) { if ( id == mAvatarID ) { - std::string avatar_name; - avatar_name.assign(first); - avatar_name.append(" "); - avatar_name.append(last); + std::string avatar_name = full_name; getChild("avatar_name")->setValue(avatar_name); getChild("avatar_name")->setToolTip(avatar_name); } diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h index 25fdf944c9..0d750acc82 100644 --- a/indra/newview/llpanelimcontrolpanel.h +++ b/indra/newview/llpanelimcontrolpanel.h @@ -82,7 +82,7 @@ public: virtual void changed(U32 mask); protected: - void nameUpdatedCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + void onNameCache(const LLUUID& id, const std::string& full_name, bool is_group); private: void onViewProfileButtonClicked(); diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp index a23aed2e98..dcc052f15e 100644 --- a/indra/newview/llpanelmediasettingspermissions.cpp +++ b/indra/newview/llpanelmediasettingspermissions.cpp @@ -115,7 +115,7 @@ void LLPanelMediaSettingsPermissions::draw() if(mPermsGroupName) { mPermsGroupName->setNameID(LLUUID::null, TRUE); - mPermsGroupName->refresh(LLUUID::null, LLStringUtil::null, LLStringUtil::null, true); + mPermsGroupName->refresh(LLUUID::null, std::string(), true); mPermsGroupName->setEnabled(false); }; }; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 8b8b1bed37..b820adeaf3 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -385,7 +385,7 @@ void LLPanelPermissions::refresh() if (mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); - mLabelGroupName->refresh(LLUUID::null,LLStringUtil::null, LLStringUtil::null, TRUE); + mLabelGroupName->refresh(LLUUID::null, std::string(), true); mLabelGroupName->setEnabled(FALSE); } } diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 0c10f11bfc..ccb364a001 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -274,9 +274,7 @@ void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global, LLPanelPickEdit* } // static -void LLPanelPlaceInfo::nameUpdatedCallback(LLTextBox* text, - const std::string& first, - const std::string& last) +void LLPanelPlaceInfo::onNameCache(LLTextBox* text, const std::string& full_name) { - text->setText(first + " " + last); + text->setText(full_name); } diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h index 3091f7ed24..248b967842 100644 --- a/indra/newview/llpanelplaceinfo.h +++ b/indra/newview/llpanelplaceinfo.h @@ -100,9 +100,7 @@ public: void createPick(const LLVector3d& pos_global, LLPanelPickEdit* pick_panel); protected: - static void nameUpdatedCallback(LLTextBox* text, - const std::string& first, - const std::string& last); + static void onNameCache(LLTextBox* text, const std::string& full_name); /** * mParcelID is valid only for remote places, in other cases it's null. See resetLocation() diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index a80b6f2e0e..a24f873145 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -426,11 +426,11 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, if(!parcel->getGroupID().isNull()) { // FIXME: Using parcel group as region group. - gCacheName->get(parcel->getGroupID(), TRUE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionGroupText, _2, _3)); + gCacheName->get(parcel->getGroupID(), true, + boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionGroupText, _2)); - gCacheName->get(parcel->getGroupID(), TRUE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3)); + gCacheName->get(parcel->getGroupID(), true, + boost::bind(&LLPanelPlaceInfo::onNameCache, mParcelOwner, _2)); } else { @@ -448,8 +448,8 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, std::string parcel_owner = LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect"); mParcelOwner->setText(parcel_owner); - gCacheName->get(region->getOwner(), FALSE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mRegionOwnerText, _2, _3)); + gCacheName->get(region->getOwner(), false, + boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionOwnerText, _2)); } if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) @@ -475,8 +475,8 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { - gCacheName->get(auth_buyer_id, TRUE, - boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mSaleToText, _2, _3)); + gCacheName->get(auth_buyer_id, true, + boost::bind(&LLPanelPlaceInfo::onNameCache, mSaleToText, _2)); // Show sales info to a specific person or a group he belongs to. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id)) diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index 7832f63e6a..1e7a259b41 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -109,8 +109,8 @@ void LLPanelProfileView::onOpen(const LLSD& key) } // Update the avatar name. - gCacheName->get(getAvatarId(), FALSE, - boost::bind(&LLPanelProfileView::onAvatarNameCached, this, _1, _2, _3, _4)); + gCacheName->get(getAvatarId(), false, + boost::bind(&LLPanelProfileView::onNameCache, this, _1, _2, _3)); /* // disable this part of code according to EXT-2022. See processOnlineStatus // status should only show if viewer has permission to view online/offline. EXT-453 @@ -187,10 +187,10 @@ void LLPanelProfileView::processOnlineStatus(bool online) mStatusText->setVisible(online); } -void LLPanelProfileView::onAvatarNameCached(const LLUUID& id, const std::string& first_name, const std::string& last_name, BOOL is_group) +void LLPanelProfileView::onNameCache(const LLUUID& id, const std::string& full_name, bool is_group) { llassert(getAvatarId() == id); - getChild("user_name", FALSE)->setValue(first_name + " " + last_name); + getChild("user_name", FALSE)->setValue(full_name); } void LLPanelProfileView::togglePanel(LLPanel* panel, const LLSD& key) diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h index 5dc617d4a0..02bb004a1e 100644 --- a/indra/newview/llpanelprofileview.h +++ b/indra/newview/llpanelprofileview.h @@ -88,11 +88,10 @@ protected: private: // LLCacheName will call this function when avatar name is loaded from server. // This is required to display names that have not been cached yet. - void onAvatarNameCached( + void onNameCache( const LLUUID& id, - const std::string& first_name, - const std::string& last_name, - BOOL is_group); + const std::string& full_name, + bool is_group); LLTextBox* mStatusText; AvatarStatusObserver* mAvatarStatusObserver; diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 0b8f66c5f3..1da6fc516d 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -348,7 +348,7 @@ void LLSidepanelTaskInfo::refresh() if (mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); - mLabelGroupName->refresh(LLUUID::null,LLStringUtil::null, LLStringUtil::null, TRUE); + mLabelGroupName->refresh(LLUUID::null, std::string(), true); mLabelGroupName->setEnabled(FALSE); } } diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 9608cd1263..fea78852c1 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -77,12 +77,13 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy void LLSpeaker::lookupName() { - gCacheName->get(mID, FALSE, boost::bind(&LLSpeaker::onAvatarNameLookup, this, _1, _2, _3, _4)); + gCacheName->get(mID, false, + boost::bind(&LLSpeaker::onNameCache, this, _1, _2, _3)); } -void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) +void LLSpeaker::onNameCache(const LLUUID& id, const std::string& full_name, bool is_group) { - mDisplayName = first + " " + last; + mDisplayName = full_name; } bool LLSpeaker::isInVoiceChannel() diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index 63237204c8..cf236f4fe8 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -65,7 +65,7 @@ public: ~LLSpeaker() {}; void lookupName(); - void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + void onNameCache(const LLUUID& id, const std::string& full_name, bool is_group); bool isInVoiceChannel(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index a372ab44f2..0ba5fa9866 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -268,11 +268,11 @@ void apply_udp_blacklist(const std::string& csv); bool process_login_success_response(); void transition_back_to_login_panel(const std::string& emsg); -void callback_cache_name(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group) +void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group) { - LLNameListCtrl::refreshAll(id, firstname, lastname, is_group); - LLNameBox::refreshAll(id, firstname, lastname, is_group); - LLNameEditor::refreshAll(id, firstname, lastname, is_group); + LLNameListCtrl::refreshAll(id, full_name, is_group); + LLNameBox::refreshAll(id, full_name, is_group); + LLNameEditor::refreshAll(id, full_name, is_group); // TODO: Actually be intelligent about the refresh. // For now, just brute force refresh the dialogs. diff --git a/indra/newview/llurlentryagent.cpp b/indra/newview/llurlentryagent.cpp index 6af7c9001d..bce64d7140 100644 --- a/indra/newview/llurlentryagent.cpp +++ b/indra/newview/llurlentryagent.cpp @@ -53,10 +53,10 @@ LLUrlEntryAgent::LLUrlEntryAgent() } // IDEVO demo code -static std::string clean_name(const std::string& first, const std::string& last) +static std::string clean_name(const std::string& full_name) { std::string displayname; - if (first == "miyazaki23") // IDEVO demo code + if (full_name == "miyazaki23") // IDEVO demo code { // miyazaki displayname += (char)(0xE5); @@ -77,44 +77,35 @@ static std::string clean_name(const std::string& first, const std::string& last) displayname += (char)(0x82); displayname += (char)(0x93); } - else if (first == "Jim") + else if (full_name == "Jim Linden") { displayname = "Jos"; displayname += (char)(0xC3); displayname += (char)(0xA9); displayname += " Sanchez"; } - else if (first == "James") + else if (full_name == "James Linden") { displayname = "James Cook"; } - std::string fullname = first; - if (!last.empty() - && last != "Resident") - { - fullname += ' '; - fullname += last; - } - std::string final; if (!displayname.empty()) { - final = displayname + " (" + fullname + ")"; + final = displayname + " (" + full_name + ")"; } else { - final = fullname; + final = full_name; } return final; } -void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id, - const std::string& first, - const std::string& last, - BOOL is_group) +void LLUrlEntryAgent::onNameCache(const LLUUID& id, + const std::string& full_name, + bool is_group) { - std::string final = clean_name(first, last); + std::string final = clean_name(full_name); // received the agent name from the server - tell our observers callObservers(id.asString(), final); } @@ -135,20 +126,20 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa } LLUUID agent_id(agent_id_string); - std::string first, last; + std::string full_name; if (agent_id.isNull()) { return LLTrans::getString("AvatarNameNobody"); } - else if (gCacheName->getName(agent_id, first, last)) + else if (gCacheName->getFullName(agent_id, full_name)) { - return clean_name(first, last); + return clean_name(full_name); } else { - gCacheName->get(agent_id, FALSE, - boost::bind(&LLUrlEntryAgent::onAgentNameReceived, - this, _1, _2, _3, _4)); + gCacheName->get(agent_id, false, + boost::bind(&LLUrlEntryAgent::onNameCache, + this, _1, _2, _3)); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } diff --git a/indra/newview/llurlentryagent.h b/indra/newview/llurlentryagent.h index 8e5e321a31..76a54dfeb1 100644 --- a/indra/newview/llurlentryagent.h +++ b/indra/newview/llurlentryagent.h @@ -46,8 +46,7 @@ public: LLUrlEntryAgent(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); private: - void onAgentNameReceived(const LLUUID& id, const std::string& first, - const std::string& last, BOOL is_group); + void onNameCache(const LLUUID& id, const std::string& full_name, bool is_group); }; #endif diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b330c1ba83..189a174d11 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1432,9 +1432,9 @@ bool LLViewerInventoryItem::checkPermissionsSet(PermissionMask mask) const //---------- -void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& first_name, const std::string& last_name) +void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group) { - rename(first_name + " " + last_name); + rename(name); gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID()); gInventory.notifyObservers(); } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 917b8747ea..eb6e0fdc9c 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -164,7 +164,7 @@ public: bool checkPermissionsSet(PermissionMask mask) const; // callback - void onCallingCardNameLookup(const LLUUID& id, const std::string& first_name, const std::string& last_name); + void onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group); // If this is a broken link, try to fix it and any other identical link. BOOL regenerateLink(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b7d3e407c6..79e21b3ee7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -983,27 +983,24 @@ void open_inventory_offer(const std::vector& items, const std::string& f } void inventory_offer_mute_callback(const LLUUID& blocked_id, - const std::string& first_name, - const std::string& last_name, - BOOL is_group, LLOfferInfo* offer = NULL) + const std::string& full_name, + bool is_group, + LLOfferInfo* offer = NULL) { - std::string from_name; + std::string from_name = full_name; LLMute::EType type; if (is_group) { type = LLMute::GROUP; - from_name = first_name; } else if(offer && offer->mFromObject) { //we have to block object by name because blocked_id is an id of owner type = LLMute::BY_NAME; - from_name = offer->mFromName; } else { type = LLMute::AGENT; - from_name = first_name + " " + last_name; } // id should be null for BY_NAME mute, see LLMuteList::add for details @@ -1129,7 +1126,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // * we can't build two messages at once. if (2 == button) // Block { - gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this)); + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,this)); } std::string from_string; // Used in the pop-up. @@ -1270,7 +1267,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const // * we can't build two messages at once. if (2 == button) { - gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this)); + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,this)); } LLMessageSystem* msg = gMessageSystem; @@ -4761,7 +4758,7 @@ void handle_show_mean_events(void *) //LLFloaterBump::showInstance(); } -void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false) +void mean_name_callback(const LLUUID &id, const std::string& full_name, bool is_group) { if (gNoRender) { @@ -4783,8 +4780,7 @@ void mean_name_callback(const LLUUID &id, const std::string& first, const std::s LLMeanCollisionData *mcd = *iter; if (mcd->mPerp == id) { - mcd->mFirstName = first; - mcd->mLastName = last; + mcd->mFullName = full_name; } } } @@ -4838,8 +4834,7 @@ void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **use { LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag); gMeanCollisionList.push_front(mcd); - const BOOL is_group = FALSE; - gCacheName->get(perp, is_group, &mean_name_callback); + gCacheName->get(perp, false, boost::bind(&mean_name_callback, _1, _2, _3)); } } } @@ -5738,7 +5733,7 @@ static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", ca // We've got the name of the person who owns the object hurling the url. // Display confirmation dialog. -void callback_load_url_name(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) +void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool is_group) { std::vector::iterator it; for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) @@ -5751,11 +5746,11 @@ void callback_load_url_name(const LLUUID& id, const std::string& first, const st std::string owner_name; if (is_group) { - owner_name = first + LLTrans::getString("Group"); + owner_name = full_name + LLTrans::getString("Group"); } else { - owner_name = first + " " + last; + owner_name = full_name; } // For legacy name-only mutes. @@ -5815,7 +5810,8 @@ void process_load_url(LLMessageSystem* msg, void**) // Add to list of pending name lookups gLoadUrlList.push_back(payload); - gCacheName->get(owner_id, owner_is_group, &callback_load_url_name); + gCacheName->get(owner_id, owner_is_group, + boost::bind(&callback_load_url_name, _1, _2, _3)); } diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index c84afa5af1..1d9297cf2d 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -6941,18 +6941,8 @@ void LLVoiceClient::notifyFriendObservers() void LLVoiceClient::lookupName(const LLUUID &id) { - BOOL is_group = FALSE; - gCacheName->get(id, is_group, &LLVoiceClient::onAvatarNameLookup); -} - -//static -void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) -{ - if(gVoiceClient) - { - std::string name = llformat("%s %s", first.c_str(), last.c_str()); - gVoiceClient->avatarNameResolved(id, name); - } + gCacheName->get(id, false, + boost::bind(&LLVoiceClient::avatarNameResolved, this, _1, _2)); } void LLVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name) diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 6231c6ba29..c6f6b2368b 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -474,7 +474,6 @@ static void updatePosition(void); void removeObserver(LLFriendObserver* observer); void lookupName(const LLUUID &id); - static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); void avatarNameResolved(const LLUUID &id, const std::string &name); typedef std::vector deviceList; diff --git a/indra/newview/skins/default/xui/en/floater_bumps.xml b/indra/newview/skins/default/xui/en/floater_bumps.xml index 303c28d7c8..1f2fe62b3c 100644 --- a/indra/newview/skins/default/xui/en/floater_bumps.xml +++ b/indra/newview/skins/default/xui/en/floater_bumps.xml @@ -14,23 +14,23 @@ - [TIME] [FIRST] [LAST] bumped you + [TIME] [NAME] bumped you - [TIME] [FIRST] [LAST] pushed you with a script + [TIME] [NAME] pushed you with a script - [TIME] [FIRST] [LAST] hit you with an object + [TIME] [NAME] hit you with an object - [TIME] [FIRST] [LAST] hit you with a scripted object + [TIME] [NAME] hit you with a scripted object - [TIME] [FIRST] [LAST] hit you with a physical object + [TIME] [NAME] hit you with a physical object diff --git a/indra/newview/skins/default/xui/en/floater_pay.xml b/indra/newview/skins/default/xui/en/floater_pay.xml index 509cffe490..8f60dd6f28 100644 --- a/indra/newview/skins/default/xui/en/floater_pay.xml +++ b/indra/newview/skins/default/xui/en/floater_pay.xml @@ -28,16 +28,6 @@ width="75"> Pay: - - [FIRST] [LAST] + top_pad="0" + width="230"> + Test Name + -- cgit v1.2.3 From 5aa8b5d37eb6824865d09af248aa9d9d518daeb9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 11 May 2010 17:27:14 -0700 Subject: Clean up merge, dueling LLDateUtil refactoring --- indra/newview/lldateutil.cpp | 72 +++++++++++++++++++-------------- indra/newview/lldateutil.h | 6 +-- indra/newview/llfloateravatarpicker.cpp | 2 +- indra/newview/tests/lldateutil_test.cpp | 18 ++++----- 4 files changed, 54 insertions(+), 44 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldateutil.cpp b/indra/newview/lldateutil.cpp index 32b8b9662a..ae955b6cad 100644 --- a/indra/newview/lldateutil.cpp +++ b/indra/newview/lldateutil.cpp @@ -59,18 +59,22 @@ static S32 days_from_month(S32 year, S32 month) } } -std::string LLDateUtil::ageFromDate(S32 born_year, - S32 born_month, - S32 born_day, - const LLDate& now) +bool LLDateUtil::dateFromPDTString(LLDate& date, const std::string& str) { - LLDate born_date; - born_date.fromYMDHMS(born_year, born_month, born_day); - F64 born_date_secs_since_epoch = born_date.secondsSinceEpoch(); - // Correct for the fact that account creation dates are in Pacific time, - // == UTC - 8 - born_date_secs_since_epoch += 8.0 * 60.0 * 60.0; - born_date.secondsSinceEpoch(born_date_secs_since_epoch); + S32 month, day, year; + S32 matched = sscanf(str.c_str(), "%d/%d/%d", &month, &day, &year); + if (matched != 3) return false; + date.fromYMDHMS(year, month, day); + F64 secs_since_epoch = date.secondsSinceEpoch(); + // Correct for the fact that specified date is in Pacific time, == UTC - 8 + secs_since_epoch += 8.0 * 60.0 * 60.0; + date.secondsSinceEpoch(secs_since_epoch); + return true; +} + +std::string LLDateUtil::ageFromDate(const LLDate& born_date, const LLDate& now) +{ + S32 born_month, born_day, born_year; // explode out to month/day/year again born_date.split(&born_year, &born_month, &born_day); @@ -154,13 +158,14 @@ std::string LLDateUtil::ageFromDate(S32 born_year, return LLTrans::getString("TodayOld"); } -std::string LLDateUtil::ageFromDate(const std::string& date_string, - const LLDate& now) +std::string LLDateUtil::ageFromDate(const std::string& date_string, const LLDate& now) { - S32 born_month, born_day, born_year; - S32 matched = sscanf(date_string.c_str(), "%d/%d/%d", &born_month, &born_day, &born_year); - if (matched != 3) return "???"; - return ageFromDate(born_year, born_month, born_day, now); + LLDate born_date; + + if (!dateFromPDTString(born_date, date_string)) + return "???"; + + return ageFromDate(born_date, now); } std::string LLDateUtil::ageFromDate(const std::string& date_string) @@ -168,17 +173,22 @@ std::string LLDateUtil::ageFromDate(const std::string& date_string) return ageFromDate(date_string, LLDate::now()); } -std::string LLDateUtil::ageFromDateISO(const std::string& date_string, - const LLDate& now) -{ - S32 born_month, born_day, born_year; - S32 matched = sscanf(date_string.c_str(), "%d-%d-%d", - &born_year, &born_month, &born_day); - if (matched != 3) return "???"; - return ageFromDate(born_year, born_month, born_day, now); -} - -std::string LLDateUtil::ageFromDateISO(const std::string& date_string) -{ - return ageFromDateISO(date_string, LLDate::now()); -} +//std::string LLDateUtil::ageFromDateISO(const std::string& date_string, +// const LLDate& now) +//{ +// S32 born_month, born_day, born_year; +// S32 matched = sscanf(date_string.c_str(), "%d-%d-%d", +// &born_year, &born_month, &born_day); +// if (matched != 3) return "???"; +// date.fromYMDHMS(year, month, day); +// F64 secs_since_epoch = date.secondsSinceEpoch(); +// // Correct for the fact that specified date is in Pacific time, == UTC - 8 +// secs_since_epoch += 8.0 * 60.0 * 60.0; +// date.secondsSinceEpoch(secs_since_epoch); +// return ageFromDate(born_year, born_month, born_day, now); +//} +// +//std::string LLDateUtil::ageFromDateISO(const std::string& date_string) +//{ +// return ageFromDateISO(date_string, LLDate::now()); +//} diff --git a/indra/newview/lldateutil.h b/indra/newview/lldateutil.h index a2bfa11ce7..8d41eea511 100644 --- a/indra/newview/lldateutil.h +++ b/indra/newview/lldateutil.h @@ -69,12 +69,12 @@ namespace LLDateUtil std::string ageFromDate(const std::string& date_string); // As above, for YYYY-MM-DD dates - std::string ageFromDateISO(const std::string& date_string, const LLDate& now); + //std::string ageFromDateISO(const std::string& date_string, const LLDate& now); // Calls the above with LLDate::now() - std::string ageFromDateISO(const std::string& date_string); + //std::string ageFromDateISO(const std::string& date_string); - std::string ageFromDate(S32 born_year, S32 born_month, S32 born_day, const LLDate& now); + //std::string ageFromDate(S32 born_year, S32 born_month, S32 born_day, const LLDate& now); } #endif diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index bca9282cec..e0346222c0 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -604,7 +604,7 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& S32 year, month, day; account_created.split(&year, &month, &day); std::string age = - LLDateUtil::ageFromDate(year, month, day, LLDate::now()); + LLDateUtil::ageFromDate(account_created, LLDate::now()); columns[2]["column"] = "age"; columns[2]["value"] = age; search_results->addElement(item); diff --git a/indra/newview/tests/lldateutil_test.cpp b/indra/newview/tests/lldateutil_test.cpp index e19983db8f..9ec24eb515 100644 --- a/indra/newview/tests/lldateutil_test.cpp +++ b/indra/newview/tests/lldateutil_test.cpp @@ -190,13 +190,13 @@ namespace tut "3 weeks old" ); } - template<> template<> - void dateutil_object_t::test<6>() - { - set_test_name("ISO dates"); - LLDate now(std::string("2010-01-04T12:00:00Z")); - ensure_equals("days", - LLDateUtil::ageFromDateISO("2009-12-13", now), - "3 weeks old" ); - } + //template<> template<> + //void dateutil_object_t::test<6>() + //{ + // set_test_name("ISO dates"); + // LLDate now(std::string("2010-01-04T12:00:00Z")); + // ensure_equals("days", + // LLDateUtil::ageFromDateISO("2009-12-13", now), + // "3 weeks old" ); + //} } -- cgit v1.2.3 From 49d6cf471df112eff54eba050f1aa57647c130c3 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 11 May 2010 17:27:27 -0700 Subject: Clean up merge, advanced preferences layout --- indra/newview/skins/default/xui/en/panel_preferences_advanced.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 063d51e08d..2452067383 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -301,6 +301,7 @@ Automatic position for: halign="center" height="23" image_overlay="Refresh_Off" + layout="topleft" tool_tip="Reset to Middle Mouse Button" mouse_opaque="true" name="set_voice_middlemouse_button" @@ -314,7 +315,7 @@ Automatic position for: label="Other Devices" left="30" name="joystick_setup_button" - top_pad="12" + top_pad="5" width="155"> + tool_tip="Check to use display names in chat, IM, name tags, etc." + top_pad="5"/> -- cgit v1.2.3 From fd2d23aa2c1f726dc522bbc268a92de5ee649f79 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 11:58:27 -0700 Subject: Delete textures/xui files incorrectly added back during last merge --- .../skins/default/textures/icons/Generic_Group_Large.png | Bin 2282 -> 0 bytes indra/newview/skins/default/textures/locked_image.j2c | Bin 6140 -> 0 bytes indra/newview/skins/default/textures/map_infohub.tga | Bin 1068 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 indra/newview/skins/default/textures/icons/Generic_Group_Large.png delete mode 100644 indra/newview/skins/default/textures/locked_image.j2c delete mode 100644 indra/newview/skins/default/textures/map_infohub.tga (limited to 'indra/newview') diff --git a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png deleted file mode 100644 index 4d4f1e1bee..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/locked_image.j2c b/indra/newview/skins/default/textures/locked_image.j2c deleted file mode 100644 index 9e8998d675..0000000000 Binary files a/indra/newview/skins/default/textures/locked_image.j2c and /dev/null differ diff --git a/indra/newview/skins/default/textures/map_infohub.tga b/indra/newview/skins/default/textures/map_infohub.tga deleted file mode 100644 index 545b8e532c..0000000000 Binary files a/indra/newview/skins/default/textures/map_infohub.tga and /dev/null differ -- cgit v1.2.3 From 3bc7e63f92b29f4be44a589b661d7ff911b443cf Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 13:54:49 -0700 Subject: Fix merge problem, crash on close prefs due to SmallAvatarNames Was deleted in trunk in code I refactored extensively. --- indra/newview/llvoavatar.cpp | 4 +--- .../skins/default/xui/en/panel_preferences_general.xml | 11 ----------- 2 files changed, 1 insertion(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8fa845e54a..9ee2c913c6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2886,9 +2886,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } else { - static LLUICachedControl small_avatar_names("SmallAvatarNames"); - const LLFontGL* font = - (small_avatar_names ? LLFontGL::getFontSansSerif() : LLFontGL::getFontSansSerifBig() ); + const LLFontGL* font = LLFontGL::getFontSansSerif(); std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 15db679f2a..131d9312af 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -246,17 +246,6 @@ value="2" width="160" /> - Date: Wed, 12 May 2010 13:55:16 -0700 Subject: Add link to help docs to "Thanks for updating your name" dialog --- indra/newview/skins/default/xui/en/notifications.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b01a071c2a..ffc58746e3 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3095,6 +3095,8 @@ Change your display name? Thanks for updating your name! Just like in real life, it takes a while for everyone to learn about a new name. Please allow [HOURS] hours for your name to update in object ownership, scripts, search, etc. + +See http://wiki.secondlife.com/wiki/Display_Names for details. Date: Wed, 12 May 2010 14:01:22 -0700 Subject: DEV-50013 IM inline text uses display names Reviewed with Leyla --- indra/newview/llchathistory.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 0fc5e92324..b3f9bb1dc1 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -242,12 +242,6 @@ public: mAvatarID = chat.mFromID; mSessionID = chat.mSessionID; mSourceType = chat.mSourceType; - //gCacheName->get(mAvatarID, false, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3)); - if (mAvatarID.notNull()) - { - LLAvatarNameCache::get(mAvatarID, - boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2)); - } //*TODO overly defensive thing, source type should be maintained out there if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM) @@ -260,14 +254,19 @@ public: userName->setReadOnlyColor(style_params.readonly_color()); userName->setColor(style_params.color()); - userName->setValue(chat.mFromName); - mFrom = chat.mFromName; - if (chat.mFromName.empty() || CHAT_SOURCE_SYSTEM == mSourceType) + if (chat.mFromName.empty() + || mSourceType == CHAT_SOURCE_SYSTEM + || mAvatarID.isNull()) { mFrom = LLTrans::getString("SECOND_LIFE"); userName->setValue(mFrom); } - + else + { + // ...from a normal user, lookup the name and fill in later + LLAvatarNameCache::get(mAvatarID, + boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2)); + } mMinUserNameWidth = style_params.font()->getWidth(userName->getWText().c_str()) + PADDING; @@ -324,21 +323,15 @@ public: LLPanel::draw(); } - void nameUpdatedCallback(const LLUUID& id,const std::string& full_name, bool is_group) - { - if (id != mAvatarID) - return; - mFrom = full_name; - } - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - if (agent_id != mAvatarID) return; + mFrom = av_name.mDisplayName; - // HACK: just update tooltip - setToolTip( av_name.mSLID ); LLTextBox* user_name = getChild("user_name"); + user_name->setValue( LLSD(av_name.mDisplayName ) ); + user_name->setToolTip( av_name.mSLID ); + setToolTip( av_name.mSLID ); } protected: -- cgit v1.2.3 From ab79144d7937b12677d0a19145e3fc958e4c659c Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 16:31:16 -0700 Subject: Remove unnecessary include (was for debugging) --- indra/newview/llviewerdisplayname.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index bec2687cca..ec80129f8a 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -148,7 +148,6 @@ public: } }; -#include "llsdserialize.h" class LLDisplayNameUpdate : public LLHTTPNode { -- cgit v1.2.3 From bee1a091469f8d1f2277e8d5b4cc9981e8060bde Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 16:32:25 -0700 Subject: DEV-50013 IM window titles use correct name lookup method --- indra/newview/llavataractions.cpp | 65 +++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 37 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 85a087d6f6..fe6ca60d7c 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -187,28 +187,11 @@ void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) handle_lure(ids); } -// static -void LLAvatarActions::startIM(const LLUUID& id) +static void on_avatar_name_cache_start_im(const LLUUID& agent_id, + const LLAvatarName& av_name) { - if (id.isNull()) - return; - - std::string name; - if (!gCacheName->getFullName(id, name)) - { - gCacheName->get(id, FALSE, boost::bind(&LLAvatarActions::startIM, id)); - return; - } - - // IDEVO - LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(id, &av_name)) - { - name = av_name.mDisplayName + " (" + av_name.mSLID + ")"; - } - - LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id); + std::string name = av_name.getNameAndSLID(); + LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id); if (session_id != LLUUID::null) { LLIMFloater::show(session_id); @@ -216,6 +199,16 @@ void LLAvatarActions::startIM(const LLUUID& id) make_ui_sound("UISndStartIM"); } +// static +void LLAvatarActions::startIM(const LLUUID& id) +{ + if (id.isNull()) + return; + + LLAvatarNameCache::get(id, + boost::bind(&on_avatar_name_cache_start_im, _1, _2)); +} + // static void LLAvatarActions::endIM(const LLUUID& id) { @@ -229,6 +222,18 @@ void LLAvatarActions::endIM(const LLUUID& id) } } +static void on_avatar_name_cache_start_call(const LLUUID& agent_id, + const LLAvatarName& av_name) +{ + std::string name = av_name.getNameAndSLID(); + LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true); + if (session_id != LLUUID::null) + { + gIMMgr->startCall(session_id); + } + make_ui_sound("UISndStartIM"); +} + // static void LLAvatarActions::startCall(const LLUUID& id) { @@ -236,22 +241,8 @@ void LLAvatarActions::startCall(const LLUUID& id) { return; } - - std::string name; - gCacheName->getFullName(id, name); - // IDEVO - LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(id, &av_name)) - { - name = av_name.mDisplayName + " (" + av_name.mSLID + ")"; - } - LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id, true); - if (session_id != LLUUID::null) - { - gIMMgr->startCall(session_id); - } - make_ui_sound("UISndStartIM"); + LLAvatarNameCache::get(id, + boost::bind(&on_avatar_name_cache_start_call, _1, _2)); } // static -- cgit v1.2.3 From 6871747f11f300fcf90edba2224c91a3645617cc Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 16:32:54 -0700 Subject: DEV-50013 Display names limited to 31 chars (not bytes) in viewer UI Reviewed with Leyla --- indra/newview/llpanelme.cpp | 15 +++++++++++++-- indra/newview/skins/default/xui/en/notifications.xml | 11 ++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 483741e643..f38c8859ef 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -352,8 +352,19 @@ void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& LLUUID agent_id = notification["payload"]["agent_id"]; if (agent_id.isNull()) return; - std::string display_name = response["display_name"].asString(); - LLViewerDisplayName::set(display_name, + std::string display_name_utf8 = response["display_name"].asString(); + + const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes + LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8); + if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH) + { + LLSD args; + args["LENGTH"] = llformat("%d", DISPLAY_NAME_MAX_LENGTH); + LLNotificationsUtil::add("SetDisplayNameFailedLength", args); + return; + } + + LLViewerDisplayName::set(display_name_utf8, boost::bind(&LLPanelMyProfileEdit::onCacheSetName, this, _1, _2, _3)); } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index ffc58746e3..c4ddae1a12 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3098,7 +3098,16 @@ Just like in real life, it takes a while for everyone to learn about a new name. See http://wiki.secondlife.com/wiki/Display_Names for details. - + + +Sorry, that name is too long. Display names can have a maximum of [LENGTH] characters. + +Please try a shorter name. + + Date: Wed, 12 May 2010 16:33:21 -0700 Subject: DEV-50031 Moved buttons in IM ctrl panel to top, looks cleaner Reviewed with Leyla --- .../default/xui/en/panel_im_control_panel.xml | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml index 33a5e01e4c..a36f078f4f 100644 --- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml @@ -23,26 +23,16 @@ orientation="vertical" top_pad="5" width="114"> - + top_pad="5"/> -- cgit v1.2.3 From 14f423a23c38bf554e9633752074fbcabd92599c Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 13 May 2010 12:18:10 -0700 Subject: DEV-50013 General "name list" support for display name +/- SLID Added lookups via new name cache system. Added optional short_name parameter to show only display names in the list (don't need this yet). Removed top-level global refresh of all name list controls when legacy name cache receives names -- it was inefficient and we don't need it anymore. Reviewed with Leyla. --- indra/newview/llnamelistctrl.cpp | 51 ++++++++++++---------- indra/newview/llnamelistctrl.h | 8 ++-- indra/newview/llstartup.cpp | 1 - .../skins/default/xui/en/panel_group_general.xml | 1 + .../skins/default/xui/en/panel_group_roles.xml | 1 + 5 files changed, 33 insertions(+), 29 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index c5706e8345..2a7e84256e 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -36,6 +36,7 @@ #include +#include "llavatarnamecache.h" #include "llcachename.h" #include "llfloaterreg.h" #include "llinventory.h" @@ -58,7 +59,8 @@ void LLNameListCtrl::NameTypeNames::declareValues() LLNameListCtrl::Params::Params() : name_column(""), - allow_calling_card_drop("allow_calling_card_drop", false) + allow_calling_card_drop("allow_calling_card_drop", false), + short_names("short_names", false) { name = "name_list"; } @@ -67,7 +69,8 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) : LLScrollListCtrl(p), mNameColumnIndex(p.name_column.column_index), mNameColumn(p.name_column.column_name), - mAllowCallingCardDrop(p.allow_calling_card_drop) + mAllowCallingCardDrop(p.allow_calling_card_drop), + mShortNames(p.short_names) {} // public @@ -297,10 +300,20 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( break; case INDIVIDUAL: { - std::string name; - if (gCacheName->getFullName(id, name)) + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) { - fullname = name; + if (mShortNames) + fullname = av_name.mDisplayName; + else + fullname = av_name.getNameAndSLID(); + } + else + { + // ...schedule a callback + LLAvatarNameCache::get(id, + boost::bind(&LLNameListCtrl::onAvatarNameCache, + this, _1, _2)); } break; } @@ -355,23 +368,25 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) } } -// public -void LLNameListCtrl::refresh(const LLUUID& id, const std::string& full_name, bool is_group) +void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, + const LLAvatarName& av_name) { - //llinfos << "LLNameListCtrl::refresh " << id << " '" << first << " " - // << last << "'" << llendl; + std::string name; + if (mShortNames) + name = av_name.mDisplayName; + else + name = av_name.getNameAndSLID(); - // TODO: scan items for that ID, fix if necessary item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) { LLScrollListItem* item = *iter; - if (item->getUUID() == id) + if (item->getUUID() == agent_id) { LLScrollListCell* cell = item->getColumn(mNameColumnIndex); if (cell) { - cell->setValue(full_name); + cell->setValue(name); } } } @@ -380,18 +395,6 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& full_name, boo } -// static -void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& full_name, bool is_group) -{ - LLInstanceTrackerScopedGuard guard; - LLInstanceTracker::instance_iter it; - for (it = guard.beginInstances(); it != guard.endInstances(); ++it) - { - LLNameListCtrl& ctrl = *it; - ctrl.refresh(id, full_name, is_group); - } -} - void LLNameListCtrl::updateColumns() { LLScrollListCtrl::updateColumns(); diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 6d61214712..54237f4305 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -37,6 +37,7 @@ #include "llscrolllistctrl.h" +class LLAvatarName; class LLNameListCtrl : public LLScrollListCtrl, protected LLInstanceTracker @@ -80,6 +81,7 @@ public: { Optional name_column; Optional allow_calling_card_drop; + Optional short_names; Params(); }; @@ -105,10 +107,6 @@ public: void removeNameItem(const LLUUID& agent_id); - void refresh(const LLUUID& id, const std::string& full_name, bool is_group); - - static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group); - // LLView interface /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, @@ -123,11 +121,13 @@ public: /*virtual*/ void mouseOverHighlightNthItem( S32 index ); private: void showInspector(const LLUUID& avatar_id, bool is_group); + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); private: S32 mNameColumnIndex; std::string mNameColumn; BOOL mAllowCallingCardDrop; + bool mShortNames; // display name only, no SLID }; /** diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8f53463269..689275421d 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -269,7 +269,6 @@ void transition_back_to_login_panel(const std::string& emsg); void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group) { - LLNameListCtrl::refreshAll(id, full_name, is_group); LLNameBox::refreshAll(id, full_name, is_group); LLNameEditor::refreshAll(id, full_name, is_group); diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml index 9341d433e8..d7a4094d50 100644 --- a/indra/newview/skins/default/xui/en/panel_group_general.xml +++ b/indra/newview/skins/default/xui/en/panel_group_general.xml @@ -112,6 +112,7 @@ Hover your mouse over the options for more help. layout="topleft" left="0" name="visible_members" + short_names="false" top_pad="2"> Date: Thu, 13 May 2010 16:30:15 -0700 Subject: Fix build errors introduced in last merge --- indra/newview/llavataractions.cpp | 2 +- indra/newview/llfloaterland.cpp | 7 +++---- indra/newview/llfloaterpay.cpp | 4 ++-- indra/newview/llpanellandmarkinfo.cpp | 6 +++--- indra/newview/llpanellogin.cpp | 18 +++++++++++++++--- indra/newview/llpanelplaceprofile.cpp | 2 +- indra/newview/llviewermessage.cpp | 4 ++-- indra/newview/llvoicevivox.cpp | 6 ++---- indra/newview/llvoicevivox.h | 2 +- 9 files changed, 30 insertions(+), 21 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index e1e9e03889..708ef1895e 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -79,7 +79,7 @@ void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::strin } LLSD args; - args["NAME"] = LLSLURL::buildCommand("agent", id, "inspect"); + args["NAME"] = LLSLURL("agent", id, "inspect").getSLURLString(); LLSD payload; payload["id"] = id; payload["name"] = name; diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index b80280d74d..b008189b0d 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -825,9 +825,9 @@ void LLPanelLandGeneral::refreshNames() const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { - std::string name; - name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString(); - mSaleInfoForSale2->setTextArg("[BUYER]", name); + std::string name; + name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString(); + mSaleInfoForSale2->setTextArg("[BUYER]", name); } else { @@ -835,7 +835,6 @@ void LLPanelLandGeneral::refreshNames() } } } -} // virtual diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp index 7dbcc9555c..7b596e9ba3 100644 --- a/indra/newview/llfloaterpay.cpp +++ b/indra/newview/llfloaterpay.cpp @@ -430,12 +430,12 @@ void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group) if (is_group) { setTitle(getString("payee_group")); - slurl = LLSLURL::buildCommand("group", target_id, "inspect"); + slurl = LLSLURL("group", target_id, "inspect").getSLURLString(); } else { setTitle(getString("payee_resident")); - slurl = LLSLURL::buildCommand("agent", target_id, "inspect"); + slurl = LLSLURL("agent", target_id, "inspect").getSLURLString(); } childSetText("payee_name", slurl); diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index c03bc82904..4c2ff471e8 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -235,7 +235,7 @@ void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem) // IDEVO LLUUID creator_id = pItem->getCreatorUUID(); std::string name = - LLSLURL::buildCommand("agent", creator_id, "inspect"); + LLSLURL("agent", creator_id, "inspect").getSLURLString(); //if (!gCacheName->getFullName(creator_id, name)) //{ // gCacheName->get(creator_id, FALSE, @@ -263,7 +263,7 @@ void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem) // gCacheName->get(group_id, TRUE, // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mOwner, _2, _3)); //} - name = LLSLURL::buildCommand("group", group_id, "inspect"); + name = LLSLURL("group", group_id, "inspect").getSLURLString(); } else { @@ -274,7 +274,7 @@ void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem) // gCacheName->get(owner_id, FALSE, // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mOwner, _2, _3)); //} - name = LLSLURL::buildCommand("agent", owner_id, "inspect"); + name = LLSLURL("agent", owner_id, "inspect").getSLURLString(); } mOwner->setText(name); } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 23d05183b4..d313a95546 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -600,7 +600,8 @@ void LLPanelLogin::getFields(LLPointer& credential, LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL; // determine if the username is a first/last form or not. size_t separator_index = username.find_first_of(' '); - if (separator_index == username.npos) + if (separator_index == username.npos + && !LLGridManager::getInstance()->isSystemGrid()) { LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL; // single username, so this is a 'clear' identifier @@ -618,8 +619,19 @@ void LLPanelLogin::getFields(LLPointer& credential, else { std::string first = username.substr(0, separator_index); - std::string last = username.substr(separator_index, username.npos); - LLStringUtil::trim(last); + std::string last; + if (separator_index != username.npos) + { + last = username.substr(separator_index, username.npos); + LLStringUtil::trim(last); + } + else + { + // ...on Linden grids, single username users as considered to have + // last name "Resident" + // *TODO: Make login.cgi support "account_name" like above + last = "Resident"; + } if (last.find_first_of(' ') == last.npos) { diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 41ca237b1e..52a46a45b6 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -448,7 +448,7 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, //gCacheName->get(parcel->getOwnerID(), FALSE, // boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, mParcelOwner, _2, _3)); std::string parcel_owner = - LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect"); + LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString(); mParcelOwner->setText(parcel_owner); gCacheName->get(region->getOwner(), false, boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionOwnerText, _2)); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e5fdda62d5..11ab6e7de4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5008,11 +5008,11 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) const char* source_type = (is_source_group ? "group" : "agent"); std::string source_slurl = - LLSLURL::buildCommand( source_type, source_id, "about"); + LLSLURL( source_type, source_id, "about").getSLURLString(); const char* dest_type = (is_dest_group ? "group" : "agent"); std::string dest_slurl = - LLSLURL::buildCommand( dest_type, dest_id, "about"); + LLSLURL( dest_type, dest_id, "about").getSLURLString(); // // diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index bcb1a70efb..a457bd1fe6 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6181,11 +6181,9 @@ void LLVivoxVoiceClient::lookupName(const LLUUID &id) } //static -void LLVivoxVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) +void LLVivoxVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& name, BOOL is_group) { - std::string name = llformat("%s %s", first.c_str(), last.c_str()); - LLVivoxVoiceClient::getInstance()->avatarNameResolved(id, name); - + LLVivoxVoiceClient::getInstance()->avatarNameResolved(id, name); } void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 59fec8b954..e6dd0e9823 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -619,7 +619,7 @@ protected: void leaveAudioSession(); void lookupName(const LLUUID &id); - static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + static void onAvatarNameLookup(const LLUUID& id, const std::string& name, BOOL is_group); void avatarNameResolved(const LLUUID &id, const std::string &name); private: -- cgit v1.2.3 From 669953f6950000821c33e77d4c29ef0c905667f9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 13 May 2010 17:07:21 -0700 Subject: DEV-50013 Call floater uses your display name --- indra/newview/llcallfloater.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index dd99c6564c..44fb4e9e72 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -33,13 +33,14 @@ #include "llviewerprecompiledheaders.h" +#include "llcallfloater.h" + #include "llnotificationsutil.h" #include "lltrans.h" -#include "llcallfloater.h" - #include "llagent.h" #include "llagentdata.h" // for gAgentID +#include "llavatarnamecache.h" #include "llavatariconctrl.h" #include "llavatarlist.h" #include "llbottomtray.h" @@ -422,9 +423,10 @@ void LLCallFloater::initAgentData() { mAgentPanel->childSetValue("user_icon", gAgentID); - std::string name; - gCacheName->getFullName(gAgentID, name); - mAgentPanel->childSetValue("user_text", name); + // Just use display name, because it's you + LLAvatarName av_name; + LLAvatarNameCache::get( gAgentID, &av_name ); + mAgentPanel->childSetValue("user_text", av_name.mDisplayName); mSpeakingIndicator = mAgentPanel->getChild("speaking_indicator"); mSpeakingIndicator->setSpeakerId(gAgentID); @@ -445,7 +447,10 @@ void LLCallFloater::setModeratorMutedVoice(bool moderator_muted) void LLCallFloater::updateAgentModeratorState() { std::string name; - gCacheName->getFullName(gAgentID, name); + // Just use display name, because it's you + LLAvatarName av_name; + LLAvatarNameCache::get(gAgentID, &av_name); + name = av_name.mDisplayName; if(gAgent.isInGroup(mSpeakerManager->getSessionID())) { -- cgit v1.2.3 From 2af4875309450fa3d3e266426ada12330489a8c9 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 13 May 2010 17:26:06 -0700 Subject: DEV-50013 Friends in sidebar now correctly displaying names reviewed by James --- indra/newview/llavatarlist.cpp | 14 ++++++++++---- indra/newview/llavatarlistitem.cpp | 8 +++++--- indra/newview/llavatarlistitem.h | 3 ++- 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index dfb213716c..8801903df7 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -41,6 +41,7 @@ // newview #include "llavatariconctrl.h" +#include "llavatarnamecache.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llcachename.h" #include "llrecentpeople.h" @@ -239,12 +240,15 @@ void LLAvatarList::refresh() // Handle added items. unsigned nadded = 0; + const std::string waiting_str = LLTrans::getString("AvatarNameWaiting"); + for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++) { - std::string name; const LLUUID& buddy_id = *it; - have_names &= (bool)gCacheName->getFullName(buddy_id, name); - if (!have_filter || findInsensitive(name, mNameFilter)) + LLAvatarName av_name; + have_names &= LLAvatarNameCache::get(buddy_id, &av_name); + + if (!have_filter || findInsensitive(av_name.mDisplayName, mNameFilter)) { if (nadded >= ADD_LIMIT) { @@ -253,7 +257,9 @@ void LLAvatarList::refresh() } else { - addNewItem(buddy_id, name, LLAvatarTracker::instance().isBuddyOnline(buddy_id)); + addNewItem(buddy_id, + av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, + LLAvatarTracker::instance().isBuddyOnline(buddy_id)); modified = true; nadded++; } diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index fc5453c2dd..fcfc05af02 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -38,6 +38,7 @@ #include "llfloaterreg.h" #include "llagent.h" +#include "llavatarnamecache.h" #include "lloutputmonitorctrl.h" #include "llavatariconctrl.h" #include "lltextutil.h" @@ -229,7 +230,8 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, b mAvatarIcon->setValue(id); // Set avatar name. - gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2)); + LLAvatarNameCache::get(id, + boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2)); } } @@ -335,9 +337,9 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin mAvatarName->setToolTip(name); } -void LLAvatarListItem::onNameCache(const std::string& fullname) +void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { - setName(fullname); + setName(av_name.mDisplayName); //requesting the list to resort notifyParent(LLSD().with("sort", LLSD())); diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 1e3b67b094..bad8aa9d5c 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -42,6 +42,7 @@ #include "llcallingcard.h" // for LLFriendObserver class LLAvatarIconCtrl; +class LLAvatarName; class LLAvatarListItem : public LLPanel, public LLFriendObserver { @@ -151,7 +152,7 @@ private: } EAvatarListItemChildIndex; void setNameInternal(const std::string& name, const std::string& highlight); - void onNameCache(const std::string& fullname); + void onAvatarNameCache(const LLAvatarName& av_name); std::string formatSeconds(U32 secs); -- cgit v1.2.3 From 73a53aa64328f1b48fa09286120609b7297985e3 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 17 May 2010 09:13:46 -0700 Subject: DEV-50013 Rename "SLID" to "Username" at Product's request --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/skins/default/xui/en/panel_login.xml | 2 +- indra/newview/skins/default/xui/en/panel_preferences_general.xml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f8ad1c2dac..6a68f72bb5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7340,7 +7340,7 @@ NameTagShowSLIDs Comment - Show Second Life IDs in name labels + Show usernames in avatar name tags Persist 1 Type diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 21846f6e87..88c264c649 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -60,7 +60,7 @@ name="username_text" top="20" left="20" width="150"> -Second Life ID or Name: +Username: Date: Mon, 17 May 2010 15:01:52 -0700 Subject: DEV-50013 Display name for inbound voice calls --- indra/newview/llimview.cpp | 15 +++++++++++++-- indra/newview/llvoicechannel.h | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 356f194c81..23ad308a82 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1746,8 +1746,19 @@ void LLOutgoingCallDialog::show(const LLSD& key) setTitle(callee_name); LLSD callee_id = mPayload["other_user_id"]; - childSetTextArg("calling", "[CALLEE_NAME]", callee_name); - childSetTextArg("connecting", "[CALLEE_NAME]", callee_name); + // Beautification: Since SLID is in the title bar, and you probably + // recognize this person's voice, just show display name + std::string final_callee_name = callee_name; + if (is_avatar) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(callee_id, &av_name)) + { + final_callee_name = av_name.mDisplayName; + } + } + childSetTextArg("calling", "[CALLEE_NAME]", final_callee_name); + childSetTextArg("connecting", "[CALLEE_NAME]", final_callee_name); // for outgoing group calls callee_id == group id == session id setIcon(callee_id, callee_id); diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index 573fab1f4f..1784ceaa12 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -82,6 +82,9 @@ public: virtual void getChannelInfo(); virtual BOOL isActive(); virtual BOOL callStarted(); + + // Session name is a UI label used for feedback about which person, + // group, or phone number you are talking to const std::string& getSessionName() const { return mSessionName; } boost::signals2::connection setStateChangedCallback(const state_changed_signal_t::slot_type& callback) -- cgit v1.2.3 From 22f4de740dfcb2fdf92e46b91a426ca14fc42081 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 17 May 2010 15:28:37 -0700 Subject: inspector and friends list tooltip updates reviewed by James --- indra/newview/llavatarlistitem.cpp | 3 ++- indra/newview/llinspectavatar.cpp | 38 +++++++++++++++----------------------- 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index fcfc05af02..c458930a62 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -170,6 +170,7 @@ void LLAvatarListItem::setOnline(bool online) void LLAvatarListItem::setName(const std::string& name) { setNameInternal(name, mHighlihtSubstring); + mAvatarName->setToolTip(name); } void LLAvatarListItem::setHighlight(const std::string& highlight) @@ -334,12 +335,12 @@ const std::string LLAvatarListItem::getAvatarName() const void LLAvatarListItem::setNameInternal(const std::string& name, const std::string& highlight) { LLTextUtil::textboxSetHighlightedVal(mAvatarName, mAvatarNameStyle, name, highlight); - mAvatarName->setToolTip(name); } void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { setName(av_name.mDisplayName); + mAvatarName->setToolTip(av_name.mSLID); //requesting the list to resort notifyParent(LLSD().with("sort", LLSD())); diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 0024651863..3cbde2bb9c 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -154,7 +154,7 @@ private: private: LLUUID mAvatarID; // Need avatar name information to spawn friend add request - std::string mAvatarName; + std::string mLegacyName; // an in-flight request for avatar properties from LLAvatarPropertiesProcessor // is represented by this object LLFetchAvatarData* mPropertiesRequest; @@ -209,7 +209,7 @@ public: LLInspectAvatar::LLInspectAvatar(const LLSD& sd) : LLInspect( LLSD() ), // single_instance, doesn't really need key mAvatarID(), // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec* - mAvatarName(), + mLegacyName(), mPropertiesRequest(NULL) { mCommitCallbackRegistrar.add("InspectAvatar.ViewProfile", boost::bind(&LLInspectAvatar::onClickViewProfile, this)); @@ -376,8 +376,7 @@ void LLInspectAvatar::requestUpdate() childSetValue("avatar_icon", LLSD(mAvatarID) ); // JAMESDEBUG HACK: Request via both legacy name system and new - // name system to set mAvatarName for not-yet-converted friendship - // request system. + // name system to set mLegacyName for use with mute system gCacheName->get(mAvatarID, false, boost::bind(&LLInspectAvatar::onNameCache, this, _1, _2, _3)); @@ -574,7 +573,7 @@ void LLInspectAvatar::updateVolumeSlider() LLUICtrl* mute_btn = getChild("mute_btn"); - bool is_linden = LLStringUtil::endsWith(mAvatarName, " Linden"); + bool is_linden = LLStringUtil::endsWith(mLegacyName, " Linden"); mute_btn->setEnabled( !is_linden); mute_btn->setValue( is_muted ); @@ -605,7 +604,7 @@ void LLInspectAvatar::onClickMuteVolume() LLMuteList* mute_list = LLMuteList::getInstance(); bool is_muted = mute_list->isMuted(mAvatarID, LLMute::flagVoiceChat); - LLMute mute(mAvatarID, mAvatarName, LLMute::AGENT); + LLMute mute(mAvatarID, mLegacyName, LLMute::AGENT); if (!is_muted) { mute_list->add(mute, LLMute::flagVoiceChat); @@ -631,14 +630,8 @@ void LLInspectAvatar::onNameCache( { if (id == mAvatarID) { - mAvatarName = full_name; - - // IDEVO JAMESDEBUG - need to always display a display name - if (!LLAvatarNameCache::useDisplayNames()) - { - getChild("user_name")->setValue(full_name); - getChild("user_slid")->setValue(""); - } + // we need the legacy name for the mute list :-( + mLegacyName = full_name; } } @@ -648,7 +641,6 @@ void LLInspectAvatar::onAvatarNameCache( { if (agent_id == mAvatarID) { - // JAMESDEBUG what to do about mAvatarName ? getChild("user_name")->setValue(av_name.mDisplayName); getChild("user_slid")->setValue(av_name.mSLID); } @@ -656,7 +648,7 @@ void LLInspectAvatar::onAvatarNameCache( void LLInspectAvatar::onClickAddFriend() { - LLAvatarActions::requestFriendshipDialog(mAvatarID, mAvatarName); + LLAvatarActions::requestFriendshipDialog(mAvatarID, mLegacyName); closeFloater(); } @@ -724,7 +716,7 @@ void LLInspectAvatar::onClickShare() void LLInspectAvatar::onToggleMute() { - LLMute mute(mAvatarID, mAvatarName, LLMute::AGENT); + LLMute mute(mAvatarID, mLegacyName, LLMute::AGENT); if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) { @@ -741,7 +733,7 @@ void LLInspectAvatar::onToggleMute() void LLInspectAvatar::onClickReport() { - LLFloaterReporter::showFromAvatar(mAvatarID, mAvatarName); + LLFloaterReporter::showFromAvatar(mAvatarID, mLegacyName); closeFloater(); } @@ -765,17 +757,17 @@ void LLInspectAvatar::onClickZoomIn() void LLInspectAvatar::onClickFindOnMap() { - gFloaterWorldMap->trackAvatar(mAvatarID, mAvatarName); + gFloaterWorldMap->trackAvatar(mAvatarID, mLegacyName); LLFloaterReg::showInstance("world_map"); } bool LLInspectAvatar::enableMute() { - bool is_linden = LLStringUtil::endsWith(mAvatarName, " Linden"); + bool is_linden = LLStringUtil::endsWith(mLegacyName, " Linden"); bool is_self = mAvatarID == gAgent.getID(); - if (!is_linden && !is_self && !LLMuteList::getInstance()->isMuted(mAvatarID, mAvatarName)) + if (!is_linden && !is_self && !LLMuteList::getInstance()->isMuted(mAvatarID, mLegacyName)) { return true; } @@ -787,10 +779,10 @@ bool LLInspectAvatar::enableMute() bool LLInspectAvatar::enableUnmute() { - bool is_linden = LLStringUtil::endsWith(mAvatarName, " Linden"); + bool is_linden = LLStringUtil::endsWith(mLegacyName, " Linden"); bool is_self = mAvatarID == gAgent.getID(); - if (!is_linden && !is_self && LLMuteList::getInstance()->isMuted(mAvatarID, mAvatarName)) + if (!is_linden && !is_self && LLMuteList::getInstance()->isMuted(mAvatarID, mLegacyName)) { return true; } -- cgit v1.2.3 From 40adb9599cd7eac1fd8062e4629a0e8b8c031638 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 17 May 2010 15:44:29 -0700 Subject: DEV-50013 New documentation URL for display names changes --- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b0f5daef14..7839d61299 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3170,7 +3170,7 @@ Thanks for updating your name! Just like in real life, it takes a while for everyone to learn about a new name. Please allow [HOURS] hours for your name to update in object ownership, scripts, search, etc. -See http://wiki.secondlife.com/wiki/Display_Names for details. +See http://wiki.secondlife.com/wiki/Setting_your_display_name for details. Date: Mon, 17 May 2010 16:33:16 -0700 Subject: DEV-50013 Display name for inbound voice calls (Last commit was actually for outbound). Reviewed with Leyla --- indra/newview/llimview.cpp | 29 +++++++++++++++++----- indra/newview/llimview.h | 9 ++++++- indra/newview/llvoicevivox.cpp | 9 +++++++ .../skins/default/xui/en/floater_incoming_call.xml | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 23ad308a82..b17dca68f6 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1915,21 +1915,21 @@ BOOL LLIncomingCallDialog::postBuild() if (caller_name == "anonymous") { caller_name = getString("anonymous"); + setCallerName(caller_name, caller_name, call_type); } else if (!is_avatar) { caller_name = LLTextUtil::formatPhoneNumber(caller_name); + setCallerName(caller_name, caller_name, call_type); } else { - // IDEVO - caller_name = LLCacheName::cleanFullName(caller_name); + // Get the full name information + LLAvatarNameCache::get(caller_id, + boost::bind(&LLIncomingCallDialog::onAvatarNameCache, + this, _1, _2, call_type)); } - setTitle(caller_name + " " + call_type); - - LLUICtrl* caller_name_widget = getChild("caller name"); - caller_name_widget->setValue(caller_name + " " + call_type); setIcon(session_id, caller_id); childSetAction("Accept", onAccept, this); @@ -1953,6 +1953,23 @@ BOOL LLIncomingCallDialog::postBuild() return TRUE; } +void LLIncomingCallDialog::setCallerName(const std::string& ui_title, + const std::string& ui_label, + const std::string& call_type) +{ + setTitle(ui_title + " " + call_type); + + LLUICtrl* caller_name_widget = getChild("caller name"); + caller_name_widget->setValue(ui_label + " " + call_type); +} + +void LLIncomingCallDialog::onAvatarNameCache(const LLUUID& agent_id, + const LLAvatarName& av_name, + const std::string& call_type) +{ + std::string title = av_name.getNameAndSLID(); + setCallerName(title, av_name.mDisplayName, call_type); +} void LLIncomingCallDialog::onOpen(const LLSD& key) { diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 758ea667ef..c132ac328f 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -41,7 +41,7 @@ #include "llvoicechannel.h" - +class LLAvatarName; class LLFriendObserver; class LLCallDialogManager; class LLIMSpeakerMgr; @@ -540,6 +540,13 @@ public: static void onStartIM(void* user_data); private: + void setCallerName(const std::string& ui_title, + const std::string& ui_label, + const std::string& call_type); + void onAvatarNameCache(const LLUUID& agent_id, + const LLAvatarName& av_name, + const std::string& call_type); + /*virtual*/ void onLifetimeExpired(); void processCallResponse(S32 response); }; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index a457bd1fe6..4a0b0f12a4 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -37,6 +37,8 @@ #include "llsdutil.h" +// Linden library includes +#include "llavatarnamecache.h" #include "llvoavatarself.h" #include "llbufferstream.h" #include "llfile.h" @@ -52,6 +54,8 @@ #include "llviewercontrol.h" #include "llkeyboard.h" #include "llappviewer.h" // for gDisconnected, gDisableVoice + +// Viewer includes #include "llmutelist.h" // to check for muted avatars #include "llagent.h" #include "llcachename.h" @@ -6178,6 +6182,11 @@ void LLVivoxVoiceClient::lookupName(const LLUUID &id) { BOOL is_group = FALSE; gCacheName->get(id, is_group, &LLVivoxVoiceClient::onAvatarNameLookup); + + // Peformance boost: We're going to need the display name later when + // we show the call request floater, so get the request going now + LLAvatarName unused; + LLAvatarNameCache::get(id, &unused); } //static diff --git a/indra/newview/skins/default/xui/en/floater_incoming_call.xml b/indra/newview/skins/default/xui/en/floater_incoming_call.xml index 1d67123726..420ba172e8 100644 --- a/indra/newview/skins/default/xui/en/floater_incoming_call.xml +++ b/indra/newview/skins/default/xui/en/floater_incoming_call.xml @@ -8,7 +8,7 @@ layout="topleft" name="incoming call" help_topic="incoming_call" - title="UNKNOWN PERSON IS CALLING" + title="Incoming call" width="410"> -- cgit v1.2.3 From efa00298b3e806a92ced61803b2bbe8ca40d1681 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 17 May 2010 17:11:27 -0700 Subject: updated preferences placement for display names option reviewed by James --- .../default/xui/en/panel_preferences_advanced.xml | 15 ++---------- .../default/xui/en/panel_preferences_setup.xml | 27 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 15 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index e3ee14771c..88b60ea3c8 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -205,7 +205,7 @@ Automatic position for: layout="topleft" left="30" name="UI Size:" - top_pad="5" + top_pad="15" width="300"> UI size @@ -316,21 +316,10 @@ Automatic position for: label="Other Devices" left="30" name="joystick_setup_button" - top_pad="5" + top_pad="10" width="155"> - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 2c6ceeef2e..7148aba00a 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -115,7 +115,7 @@ layout="topleft" left="77" name="connection_port_enabled" - top_pad="20" + top_pad="15" width="256"> Cache size @@ -375,4 +375,27 @@ name="web_proxy_port" top_delta="0" width="145" /> + + Communications: + + -- cgit v1.2.3 From f4148502e484d516b42c4a88603eee6889d45697 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 18 May 2010 16:00:45 -0700 Subject: Rename mSLID to mUsername to match the name of the field in the UI Product made a late-breaking request to change the name of this field. The wire protocol for People API has not yet changed. --- indra/newview/llavatarlistitem.cpp | 2 +- indra/newview/llchathistory.cpp | 4 ++-- indra/newview/llimview.cpp | 2 +- indra/newview/llinspectavatar.cpp | 2 +- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/llpanelme.cpp | 2 +- indra/newview/llpanelprofileview.cpp | 2 +- indra/newview/lltoolpie.cpp | 2 +- indra/newview/llviewerdisplayname.cpp | 2 +- indra/newview/llvoavatar.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index c458930a62..a59ad306d7 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -340,7 +340,7 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { setName(av_name.mDisplayName); - mAvatarName->setToolTip(av_name.mSLID); + mAvatarName->setToolTip(av_name.mUsername); //requesting the list to resort notifyParent(LLSD().with("sort", LLSD())); diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 5bf3d7b913..6d98afbc58 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -330,8 +330,8 @@ public: LLTextBox* user_name = getChild("user_name"); user_name->setValue( LLSD(av_name.mDisplayName ) ); - user_name->setToolTip( av_name.mSLID ); - setToolTip( av_name.mSLID ); + user_name->setToolTip( av_name.mUsername ); + setToolTip( av_name.mUsername ); } protected: diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b17dca68f6..0c88b9f3a1 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2075,7 +2075,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response) if (LLAvatarNameCache::useDisplayNames() && LLAvatarNameCache::get(caller_id, &av_name)) { - correct_session_name = av_name.mDisplayName + " (" + av_name.mSLID + ")"; + correct_session_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; } correct_session_name.append(ADHOC_NAME_SUFFIX); } diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 3cbde2bb9c..74bf6e378d 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -642,7 +642,7 @@ void LLInspectAvatar::onAvatarNameCache( if (agent_id == mAvatarID) { getChild("user_name")->setValue(av_name.mDisplayName); - getChild("user_slid")->setValue(av_name.mSLID); + getChild("user_slid")->setValue(av_name.mUsername); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 14e5c8b93c..9e3f80e464 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3634,7 +3634,7 @@ void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string act if (LLAvatarNameCache::useDisplayNames() && LLAvatarNameCache::get(item->getCreatorUUID(), &av_name)) { - callingcard_name = av_name.mDisplayName + " (" + av_name.mSLID + ")"; + callingcard_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; } LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID()); if (session_id != LLUUID::null) diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index f38c8859ef..c1d02fae39 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -242,7 +242,7 @@ void LLPanelMyProfileEdit::processProfileProperties(const LLAvatarData* avatar_d void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { getChild("user_name")->setValue( av_name.mDisplayName ); - getChild("user_slid")->setValue( av_name.mSLID ); + getChild("user_slid")->setValue( av_name.mUsername ); } BOOL LLPanelMyProfileEdit::postBuild() diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index 1afe2b9d44..d22d8d2718 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -207,7 +207,7 @@ void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { getChild("user_name")->setValue( av_name.mDisplayName ); - getChild("user_slid")->setValue( av_name.mSLID ); + getChild("user_slid")->setValue( av_name.mUsername ); } // EOF diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 67db778bdb..ebef28fd64 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -881,7 +881,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l if (LLAvatarNameCache::useDisplayNames() && LLAvatarNameCache::get(hover_object->getID(), &av_name)) { - final_name = av_name.mDisplayName + " (" + av_name.mSLID + ")"; + final_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; } else { diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index ec80129f8a..a783cb03d8 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -185,7 +185,7 @@ class LLDisplayNameUpdate : public LLHTTPNode { LLSD args; args["OLD_NAME"] = old_display_name; - args["SLID"] = av_name.mSLID; + args["SLID"] = av_name.mUsername; args["NEW_NAME"] = av_name.mDisplayName; LLNotificationsUtil::add("DisplayNameUpdate", args); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5e6f294071..e7721d6068 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2880,7 +2880,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { // JAMESDEBUG HACK LLColor4 slid_color = name_tag_color * 0.83f; - addNameTagLine(av_name.mSLID, slid_color, LLFontGL::NORMAL, + addNameTagLine(av_name.mUsername, slid_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } } -- cgit v1.2.3 From 09f0758f2fce699659a6ebc63962d4f9493f0098 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 18 May 2010 17:30:54 -0700 Subject: DEV-50177 IM Session window title bar shows SLID for receiving party Reviewed with Leyla --- indra/newview/llimfloater.cpp | 36 ++++++++++++++++++++++++++++++------ indra/newview/llimfloater.h | 7 +++++++ 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index d25aa37e16..804cc75f75 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -38,6 +38,7 @@ #include "llagent.h" #include "llappviewer.h" +#include "llavatarnamecache.h" #include "llbutton.h" #include "llbottomtray.h" #include "llchannelmanager.h" @@ -275,12 +276,6 @@ BOOL LLIMFloater::postBuild() mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); mInputEditor->setPassDelete( TRUE ); - std::string session_name(LLIMModel::instance().getName(mSessionID)); - - mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + session_name); - - setTitle(session_name); - childSetCommitCallback("chat_editor", onSendMsg, this); mChatHistory = getChild("chat_history"); @@ -298,6 +293,19 @@ BOOL LLIMFloater::postBuild() mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); } + if ( im_session && im_session->isP2PSessionType()) + { + // look up display name for window title + LLAvatarNameCache::get(im_session->mOtherParticipantID, + boost::bind(&LLIMFloater::onAvatarNameCache, + this, _1, _2)); + } + else + { + std::string session_name(LLIMModel::instance().getName(mSessionID)); + updateSessionName(session_name, session_name); + } + //*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla" //see LLFloaterIMPanel for how it is done (IB) @@ -311,6 +319,22 @@ BOOL LLIMFloater::postBuild() } } +void LLIMFloater::updateSessionName(const std::string& ui_title, + const std::string& ui_label) +{ + mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + ui_label); + setTitle(ui_title); +} + +void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, + const LLAvatarName& av_name) +{ + // Use display name only for labels, as the extended name will be in the + // floater title + std::string ui_title = av_name.getNameAndSLID(); + updateSessionName(ui_title, av_name.mDisplayName); +} + // virtual void LLIMFloater::draw() { diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index d63246a5cd..75ff0372ee 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -38,6 +38,7 @@ #include "lltooldraganddrop.h" #include "lltransientdockablefloater.h" +class LLAvatarName; class LLLineEditor; class LLPanelChatControlPanel; class LLChatHistory; @@ -130,6 +131,12 @@ private: /* virtual */ void onFocusLost(); /* virtual */ void onFocusReceived(); + // Update the window title, input field help text, etc. + void updateSessionName(const std::string& ui_title, const std::string& ui_label); + + // For display name lookups for IM window titles + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); + BOOL dropCallingCard(LLInventoryItem* item, BOOL drop); BOOL dropCategory(LLInventoryCategory* category, BOOL drop); -- cgit v1.2.3 From cbc9fcabf945558ef22d35e2957ae9f1c879ef7b Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 09:38:49 -0700 Subject: DEV-50013 More SLID to Username renames --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/llvoavatar.cpp | 10 +++++----- .../newview/skins/default/xui/en/panel_preferences_general.xml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6a68f72bb5..6e7d851072 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7337,7 +7337,7 @@ Value 1 - NameTagShowSLIDs + NameTagShowUsernames Comment Show usernames in avatar name tags diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index f248fde64a..a7e5eedf5f 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -326,7 +326,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) sSkin = gSavedSettings.getString("SkinCurrent"); - gSavedSettings.getControl("NameTagShowSLIDs")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); + gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e7721d6068..40e1f31697 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2856,7 +2856,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } static LLUICachedControl show_display_names("NameTagShowDisplayNames"); - static LLUICachedControl show_slids("NameTagShowSLIDs"); + static LLUICachedControl show_usernames("NameTagShowUsernames"); if (LLAvatarNameCache::useDisplayNames()) { @@ -2876,11 +2876,11 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) LLFontGL::getFontSansSerif()); } // Suppress SLID display if display name matches exactly (ugh) - if (show_slids && !av_name.mIsDisplayNameDefault) + if (show_usernames && !av_name.mIsDisplayNameDefault) { - // JAMESDEBUG HACK - LLColor4 slid_color = name_tag_color * 0.83f; - addNameTagLine(av_name.mUsername, slid_color, LLFontGL::NORMAL, + // *HACK: Desaturate the color + LLColor4 username_color = name_tag_color * 0.83f; + addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index b09ac4d0fa..5f50b962ee 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -287,7 +287,7 @@ top_pad="5" /> --> Date: Wed, 19 May 2010 10:25:52 -0700 Subject: Remove colors for match/mismatch/friends from name tags Product team request. Reviewed with Leyla --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llvoavatar.cpp | 5 +++-- indra/newview/skins/default/colors.xml | 2 +- .../skins/default/xui/en/panel_preferences_general.xml | 11 ++++++++++- 4 files changed, 25 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6e7d851072..acd3c10ec6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7337,6 +7337,17 @@ Value 1 + NameTagShowFriends + + Comment + Highlight the name tags of your friends + Persist + 1 + Type + Boolean + Value + 0 + NameTagShowUsernames Comment diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 40e1f31697..a9250991f6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3072,14 +3072,15 @@ void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) { + static LLUICachedControl show_friends("NameTagShowFriends"); const char* color_name; - if (is_friend) + if (show_friends && is_friend) { color_name = "NameTagFriend"; } else if (LLAvatarNameCache::useDisplayNames()) { - // ...color based on whether SLID "matches" a computed display + // ...color based on whether username "matches" a computed display // name LLAvatarName av_name; if (LLAvatarNameCache::get(getID(), &av_name) diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index bb43de6ada..bfa57892a7 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -550,7 +550,7 @@ reference="White" /> + reference="White" /> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 5f50b962ee..eabbdc2186 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -256,7 +256,16 @@ name="show_my_name_checkbox1" top_pad="4" width="300" /> - + Date: Wed, 19 May 2010 11:38:29 -0700 Subject: Land display name updates reviewed by James --- indra/newview/llfloaterland.cpp | 23 +++++++++-------------- indra/newview/llfloatersellland.cpp | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index b008189b0d..78dea87bfd 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -37,7 +37,7 @@ #include "llfloaterland.h" -#include "llcachename.h" +#include "llavatarnamecache.h" #include "llfocusmgr.h" #include "llnotificationsutil.h" #include "llparcel.h" @@ -586,6 +586,8 @@ void LLPanelLandGeneral::refresh() parcel, GP_LAND_SET_SALE_INFO); BOOL can_be_sold = owner_sellable || estate_manager_sellable; + can_be_sold = true; + const LLUUID &owner_id = parcel->getOwnerID(); BOOL is_public = parcel->isPublic(); @@ -1387,9 +1389,7 @@ bool LLPanelLandObjects::callbackReturnOwnerObjects(const LLSD& notification, co } else { - std::string full_name; - gCacheName->getFullName(owner_id, full_name); - args["NAME"] = full_name; + args["NAME"] = LLSLURL("agent", owner_id, "inspect").getSLURLString(); LLNotificationsUtil::add("OtherObjectsReturned", args); } send_return_objects_message(parcel->getLocalID(), RT_OWNER); @@ -1607,9 +1607,9 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo } // Placeholder for name. - std::string name; - gCacheName->getFullName(owner_id, name); - item_params.columns.add().value(name).font(FONT).column("name"); + LLAvatarName av_name; + LLAvatarNameCache::get(owner_id, &av_name); + item_params.columns.add().value(av_name.getNameAndSLID()).font(FONT).column("name"); object_count_str = llformat("%d", object_count); item_params.columns.add().value(object_count_str).font(FONT).column("count"); @@ -1718,9 +1718,7 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata) } else { - std::string name; - gCacheName->getFullName(owner_id, name); - args["NAME"] = name; + args["NAME"] = LLSLURL("agent", owner_id, "inspect").getSLURLString(); LLNotificationsUtil::add("ReturnObjectsOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerObjects, panelp, _1, _2)); } } @@ -1779,10 +1777,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) } else { - std::string name; - gCacheName->getFullName(owner_id, name); - args["NAME"] = name; - + args["NAME"] = LLSLURL("agent", owner_id, "inspect").getSLURLString(); LLNotificationsUtil::add("ReturnObjectsNotOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2)); } } diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 9dddbd998a..ad35581641 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -33,6 +33,7 @@ #include "llfloatersellland.h" +#include "llavatarnamecache.h" #include "llfloateravatarpicker.h" #include "llfloaterreg.h" #include "llfloaterland.h" @@ -47,6 +48,8 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" +class LLAvatarName; + // defined in llfloaterland.cpp void send_parcel_select_objects(S32 parcel_local_id, U32 return_type, uuid_list_t* return_ids = NULL); @@ -97,6 +100,8 @@ private: void callbackAvatarPick(const std::vector& names, const uuid_vec_t& ids); + void onBuyerNameCache(const LLAvatarName& av_name); + public: virtual BOOL postBuild(); @@ -230,12 +235,17 @@ void LLFloaterSellLandUI::updateParcelInfo() if(mSellToBuyer) { - std::string name; - gCacheName->getFullName(mAuthorizedBuyer, name); - childSetText("sell_to_agent", name); + LLAvatarNameCache::get(mAuthorizedBuyer, + boost::bind(&LLFloaterSellLandUI::onBuyerNameCache, this, _2)); } } +void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name) +{ + childSetText("sell_to_agent", av_name.getNameAndSLID()); + childSetToolTip("sell_to_agent", av_name.mSLID); +} + void LLFloaterSellLandUI::setBadge(const char* id, Badge badge) { static std::string badgeOK("badge_ok.j2c"); -- cgit v1.2.3 From ccc4fbdb1db0ca79b18e9e7f9ba1c2a8d812e5c8 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 12:31:57 -0700 Subject: DEV-50263 "Username" hovertip still mentions "Second Life ID" Now refers to Username. Also checked with Char to make sure it's OK to refer to Steller Sunshine (she's fine with it) and fixed the spelling of "Steller" --- indra/newview/skins/default/xui/en/panel_login.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 88c264c649..5a671ac78a 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -65,13 +65,13 @@ Username: Date: Wed, 19 May 2010 12:34:13 -0700 Subject: DEV-50204 "Ericag Vader" shows when starting IM and local chat Start with blank header to hide sample text from XUI XML. Also fixed problem with computation of minimum chat header name width when the name wasn't in cache. --- indra/newview/llchathistory.cpp | 44 ++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 6d98afbc58..a196b4c750 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -106,6 +106,18 @@ LLObjectIMHandler gObjectIMHandler; class LLChatHistoryHeader: public LLPanel { public: + LLChatHistoryHeader() + : LLPanel(), + mPopupMenuHandleAvatar(), + mPopupMenuHandleObject(), + mAvatarID(), + mSourceType(CHAT_SOURCE_UNKNOWN), + mFrom(), + mSessionID(), + mMinUserNameWidth(0), + mUserNameFont(NULL) + {} + static LLChatHistoryHeader* createInstance(const std::string& file_name) { LLChatHistoryHeader* pInstance = new LLChatHistoryHeader; @@ -249,27 +261,29 @@ public: mSourceType = CHAT_SOURCE_SYSTEM; } - LLTextBox* userName = getChild("user_name"); - - userName->setReadOnlyColor(style_params.readonly_color()); - userName->setColor(style_params.color()); + mUserNameFont = style_params.font(); + LLTextBox* user_name = getChild("user_name"); + user_name->setReadOnlyColor(style_params.readonly_color()); + user_name->setColor(style_params.color()); if (chat.mFromName.empty() || mSourceType == CHAT_SOURCE_SYSTEM || mAvatarID.isNull()) { mFrom = LLTrans::getString("SECOND_LIFE"); - userName->setValue(mFrom); + user_name->setValue(mFrom); + updateMinUserNameWidth(); } else { - // ...from a normal user, lookup the name and fill in later + // ...from a normal user, lookup the name and fill in later, + // but start with blank so sample data from XUI XML doesn't + // flash on the screen + user_name->setValue( LLSD() ); LLAvatarNameCache::get(mAvatarID, boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2)); } - mMinUserNameWidth = style_params.font()->getWidth(userName->getWText().c_str()) + PADDING; - setTimeField(chat); LLAvatarIconCtrl* icon = getChild("avatar_icon"); @@ -323,15 +337,26 @@ public: LLPanel::draw(); } + void updateMinUserNameWidth() + { + if (mUserNameFont) + { + LLTextBox* user_name = getChild("user_name"); + const LLWString& text = user_name->getWText(); + mMinUserNameWidth = mUserNameFont->getWidth(text.c_str()) + PADDING; + } + } + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { mFrom = av_name.mDisplayName; LLTextBox* user_name = getChild("user_name"); user_name->setValue( LLSD(av_name.mDisplayName ) ); - user_name->setToolTip( av_name.mUsername ); setToolTip( av_name.mUsername ); + // name might have changed, update width + updateMinUserNameWidth(); } protected: @@ -450,6 +475,7 @@ protected: LLUUID mSessionID; S32 mMinUserNameWidth; + const LLFontGL* mUserNameFont; }; LLUICtrl* LLChatHistoryHeader::sInfoCtrl = NULL; -- cgit v1.2.3 From b62d1472be7e64c176ea663562d8747f46ace316 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 12:35:22 -0700 Subject: DEV-50265 Login screen should say "Forgot your username or password?" --- indra/newview/skins/default/xui/en/panel_login.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 5a671ac78a..14759ad731 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -186,7 +186,7 @@ name="forgot_password_text" top_pad="12" right="-10" width="180"> - Forgot your name or password? + Forgot your username or password? Date: Wed, 19 May 2010 14:39:36 -0700 Subject: Updated avatar inspectors to use new legacy name field in avatarnamecache --- indra/newview/llinspectavatar.cpp | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 74bf6e378d..c4144c9844 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -144,10 +144,6 @@ private: // Is used to determine if "Add friend" option should be enabled in gear menu bool isNotFriend(); - // Callback for gCacheName to look up avatar name - void onNameCache(const LLUUID& id, - const std::string& name, - bool is_group); void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); @@ -375,18 +371,9 @@ void LLInspectAvatar::requestUpdate() childSetValue("avatar_icon", LLSD(mAvatarID) ); - // JAMESDEBUG HACK: Request via both legacy name system and new - // name system to set mLegacyName for use with mute system - gCacheName->get(mAvatarID, false, - boost::bind(&LLInspectAvatar::onNameCache, - this, _1, _2, _3)); - - if (LLAvatarNameCache::useDisplayNames()) - { - LLAvatarNameCache::get(mAvatarID, + LLAvatarNameCache::get(mAvatarID, boost::bind(&LLInspectAvatar::onAvatarNameCache, this, _1, _2)); - } } void LLInspectAvatar::processAvatarData(LLAvatarData* data) @@ -623,18 +610,6 @@ void LLInspectAvatar::onVolumeChange(const LLSD& data) LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume); } -void LLInspectAvatar::onNameCache( - const LLUUID& id, - const std::string& full_name, - bool is_group) -{ - if (id == mAvatarID) - { - // we need the legacy name for the mute list :-( - mLegacyName = full_name; - } -} - void LLInspectAvatar::onAvatarNameCache( const LLUUID& agent_id, const LLAvatarName& av_name) @@ -643,6 +618,7 @@ void LLInspectAvatar::onAvatarNameCache( { getChild("user_name")->setValue(av_name.mDisplayName); getChild("user_slid")->setValue(av_name.mUsername); + mLegacyName = av_name.getLegacyName(); } } -- cgit v1.2.3 From 415cc68810a17bbe29759d6914746b0b9eb5d8a5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 15:06:47 -0700 Subject: Fix name tag update when prefs applied Reviewed with Leyla --- indra/newview/llfloaterpreference.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index a7e5eedf5f..806572e04d 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -327,6 +327,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) sSkin = gSavedSettings.getString("SkinCurrent"); gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); + gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); } -- cgit v1.2.3 From 32f9bd0bcedfa2ba858448c7211a681d81b85b97 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 15:07:25 -0700 Subject: DEV-50013 Add 2px line padding to name tags Should match final requests from Rhett. Reviewed with Leyla --- indra/newview/llhudnametag.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index e444fc88eb..2cb333a717 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -60,7 +60,7 @@ const F32 SPRING_STRENGTH = 0.7f; const F32 RESTORATION_SPRING_TIME_CONSTANT = 0.1f; const F32 HORIZONTAL_PADDING = 16.f; const F32 VERTICAL_PADDING = 12.f; -const F32 LINE_PADDING = 1; // aka "leading" +const F32 LINE_PADDING = 3.f; // aka "leading" const F32 BUFFER_SIZE = 2.f; const F32 MIN_EDGE_OVERLAP = 3.f; const F32 HUD_TEXT_MAX_WIDTH = 190.f; @@ -460,7 +460,7 @@ void LLHUDNameTag::renderText(BOOL for_select) LLUI::popMatrix(); } - F32 y_offset = (F32)mOffsetY - 2; // JAMESDEBUG + F32 y_offset = (F32)mOffsetY; // Render label { @@ -807,6 +807,12 @@ void LLHUDNameTag::updateSize() ++iter; } + // Don't want line spacing under the last line + if (height > 0.f) + { + height -= LINE_PADDING; + } + iter = mLabelSegments.begin(); while (iter != mLabelSegments.end()) { -- cgit v1.2.3 From 2c87657659eb6cdd0a0f135b78d290ed180cc21d Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 16:38:50 -0700 Subject: DEV-50265 Fix clipping of "Forgot your username or password?" --- indra/newview/skins/default/xui/en/panel_login.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 14759ad731..0f97301856 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -160,8 +160,8 @@ width="135" + width="200"> Sign up + width="200"> Forgot your username or password? + width="200"> Need help logging in? Click to view this web page Click to view this location's information - Click to view this Resident's profile - Click to mute this Resident + Click to view this Resident's profile + Learn more about this Resident + Click to mute this Resident Click to unmute this Resident Click to IM this Resident Click to Pay this Resident -- cgit v1.2.3 From e47249777b79d9c7576f5df010de92f9bbb4f999 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 14:16:02 -0700 Subject: DEV-50013 Display names for online/offline notifications Reviewed with Leyla --- indra/newview/llcallingcard.cpp | 77 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 36de46a367..645ff1f3e9 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -43,6 +43,7 @@ //#include #include "indra_constants.h" +#include "llavatarnamecache.h" #include "llcachename.h" #include "llstl.h" #include "lltimer.h" @@ -96,8 +97,10 @@ const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f; // static LLAvatarTracker LLAvatarTracker::sInstance; - - +static void on_avatar_name_cache_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + bool online, + LLSD payload); ///---------------------------------------------------------------------------- /// Class LLAvatarTracker @@ -681,8 +684,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) { tracking_id = mTrackingData->mAvatarID; } - BOOL notify = FALSE; - LLSD args; LLSD payload; for(S32 i = 0; i < count; ++i) { @@ -692,16 +693,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) if(info) { setBuddyOnline(agent_id,online); - if(chat_notify) - { - std::string full_name; - if(gCacheName->getFullName(agent_id, full_name)) - { - notify = TRUE; - args["NAME"] = full_name; - } - - } } else { @@ -717,29 +708,12 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) // *TODO: get actual inventory id gInventory.addChangedMask(LLInventoryObserver::CALLING_CARD, LLUUID::null); } - if(notify) + if(chat_notify) { - // Popup a notify box with online status of this agent - LLNotificationPtr notification; - - if (online) - { - notification = - LLNotificationsUtil::add("FriendOnline", - args, - payload.with("respond_on_mousedown", TRUE), - boost::bind(&LLAvatarActions::startIM, agent_id)); - } - else - { - notification = - LLNotificationsUtil::add("FriendOffline", args, payload); - } - - // If there's an open IM session with this agent, send a notification there too. - LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); - std::string notify_msg = notification->getMessage(); - LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); + // Look up the name of this agent for the notification + LLAvatarNameCache::get(agent_id, + boost::bind(&on_avatar_name_cache_notify, + _1, _2, online, payload)); } mModifyMask |= LLFriendObserver::ONLINE; @@ -748,6 +722,37 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) } } +static void on_avatar_name_cache_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + bool online, + LLSD payload) +{ + // Popup a notify box with online status of this agent + // Use display name only because this user is your friend + LLSD args; + args["NAME"] = av_name.mDisplayName; + + LLNotificationPtr notification; + if (online) + { + notification = + LLNotificationsUtil::add("FriendOnline", + args, + payload.with("respond_on_mousedown", TRUE), + boost::bind(&LLAvatarActions::startIM, agent_id)); + } + else + { + notification = + LLNotificationsUtil::add("FriendOffline", args, payload); + } + + // If there's an open IM session with this agent, send a notification there too. + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); + std::string notify_msg = notification->getMessage(); + LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); +} + void LLAvatarTracker::formFriendship(const LLUUID& id) { if(id.notNull()) -- cgit v1.2.3 From c994a93ed11642fc0fe12c1b743215bf63d852ab Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 15:30:59 -0700 Subject: DEV-50013 Convert call dialogs to use Display Names Reviewed with Leyla --- indra/newview/llimview.cpp | 17 +++++++---------- indra/newview/llvoicevivox.cpp | 19 +++++++++---------- indra/newview/llvoicevivox.h | 4 ++-- 3 files changed, 18 insertions(+), 22 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index fa8390f5ab..f615402f9c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1749,7 +1749,7 @@ void LLOutgoingCallDialog::show(const LLSD& key) // Beautification: Since SLID is in the title bar, and you probably // recognize this person's voice, just show display name std::string final_callee_name = callee_name; - if (is_avatar) + if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION) { LLAvatarName av_name; if (LLAvatarNameCache::get(callee_id, &av_name)) @@ -1957,8 +1957,9 @@ void LLIncomingCallDialog::setCallerName(const std::string& ui_title, const std::string& ui_label, const std::string& call_type) { - setTitle(ui_title + " " + call_type); + setTitle(ui_title); + // call_type may be a string like " is calling." LLUICtrl* caller_name_widget = getChild("caller name"); caller_name_widget->setValue(ui_label + " " + call_type); } @@ -2068,15 +2069,11 @@ void LLIncomingCallDialog::processCallResponse(S32 response) } else { - if (gCacheName->getFullName(caller_id, correct_session_name)) + // *NOTE: really should be using callbacks here + LLAvatarName av_name; + if (LLAvatarNameCache::get(caller_id, &av_name)) { - // IDEVO really should be using callbacks here - LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(caller_id, &av_name)) - { - correct_session_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; - } + correct_session_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; correct_session_name.append(ADHOC_NAME_SUFFIX); } } diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 4a0b0f12a4..409e507c16 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6180,19 +6180,18 @@ void LLVivoxVoiceClient::notifyFriendObservers() void LLVivoxVoiceClient::lookupName(const LLUUID &id) { - BOOL is_group = FALSE; - gCacheName->get(id, is_group, &LLVivoxVoiceClient::onAvatarNameLookup); - - // Peformance boost: We're going to need the display name later when - // we show the call request floater, so get the request going now - LLAvatarName unused; - LLAvatarNameCache::get(id, &unused); + LLAvatarNameCache::get(id, + boost::bind(&LLVivoxVoiceClient::onAvatarNameCache, + this, _1, _2)); } -//static -void LLVivoxVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& name, BOOL is_group) +void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id, + const LLAvatarName& av_name) { - LLVivoxVoiceClient::getInstance()->avatarNameResolved(id, name); + // For Vivox, we use the legacy name because I'm uncertain whether or + // not their service can tolerate switching to Username or Display Name + std::string legacy_name = av_name.getLegacyName(); + avatarNameResolved(agent_id, legacy_name); } void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index e6dd0e9823..341f22bd73 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -51,7 +51,7 @@ class LLVivoxProtocolParser; #endif #include "llvoiceclient.h" - +class LLAvatarName; class LLVivoxVoiceAccountProvisionResponder; class LLVivoxVoiceClientMuteListObserver; class LLVivoxVoiceClientFriendsObserver; @@ -619,7 +619,7 @@ protected: void leaveAudioSession(); void lookupName(const LLUUID &id); - static void onAvatarNameLookup(const LLUUID& id, const std::string& name, BOOL is_group); + void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); void avatarNameResolved(const LLUUID &id, const std::string &name); private: -- cgit v1.2.3 From be3fb2b578bfc20dda7175cca595a1be53fe23d2 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 15:31:58 -0700 Subject: DEV-50266 Allow login with firstname.lastname Discussed with Gino --- indra/newview/llpanellogin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index d313a95546..632c66a68c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -618,11 +618,14 @@ void LLPanelLogin::getFields(LLPointer& credential, } else { + // Be lenient in terms of what separators we allow for two-word names + // and allow legacy users to login with firstname.lastname + separator_index = username.find_first_of(" ._"); std::string first = username.substr(0, separator_index); std::string last; if (separator_index != username.npos) { - last = username.substr(separator_index, username.npos); + last = username.substr(separator_index+1, username.npos); LLStringUtil::trim(last); } else -- cgit v1.2.3 From b637a183c41b091ea1c2e0a2f85987b7b5988afd Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 16:15:22 -0700 Subject: DEV-50304 Busy mode response off bottom of preferences --- indra/newview/llpanellogin.cpp | 2 +- indra/newview/skins/default/xui/en/panel_preferences_general.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 632c66a68c..feb36cf7dd 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -532,7 +532,7 @@ void LLPanelLogin::setFields(LLPointer credential, std::string login_id = firstname; if (!lastname.empty() && lastname != "Resident") { - // support traditional First Last name slurls + // support traditional First Last name SLURLs login_id += " "; login_id += lastname; } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index eabbdc2186..c43784a6f8 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -303,7 +303,7 @@ left_delta="0" name="show_slids" tool_tip="Show username, like bobsmith123" - top_pad="5" /> + top_pad="2" /> Away timeout: @@ -394,7 +395,7 @@ hover="false" commit_on_focus_lost = "true" follows="left|top" - height="60" + height="42" layout="topleft" left="50" name="busy_response" -- cgit v1.2.3 From e7b1a16f071ff0ab253136a284e20d737352a5ca Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 16:39:26 -0700 Subject: Strip out debug code related to toggling display names on/off --- indra/newview/llfloaterpreference.cpp | 1 + indra/newview/llviewermenu.cpp | 9 --------- indra/newview/llvoavatar.cpp | 8 -------- indra/newview/llvoavatar.h | 1 - 4 files changed, 1 insertion(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 806572e04d..920d09bd7f 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -230,6 +230,7 @@ void handleNameTagOptionChanged(const LLSD& newvalue) void handleDisplayNamesOptionChanged(const LLSD& newvalue) { LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean()); + LLVOAvatar::invalidateNameTags(); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b661e1bcd1..f31f1e80e1 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7588,15 +7588,6 @@ class LLWorldToggleCameraControls : public view_listener_t } }; -// IDEVO JAMESDEBUG temp code for testing -void toggle_display_names() -{ - bool use = LLAvatarNameCache::useDisplayNames(); - LLAvatarNameCache::setUseDisplayNames(!use); - - LLVOAvatar::invalidateNameTags(); -} - void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) { static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_hide_navbar.xml", diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7e061d69c9..cc38616cb8 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -665,7 +665,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNameAlpha(0.f), mRenderGroupTitles(sRenderGroupTitles), mNameCloud(false), - mUseDisplayNames( LLAvatarNameCache::useDisplayNames() ), mFirstTEMessageReceived( FALSE ), mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), @@ -2748,13 +2747,6 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - // IDEVO HACK to force refresh - if (LLAvatarNameCache::useDisplayNames() != mUseDisplayNames) - { - mUseDisplayNames = LLAvatarNameCache::useDisplayNames(); - new_name = TRUE; - } - // First Calculate Alpha // If alpha > 0, create mNameText if necessary, otherwise delete it F32 alpha = 0.f; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 703066b7a6..c99902a540 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -843,7 +843,6 @@ private: bool mNameCloud; F32 mNameAlpha; BOOL mRenderGroupTitles; - bool mUseDisplayNames; // IDEVO HACK to force refresh //-------------------------------------------------------------------- // Display the name (then optionally fade it out) -- cgit v1.2.3 From 22cef83f9a1008b341c905b0e9840fa37c4930fa Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 21 May 2010 15:26:18 -0700 Subject: DEV-49489 Money transaction msgs use display names Server 1.40 will be deployed before Viewer 2.1, and it sends more extensive money transaction messages, so I removed all the old crufty localization code. If Viewer 2.1 connects to an older server (like a dev grid) money transaction messages will be English only. This simplifies the code tremendously. Reviewed with Leyla --- indra/newview/llviewermessage.cpp | 323 ++++++++++--------------- indra/newview/skins/default/xui/en/strings.xml | 3 +- 2 files changed, 136 insertions(+), 190 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index cff1db3230..4188a214a8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -141,7 +141,6 @@ extern BOOL gDebugClicks; // function prototypes bool check_offer_throttle(const std::string& from_name, bool check_only); static void process_money_balance_reply_extended(LLMessageSystem* msg); -static void process_money_balance_reply_legacy(const std::string& desc); //inventory offer throttle globals LLFrameTimer gThrottleTimer; @@ -4852,71 +4851,6 @@ void process_time_dilation(LLMessageSystem *msg, void **user_data) } */ -// Both Product Engine and I wrote solutions to non-localized payment messages. -// Their code probably has more localized strings against it. -// James Cook, 2010-03-27 -// -//static void show_money_balance_notification(const std::string& desc) -//{ -// // Intercept some messages constructed in lltransactionflags.cpp -// // to fix avatar names and allow localization. -// LLSD args; -// LLSD payload; -// std::string name; -// boost::smatch match; -// const char* notification_name = NULL; -// -// // paid you L$ for . -// static const boost::regex paid_you_for("(.+) paid you L\\$(\\d+) for (.*)\\."); -// // paid you L$. -// static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\."); -// // You paid L$ [for ]. -// static const boost::regex you_paid("You paid (.*) L\\$(\\d+)(.*)\\."); -// -// if (boost::regex_match(desc, match, paid_you_for)) -// { -// name = match[1].str(); -// // IDEVO strip legacy "Resident" name -// name = LLCacheName::cleanFullName(name); -// args["NAME"] = name; -// args["AMOUNT"] = match[2].str(); -// args["REASON"] = match[3].str(); -// notification_name = "PaymentReceivedFor"; -// } -// else if (boost::regex_match(desc, match, paid_you)) -// { -// name = match[1].str(); -// // IDEVO strip legacy "Resident" name -// name = LLCacheName::cleanFullName(name); -// args["NAME"] = name; -// args["AMOUNT"] = match[2].str(); -// notification_name = "PaymentReceived"; -// } -// else if (boost::regex_match(desc, match, you_paid)) -// { -// name = match[1].str(); -// // IDEVO strip legacy "Resident" name -// name = LLCacheName::cleanFullName(name); -// args["NAME"] = name; -// args["AMOUNT"] = match[2].str(); -// args["REASON"] = match[3].str(); -// notification_name = "PaymentSent"; -// } -// -// // if name extracted and name cache contains avatar id send loggable notification -// LLUUID from_id; -// if (notification_name != NULL -// && gCacheName->getUUID(name, from_id)) -// { -// payload["from_id"] = from_id; -// LLNotificationsUtil::add(notification_name, args, payload); -// } -// else -// { -// args["MESSAGE"] = desc; -// LLNotificationsUtil::add("SystemMessage", args); -// } -//} void process_money_balance_reply( LLMessageSystem* msg, void** ) { @@ -4969,19 +4903,84 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) if (msg->has("TransactionInfo")) { - // JAMESDEBUG TODO - for test, do both!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - process_money_balance_reply_legacy(desc); - // ...message has extended info for localization process_money_balance_reply_extended(msg); } else { - // *NOTE: Can remove this after server 1.40 is widely deployed. - process_money_balance_reply_legacy(desc); + // Only old dev grids will not supply the TransactionInfo block, + // so we can just use the hard-coded English string. + LLSD args; + args["MESSAGE"] = desc; + LLNotificationsUtil::add("SystemMessage", args); + } +} + +static std::string reason_from_transaction_type(S32 transaction_type, + const std::string& item_desc) +{ + // *NOTE: The keys for the reason strings are unusual because + // an earlier version of the code used English language strings + // extracted from hard-coded server English descriptions. + // Keeping them so we don't have to re-localize them. + switch (transaction_type) + { + case TRANS_OBJECT_SALE: + { + LLStringUtil::format_map_t arg; + arg["ITEM"] = item_desc; + return LLTrans::getString("for item", arg); + } + case TRANS_LAND_SALE: + return LLTrans::getString("for a parcel of land"); + + case TRANS_LAND_PASS_SALE: + return LLTrans::getString("for a land access pass"); + + case TRANS_GROUP_LAND_DEED: + return LLTrans::getString("for deeding land"); + + case TRANS_GROUP_CREATE: + return LLTrans::getString("to create a group"); + + case TRANS_GROUP_JOIN: + return LLTrans::getString("to join a group"); + + case TRANS_UPLOAD_CHARGE: + return LLTrans::getString("to upload"); + + default: + llwarns << "Unknown transaction type " + << transaction_type << llendl; + return std::string(); } } +static void money_balance_group_notify(const LLUUID& group_id, + const std::string& name, + bool is_group, + std::string notification, + LLSD args, + LLSD payload) +{ + // Message uses name SLURLs, don't actually have to substitute in + // the name. We're just making sure it's available. + // Notification is either PaymentReceived or PaymentSent + LLNotificationsUtil::add(notification, args, payload); +} + +static void money_balance_avatar_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + std::string notification, + LLSD args, + LLSD payload) +{ + // Message uses name SLURLs, don't actually have to substitute in + // the name. We're just making sure it's available. + // Notification is either PaymentReceived or PaymentSent + LLNotificationsUtil::add(notification, args, payload); +} + static void process_money_balance_reply_extended(LLMessageSystem* msg) { // Added in server 1.40 and viewer 2.1, support for localization @@ -5008,138 +5007,84 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) const char* source_type = (is_source_group ? "group" : "agent"); std::string source_slurl = - LLSLURL( source_type, source_id, "about").getSLURLString(); + LLSLURL( source_type, source_id, "inspect").getSLURLString(); const char* dest_type = (is_dest_group ? "group" : "agent"); std::string dest_slurl = - LLSLURL( dest_type, dest_id, "about").getSLURLString(); + LLSLURL( dest_type, dest_id, "inspect").getSLURLString(); - // - // - // JAMESDEBUG TODO HERE!!! - // - // - - switch (transaction_type) - { - case TRANS_OBJECT_SALE: - case TRANS_LAND_SALE: - case TRANS_LAND_PASS_SALE: - case TRANS_GROUP_LAND_DEED: - case TRANS_GROUP_CREATE: - case TRANS_GROUP_JOIN: - case TRANS_UPLOAD_CHARGE: - default: - llinfos << "HERE!" << llendl; - break; - } -} - -// *NOTE: This can be removed after server 1.40 is widely deployed, as it will -// send an extra TransactionInfo block to allow proper localization. -static void process_money_balance_reply_legacy(const std::string& desc) -{ - LLSD args; - - // this is a marker to retrieve avatar name from server message: - // " paid you L$" - const std::string marker = "paid you L$"; - - args["MESSAGE"] = desc; - - // extract avatar name from system message - S32 marker_pos = desc.find(marker, 0); - - std::string base_name = desc.substr(0, marker_pos); + std::string reason = + reason_from_transaction_type(transaction_type, item_description); - std::string name = base_name; - LLStringUtil::trim(name); - - // if name extracted and name cache contains avatar id send loggable notification - LLUUID from_id; - if(name.size() > 0 && gCacheName->getUUID(name, from_id)) + LLStringUtil::format_map_t args; + args["REASON"] = reason; // could be empty + args["AMOUNT"] = llformat("%d", amount); + + // Need to delay until name looked up, so need to know whether or not + // is group + bool is_name_group = false; + LLUUID name_id; + std::string message; + std::string notification; + LLSD final_args; + LLSD payload; + + bool you_paid_someone = (source_id == gAgentID); + if (you_paid_someone) { - //description always comes not localized. lets fix this - - //ammount paid - std::string ammount = desc.substr(marker_pos + marker.length(),desc.length() - marker.length() - marker_pos); - - //reform description - LLStringUtil::format_map_t str_args; - str_args["NAME"] = LLCacheName::cleanFullName(name); - str_args["AMOUNT"] = ammount; - std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); - - args["MESSAGE"] = new_description; - args["NAME"] = LLCacheName::cleanFullName(name); - LLSD payload; - payload["from_id"] = from_id; - LLNotificationsUtil::add("PaymentReceived", args, payload); + args["NAME"] = dest_slurl; + is_name_group = is_dest_group; + name_id = dest_id; + if (!reason.empty()) + { + message = LLTrans::getString("you_paid_ldollars", args); + } + else + { + message = LLTrans::getString("you_paid_ldollars_no_reason", args); + } + final_args["MESSAGE"] = message; + notification = "PaymentSent"; } - //AD *HACK: Parsing incoming string to localize messages that come from server! EXT-5986 - // It's only a temporarily and ineffective measure. It doesn't affect performance much - // because we get here only for specific type of messages, but anyway it is not right to do it! - // *TODO: Server-side changes should be made and this code removed. - else - { - if(desc.find("You paid")==0) + else { + // ...someone paid you + args["NAME"] = source_slurl; + is_name_group = is_source_group; + name_id = source_id; + if (!reason.empty()) { - // Regular expression for message parsing- change it in case of server-side changes. - // Each set of parenthesis will later be used to find arguments of message we generate - // in the end of this if- (.*) gives us name of money receiver, (\\d+)-amount of money we pay - // and ([^$]*)- reason of payment - boost::regex expr("You paid (?:.{0}|(.*) )L\\$(\\d+)\\s?([^$]*)\\."); - boost::match_results matches; - if(boost::regex_match(desc, matches, expr)) - { - // Name of full localizable notification string - // there are four types of this string- with name of receiver and reason of payment, - // without name and without reason (both may also be absent simultaneously). - // example of string without name - You paid L$100 to create a group. - // example of string without reason - You paid Smdby Linden L$100. - // example of string with reason and name - You paid Smbdy Linden L$100 for a land access pass. - // example of string with no info - You paid L$50. - std::string line = "you_paid_ldollars_no_name"; - - // arguments of string which will be in notification - LLStringUtil::format_map_t str_args; - - // extracting amount of money paid (without L$ symbols). It is always present. - str_args["[AMOUNT]"] = std::string(matches[2]); - - // extracting name of person/group you are paying (it may be absent) - std::string name = std::string(matches[1]); - if(!name.empty()) - { - str_args["[NAME]"] = LLCacheName::cleanFullName(name); - line = "you_paid_ldollars"; - } - - // extracting reason of payment (it may be absent) - std::string reason = std::string(matches[3]); - if (reason.empty()) - { - line = name.empty() ? "you_paid_ldollars_no_info" : "you_paid_ldollars_no_reason"; - } - else - { - std::string localized_reason; - // if we haven't found localized string for reason of payment leave it as it was - str_args["[REASON]"] = LLTrans::findString(localized_reason, reason) ? localized_reason : reason; - } - - // forming final message string by retrieving localized version from xml - // and applying previously found arguments - line = LLTrans::getString(line, str_args); - args["MESSAGE"] = line; - } + message = LLTrans::getString("paid_you_ldollars", args); } + else { + message = LLTrans::getString("paid_you_ldollars_no_reason", args); + } + final_args["MESSAGE"] = message; - LLNotificationsUtil::add("SystemMessage", args); + // make notification loggable + payload["from_id"] = source_id; + notification = "PaymentReceived"; } + // Despite using SLURLs, wait until the name is available before + // showing the notification, otherwise the UI layout is strange and + // the user sees a "Loading..." message + if (is_name_group) + { + gCacheName->get(name_id, true, + boost::bind(&money_balance_group_notify, + _1, _2, _3, + notification, final_args, payload)); + } + else { + LLAvatarNameCache::get(name_id, + boost::bind(&money_balance_avatar_notify, + _1, _2, + notification, final_args, payload)); + } } + + bool handle_special_notification_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 83e3fee546..423e3a89c5 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3092,7 +3092,8 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. - [NAME] paid you L$[AMOUNT] + [NAME] paid you L$[AMOUNT] [REASON]. + [NAME] paid you L$[AMOUNT]. You paid [NAME] L$[AMOUNT] [REASON]. You paid L$[AMOUNT]. You paid [NAME] L$[AMOUNT]. -- cgit v1.2.3 From 8992232e64155588c64b4ab29bad6766bc6c7ff6 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 21 May 2010 16:45:35 -0700 Subject: DEV-50013 Display names in mini-map tooltips Reviewed with Leyla --- indra/newview/llnetmap.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index a8dee8a24a..33d03bd890 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -37,6 +37,7 @@ // Library includes (should move below) #include "indra_constants.h" +#include "llavatarnamecache.h" #include "llmath.h" #include "llfloaterreg.h" #include "llfocusmgr.h" @@ -555,11 +556,14 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask ) // mToolTipMsg = "[AGENT][REGION](Double-click to open Map)" + bool have_agent = false; LLStringUtil::format_map_t args; - std::string fullname; - if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) + LLAvatarName av_name; + if(mClosestAgentToCursor.notNull() + && LLAvatarNameCache::get(mClosestAgentToCursor, &av_name)) { - args["[AGENT]"] = fullname + "\n"; + args["[AGENT]"] = av_name.getNameAndSLID() + "\n"; + have_agent = true; } else { @@ -567,7 +571,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask ) } LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); - if( region ) + if( region && !have_agent) { args["[REGION]"] = region->getName() + "\n"; } -- cgit v1.2.3 From d674d11f895b8f3d578cded931cdc1c430379c95 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 21 May 2010 17:11:31 -0700 Subject: Rename LLAvatarName::getNameAndSLID() to getCompleteName() Discussed with Leyla/Richard --- indra/newview/llavataractions.cpp | 4 ++-- indra/newview/llfloaterland.cpp | 2 +- indra/newview/llfloatersellland.cpp | 2 +- indra/newview/llimfloater.cpp | 2 +- indra/newview/llimview.cpp | 2 +- indra/newview/llnamelistctrl.cpp | 4 ++-- indra/newview/llnetmap.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 708ef1895e..1d1a127dae 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -190,7 +190,7 @@ void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string name = av_name.getNameAndSLID(); + std::string name = av_name.getCompleteName(); LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id); if (session_id != LLUUID::null) { @@ -225,7 +225,7 @@ void LLAvatarActions::endIM(const LLUUID& id) static void on_avatar_name_cache_start_call(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string name = av_name.getNameAndSLID(); + std::string name = av_name.getCompleteName(); LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true); if (session_id != LLUUID::null) { diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 78dea87bfd..d0a15450a0 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1609,7 +1609,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo // Placeholder for name. LLAvatarName av_name; LLAvatarNameCache::get(owner_id, &av_name); - item_params.columns.add().value(av_name.getNameAndSLID()).font(FONT).column("name"); + item_params.columns.add().value(av_name.getCompleteName()).font(FONT).column("name"); object_count_str = llformat("%d", object_count); item_params.columns.add().value(object_count_str).font(FONT).column("count"); diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index ebb73baffb..e214b58a9a 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -242,7 +242,7 @@ void LLFloaterSellLandUI::updateParcelInfo() void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name) { - childSetText("sell_to_agent", av_name.getNameAndSLID()); + childSetText("sell_to_agent", av_name.getCompleteName()); childSetToolTip("sell_to_agent", av_name.mUsername); } diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b5b923dcad..1c1d9343aa 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -331,7 +331,7 @@ void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, { // Use display name only for labels, as the extended name will be in the // floater title - std::string ui_title = av_name.getNameAndSLID(); + std::string ui_title = av_name.getCompleteName(); updateSessionName(ui_title, av_name.mDisplayName); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index f615402f9c..e915d3ad70 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1968,7 +1968,7 @@ void LLIncomingCallDialog::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& call_type) { - std::string title = av_name.getNameAndSLID(); + std::string title = av_name.getCompleteName(); setCallerName(title, av_name.mDisplayName, call_type); } diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 2a7e84256e..a2450fcdd2 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -306,7 +306,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( if (mShortNames) fullname = av_name.mDisplayName; else - fullname = av_name.getNameAndSLID(); + fullname = av_name.getCompleteName(); } else { @@ -375,7 +375,7 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, if (mShortNames) name = av_name.mDisplayName; else - name = av_name.getNameAndSLID(); + name = av_name.getCompleteName(); item_list::iterator iter; for (iter = getItemList().begin(); iter != getItemList().end(); iter++) diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 33d03bd890..67b238ad58 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -562,7 +562,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask ) if(mClosestAgentToCursor.notNull() && LLAvatarNameCache::get(mClosestAgentToCursor, &av_name)) { - args["[AGENT]"] = av_name.getNameAndSLID() + "\n"; + args["[AGENT]"] = av_name.getCompleteName() + "\n"; have_agent = true; } else -- cgit v1.2.3 From 01fa1379931ea41813e33a4228dcb8a156f609e7 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 24 May 2010 15:36:30 -0700 Subject: DEV-50013 Use new cache to get legacy name for Vivox --- indra/newview/llvoicevivox.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 409e507c16..a9e14e4e89 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2658,12 +2658,16 @@ void LLVivoxVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream) void LLVivoxVoiceClient::checkFriend(const LLUUID& id) { - std::string name; buddyListEntry *buddy = findBuddy(id); // Make sure we don't add a name before it's been looked up. - if(gCacheName->getFullName(id, name)) + LLAvatarName av_name; + if(LLAvatarNameCache::get(id, &av_name)) { + // *NOTE: For now, we feed legacy names to Vivox because I don't know + // if their service can support a mix of new and old clients with + // different sorts of names. + std::string name = av_name.getLegacyName(); const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id); bool canSeeMeOnline = false; -- cgit v1.2.3 From 3b0bb8159605685befd79784ddcf6feadee36b67 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 24 May 2010 16:58:49 -0700 Subject: DEV-50013 Add "Reset" button to Set Name dialog Reviewed with Richard --- indra/newview/llpanelme.cpp | 14 ++++++++++++-- indra/newview/skins/default/xui/en/notifications.xml | 8 +++++++- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index c1d02fae39..544ca47da4 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -347,12 +347,22 @@ void LLPanelMyProfileEdit::onCacheSetName(bool success, void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) + if (option == 0 || option == 1) { LLUUID agent_id = notification["payload"]["agent_id"]; if (agent_id.isNull()) return; - std::string display_name_utf8 = response["display_name"].asString(); + std::string display_name_utf8; + if (option == 0) + { + // user gave us a name + display_name_utf8 = response["display_name"].asString(); + } + else + { + // reset back to People API default + display_name_utf8 = ""; + } const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index cc32941633..51b88cf59a 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3145,7 +3145,9 @@ You are no longer frozen. icon="alertmodal.tga" name="SetDisplayName" type="alertmodal"> -Change your display name? +Change your display name (used for name tags, chat, etc.)? + +You can also reset it back to your original username.
[DISPLAY_NAME] @@ -3157,6 +3159,10 @@ Change your display name? text="Change"/>
+ + (People and/or Objects you have blocked) + -- cgit v1.2.3 From 5894a6a593a0a948815d925dabfb2a4bc78e9d3f Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 11 Nov 2010 14:59:51 +0200 Subject: STORM-582 FIXED Moved movement and camera control preferences from Advanced to the new Move & View tab. In addition to moving existing controls, created stub checkbox and radiobuttons for double-click behavior. Logic will be hooked up to them in STORM-576. --- .../default/xui/en/panel_preferences_move.xml | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index 2d6dddfc8c..ec80efe188 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -9,4 +9,198 @@ name="move_panel" top="1" width="517"> + + + + + Automatic position for: + + + + + + + + Mouselook mouse sensitivity: + + + + + + + + + + -- cgit v1.2.3 From d358feff7ad732b28d8e914e44cdb08761207346 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 11 Nov 2010 15:06:51 +0200 Subject: STORM-586 FIXED Layout cleanup in the Setup tab of Preferences - Deleted Mouselook settings - Increased vertical padding between "Cache size" and "Cache location" controls --- .../default/xui/en/panel_preferences_setup.xml | 49 +--------------------- 1 file changed, 2 insertions(+), 47 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 140d16e37f..14aa38c5d3 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -9,51 +9,6 @@ name="Input panel" top="1" width="517"> - - Mouselook: - - - Mouse sensitivity - - - Network: @@ -187,7 +142,7 @@ layout="topleft" left="80" name="Cache location" - top_delta="20" + top_delta="40" width="300"> Cache location:
-- cgit v1.2.3 From 5821631c2e3527d248d6190e342e241acdc38dd7 Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 11 Nov 2010 15:15:04 +0200 Subject: STORM-583 ADDITIONAL_FIX Fixed top_pad of topmost control in "Colors" so that it is consistent with other preferences tab. --- indra/newview/skins/default/xui/en/panel_preferences_colors.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml index 06e8ee80b5..036730a646 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml @@ -17,7 +17,7 @@ layout="topleft" left="30" name="effects_color_textbox" - top_pad="15" + top_pad="10" width="200"> My effects (selection beam):
-- cgit v1.2.3 From 51e38dff76fce7f0fe5b665f8707931435e2ff99 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 11 Nov 2010 16:45:35 +0200 Subject: STORM-587 FIXED Layout cleanup in the Advanced tab of Preferences - According to the specification deleted all controls except: 1. "UI Size" slider 2. "Show script errors in" radio group - According to the specification: 1. "Allow Multiple Viewer" checkbox 2. "Show Grid Selection at login" checkbox 3. "Show Advanced Manu" checkbox 4. "Show Developer Menu" checkbox --- .../default/xui/en/panel_preferences_advanced.xml | 259 +++------------------ 1 file changed, 32 insertions(+), 227 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index e17d4768d4..6f4beea43a 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -17,188 +17,17 @@ name="middle_mouse"> Middle Mouse - - - - -Automatic position for: - - - - - - - - - - - - - - - - UI size + width="100"> + UI size: + width="250" /> - - + - - - + height="15" + label="Show Developer Menu" + layout="topleft" + left="30" + name="push_to_talk_toggle_check" + top_pad="5" + width="237"/> -- cgit v1.2.3 From 2287f7612ce0e2cbc439c4ce048edcb2df3b3d40 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 11 Nov 2010 18:49:55 +0200 Subject: STORM-587 ADDITIONAL FIX Layout cleanup in the Advanced tab of Preferences - Temporary restored controls: 1. "Move avatar lips when speaking" checkbox 2. "Toggle speak on/off when I press:" checkbox 3. "Push-to-Speak trigger" lineeditor 4. "set_voice_hotkey_button" button 5. "set_voice_middlemouse_button" button They should be moved to the Sound&Media panel of floater Preferences. But the specification for the Sound&Media panel is not ready yet. As specification will be ready, these controls will be moved to the Sound&Media panel. --- .../default/xui/en/panel_preferences_advanced.xml | 64 +++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 6f4beea43a..6a9ea5afb6 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -103,7 +103,7 @@ + + + + + + + -- cgit v1.2.3 From 4077e6bb52f73a3ccd7f560788fc2fda21d7d9e7 Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Thu, 11 Nov 2010 22:50:14 -0500 Subject: STORM-102 : STORM-143 :Made needed changes to code to improve searching for previous logs and also changed the name used for P2P IM log file names. The latter change is going to temporarely break personal content for those that are saving conversation logs as P2P IM logs will now be useinf the user name and not the legacy name. --- indra/newview/llimview.cpp | 5 +++-- indra/newview/lllogchat.cpp | 53 +++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 28 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 857c27be63..14a29b7e0f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -537,7 +537,8 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { - if (av_name.mLegacyFirstName.empty()) + mHistoryFileName = av_name.mUsername; + /*if (av_name.mLegacyFirstName.empty()) { // if mLegacyFirstName is empty it means display names is off and the // data came from the gCacheName, mDisplayName will be the legacy name @@ -546,7 +547,7 @@ void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LL else { mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName()); - } + }*/ } void LLIMModel::LLIMSession::buildHistoryFileName() diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 4f80472330..2fb5ba82ba 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -206,7 +206,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { - std::string invalidChars = "\"\'\\/?*:<>|"; + std::string invalidChars = "\"\'\\/?*:.<>|"; std::string::size_type position = filename.find_first_of(invalidChars); while (position != filename.npos) { @@ -370,8 +370,8 @@ void LLLogChat::loadAllHistory(const std::string& file_name, std::list& me llwarns << "Session name is Empty!" << llendl; return ; } - LL_INFOS("") << "Loading:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ - LL_INFOS("") << "Current:" << makeLogFileName(file_name) << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + //LL_INFOS("") << "Loading:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + //LL_INFOS("") << "Current:" << makeLogFileName(file_name) << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ LLFILE* fptr = LLFile::fopen(makeLogFileName(file_name), "r");/*Flawfinder: ignore*/ if (!fptr) { @@ -569,31 +569,32 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im) im[IM_TEXT] = name_and_text[IDX_TEXT]; return true; //parsed name and message text, maybe have a timestamp too } -std::string LLLogChat::oldLogFileName(std::string filename) -{ +std::string LLLogChat::oldLogFileName(std::string filename) +{ std::string scanResult; std::string directory = gDirUtilp->getPerAccountChatLogsDir();/* get Users log directory */ directory += gDirUtilp->getDirDelimiter();/* add final OS dependent delimiter */ - std::string pattern = (cleanFileName(filename)+(( filename == "chat" ) ? "-???\?-?\?-??.txt" : "-???\?-??.txt"));/* create search pattern*/ - LL_INFOS("") << "Checking:" << directory << " for " << pattern << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ - std::vector allfiles; - - while (gDirUtilp->getNextFileInDir(directory, pattern, scanResult)) + filename=cleanFileName(filename);/* lest make shure the file name has no invalad charecters befor making the pattern */ + std::string pattern = (filename+(( filename == "chat" ) ? "-???\?-?\?-??.txt" : "-???\?-??.txt"));/* create search pattern*/ + //LL_INFOS("") << "Checking:" << directory << " for " << pattern << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + std::vector allfiles; + + while (gDirUtilp->getNextFileInDir(directory, pattern, scanResult)) + { + //LL_INFOS("") << "Found :" << scanResult << LL_ENDL; + allfiles.push_back(scanResult); + } + + if (allfiles.size() == 0) // if no result from date search, return generic filename + { + scanResult = directory + filename + ".txt"; + } + else { - //LL_INFOS("") << "Found :" << scanResult << LL_ENDL; - allfiles.push_back(scanResult); - } - - if (allfiles.size() == 0) // if no result from date search, return generic filename - { - scanResult = directory + filename + ".txt"; - } - else - { - std::sort(allfiles.begin(), allfiles.end()); - scanResult = directory + allfiles.back(); - // thisfile is now the most recent version of the file. - } - LL_INFOS("") << "Reading:" << scanResult << LL_ENDL; - return scanResult; + std::sort(allfiles.begin(), allfiles.end()); + scanResult = directory + allfiles.back(); + // thisfile is now the most recent version of the file. + } + //LL_INFOS("") << "Reading:" << scanResult << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + return scanResult; } -- cgit v1.2.3 From 5c18ab7aceabc01fdcf01e86e364621241132966 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Fri, 12 Nov 2010 15:35:42 +0200 Subject: STORM-587 ADDITIONAL FIX Layout cleanup in the Advanced tab of Preferences - Removed controls: 1. "Move avatar lips when speaking" checkbox 2. "Toggle speak on/off when I press:" checkbox 3. "Push-to-Speak trigger" lineeditor 4. "set_voice_hotkey_button" button 5. "set_voice_middlemouse_button" button - Set proper names for checkboxes According to the specification these controls are in the Sound&Media panel now. --- .../default/xui/en/panel_preferences_advanced.xml | 70 ++-------------------- 1 file changed, 4 insertions(+), 66 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 6a9ea5afb6..c1fb0243b7 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -88,7 +88,7 @@ label="Allow Multiple Viewer" layout="topleft" left="30" - name="push_to_talk_toggle_check" + name="allow_multiple_viewer_check" top_pad="20" width="237"/> - - - - - - - -- cgit v1.2.3 From 2632565bbced3002eb9912270b1f7303c48a0b44 Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Fri, 12 Nov 2010 09:09:41 -0500 Subject: STORM-102 : STORM-143 :Removed unneeded code in llimview. --- indra/newview/llimview.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 14a29b7e0f..cc48226052 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -538,16 +538,6 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { mHistoryFileName = av_name.mUsername; - /*if (av_name.mLegacyFirstName.empty()) - { - // if mLegacyFirstName is empty it means display names is off and the - // data came from the gCacheName, mDisplayName will be the legacy name - mHistoryFileName = LLCacheName::cleanFullName(av_name.mDisplayName); - } - else - { - mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName()); - }*/ } void LLIMModel::LLIMSession::buildHistoryFileName() -- cgit v1.2.3 From ef46e7037ca59224dfcdf3745e165ee97b086a69 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 12 Nov 2010 17:28:44 +0200 Subject: STORM-579 FIXED resident SLURL font color to match Chat preferences for plain text Nearby Chat log --- indra/newview/llchathistory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 0f7e9313a9..271ee0c4a4 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -798,9 +798,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) { LLStyle::Params link_params(style_params); - link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); + + // Setting is_link = true for agent SLURL to avoid applying default style to it. + // See LLTextBase::appendTextImpl(). + link_params.is_link = true; + link_params.link_href = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString(); + // Add link to avatar's inspector and delimiter to message. - mEditor->appendText(link_params.link_href, false, style_params); + mEditor->appendText(chat.mFromName, false, link_params); mEditor->appendText(delimiter, false, style_params); } else -- cgit v1.2.3 From 29a36c21db57729ff86785745c90ffbf93875edb Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Fri, 12 Nov 2010 18:18:44 +0200 Subject: STORM-571 FIXED Moved voice prefs from advanced to Sound&Media and changed layout accordingly. This changeset also covers STORM-572 (note that design in this fix differs a little from the one proposed in there because there was not enough space to make it that way). --- .../default/xui/en/panel_preferences_advanced.xml | 4 - .../default/xui/en/panel_preferences_sound.xml | 140 +++++++++++++++------ 2 files changed, 104 insertions(+), 40 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index c1fb0243b7..15d1222d00 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -13,10 +13,6 @@ name="aspect_ratio_text"> [NUM]:[DEN] - - Middle Mouse - + + Middle Mouse + + left="25" + width="230"/> + + width="180" + top_pad="10"> Voice Chat Settings + width="102"> Listen from: + top_delta="0" /> + + + + @@ -396,14 +464,14 @@ visiblity_control="ShowDeviceSettings" border="false" follows="top|left" - height="120" + height="100" label="Device Settings" layout="topleft" - left="0" + left_delta="-2" name="device_settings_panel" class="panel_voice_device_settings" - width="501" - top="285"> + width="470" + top_pad="0"> Default @@ -419,7 +487,7 @@ + width="70"> Input My volume: @@ -465,11 +533,11 @@ increment="0.025" initial_value="1.0" layout="topleft" - left="160" + left_delta="-6" max_val="2" name="mic_volume_slider" tool_tip="Change the volume using this slider" - top_pad="-2" + top_pad="-1" width="220" /> Please wait @@ -489,7 +557,7 @@ layout="topleft" left_delta="0" name="bar0" - top_delta="0" + top_delta="-2" width="20" /> + width="70"> Output -- cgit v1.2.3 From e3677f9ee2223cc13d12456e1eee4f7f9a90c474 Mon Sep 17 00:00:00 2001 From: Dave SIMmONs Date: Fri, 12 Nov 2010 12:18:18 -0800 Subject: Revert change for ER-301 to make merging easier. We'll get this in another pass --- indra/newview/llviewerthrottle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 5147272122..b614ccdbc2 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -46,7 +46,7 @@ const F32 MAX_FRACTIONAL = 1.5f; const F32 MIN_FRACTIONAL = 0.2f; const F32 MIN_BANDWIDTH = 50.f; -const F32 MAX_BANDWIDTH = 3000.f; +const F32 MAX_BANDWIDTH = 1500.f; const F32 STEP_FRACTIONAL = 0.1f; const F32 TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s const F32 EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s -- cgit v1.2.3 From b2fcba25c8dd04318420af30f877b0984a524055 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Sat, 13 Nov 2010 00:53:29 +0200 Subject: STORM-52 FIXED Made it possible to use an external script editor. The editor can be specified: * via "ExternalEditor" setting in settings.xml * via LL_SCRIPT_EDITOR variable Removed obsolete XUIEditor setting in favor of the new one. --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 4 +- indra/newview/llexternaleditor.cpp | 192 +++++++++++++++++ indra/newview/llexternaleditor.h | 91 ++++++++ indra/newview/llfloateruipreview.cpp | 210 ++++-------------- indra/newview/llpreviewscript.cpp | 235 ++++++++++++++++----- indra/newview/llpreviewscript.h | 15 +- .../skins/default/xui/en/panel_script_ed.xml | 9 + 8 files changed, 530 insertions(+), 228 deletions(-) create mode 100644 indra/newview/llexternaleditor.cpp create mode 100644 indra/newview/llexternaleditor.h (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 09622d3af5..d44b0ce679 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -143,6 +143,7 @@ set(viewer_SOURCE_FILES lleventnotifier.cpp lleventpoll.cpp llexpandabletextbox.cpp + llexternaleditor.cpp llface.cpp llfasttimerview.cpp llfavoritesbar.cpp @@ -674,6 +675,7 @@ set(viewer_HEADER_FILES lleventnotifier.h lleventpoll.h llexpandabletextbox.h + llexternaleditor.h llface.h llfasttimerview.h llfavoritesbar.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ebd93b5987..a5d9bd0f4f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11883,10 +11883,10 @@ Value 150000.0
- XUIEditor + ExternalEditor Comment - Path to program used to edit XUI files + Path to program used to edit LSL scripts and XUI files, e.g.: /usr/bin/gedit --new-window "%s" Persist 1 Type diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp new file mode 100644 index 0000000000..54968841ab --- /dev/null +++ b/indra/newview/llexternaleditor.cpp @@ -0,0 +1,192 @@ +/** + * @file llexternaleditor.cpp + * @brief A convenient class to run external editor. + * + * $LicenseInfo:firstyear=2010&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 "llexternaleditor.h" + +#include "llui.h" + +// static +const std::string LLExternalEditor::sFilenameMarker = "%s"; + +// static +const std::string LLExternalEditor::sSetting = "ExternalEditor"; + +bool LLExternalEditor::setCommand(const std::string& env_var, const std::string& override) +{ + std::string cmd = findCommand(env_var, override); + if (cmd.empty()) + { + llwarns << "Empty editor command" << llendl; + return false; + } + + // Add the filename marker if missing. + if (cmd.find(sFilenameMarker) == std::string::npos) + { + cmd += " \"" + sFilenameMarker + "\""; + llinfos << "Adding the filename marker (" << sFilenameMarker << ")" << llendl; + } + + string_vec_t tokens; + if (tokenize(tokens, cmd) < 2) // 2 = bin + at least one arg (%s) + { + llwarns << "Error parsing editor command" << llendl; + return false; + } + + // Check executable for existence. + std::string bin_path = tokens[0]; + if (!LLFile::isfile(bin_path)) + { + llwarns << "Editor binary [" << bin_path << "] not found" << llendl; + return false; + } + + // Save command. + mProcess.setExecutable(bin_path); + mArgs.clear(); + for (size_t i = 1; i < tokens.size(); ++i) + { + if (i > 1) mArgs += " "; + mArgs += "\"" + tokens[i] + "\""; + } + llinfos << "Setting command [" << bin_path << " " << mArgs << "]" << llendl; + + return true; +} + +bool LLExternalEditor::run(const std::string& file_path) +{ + std::string args = mArgs; + if (mProcess.getExecutable().empty() || args.empty()) + { + llwarns << "Editor command not set" << llendl; + return false; + } + + // Substitute the filename marker in the command with the actual passed file name. + LLStringUtil::replaceString(args, sFilenameMarker, file_path); + + // Split command into separate tokens. + string_vec_t tokens; + tokenize(tokens, args); + + // Set process arguments taken from the command. + mProcess.clearArguments(); + for (string_vec_t::const_iterator arg_it = tokens.begin(); arg_it != tokens.end(); ++arg_it) + { + mProcess.addArgument(*arg_it); + } + + // Run the editor. + llinfos << "Running editor command [" << mProcess.getExecutable() + " " + args << "]" << llendl; + int result = mProcess.launch(); + if (result == 0) + { + // Prevent killing the process in destructor (will add it to the zombies list). + mProcess.orphan(); + } + + return result == 0; +} + +// static +size_t LLExternalEditor::tokenize(string_vec_t& tokens, const std::string& str) +{ + tokens.clear(); + + // Split the argument string into separate strings for each argument + typedef boost::tokenizer< boost::char_separator > tokenizer; + boost::char_separator sep("", "\" ", boost::drop_empty_tokens); + + tokenizer tokens_list(str, sep); + tokenizer::iterator token_iter; + BOOL inside_quotes = FALSE; + BOOL last_was_space = FALSE; + for (token_iter = tokens_list.begin(); token_iter != tokens_list.end(); ++token_iter) + { + if (!strncmp("\"",(*token_iter).c_str(),2)) + { + inside_quotes = !inside_quotes; + } + else if (!strncmp(" ",(*token_iter).c_str(),2)) + { + if(inside_quotes) + { + tokens.back().append(std::string(" ")); + last_was_space = TRUE; + } + } + else + { + std::string to_push = *token_iter; + if (last_was_space) + { + tokens.back().append(to_push); + last_was_space = FALSE; + } + else + { + tokens.push_back(to_push); + } + } + } + + return tokens.size(); +} + +// static +std::string LLExternalEditor::findCommand( + const std::string& env_var, + const std::string& override) +{ + std::string cmd; + + // Get executable path. + if (!override.empty()) // try the supplied override first + { + cmd = override; + llinfos << "Using override" << llendl; + } + else if (!LLUI::sSettingGroups["config"]->getString(sSetting).empty()) + { + cmd = LLUI::sSettingGroups["config"]->getString(sSetting); + llinfos << "Using setting" << llendl; + } + else // otherwise use the path specified by the environment variable + { + char* env_var_val = getenv(env_var.c_str()); + if (env_var_val) + { + cmd = env_var_val; + llinfos << "Using env var " << env_var << llendl; + } + } + + llinfos << "Found command [" << cmd << "]" << llendl; + return cmd; +} diff --git a/indra/newview/llexternaleditor.h b/indra/newview/llexternaleditor.h new file mode 100644 index 0000000000..6ea210d5e2 --- /dev/null +++ b/indra/newview/llexternaleditor.h @@ -0,0 +1,91 @@ +/** + * @file llexternaleditor.h + * @brief A convenient class to run external editor. + * + * $LicenseInfo:firstyear=2010&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_LLEXTERNALEDITOR_H +#define LL_LLEXTERNALEDITOR_H + +#include + +/** + * Usage: + * LLExternalEditor ed; + * ed.setCommand("MY_EXTERNAL_EDITOR_VAR"); + * ed.run("/path/to/file1"); + * ed.run("/other/path/to/file2"); + */ +class LLExternalEditor +{ + typedef std::vector string_vec_t; + +public: + + /** + * Set editor command. + * + * @param env_var Environment variable of the same purpose. + * @param override Optional override. + * + * First tries the override, then a predefined setting (sSetting), + * then the environment variable. + * + * @return Command if found, empty string otherwise. + * + * @see sSetting + */ + bool setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null); + + /** + * Run the editor with the given file. + * + * @param file_path File to edit. + * @return true on success, false on error. + */ + bool run(const std::string& file_path); + +private: + + static std::string findCommand( + const std::string& env_var, + const std::string& override); + + static size_t tokenize(string_vec_t& tokens, const std::string& str); + + /** + * Filename placeholder that gets replaced with an actual file name. + */ + static const std::string sFilenameMarker; + + /** + * Setting that can specify the editor command. + */ + static const std::string sSetting; + + + std::string mArgs; + LLProcessLauncher mProcess; +}; + +#endif // LL_LLEXTERNALEDITOR_H diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 5dc8067648..d3a2f144d9 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -36,6 +36,7 @@ // Internal utility #include "lleventtimer.h" +#include "llexternaleditor.h" #include "llrender.h" #include "llsdutil.h" #include "llxmltree.h" @@ -160,6 +161,8 @@ public: DiffMap mDiffsMap; // map, of filename to pair of list of changed element paths and list of errors private: + LLExternalEditor mExternalEditor; + // XUI elements for this floater LLScrollListCtrl* mFileList; // scroll list control for file list LLLineEditor* mEditorPathTextBox; // text field for path to editor executable @@ -185,7 +188,7 @@ private: std::string mSavedDiffPath; // stored diff file path so closing this floater doesn't reset it // Internal functionality - static void popupAndPrintWarning(std::string& warning); // pop up a warning + static void popupAndPrintWarning(const std::string& warning); // pop up a warning std::string getLocalizedDirectory(); // build and return the path to the XUI directory for the currently-selected localization void scanDiffFile(LLXmlTreeNode* file_node); // scan a given XML node for diff entries and highlight them in its associated file void highlightChangedElements(); // look up the list of elements to highlight and highlight them in the current floater @@ -597,7 +600,7 @@ void LLFloaterUIPreview::onClose(bool app_quitting) // Error handling (to avoid code repetition) // *TODO: this is currently unlocalized. Add to alerts/notifications.xml, someday, maybe. -void LLFloaterUIPreview::popupAndPrintWarning(std::string& warning) +void LLFloaterUIPreview::popupAndPrintWarning(const std::string& warning) { llwarns << warning << llendl; LLSD args; @@ -998,190 +1001,55 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) // Respond to button click to edit currently-selected floater void LLFloaterUIPreview::onClickEditFloater() { - std::string file_name = mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater - if(std::string("") == file_name) // if no item is selected - { - return; // ignore click - } - std::string path = getLocalizedDirectory() + file_name; - - // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file) - llstat dummy; - if(LLFile::stat(path.c_str(), &dummy)) // if the file does not exist - { - std::string warning = "No file for this floater exists in the selected localization. Opening the EN version instead."; - popupAndPrintWarning(warning); - - path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default - } - - // get executable path - const char* exe_path_char; - std::string path_in_textfield = mEditorPathTextBox->getText(); - if(std::string("") != path_in_textfield) // if the text field is not emtpy, use its path - { - exe_path_char = path_in_textfield.c_str(); - } - else if (!LLUI::sSettingGroups["config"]->getString("XUIEditor").empty()) - { - exe_path_char = LLUI::sSettingGroups["config"]->getString("XUIEditor").c_str(); - } - else // otherwise use the path specified by the environment variable + // Determine file to edit. + std::string file_path; { - exe_path_char = getenv("LL_XUI_EDITOR"); - } - - // error check executable path - if(NULL == exe_path_char) - { - std::string warning = "Select an editor by setting the environment variable LL_XUI_EDITOR or specifying its path in the \"Editor Path\" field."; - popupAndPrintWarning(warning); - return; - } - std::string exe_path = exe_path_char; // do this after error check, otherwise internal strlen call fails on bad char* - - // remove any quotes; they're added back in later where necessary - int found_at; - while((found_at = exe_path.find("\"")) != -1 || (found_at = exe_path.find("'")) != -1) - { - exe_path.erase(found_at,1); - } - - llstat s; - if(!LLFile::stat(exe_path.c_str(), &s)) // If the executable exists - { - // build paths and arguments - std::string quote = std::string("\""); - std::string args; - std::string custom_args = mEditorArgsTextBox->getText(); - int position_of_file = custom_args.find(std::string("%FILE%"), 0); // prepare to replace %FILE% with actual file path - std::string first_part_of_args = ""; - std::string second_part_of_args = ""; - if(-1 == position_of_file) // default: Executable.exe File.xml - { - args = quote + path + quote; // execute the command Program.exe "File.xml" - } - else // use advanced command-line arguments, e.g. "Program.exe -safe File.xml" -windowed for "-safe %FILE% -windowed" + std::string file_name = mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater + if (file_name.empty()) // if no item is selected { - first_part_of_args = custom_args.substr(0,position_of_file); // get part of args before file name - second_part_of_args = custom_args.substr(position_of_file+6,custom_args.length()); // get part of args after file name - custom_args = first_part_of_args + std::string("\"") + path + std::string("\"") + second_part_of_args; // replace %FILE% with "" and put back together - args = custom_args; // and save in the variable that is actually used + llwarns << "No file selected" << llendl; + return; // ignore click } + file_path = getLocalizedDirectory() + file_name; - // find directory in which executable resides by taking everything after last slash - int last_slash_position = exe_path.find_last_of(mDelim); - if(-1 == last_slash_position) - { - std::string warning = std::string("Unable to find a valid path to the specified executable for XUI XML editing: ") + exe_path; - popupAndPrintWarning(warning); - return; - } - std::string exe_dir = exe_path.substr(0,last_slash_position); // strip executable off, e.g. get "C:\Program Files\TextPad 5" (with or without trailing slash) - -#if LL_WINDOWS - PROCESS_INFORMATION pinfo; - STARTUPINFOA sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - memset(&pinfo, 0, sizeof(pinfo)); - - std::string exe_name = exe_path.substr(last_slash_position+1); - args = quote + exe_name + quote + std::string(" ") + args; // and prepend the executable name, so we get 'Program.exe "Arg1"' - - char *args2 = new char[args.size() + 1]; // Windows requires that the second parameter to CreateProcessA be a writable (non-const) string... - strcpy(args2, args.c_str()); - - // we don't want the current directory to be the executable directory, since the file path is now relative. By using - // NULL for the current directory instead of exe_dir.c_str(), the path to the target file will work. - if(!CreateProcessA(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, NULL, &sinfo, &pinfo)) - { - // DWORD dwErr = GetLastError(); - std::string warning = "Creating editor process failed!"; - popupAndPrintWarning(warning); - } - else + // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file) + llstat dummy; + if(LLFile::stat(file_path.c_str(), &dummy)) // if the file does not exist { - // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on - // sGatewayHandle = pinfo.hProcess; - CloseHandle(pinfo.hThread); // stops leaks - nothing else + popupAndPrintWarning("No file for this floater exists in the selected localization. Opening the EN version instead."); + file_path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default } + } - delete[] args2; -#else // if !LL_WINDOWS - // This code was copied from the code to run SLVoice, with some modification; should work in UNIX (Mac/Darwin or Linux) + // Set the editor command. + std::string cmd_override; + { + std::string bin = mEditorPathTextBox->getText(); + if (!bin.empty()) { - std::vector arglist; - arglist.push_back(exe_path.c_str()); - - // Split the argument string into separate strings for each argument - typedef boost::tokenizer< boost::char_separator > tokenizer; - boost::char_separator sep("","\" ", boost::drop_empty_tokens); - - tokenizer tokens(args, sep); - tokenizer::iterator token_iter; - BOOL inside_quotes = FALSE; - BOOL last_was_space = FALSE; - for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - if(!strncmp("\"",(*token_iter).c_str(),2)) - { - inside_quotes = !inside_quotes; - } - else if(!strncmp(" ",(*token_iter).c_str(),2)) - { - if(inside_quotes) - { - arglist.back().append(std::string(" ")); - last_was_space = TRUE; - } - } - else - { - std::string to_push = *token_iter; - if(last_was_space) - { - arglist.back().append(to_push); - last_was_space = FALSE; - } - else - { - arglist.push_back(to_push); - } - } - } - - // create an argv vector for the child process - char **fakeargv = new char*[arglist.size() + 1]; - int i; - for(i=0; i < arglist.size(); i++) - fakeargv[i] = const_cast(arglist[i].c_str()); - - fakeargv[i] = NULL; - - fflush(NULL); // flush all buffers before the child inherits them - pid_t id = vfork(); - if(id == 0) + // surround command with double quotes for the case if the path contains spaces + if (bin.find("\"") == std::string::npos) { - // child - execv(exe_path.c_str(), fakeargv); - - // If we reach this point, the exec failed. - // Use _exit() instead of exit() per the vfork man page. - std::string warning = "Creating editor process failed (vfork/execv)!"; - popupAndPrintWarning(warning); - _exit(0); + bin = "\"" + bin + "\""; } - // parent - delete[] fakeargv; - // sGatewayPID = id; + std::string args = mEditorArgsTextBox->getText(); + cmd_override = bin + " " + args; } -#endif // LL_WINDOWS } - else + if (!mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override)) { - std::string warning = "Unable to find path to external XML editor for XUI preview tool"; + std::string warning = "Select an editor by setting the environment variable LL_XUI_EDITOR " + "or the ExternalEditor setting or specifying its path in the \"Editor Path\" field."; popupAndPrintWarning(warning); + return; + } + + // Run the editor. + if (!mExternalEditor.run(file_path)) + { + popupAndPrintWarning("Failed to run editor"); + return; } } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index cf2ea38288..330e809c53 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -34,11 +34,13 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldir.h" +#include "llexternaleditor.h" #include "llfloaterreg.h" #include "llinventorydefines.h" #include "llinventorymodel.h" #include "llkeyboard.h" #include "lllineeditor.h" +#include "lllivefile.h" #include "llhelp.h" #include "llnotificationsutil.h" #include "llresmgr.h" @@ -115,6 +117,54 @@ static bool have_script_upload_cap(LLUUID& object_id) return object && (! object->getRegion()->getCapability("UpdateScriptTask").empty()); } +/// --------------------------------------------------------------------------- +/// LLLiveLSLFile +/// --------------------------------------------------------------------------- +class LLLiveLSLFile : public LLLiveFile +{ +public: + LLLiveLSLFile(std::string file_path, LLLiveLSLEditor* parent); + ~LLLiveLSLFile(); + + void ignoreNextUpdate() { mIgnoreNextUpdate = true; } + +protected: + /*virtual*/ bool loadFile(); + + LLLiveLSLEditor* mParent; + bool mIgnoreNextUpdate; +}; + +LLLiveLSLFile::LLLiveLSLFile(std::string file_path, LLLiveLSLEditor* parent) +: mParent(parent) +, mIgnoreNextUpdate(false) +, LLLiveFile(file_path, 1.0) +{ +} + +LLLiveLSLFile::~LLLiveLSLFile() +{ + LLFile::remove(filename()); +} + +bool LLLiveLSLFile::loadFile() +{ + if (mIgnoreNextUpdate) + { + mIgnoreNextUpdate = false; + return true; + } + + if (!mParent->loadScriptText(filename())) + { + return false; + } + + // Disable sync to avoid recursive load->save->load calls. + mParent->saveIfNeeded(false); + return true; +} + /// --------------------------------------------------------------------------- /// LLFloaterScriptSearch /// --------------------------------------------------------------------------- @@ -281,6 +331,7 @@ LLScriptEdCore::LLScriptEdCore( const LLHandle& floater_handle, void (*load_callback)(void*), void (*save_callback)(void*, BOOL), + void (*edit_callback)(void*), void (*search_replace_callback) (void* userdata), void* userdata, S32 bottom_pad) @@ -290,6 +341,7 @@ LLScriptEdCore::LLScriptEdCore( mEditor( NULL ), mLoadCallback( load_callback ), mSaveCallback( save_callback ), + mEditCallback( edit_callback ), mSearchReplaceCallback( search_replace_callback ), mUserdata( userdata ), mForceClose( FALSE ), @@ -329,6 +381,7 @@ BOOL LLScriptEdCore::postBuild() childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE)); + childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::onEditButtonClick, this)); initMenu(); @@ -809,6 +862,13 @@ void LLScriptEdCore::doSave( BOOL close_after_save ) } } +void LLScriptEdCore::onEditButtonClick() +{ + if (mEditCallback) + { + mEditCallback(mUserdata); + } +} void LLScriptEdCore::onBtnUndoChanges() { @@ -949,6 +1009,7 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata) self->getHandle(), LLPreviewLSL::onLoad, LLPreviewLSL::onSave, + NULL, // no edit callback LLPreviewLSL::onSearchReplace, self, 0); @@ -1417,6 +1478,7 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) self->getHandle(), &LLLiveLSLEditor::onLoad, &LLLiveLSLEditor::onSave, + &LLLiveLSLEditor::onEdit, &LLLiveLSLEditor::onSearchReplace, self, 0); @@ -1433,6 +1495,7 @@ LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) : mCloseAfterSave(FALSE), mPendingUploads(0), mIsModifiable(FALSE), + mLiveFile(NULL), mIsNew(false) { mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); @@ -1458,6 +1521,7 @@ BOOL LLLiveLSLEditor::postBuild() LLLiveLSLEditor::~LLLiveLSLEditor() { + delete mLiveFile; } // virtual @@ -1639,38 +1703,39 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, delete xored_id; } -// unused -// void LLLiveLSLEditor::loadScriptText(const std::string& filename) -// { -// if(!filename) -// { -// llerrs << "Filename is Empty!" << llendl; -// return; -// } -// LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ -// if(file) -// { -// // read in the whole file -// fseek(file, 0L, SEEK_END); -// long file_length = ftell(file); -// fseek(file, 0L, SEEK_SET); -// char* buffer = new char[file_length+1]; -// size_t nread = fread(buffer, 1, file_length, file); -// if (nread < (size_t) file_length) -// { -// llwarns << "Short read" << llendl; -// } -// buffer[nread] = '\0'; -// fclose(file); -// mScriptEd->mEditor->setText(LLStringExplicit(buffer)); -// mScriptEd->mEditor->makePristine(); -// delete[] buffer; -// } -// else -// { -// llwarns << "Error opening " << filename << llendl; -// } -// } + bool LLLiveLSLEditor::loadScriptText(const std::string& filename) + { + if (filename.empty()) + { + llwarns << "Empty file name" << llendl; + return false; + } + + LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ + if (!file) + { + llwarns << "Error opening " << filename << llendl; + return false; + } + + // read in the whole file + fseek(file, 0L, SEEK_END); + size_t file_length = (size_t) ftell(file); + fseek(file, 0L, SEEK_SET); + char* buffer = new char[file_length+1]; + size_t nread = fread(buffer, 1, file_length, file); + if (nread < file_length) + { + llwarns << "Short read" << llendl; + } + buffer[nread] = '\0'; + fclose(file); + mScriptEd->mEditor->setText(LLStringExplicit(buffer)); + //mScriptEd->mEditor->makePristine(); + delete[] buffer; + + return true; + } void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) { @@ -1825,9 +1890,8 @@ LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id, mItem = new LLViewerInventoryItem(item); } -void LLLiveLSLEditor::saveIfNeeded() +void LLLiveLSLEditor::saveIfNeeded(bool sync) { - llinfos << "LLLiveLSLEditor::saveIfNeeded()" << llendl; LLViewerObject* object = gObjectList.findObject(mObjectUUID); if(!object) { @@ -1877,9 +1941,74 @@ void LLLiveLSLEditor::saveIfNeeded() mItem->setAssetUUID(asset_id); mItem->setTransactionID(tid); - // write out the data, and store it in the asset database + writeToFile(filename); + + if (sync) + { + // Sync with external ed2itor. + std::string tmp_file = getTmpFileName(); + llstat s; + if (LLFile::stat(tmp_file, &s) == 0) // file exists + { + if (mLiveFile) mLiveFile->ignoreNextUpdate(); + writeToFile(tmp_file); + } + } + + // save it out to asset server + std::string url = object->getRegion()->getCapability("UpdateScriptTask"); + getWindow()->incBusyCount(); + mPendingUploads++; + BOOL is_running = getChild( "running")->get(); + if (!url.empty()) + { + uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running); + } + else if (gAssetStorage) + { + uploadAssetLegacy(filename, object, tid, is_running); + } +} + +void LLLiveLSLEditor::openExternalEditor() +{ + LLViewerObject* object = gObjectList.findObject(mObjectUUID); + if(!object) + { + LLNotificationsUtil::add("SaveScriptFailObjectNotFound"); + return; + } + + delete mLiveFile; // deletes file + + // Save the script to a temporary file. + std::string filename = getTmpFileName(); + writeToFile(filename); + + // Start watching file changes. + mLiveFile = new LLLiveLSLFile(filename, this); + mLiveFile->addToEventTimer(); + + // Open it in external editor. + { + LLExternalEditor ed; + + if (!ed.setCommand("LL_SCRIPT_EDITOR")) + { + std::string msg = "Select an editor by setting the environment variable LL_SCRIPT_EDITOR " + "or the ExternalEditor setting"; // *TODO: localize + LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg)); + return; + } + + ed.run(filename); + } +} + +bool LLLiveLSLEditor::writeToFile(const std::string& filename) +{ LLFILE* fp = LLFile::fopen(filename, "wb"); - if(!fp) + if (!fp) { llwarns << "Unable to write to " << filename << llendl; @@ -1887,33 +2016,25 @@ void LLLiveLSLEditor::saveIfNeeded() row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?"; row["columns"][0]["font"] = "SANSSERIF_SMALL"; mScriptEd->mErrorList->addElement(row); - return; + return false; } + std::string utf8text = mScriptEd->mEditor->getText(); // Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889 - if ( utf8text.size() == 0 ) + if (utf8text.size() == 0) { utf8text = " "; } fputs(utf8text.c_str(), fp); fclose(fp); - fp = NULL; - - // save it out to asset server - std::string url = object->getRegion()->getCapability("UpdateScriptTask"); - getWindow()->incBusyCount(); - mPendingUploads++; - BOOL is_running = getChild( "running")->get(); - if (!url.empty()) - { - uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running); - } - else if (gAssetStorage) - { - uploadAssetLegacy(filename, object, tid, is_running); - } + return true; +} + +std::string LLLiveLSLEditor::getTmpFileName() +{ + return std::string(LLFile::tmpdir()) + "sl_script_" + mObjectUUID.asString() + ".lsl"; } void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, @@ -2138,6 +2259,14 @@ void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save) self->saveIfNeeded(); } + +// static +void LLLiveLSLEditor::onEdit(void* userdata) +{ + LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; + self->openExternalEditor(); +} + // static void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) { diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index f4b31e5962..d35c6b8528 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -35,6 +35,7 @@ #include "lliconctrl.h" #include "llframetimer.h" +class LLLiveLSLFile; class LLMessageSystem; class LLTextEditor; class LLButton; @@ -62,6 +63,7 @@ public: const LLHandle& floater_handle, void (*load_callback)(void* userdata), void (*save_callback)(void* userdata, BOOL close_after_save), + void (*edit_callback)(void*), void (*search_replace_callback)(void* userdata), void* userdata, S32 bottom_pad = 0); // pad below bottom row of buttons @@ -80,6 +82,8 @@ public: bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response); + void onEditButtonClick(); + static void onCheckLock(LLUICtrl*, void*); static void onHelpComboCommit(LLUICtrl* ctrl, void* userdata); static void onClickBack(void* userdata); @@ -114,6 +118,7 @@ private: LLTextEditor* mEditor; void (*mLoadCallback)(void* userdata); void (*mSaveCallback)(void* userdata, BOOL close_after_save); + void (*mEditCallback)(void* userdata); void (*mSearchReplaceCallback) (void* userdata); void* mUserdata; LLComboBox *mFunctions; @@ -179,6 +184,7 @@ protected: // Used to view and edit an LSL that is attached to an object. class LLLiveLSLEditor : public LLPreview { + friend class LLLiveLSLFile; public: LLLiveLSLEditor(const LLSD& key); ~LLLiveLSLEditor(); @@ -202,7 +208,10 @@ private: virtual void loadAsset(); void loadAsset(BOOL is_new); - void saveIfNeeded(); + void saveIfNeeded(bool sync = true); + void openExternalEditor(); + std::string getTmpFileName(); + bool writeToFile(const std::string& filename); void uploadAssetViaCaps(const std::string& url, const std::string& filename, const LLUUID& task_id, @@ -218,6 +227,7 @@ private: static void onSearchReplace(void* userdata); static void onLoad(void* userdata); static void onSave(void* userdata, BOOL close_after_save); + static void onEdit(void* userdata); static void onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, @@ -227,7 +237,7 @@ private: static void onRunningCheckboxClicked(LLUICtrl*, void* userdata); static void onReset(void* userdata); -// void loadScriptText(const std::string& filename); // unused + bool loadScriptText(const std::string& filename); void loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type); static void onErrorList(LLUICtrl*, void* user_data); @@ -253,6 +263,7 @@ private: LLCheckBoxCtrl* mMonoCheckbox; BOOL mIsModifiable; + LLLiveLSLFile* mLiveFile; }; #endif // LL_LLPREVIEWSCRIPT_H diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 1e332a40c2..a041c9b229 100644 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -179,4 +179,13 @@ right="487" name="Save_btn" width="81" /> +