summaryrefslogtreecommitdiff
path: root/indra/newview/llcallfloater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llcallfloater.cpp')
-rw-r--r--indra/newview/llcallfloater.cpp92
1 files changed, 61 insertions, 31 deletions
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index a03fe79512..078bd73379 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -3,43 +3,38 @@
* @author Mike Antipov
* @brief Voice Control Panel in a Voice Chats (P2P, Group, Nearby...).
*
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- *
- * Copyright (c) 2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
* 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
+ * 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.
*
- * 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
+ * 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.
*
- * 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.
+ * 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
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#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"
@@ -50,6 +45,7 @@
#include "llspeakers.h"
#include "lltextutil.h"
#include "lltransientfloatermgr.h"
+#include "llviewerdisplayname.h"
#include "llviewerwindow.h"
#include "llvoicechannel.h"
#include "llviewerparcelmgr.h"
@@ -83,7 +79,8 @@ public:
void setName(const std::string& name)
{
const std::string& formatted_phone = LLTextUtil::formatPhoneNumber(name);
- LLAvatarListItem::setName(formatted_phone);
+ LLAvatarListItem::setAvatarName(formatted_phone);
+ LLAvatarListItem::setAvatarToolTip(formatted_phone);
}
void setSpeakerId(const LLUUID& id) { mSpeakingIndicator->setSpeakerId(id); }
@@ -118,6 +115,11 @@ LLCallFloater::LLCallFloater(const LLSD& key)
// force docked state since this floater doesn't save it between recreations
setDocked(true);
+
+ // update the agent's name if display name setting change
+ LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLCallFloater::updateAgentModeratorState, this));
+ LLViewerDisplayName::addNameChangedCallback(boost::bind(&LLCallFloater::updateAgentModeratorState, this));
+
}
LLCallFloater::~LLCallFloater()
@@ -147,7 +149,7 @@ BOOL LLCallFloater::postBuild()
childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this));
- mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller");
+ mNonAvatarCaller = findChild<LLNonAvatarCaller>("non_avatar_caller");
mNonAvatarCaller->setVisible(FALSE);
LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_flyout_btn");
@@ -374,9 +376,31 @@ void LLCallFloater::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)
call_floater->connectToChannel(channel);
}
+void LLCallFloater::onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name)
+{
+ LLStringUtil::format_map_t args;
+ args["[NAME]"] = av_name.getCompleteName();
+ std::string title = getString("title_peer_2_peer", args);
+ setTitle(title);
+}
+
void LLCallFloater::updateTitle()
{
LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
+ if (mVoiceType == VC_PEER_TO_PEER)
+ {
+ LLUUID session_id = voice_channel->getSessionID();
+ LLIMModel::LLIMSession* im_session =
+ LLIMModel::getInstance()->findIMSession(session_id);
+ if (im_session)
+ {
+ LLAvatarNameCache::get(im_session->mOtherParticipantID,
+ boost::bind(&LLCallFloater::onAvatarNameCache,
+ this, _1, _2));
+ return;
+ }
+ }
std::string title;
switch (mVoiceType)
{
@@ -421,9 +445,10 @@ void LLCallFloater::initAgentData()
{
mAgentPanel->getChild<LLUICtrl>("user_icon")->setValue(gAgentID);
- std::string name;
- gCacheName->getFullName(gAgentID, name);
- mAgentPanel->getChild<LLUICtrl>("user_text")->setValue(name);
+ // Just use display name, because it's you
+ LLAvatarName av_name;
+ LLAvatarNameCache::get( gAgentID, &av_name );
+ mAgentPanel->getChild<LLUICtrl>("user_text")->setValue(av_name.mDisplayName);
mSpeakingIndicator = mAgentPanel->getChild<LLOutputMonitorCtrl>("speaking_indicator");
mSpeakingIndicator->setSpeakerId(gAgentID);
@@ -441,12 +466,12 @@ void LLCallFloater::setModeratorMutedVoice(bool moderator_muted)
mSpeakingIndicator->setIsMuted(moderator_muted);
}
-void LLCallFloater::updateAgentModeratorState()
+void LLCallFloater::onModeratorNameCache(const LLAvatarName& av_name)
{
std::string name;
- gCacheName->getFullName(gAgentID, name);
+ name = av_name.mDisplayName;
- if(gAgent.isInGroup(mSpeakerManager->getSessionID()))
+ if(mSpeakerManager && gAgent.isInGroup(mSpeakerManager->getSessionID()))
{
// This method can be called when LLVoiceChannel.mState == STATE_NO_CHANNEL_INFO
// in this case there are not any speakers yet.
@@ -464,6 +489,11 @@ void LLCallFloater::updateAgentModeratorState()
mAgentPanel->getChild<LLUICtrl>("user_text")->setValue(name);
}
+void LLCallFloater::updateAgentModeratorState()
+{
+ LLAvatarNameCache::get(gAgentID, boost::bind(&LLCallFloater::onModeratorNameCache, this, _2));
+}
+
static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids)
{
// Get a list of participants from VoiceClient