From dcbdb1fee553dd3877447b659e35e158fabc0c47 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Thu, 22 Jul 2010 17:35:35 +0100 Subject: EXT-1579 FIXED Show icons representing permissions granted in friends list on roll-over. Needs new icon artwork, currently reusing old 1.23 icons. --- indra/newview/app_settings/settings.xml | 11 +++ indra/newview/llavatarlist.cpp | 17 ++++ indra/newview/llavatarlist.h | 5 +- indra/newview/llavatarlistitem.cpp | 99 ++++++++++++++++++---- indra/newview/llavatarlistitem.h | 28 ++++++ indra/newview/llcallingcard.h | 2 +- indra/newview/llpanelpeople.cpp | 10 +++ indra/newview/skins/default/textures/textures.xml | 7 +- .../xui/en/menu_people_friends_view_sort.xml | 8 ++ .../default/xui/en/panel_avatar_list_item.xml | 48 ++++++++++- .../newview/skins/default/xui/en/panel_people.xml | 2 + 11 files changed, 216 insertions(+), 21 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 810b2d9a1d..6710a22a76 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8834,6 +8834,17 @@ Value 1 + FriendsListShowPermissions + + Comment + Show/hide permission icons in the friend list + Persist + 1 + Type + Boolean + Value + 1 + NearbyListShowIcons Comment diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 76ad9b4afb..f0ae5f3ba5 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -90,6 +90,20 @@ void LLAvatarList::setSpeakingIndicatorsVisible(bool visible) } } +void LLAvatarList::showPermissions(bool visible) +{ + // Save the value for new items to use. + mShowPermissions = visible; + + // Enable or disable showing permissions icons for all existing items. + std::vector items; + getItems(items); + for(std::vector::const_iterator it = items.begin(), end_it = items.end(); it != end_it; ++it) + { + static_cast(*it)->setShowPermissions(mShowPermissions); + } +} + static bool findInsensitive(std::string haystack, const std::string& needle_upper) { LLStringUtil::toUpper(haystack); @@ -107,6 +121,7 @@ LLAvatarList::Params::Params() , show_info_btn("show_info_btn", true) , show_profile_btn("show_profile_btn", true) , show_speaking_indicator("show_speaking_indicator", true) +, show_permissions_granted("show_permissions_granted", false) { } @@ -121,6 +136,7 @@ LLAvatarList::LLAvatarList(const Params& p) , mShowInfoBtn(p.show_info_btn) , mShowProfileBtn(p.show_profile_btn) , mShowSpeakingIndicator(p.show_speaking_indicator) +, mShowPermissions(p.show_permissions_granted) { setCommitOnSelectionChange(true); @@ -377,6 +393,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is item->setShowInfoBtn(mShowInfoBtn); item->setShowProfileBtn(mShowProfileBtn); item->showSpeakingIndicator(mShowSpeakingIndicator); + item->setShowPermissions(mShowPermissions); item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoucleClicked, this, _1, _2, _3, _4)); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 84800842e9..823c586feb 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -54,7 +54,8 @@ public: show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class show_info_btn, show_profile_btn, - show_speaking_indicator; + show_speaking_indicator, + show_permissions_granted; Params(); }; @@ -78,6 +79,7 @@ public: void toggleIcons(); void setSpeakingIndicatorsVisible(bool visible); + void showPermissions(bool visible); void sortByName(); void setShowIcons(std::string param_name); bool getIconsVisible() const { return mShowIcons; } @@ -115,6 +117,7 @@ private: bool mShowInfoBtn; bool mShowProfileBtn; bool mShowSpeakingIndicator; + bool mShowPermissions; LLTimer* mLITUpdateTimer; // last interaction time update timer std::string mIconParamName; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 706f20404d..a93c2a0a64 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -60,12 +60,17 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) mAvatarIcon(NULL), mAvatarName(NULL), mLastInteractionTime(NULL), + mPermissionOnline(NULL), + mPermissionMap(NULL), + mPermissionEditMine(NULL), + mPermissionEditTheirs(NULL), mSpeakingIndicator(NULL), mInfoBtn(NULL), mProfileBtn(NULL), mOnlineStatus(E_UNKNOWN), mShowInfoBtn(true), - mShowProfileBtn(true) + mShowProfileBtn(true), + mShowPermissions(false) { if (not_from_ui_factory) { @@ -86,7 +91,16 @@ BOOL LLAvatarListItem::postBuild() mAvatarIcon = getChild("avatar_icon"); mAvatarName = getChild("avatar_name"); mLastInteractionTime = getChild("last_interaction"); - + + mPermissionOnline = getChild("permission_online_icon"); + mPermissionMap = getChild("permission_map_icon"); + mPermissionEditMine = getChild("permission_edit_mine_icon"); + mPermissionEditTheirs = getChild("permission_edit_theirs_icon"); + mPermissionOnline->setVisible(false); + mPermissionMap->setVisible(false); + mPermissionEditMine->setVisible(false); + mPermissionEditTheirs->setVisible(false); + mSpeakingIndicator = getChild("speaking_indicator"); mInfoBtn = getChild("info_btn"); mProfileBtn = getChild("profile_btn"); @@ -125,8 +139,10 @@ void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) mInfoBtn->setVisible(mShowInfoBtn); mProfileBtn->setVisible(mShowProfileBtn); + mHovered = true; LLPanel::onMouseEnter(x, y, mask); + showPermissions(mShowPermissions); updateChildren(); } @@ -136,8 +152,10 @@ void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask) mInfoBtn->setVisible(false); mProfileBtn->setVisible(false); + mHovered = false; LLPanel::onMouseLeave(x, y, mask); + showPermissions(false); updateChildren(); } @@ -146,6 +164,12 @@ void LLAvatarListItem::changed(U32 mask) { // no need to check mAvatarId for null in this case setOnline(LLAvatarTracker::instance().isBuddyOnline(mAvatarId)); + + if (mask & LLFriendObserver::POWERS) + { + showPermissions(mShowPermissions && mHovered); + updateChildren(); + } } void LLAvatarListItem::setOnline(bool online) @@ -230,10 +254,7 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, b void LLAvatarListItem::showLastInteractionTime(bool show) { - if (show) - return; - - mLastInteractionTime->setVisible(false); + mLastInteractionTime->setVisible(show); updateChildren(); } @@ -244,17 +265,11 @@ void LLAvatarListItem::setLastInteractionTime(U32 secs_since) void LLAvatarListItem::setShowInfoBtn(bool show) { - // Already done? Then do nothing. - if(mShowInfoBtn == show) - return; mShowInfoBtn = show; } void LLAvatarListItem::setShowProfileBtn(bool show) { - // Already done? Then do nothing. - if(mShowProfileBtn == show) - return; mShowProfileBtn = show; } @@ -273,7 +288,9 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible) { // Already done? Then do nothing. if (mAvatarIcon->getVisible() == (BOOL)visible) + { return; + } // Show/hide avatar icon. mAvatarIcon->setVisible(visible); @@ -322,7 +339,7 @@ const std::string LLAvatarListItem::getAvatarName() const return mAvatarName->getValue(); } -//== PRIVATE SECITON ========================================================== +//== PRIVATE SECTION ========================================================== void LLAvatarListItem::setNameInternal(const std::string& name, const std::string& highlight) { @@ -432,10 +449,22 @@ void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item) //info btn width + padding S32 info_btn_width = avatar_item->mProfileBtn->getRect().mLeft - avatar_item->mInfoBtn->getRect().mLeft; + // edit their objects permission icon width + padding + S32 permission_edit_theirs_width = avatar_item->mInfoBtn->getRect().mLeft - avatar_item->mPermissionEditTheirs->getRect().mLeft; + + // edit my objects permission icon width + padding + S32 permission_edit_mine_width = avatar_item->mPermissionEditTheirs->getRect().mLeft - avatar_item->mPermissionEditMine->getRect().mLeft; + + // map permission icon width + padding + S32 permission_map_width = avatar_item->mPermissionEditMine->getRect().mLeft - avatar_item->mPermissionMap->getRect().mLeft; + + // online permission icon width + padding + S32 permission_online_width = avatar_item->mPermissionMap->getRect().mLeft - avatar_item->mPermissionOnline->getRect().mLeft; + // last interaction time textbox width + padding - S32 last_interaction_time_width = avatar_item->mInfoBtn->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft; + S32 last_interaction_time_width = avatar_item->mPermissionOnline->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft; - // icon width + padding + // avatar icon width + padding S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft; sLeftPadding = avatar_item->mAvatarIcon->getRect().mLeft; @@ -445,9 +474,14 @@ void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item) sChildrenWidths[--index] = icon_width; sChildrenWidths[--index] = 0; // for avatar name we don't need its width, it will be calculated as "left available space" sChildrenWidths[--index] = last_interaction_time_width; + sChildrenWidths[--index] = permission_online_width; + sChildrenWidths[--index] = permission_map_width; + sChildrenWidths[--index] = permission_edit_mine_width; + sChildrenWidths[--index] = permission_edit_theirs_width; sChildrenWidths[--index] = info_btn_width; sChildrenWidths[--index] = profile_btn_width; sChildrenWidths[--index] = speaking_indicator_width; + llassert(index == 0); } void LLAvatarListItem::updateChildren() @@ -526,6 +560,27 @@ void LLAvatarListItem::updateChildren() LL_DEBUGS("AvatarItemReshape") << "name rect after: " << name_view_rect << LL_ENDL; } +bool LLAvatarListItem::showPermissions(bool visible) +{ + const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + if(relation && visible) + { + mPermissionOnline->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); + mPermissionMap->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); + mPermissionEditMine->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); + mPermissionEditTheirs->setVisible(relation->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS)); + } + else + { + mPermissionOnline->setVisible(false); + mPermissionMap->setVisible(false); + mPermissionEditMine->setVisible(false); + mPermissionEditTheirs->setVisible(false); + } + + return NULL != relation; +} + LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_index) { LLView* child_view = mAvatarName; @@ -542,7 +597,19 @@ LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_ child_view = mLastInteractionTime; break; case ALIC_SPEAKER_INDICATOR: - child_view = mSpeakingIndicator; + child_view = mSpeakingIndicator; + break; + case ALIC_PERMISSION_ONLINE: + child_view = mPermissionOnline; + break; + case ALIC_PERMISSION_MAP: + child_view = mPermissionMap; + break; + case ALIC_PERMISSION_EDIT_MINE: + child_view = mPermissionEditMine; + break; + case ALIC_PERMISSION_EDIT_THEIRS: + child_view = mPermissionEditTheirs; break; case ALIC_INFO_BUTTON: child_view = mInfoBtn; diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index e252e69ea9..e89b85ac8a 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -36,6 +36,7 @@ #include "llcallingcard.h" // for LLFriendObserver class LLAvatarIconCtrl; +class LLIconCtrl; class LLAvatarListItem : public LLPanel, public LLFriendObserver { @@ -94,6 +95,7 @@ public: void setShowProfileBtn(bool show); void setShowInfoBtn(bool show); void showSpeakingIndicator(bool show); + void setShowPermissions(bool show) { mShowPermissions = show; }; void showLastInteractionTime(bool show); void setAvatarIconVisible(bool visible); @@ -113,6 +115,15 @@ protected: LLAvatarIconCtrl* mAvatarIcon; + /// Indicator for permission to see me online. + LLIconCtrl* mPermissionOnline; + /// Indicator for permission to see my position on the map. + LLIconCtrl* mPermissionMap; + /// Indicator for permission to edit my objects. + LLIconCtrl* mPermissionEditMine; + /// Indicator for permission to edit their objects. + LLIconCtrl* mPermissionEditTheirs; + private: typedef enum e_online_status { @@ -132,6 +143,10 @@ private: ALIC_SPEAKER_INDICATOR, ALIC_PROFILE_BUTTON, ALIC_INFO_BUTTON, + ALIC_PERMISSION_EDIT_THEIRS, + ALIC_PERMISSION_EDIT_MINE, + ALIC_PERMISSION_MAP, + ALIC_PERMISSION_ONLINE, ALIC_INTERACTION_TIME, ALIC_NAME, ALIC_ICON, @@ -158,6 +173,13 @@ private: */ void updateChildren(); + /** + * Update visibility of active permissions icons. + * + * Need to call updateChildren() afterwards to sort out their layout. + */ + bool showPermissions(bool visible); + /** * Gets child view specified by index. * @@ -181,6 +203,12 @@ private: bool mShowInfoBtn; bool mShowProfileBtn; + /// indicates whether to show icons representing permissions granted + bool mShowPermissions; + + /// true when the mouse pointer is hovering over this item + bool mHovered; + static bool sStaticInitialized; // this variable is introduced to improve code readability static S32 sLeftPadding; // padding to first left visible child (icon or name) static S32 sRightNamePadding; // right padding from name to next visible child diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h index 617f8fe27b..15ca51743a 100644 --- a/indra/newview/llcallingcard.h +++ b/indra/newview/llcallingcard.h @@ -45,7 +45,7 @@ class LLFriendObserver public: // This enumeration is a way to refer to what changed in a more // human readable format. You can mask the value provided by - // chaged() to see if the observer is interested in the change. + // changed() to see if the observer is interested in the change. enum { NONE = 0, diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index bb202c864d..196b26f3f5 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -502,8 +502,10 @@ BOOL LLPanelPeople::postBuild() mAllFriendList = getChild(FRIENDS_TAB_NAME)->getChild("avatars_all"); mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online")); mOnlineFriendList->setShowIcons("FriendsListShowIcons"); + mOnlineFriendList->showPermissions("FriendsListShowPermissions"); mAllFriendList->setNoItemsCommentText(getString("no_friends")); mAllFriendList->setShowIcons("FriendsListShowIcons"); + mAllFriendList->showPermissions("FriendsListShowPermissions"); mNearbyList = getChild(NEARBY_TAB_NAME)->getChild("avatar_list"); mNearbyList->setNoItemsCommentText(getString("no_one_near")); @@ -1206,6 +1208,14 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata) mAllFriendList->toggleIcons(); mOnlineFriendList->toggleIcons(); } + else if (chosen_item == "view_permissions") + { + bool show_permissions = !gSavedSettings.getBOOL("FriendsListShowPermissions"); + gSavedSettings.setBOOL("FriendsListShowPermissions", show_permissions); + + mAllFriendList->showPermissions(show_permissions); + mOnlineFriendList->showPermissions(show_permissions); + } } void LLPanelPeople::onGroupsViewSortMenuItemClicked(const LLSD& userdata) diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 082b37d80b..d2478a8ca5 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -358,11 +358,16 @@ with the same filename but different name + + + + + + - diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml index 92752a0fee..22796f7b68 100644 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml @@ -31,6 +31,14 @@ function="CheckControl" parameter="FriendsListShowIcons" /> + + + + diff --git a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml index 876ff9961b..7a8c6d1f2e 100644 --- a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml @@ -65,11 +65,55 @@ height="15" layout="topleft" left_pad="5" - right="-72" + right="-164" name="last_interaction" text_color="LtGray_50" value="0s" width="35" /> + + + +