From c16591c046fa76fc5d13387efa3bcaec3422e593 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 12 Feb 2010 16:12:12 -0800 Subject: Per-avatar customizable icons next to name links in text Changed LLUrlEntryAgent callbacks to handle both link label and icon Eliminated legacy LLNameCache file loading Reviewed with Kelly --- indra/newview/llappviewer.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 00a9e4d745..ba2e13da9d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1298,8 +1298,7 @@ bool LLAppViewer::cleanup() LLPolyMesh::freeAllMeshes(); - delete gCacheName; - gCacheName = NULL; + LLStartUp::cleanupNameCache(); // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be deleted. @@ -3337,15 +3336,6 @@ void LLAppViewer::loadNameCache() { if(gCacheName->importFile(cache_file)) return; } - - // Try to load from the legacy format. This should go away after a - // while. Phoenix 2008-01-30 - LLFILE* name_cache_fp = LLFile::fopen(name_cache, "r"); // Flawfinder: ignore - if (name_cache_fp) - { - gCacheName->importFile(name_cache_fp); - fclose(name_cache_fp); - } } void LLAppViewer::saveNameCache() -- cgit v1.2.3 From 55bfb4435e1a2ffc34578bf30877eb24a5edaa29 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 17 Feb 2010 16:55:58 -0800 Subject: Look up display names via a web service Also removed unused LLComboBox globals to reduce llappviewer.cpp include file burden. Review pending --- indra/newview/llappviewer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ba2e13da9d..62b8b972b6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -85,6 +85,7 @@ #include "llsecondlifeurls.h" // Linden library includes +#include "llavatarnamecache.h" #include "llimagej2c.h" #include "llmemory.h" #include "llprimitive.h" @@ -157,7 +158,6 @@ // Included so that constants/settings might be initialized // in save_settings_to_globals() #include "llbutton.h" -#include "llcombobox.h" #include "llstatusbar.h" #include "llsurface.h" #include "llvosky.h" @@ -399,9 +399,6 @@ static void settings_to_globals() MENU_BAR_HEIGHT = gSavedSettings.getS32("MenuBarHeight"); MENU_BAR_WIDTH = gSavedSettings.getS32("MenuBarWidth"); - LLCOMBOBOX_HEIGHT = BTN_HEIGHT - 2; - LLCOMBOBOX_WIDTH = 128; - LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize")); LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic"); @@ -3897,6 +3894,8 @@ void LLAppViewer::idleNetwork() // deal with any queued name requests and replies. gCacheName->processPending(); + LLAvatarNameCache::idle(); + llpushcallstacks ; LLTimer check_message_timer; // Read all available packets from network -- cgit v1.2.3 From d38727e47ba5d7dd449c6ba62ac6c988ac66236f Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 19 Apr 2010 11:26:30 -0700 Subject: DEV-47529 Viewer refresh name lookup cap URL on region cross/teleport Reviewed with Kelly --- indra/newview/llappviewer.cpp | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 02902bc8a5..409146c4a3 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3541,9 +3541,10 @@ void LLAppViewer::idle() // NOTE: Starting at this point, we may still have pointers to "dead" objects // floating throughout the various object lists. // + idleNameCache(); idleNetwork(); - + // Check for away from keyboard, kick idle agents. idle_afk_check(); @@ -3878,6 +3879,41 @@ void LLAppViewer::sendLogoutRequest() } } +void LLAppViewer::idleNameCache() +{ + // Neither old nor new name cache can function before agent has a region + LLViewerRegion* region = gAgent.getRegion(); + if (!region) return; + + // deal with any queued name requests and replies. + gCacheName->processPending(); + + // Agent may have moved to a different region, so need to update cap URL + // for name lookups. Can't do this in the cap grant code, as caps are + // granted to neighbor regions before the main agent gets there. Can't + // do it in the move-into-region code because cap not guaranteed to be + // granted yet, for example on teleport. + std::string name_lookup_url; + name_lookup_url.reserve(128); // avoid a memory allocation below + name_lookup_url = region->getCapability("GetDisplayNames"); + + // Ensure capability has been granted + U32 url_size = name_lookup_url.size(); + if (url_size > 0) + { + // capabilities require URLs with slashes before query params: + // https://:/cap//?ids= + // but the caps are granted like: + // https://:/cap/ + if (name_lookup_url[url_size-1] != '/') + { + name_lookup_url += '/'; + } + LLAvatarNameCache::setNameLookupURL(name_lookup_url); + } + LLAvatarNameCache::idle(); +} + // // Handle messages, and all message related stuff // @@ -3905,10 +3941,6 @@ void LLAppViewer::idleNetwork() { LLFastTimer t(FTM_IDLE_NETWORK); // decode - // deal with any queued name requests and replies. - gCacheName->processPending(); - LLAvatarNameCache::idle(); - llpushcallstacks ; LLTimer check_message_timer; // Read all available packets from network -- cgit v1.2.3 From 022a598694cd37bebff3322054324c7d27afd5ff Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 20 Apr 2010 17:05:49 -0700 Subject: Viewer caches avatar display names between sessions Reviewed with Simon --- indra/newview/llappviewer.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 409146c4a3..ac9672858d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3333,6 +3333,15 @@ void LLAppViewer::saveFinalSnapshot() void LLAppViewer::loadNameCache() { + // display names cache + std::string filename = + gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); + llifstream name_cache_stream(filename); + if(name_cache_stream.is_open()) + { + LLAvatarNameCache::importFile(name_cache_stream); + } + if (!gCacheName) return; std::string name_cache; @@ -3346,6 +3355,15 @@ void LLAppViewer::loadNameCache() void LLAppViewer::saveNameCache() { + // display names cache + std::string filename = + gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); + llofstream name_cache_stream(filename); + if(name_cache_stream.is_open()) + { + LLAvatarNameCache::exportFile(name_cache_stream); + } + if (!gCacheName) return; std::string name_cache; -- cgit v1.2.3 From 98f5fc5ff006a82cacde47de0cbb564b6e703597 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 22 Apr 2010 14:13:45 -0700 Subject: DEV-47529 Turn off display names if no capability from simulator, and Display name update broadcasts entire new name record to nearby viewers Display name update directly inserts new name into sim cache indra.xml has display_names_enabled setting to control cap Synchronized viewer and server versions of avatar name cache Reviewed with Ambroff --- indra/newview/llappviewer.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ac9672858d..e160951b91 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3906,6 +3906,11 @@ void LLAppViewer::idleNameCache() // deal with any queued name requests and replies. gCacheName->processPending(); + // Can't run the new cache until we have the list of capabilities + // for the agent region, and can therefore decide whether to use + // display names or fall back to the old name system. + if (!region->capabilitiesReceived()) return; + // Agent may have moved to a different region, so need to update cap URL // for name lookups. Can't do this in the cap grant code, as caps are // granted to neighbor regions before the main agent gets there. Can't @@ -3914,21 +3919,26 @@ void LLAppViewer::idleNameCache() std::string name_lookup_url; name_lookup_url.reserve(128); // avoid a memory allocation below name_lookup_url = region->getCapability("GetDisplayNames"); - - // Ensure capability has been granted - U32 url_size = name_lookup_url.size(); - if (url_size > 0) - { - // capabilities require URLs with slashes before query params: - // https://:/cap//?ids= - // but the caps are granted like: - // https://:/cap/ - if (name_lookup_url[url_size-1] != '/') - { - name_lookup_url += '/'; - } + if (!name_lookup_url.empty()) + { + // we have support for display names, use it + U32 url_size = name_lookup_url.size(); + // capabilities require URLs with slashes before query params: + // https://:/cap//?ids= + // but the caps are granted like: + // https://:/cap/ + if (url_size > 0 && name_lookup_url[url_size-1] != '/') + { + name_lookup_url += '/'; + } LLAvatarNameCache::setNameLookupURL(name_lookup_url); } + else + { + // Display names not available on this region + LLAvatarNameCache::setNameLookupURL( std::string() ); + } + LLAvatarNameCache::idle(); } -- cgit v1.2.3 From d89de271437f35f9d26e28409e6cc1d593a2fc7a Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 26 Apr 2010 10:51:42 -0700 Subject: DEV-47529 Viewer turns display names on/off based on region capability Also refreshes name tags so you can see the state. Reviewed with Kelly. --- indra/newview/llappviewer.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e160951b91..3b236676f1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3919,7 +3919,8 @@ void LLAppViewer::idleNameCache() std::string name_lookup_url; name_lookup_url.reserve(128); // avoid a memory allocation below name_lookup_url = region->getCapability("GetDisplayNames"); - if (!name_lookup_url.empty()) + bool have_capability = !name_lookup_url.empty(); + if (have_capability) { // we have support for display names, use it U32 url_size = name_lookup_url.size(); @@ -3939,6 +3940,21 @@ void LLAppViewer::idleNameCache() LLAvatarNameCache::setNameLookupURL( std::string() ); } + // Error recovery - did we change state? + if (LLAvatarNameCache::useDisplayNames() && !have_capability) + { + // ...we just lost the capability, turn names off + LLAvatarNameCache::setUseDisplayNames(false); + // name tags are persistant on screen, so make sure they refresh + LLVOAvatar::invalidateNameTags(); + } + else if (!LLAvatarNameCache::useDisplayNames() && have_capability) + { + // ...we just gained the capability, turn names on + LLAvatarNameCache::setUseDisplayNames(true); + LLVOAvatar::invalidateNameTags(); + } + LLAvatarNameCache::idle(); } -- cgit v1.2.3 From 56f5a6909d8a665531e3f6ede380cad57e313728 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 27 Apr 2010 13:54:40 -0700 Subject: Menu item to disable display names for testing works again Start up cache in not-running state on viewer. Set cache running when idle() is called. Explicitly refresh name tags when toggled. Reviewed with Simon --- indra/newview/llappviewer.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3b236676f1..5df6776fa7 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3916,6 +3916,7 @@ void LLAppViewer::idleNameCache() // granted to neighbor regions before the main agent gets there. Can't // do it in the move-into-region code because cap not guaranteed to be // granted yet, for example on teleport. + bool had_capability = LLAvatarNameCache::hasNameLookupURL(); std::string name_lookup_url; name_lookup_url.reserve(128); // avoid a memory allocation below name_lookup_url = region->getCapability("GetDisplayNames"); @@ -3941,19 +3942,11 @@ void LLAppViewer::idleNameCache() } // Error recovery - did we change state? - if (LLAvatarNameCache::useDisplayNames() && !have_capability) + if (had_capability != have_capability) { - // ...we just lost the capability, turn names off - LLAvatarNameCache::setUseDisplayNames(false); // name tags are persistant on screen, so make sure they refresh LLVOAvatar::invalidateNameTags(); } - else if (!LLAvatarNameCache::useDisplayNames() && have_capability) - { - // ...we just gained the capability, turn names on - LLAvatarNameCache::setUseDisplayNames(true); - LLVOAvatar::invalidateNameTags(); - } LLAvatarNameCache::idle(); } -- cgit v1.2.3