From 851fef680164e3472b0516e7237bbcc4a35bc5a3 Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Tue, 28 Sep 2021 15:24:42 -0700 Subject: SL-16102 Set window title to agent name (child of SL-15999 Support for low overhead, non interactive viewer sessions) --- indra/newview/llteleporthistory.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/newview/llteleporthistory.cpp') diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index 3c3c1c96ef..b872053d3f 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -39,6 +39,11 @@ #include "llviewerregion.h" #include "llworldmap.h" #include "llagentui.h" +#include "llwindow.h" +#include "llviewerwindow.h" +#include "llavatarname.h" +#include "llavatarnamecache.h" + ////////////////////////////////////////////////////////////////////////////// // LLTeleportHistoryItem @@ -174,6 +179,28 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) if (!mGotInitialUpdate) mGotInitialUpdate = true; + // update Viewer window title with username and region name + // if we are in "non-interactive mode" (SL-15999) or the debug + // setting to allow it is enabled (may be useful in other situations) + if (gNonInteractive || gSavedSettings.getBOOL("UpdateAppWindowTitleBar")) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(gAgent.getID(), &av_name)) + { + if (gAgent.getRegion() && gViewerWindow && gViewerWindow->getWindow()) + { + std::string region = gAgent.getRegion()->getName(); + std::string username = av_name.getUserName(); + + // this first pass simply displays username and region name + // but could easily be extended to include other details like + // X/Y/Z location within a region etc. + std::string new_title = STRINGIZE(username << " @ " << region); + gViewerWindow->getWindow()->setTitle(new_title); + } + } + } + // Signal the interesting party that we've changed. onHistoryChanged(); } -- cgit v1.2.3 From f3743b8e3092daabf5c5324626c4f04f36ff5bd7 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 1 Oct 2021 16:39:56 +0300 Subject: SL-15999 use callback for updating window title --- indra/newview/llteleporthistory.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'indra/newview/llteleporthistory.cpp') diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index b872053d3f..3ece12931c 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -118,6 +118,20 @@ void LLTeleportHistory::handleLoginComplete() updateCurrentLocation(gAgent.getPositionGlobal()); } +static void on_avatar_name_update_title(const LLAvatarName& av_name) +{ + if (gAgent.getRegion() && gViewerWindow && gViewerWindow->getWindow()) + { + std::string region = gAgent.getRegion()->getName(); + std::string username = av_name.getUserName(); + + // this first pass simply displays username and region name + // but could easily be extended to include other details like + // X/Y/Z location within a region etc. + std::string new_title = STRINGIZE(username << " @ " << region); + gViewerWindow->getWindow()->setTitle(new_title); + } +} void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) { @@ -184,21 +198,7 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) // setting to allow it is enabled (may be useful in other situations) if (gNonInteractive || gSavedSettings.getBOOL("UpdateAppWindowTitleBar")) { - LLAvatarName av_name; - if (LLAvatarNameCache::get(gAgent.getID(), &av_name)) - { - if (gAgent.getRegion() && gViewerWindow && gViewerWindow->getWindow()) - { - std::string region = gAgent.getRegion()->getName(); - std::string username = av_name.getUserName(); - - // this first pass simply displays username and region name - // but could easily be extended to include other details like - // X/Y/Z location within a region etc. - std::string new_title = STRINGIZE(username << " @ " << region); - gViewerWindow->getWindow()->setTitle(new_title); - } - } + LLAvatarNameCache::get(gAgent.getID(), boost::bind(&on_avatar_name_update_title, _2)); } // Signal the interesting party that we've changed. -- cgit v1.2.3