CHUI-481 : WIP : Make updateSessionName() a virtual method of LLIMConversation so we can eventually call it on events
parent
7f2ea292e1
commit
ef5121ffb3
|
|
@ -508,6 +508,12 @@ void LLIMConversation::hideOrShowTitle()
|
|||
floater_contents->setShape(contents_rect);
|
||||
}
|
||||
|
||||
void LLIMConversation::updateSessionName(const std::string& name)
|
||||
{
|
||||
llinfos << "Merov debug : updateSessionName, name = " << name << llendl;
|
||||
mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name);
|
||||
}
|
||||
|
||||
void LLIMConversation::hideAllStandardButtons()
|
||||
{
|
||||
for (S32 i = 0; i < BUTTON_COUNT; i++)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ protected:
|
|||
/// Update floater header and toolbar buttons when hosted/torn off state is toggled.
|
||||
void updateHeaderAndToolbar();
|
||||
|
||||
// Update the input field help text and other places that need the session name
|
||||
virtual void updateSessionName(const std::string& name);
|
||||
|
||||
// set the enable/disable state for the Call button
|
||||
virtual void enableDisableCallBtn();
|
||||
|
||||
|
|
|
|||
|
|
@ -243,7 +243,6 @@ void LLIMFloater::initIMSession(const LLUUID& session_id)
|
|||
{
|
||||
mIsP2PChat = mSession->isP2PSessionType();
|
||||
mSessionInitialized = mSession->mSessionInitialized;
|
||||
|
||||
mDialog = mSession->mType;
|
||||
}
|
||||
}
|
||||
|
|
@ -281,7 +280,7 @@ void LLIMFloater::initIMFloater()
|
|||
else
|
||||
{
|
||||
std::string session_name(LLIMModel::instance().getName(mSessionID));
|
||||
updateSessionName(session_name, session_name);
|
||||
updateSessionName(session_name);
|
||||
|
||||
// For ad hoc conferences we should update the title with participants names.
|
||||
if ((IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID))
|
||||
|
|
@ -292,6 +291,8 @@ void LLIMFloater::initIMFloater()
|
|||
mParticipantsListRefreshConnection.disconnect();
|
||||
}
|
||||
|
||||
// CHUI-441: We shouldn't have any avatar_list anymore... see floater_im_session.xml
|
||||
// *TODO: Track and delete if not necessary anymore
|
||||
LLAvatarList* avatar_list = getChild<LLAvatarList>("speakers_list");
|
||||
mParticipantsListRefreshConnection = avatar_list->setRefreshCompleteCallback(
|
||||
boost::bind(&LLIMFloater::onParticipantsListChanged, this, _1));
|
||||
|
|
@ -525,20 +526,21 @@ void LLIMFloater::onVoiceChannelStateChanged(
|
|||
updateCallBtnState(callIsActive);
|
||||
}
|
||||
|
||||
void LLIMFloater::updateSessionName(const std::string& ui_title,
|
||||
const std::string& ui_label)
|
||||
void LLIMFloater::updateSessionName(const std::string& name)
|
||||
{
|
||||
mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + ui_label);
|
||||
setTitle(ui_title);
|
||||
LLIMConversation::updateSessionName(name);
|
||||
setTitle(name);
|
||||
}
|
||||
|
||||
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
|
||||
// Use display name for label
|
||||
updateSessionName(av_name.mDisplayName);
|
||||
|
||||
// Overwrite the floater title with the extended name
|
||||
std::string ui_title = av_name.getCompleteName();
|
||||
updateSessionName(ui_title, av_name.mDisplayName);
|
||||
setTitle(ui_title);
|
||||
mTypingStart.setArg("[NAME]", ui_title);
|
||||
}
|
||||
|
||||
|
|
@ -550,35 +552,45 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl)
|
|||
return;
|
||||
}
|
||||
|
||||
bool all_names_resolved = true;
|
||||
std::vector<LLSD> participants_uuids;
|
||||
uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string
|
||||
LLUUID unfound_id;
|
||||
|
||||
avatar_list->getValues(participants_uuids);
|
||||
|
||||
// Check whether we have all participants names in LLAvatarNameCache
|
||||
// Check participants names in LLAvatarNameCache
|
||||
for (std::vector<LLSD>::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it)
|
||||
{
|
||||
const LLUUID& id = it->asUUID();
|
||||
temp_uuids.push_back(id);
|
||||
LLAvatarName av_name;
|
||||
if (!LLAvatarNameCache::get(id, &av_name))
|
||||
{
|
||||
all_names_resolved = false;
|
||||
|
||||
// If a name is not found in cache, request it and continue the process recursively
|
||||
// until all ids are resolved into names.
|
||||
LLAvatarNameCache::get(id,
|
||||
boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list));
|
||||
break;
|
||||
// Keep the first not found avatar id
|
||||
if (unfound_id.isNull())
|
||||
{
|
||||
unfound_id = id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the participant to the list of existing names
|
||||
temp_uuids.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
if (all_names_resolved)
|
||||
if (temp_uuids.size() != 0)
|
||||
{
|
||||
// Build the session name and update it
|
||||
std::string ui_title;
|
||||
LLAvatarActions::buildResidentsString(temp_uuids, ui_title);
|
||||
updateSessionName(ui_title, ui_title);
|
||||
updateSessionName(ui_title);
|
||||
}
|
||||
|
||||
if (unfound_id.notNull())
|
||||
{
|
||||
// If a name is not found in cache, request it and continue the process recursively
|
||||
// until all ids are resolved into names.
|
||||
LLAvatarNameCache::get(unfound_id, boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ private:
|
|||
|
||||
/*virtual*/ void onClickCloseBtn();
|
||||
|
||||
// Update the window title, input field help text, etc.
|
||||
void updateSessionName(const std::string& ui_title, const std::string& ui_label);
|
||||
// Update the window title and input field help text
|
||||
/*virtual*/ void updateSessionName(const std::string& name);
|
||||
|
||||
// For display name lookups for IM window titles
|
||||
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue