From 540493b315d8b8380b4c0bc63e7021ad499a62f8 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Tue, 1 Sep 2015 23:16:58 +0300 Subject: MAINT-5297 Allow global toggle of 'View People Icons' - Chat window part --HG-- branch : develop --- indra/newview/llconversationview.cpp | 81 +++++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 10 deletions(-) (limited to 'indra/newview/llconversationview.cpp') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index b18e543f0a..924a8d7206 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -85,7 +85,8 @@ LLConversationViewSession::LLConversationViewSession(const LLConversationViewSes mHasArrow(true), mIsInActiveVoiceChannel(false), mFlashStateOn(false), - mFlashStarted(false) + mFlashStarted(false), + mShowIcons(true) { mFlashTimer = new LLFlashTimer(); } @@ -173,7 +174,7 @@ BOOL LLConversationViewSession::postBuild() if (session) { LLAvatarIconCtrl* icon = mItemPanel->getChild("avatar_icon"); - icon->setVisible(true); + icon->setVisible(mShowIcons); icon->setValue(session->mOtherParticipantID); mSpeakingIndicator->setSpeakerId(gAgentID, session->mSessionID, true); mHasArrow = false; @@ -426,6 +427,49 @@ void LLConversationViewSession::showVoiceIndicator(bool visible) requestArrange(); } +void LLConversationViewSession::setIconsVisible(bool visible) +{ + if (visible == mShowIcons) // nothing to be done here. + return; + + // Save the new value for new items to use. + mShowIcons = visible; + + // Show/hide icons for the 1-n-1 chat. + LLConversationItem* vmi = dynamic_cast(getViewModelItem()); + if (vmi) + { + switch (vmi->getType()) + { + case LLConversationItem::CONV_PARTICIPANT: + case LLConversationItem::CONV_SESSION_1_ON_1: + { + LLIconCtrl* icon = mItemPanel->getChild("avatar_icon"); + icon->setVisible(mShowIcons); + break; + } + /* + case LLConversationItem::CONV_SESSION_AD_HOC: + case LLConversationItem::CONV_SESSION_GROUP: + { + LLIconCtrl* icon = mItemPanel->getChild("group_icon"); + icon->setVisible(mShowIcons); + break; + } + */ + default: + break; + } + } + + // Show/hide icons for all existing items. + items_t::const_iterator iter; + for (iter = getItemsBegin(); iter != getItemsEnd(); iter++) + { + dynamic_cast(*iter)->setAvatarIconVisible(mShowIcons); + } +} + void LLConversationViewSession::refresh() { // Refresh the session view from its model data @@ -458,6 +502,9 @@ void LLConversationViewSession::refresh() } } } + + setIconsVisible(gSavedSettings.getBOOL("ChatShowIcons")); + requestArrange(); // Do the regular upstream refresh LLFolderViewFolder::refresh(); @@ -509,7 +556,7 @@ void LLConversationViewParticipant::initFromParams(const LLConversationViewParti LLAvatarIconCtrl::Params avatar_icon_params(params.avatar_icon()); applyXUILayout(avatar_icon_params, this); LLAvatarIconCtrl * avatarIcon = LLUICtrlFactory::create(avatar_icon_params); - addChild(avatarIcon); + addChild(avatarIcon); LLButton::Params info_button_params(params.info_button()); applyXUILayout(info_button_params, this); @@ -525,6 +572,7 @@ void LLConversationViewParticipant::initFromParams(const LLConversationViewParti BOOL LLConversationViewParticipant::postBuild() { mAvatarIcon = getChild("avatar_icon"); + mAvatarIcon->setVisible(gSavedSettings.getBOOL("ChatShowIcons")); mInfoBtn = getChild("info_btn"); mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this)); @@ -588,12 +636,12 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height) S32 arranged = LLFolderViewItem::arrange(width, height); //Adjusts the avatar icon based upon the indentation - LLRect avatarRect(getIndentation(), - mAvatarIcon->getRect().mTop, - getIndentation() + mAvatarIcon->getRect().getWidth(), - mAvatarIcon->getRect().mBottom); - mAvatarIcon->setShape(avatarRect); - + LLRect avatarRect(getIndentation(), + mAvatarIcon->getRect().mTop, + getIndentation() + mAvatarIcon->getRect().getWidth(), + mAvatarIcon->getRect().mBottom); + mAvatarIcon->setShape(avatarRect); + //Since dimensions changed, adjust the children (info button, speaker indicator) updateChildren(); @@ -665,7 +713,7 @@ void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) S32 LLConversationViewParticipant::getLabelXPos() { - return getIndentation() + mAvatarIcon->getRect().getWidth() + mIconPad; + return getIndentation() + (mAvatarIcon->getVisible() ? mAvatarIcon->getRect().getWidth() : 0) + mIconPad; } // static @@ -744,5 +792,18 @@ void LLConversationViewParticipant::hideSpeakingIndicator() mSpeakingIndicator->setVisible(false); } +void LLConversationViewParticipant::setAvatarIconVisible(bool visible) +{ + // Already done? Then do nothing. + if (mAvatarIcon->getVisible() == (BOOL)visible) + { + return; + } + + // Show/hide avatar icon. + mAvatarIcon->setVisible(visible); + updateChildren(); +} + // EOF -- cgit v1.2.3