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/app_settings/settings.xml | 11 +++ indra/newview/llconversationview.cpp | 81 +++++++++++++++++++--- indra/newview/llconversationview.h | 5 +- indra/newview/llfloaterimcontainer.cpp | 8 +++ .../skins/default/xui/en/menu_participant_view.xml | 13 ++++ 5 files changed, 107 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0371a819dd..1ed4528cb1 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1697,6 +1697,17 @@ Value 1 + ChatShowIcons + + Comment + Show/hide people icons in chat + Persist + 1 + Type + Boolean + Value + 1 + CheesyBeacon Comment 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 diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 5a74974302..6aaba9b59c 100644 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -83,7 +83,7 @@ public: LLConversationViewParticipant* findParticipant(const LLUUID& participant_id); void showVoiceIndicator(bool visible); - + void setIconsVisible(bool visible); virtual void refresh(); /*virtual*/ void setFlashState(bool flash_state); @@ -110,6 +110,8 @@ private: bool mIsInActiveVoiceChannel; + bool mShowIcons; + LLVoiceClientStatusObserver* mVoiceClientObserver; boost::signals2::connection mActiveVoiceChannelConnection; @@ -145,6 +147,7 @@ public: /*virtual*/ S32 getLabelXPos(); /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); void hideSpeakingIndicator(); + void setAvatarIconVisible(bool visible); protected: friend class LLUICtrlFactory; diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index f1a6ef78a6..1c9b2e6acb 100755 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -924,6 +924,10 @@ void LLFloaterIMContainer::onCustomAction(const LLSD& userdata) { setSortOrderParticipants(LLConversationFilter::SO_DISTANCE); } + if ("view_icons" == command) + { + gSavedSettings.setBOOL("ChatShowIcons", !gSavedSettings.getBOOL("ChatShowIcons")); + } if ("chat_preferences" == command) { LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance("preferences"); @@ -974,6 +978,10 @@ BOOL LLFloaterIMContainer::isActionChecked(const LLSD& userdata) { return (order.getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE); } + if ("view_icons" == command) + { + return gSavedSettings.getBOOL("ChatShowIcons"); + } if ("Translating.Enabled" == command) { return gSavedPerAccountSettings.getBOOL("TranslatingEnabled"); diff --git a/indra/newview/skins/default/xui/en/menu_participant_view.xml b/indra/newview/skins/default/xui/en/menu_participant_view.xml index 7ea87ee05c..658238bf41 100755 --- a/indra/newview/skins/default/xui/en/menu_participant_view.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_view.xml @@ -59,6 +59,19 @@ function="IMFloaterContainer.Check" parameter="sort_participants_by_recent" /> + + + + + Date: Wed, 2 Sep 2015 01:16:18 +0300 Subject: MAINT-5297 Allow global toggle of 'View People Icons' - Global switch part --HG-- branch : develop --- indra/newview/app_settings/settings.xml | 11 +++++++++ indra/newview/llavatarlist.cpp | 14 +++++++----- indra/newview/llavatarlist.h | 2 +- indra/newview/llconversationview.cpp | 4 ++-- indra/newview/llfloaterimcontainer.cpp | 5 +++-- indra/newview/llpanelpeople.cpp | 24 ++++++++++++++++---- .../default/xui/en/menu_people_friends_view.xml | 4 ++-- .../default/xui/en/menu_people_nearby_view.xml | 4 ++-- .../default/xui/en/menu_people_recent_view.xml | 4 ++-- .../default/xui/en/panel_preferences_setup.xml | 26 ++++++++++++++++++++++ 10 files changed, 78 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1ed4528cb1..96fbc8323b 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11007,6 +11007,17 @@ Value 1 + GlobalShowIconsOverride + + Comment + Show/hide people icons in any list. This option should be set back to 0 when icons are enabled locally for the lists + Persist + 1 + Type + Boolean + Value + 0 + FriendsSortOrder Comment diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 8846d1317d..c7fa375ada 100755 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -63,16 +63,18 @@ bool LLAvatarList::contains(const LLUUID& id) return std::find(ids.begin(), ids.end(), id) != ids.end(); } -void LLAvatarList::toggleIcons() +void LLAvatarList::setIconsVisible(bool visible) { + if (visible == mShowIcons) // nothing to be done here. + return; + // Save the new value for new items to use. - mShowIcons = !mShowIcons; - gSavedSettings.setBOOL(mIconParamName, mShowIcons); - + mShowIcons = visible; + // Show/hide icons for all existing items. std::vector items; getItems(items); - for( std::vector::const_iterator it = items.begin(); it != items.end(); it++) + for (std::vector::const_iterator it = items.begin(); it != items.end(); it++) { static_cast(*it)->setAvatarIconVisible(mShowIcons); } @@ -187,6 +189,8 @@ void LLAvatarList::draw() updateAvatarNames(); } + setIconsVisible(gSavedSettings.getBOOL(mIconParamName) && !gSavedSettings.getBOOL("GlobalShowIconsOverride")); + if (mDirty) refresh(); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 3542577ae3..159ff991e6 100755 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -76,7 +76,7 @@ public: void setSessionID(const LLUUID& session_id) { mSessionID = session_id; } const LLUUID& getSessionID() { return mSessionID; } - void toggleIcons(); + void setIconsVisible(bool visible); void setSpeakingIndicatorsVisible(bool visible); void showPermissions(bool visible); void sortByName(); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 924a8d7206..3a6e4c4dfe 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -503,7 +503,7 @@ void LLConversationViewSession::refresh() } } - setIconsVisible(gSavedSettings.getBOOL("ChatShowIcons")); + setIconsVisible(gSavedSettings.getBOOL("ChatShowIcons") && !gSavedSettings.getBOOL("GlobalShowIconsOverride")); requestArrange(); // Do the regular upstream refresh @@ -572,7 +572,7 @@ void LLConversationViewParticipant::initFromParams(const LLConversationViewParti BOOL LLConversationViewParticipant::postBuild() { mAvatarIcon = getChild("avatar_icon"); - mAvatarIcon->setVisible(gSavedSettings.getBOOL("ChatShowIcons")); + mAvatarIcon->setVisible(gSavedSettings.getBOOL("ChatShowIcons") && !gSavedSettings.getBOOL("GlobalShowIconsOverride")); mInfoBtn = getChild("info_btn"); mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this)); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 1c9b2e6acb..0a5a6e8e13 100755 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -926,7 +926,8 @@ void LLFloaterIMContainer::onCustomAction(const LLSD& userdata) } if ("view_icons" == command) { - gSavedSettings.setBOOL("ChatShowIcons", !gSavedSettings.getBOOL("ChatShowIcons")); + gSavedSettings.setBOOL("ChatShowIcons", !(gSavedSettings.getBOOL("ChatShowIcons") && !gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + gSavedSettings.setBOOL("GlobalShowIconsOverride", (!gSavedSettings.getBOOL("ChatShowIcons") && gSavedSettings.getBOOL("GlobalShowIconsOverride"))); } if ("chat_preferences" == command) { @@ -980,7 +981,7 @@ BOOL LLFloaterIMContainer::isActionChecked(const LLSD& userdata) } if ("view_icons" == command) { - return gSavedSettings.getBOOL("ChatShowIcons"); + return gSavedSettings.getBOOL("ChatShowIcons") && !gSavedSettings.getBOOL("GlobalShowIconsOverride"); } if ("Translating.Enabled" == command) { diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index de4efc8612..6b86459d8f 100755 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1326,8 +1326,12 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata) } else if (chosen_item == "view_icons") { - mAllFriendList->toggleIcons(); - mOnlineFriendList->toggleIcons(); + std::string param = mAllFriendList->getIconParamName(); + gSavedSettings.setBOOL(param, !(gSavedSettings.getBOOL(param) && !gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + gSavedSettings.setBOOL("GlobalShowIconsOverride", (!gSavedSettings.getBOOL(param) && gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + gSavedSettings.setBOOL(mOnlineFriendList->getIconParamName(), gSavedSettings.getBOOL(param)); + mAllFriendList->setIconsVisible(gSavedSettings.getBOOL(param)); + mOnlineFriendList->setIconsVisible(gSavedSettings.getBOOL(param)); } else if (chosen_item == "view_permissions") { @@ -1363,7 +1367,10 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata) } else if (chosen_item == "view_icons") { - mNearbyList->toggleIcons(); + std::string param = mNearbyList->getIconParamName(); + gSavedSettings.setBOOL(param, !(gSavedSettings.getBOOL(param) && !gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + gSavedSettings.setBOOL("GlobalShowIconsOverride", (!gSavedSettings.getBOOL(param) && gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + mNearbyList->setIconsVisible(gSavedSettings.getBOOL(param)); } else if (chosen_item == "sort_distance") { @@ -1382,6 +1389,8 @@ bool LLPanelPeople::onNearbyViewSortMenuItemCheck(const LLSD& userdata) return sort_order == E_SORT_BY_NAME; if (item == "sort_distance") return sort_order == E_SORT_BY_DISTANCE; + if (item == "view_icons") + return gSavedSettings.getBOOL(mNearbyList->getIconParamName()) && !gSavedSettings.getBOOL("GlobalShowIconsOverride"); return false; } @@ -1400,7 +1409,10 @@ void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata) } else if (chosen_item == "view_icons") { - mRecentList->toggleIcons(); + std::string param = mRecentList->getIconParamName(); + gSavedSettings.setBOOL(param, !(gSavedSettings.getBOOL(param) && !gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + gSavedSettings.setBOOL("GlobalShowIconsOverride", (!gSavedSettings.getBOOL(param) && gSavedSettings.getBOOL("GlobalShowIconsOverride"))); + mRecentList->setIconsVisible(gSavedSettings.getBOOL(param)); } } @@ -1413,6 +1425,8 @@ bool LLPanelPeople::onFriendsViewSortMenuItemCheck(const LLSD& userdata) return sort_order == E_SORT_BY_NAME; if (item == "sort_status") return sort_order == E_SORT_BY_STATUS; + if (item == "view_icons") + return gSavedSettings.getBOOL(mAllFriendList->getIconParamName()) && !gSavedSettings.getBOOL("GlobalShowIconsOverride"); return false; } @@ -1426,6 +1440,8 @@ bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata) return sort_order == E_SORT_BY_MOST_RECENT; if (item == "sort_name") return sort_order == E_SORT_BY_NAME; + if (item == "view_icons") + return gSavedSettings.getBOOL(mRecentList->getIconParamName()) && !gSavedSettings.getBOOL("GlobalShowIconsOverride"); return false; } diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view.xml index 8790fde7c5..02c6cfc006 100755 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view.xml +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view.xml @@ -29,8 +29,8 @@ function="People.Friends.ViewSort.Action" parameter="view_icons" /> + function="People.Friends.ViewSort.CheckItem" + parameter="view_icons" /> + function="People.Nearby.ViewSort.CheckItem" + parameter="view_icons"/> + function="People.Recent.ViewSort.CheckItem" + parameter="view_icons" /> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index b201e071ef..a8be517f3c 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -313,4 +313,30 @@ + + People Icons: + + -- cgit v1.2.3