diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-07-22 17:35:35 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-07-22 17:35:35 +0100 |
commit | dcbdb1fee553dd3877447b659e35e158fabc0c47 (patch) | |
tree | e26019d661a5614383cd84e8cee84c6ef91dfe0e /indra | |
parent | 047b74c4f4727c41ae1086d18a12a9cf5aad5fce (diff) |
EXT-1579 FIXED Show icons representing permissions granted in friends list on roll-over.
Needs new icon artwork, currently reusing old 1.23 icons.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llavatarlist.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llavatarlist.h | 5 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 99 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 28 | ||||
-rw-r--r-- | indra/newview/llcallingcard.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 10 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_avatar_list_item.xml | 48 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_people.xml | 2 |
11 files changed, 216 insertions, 21 deletions
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 @@ <key>Value</key> <integer>1</integer> </map> + <key>FriendsListShowPermissions</key> + <map> + <key>Comment</key> + <string>Show/hide permission icons in the friend list</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>NearbyListShowIcons</key> <map> <key>Comment</key> 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<LLPanel*> items; + getItems(items); + for(std::vector<LLPanel*>::const_iterator it = items.begin(), end_it = items.end(); it != end_it; ++it) + { + static_cast<LLAvatarListItem*>(*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<LLAvatarIconCtrl>("avatar_icon"); mAvatarName = getChild<LLTextBox>("avatar_name"); mLastInteractionTime = getChild<LLTextBox>("last_interaction"); - + + mPermissionOnline = getChild<LLIconCtrl>("permission_online_icon"); + mPermissionMap = getChild<LLIconCtrl>("permission_map_icon"); + mPermissionEditMine = getChild<LLIconCtrl>("permission_edit_mine_icon"); + mPermissionEditTheirs = getChild<LLIconCtrl>("permission_edit_theirs_icon"); + mPermissionOnline->setVisible(false); + mPermissionMap->setVisible(false); + mPermissionEditMine->setVisible(false); + mPermissionEditTheirs->setVisible(false); + mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator"); mInfoBtn = getChild<LLButton>("info_btn"); mProfileBtn = getChild<LLButton>("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, @@ -159,6 +174,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. * * This method implemented via switch by all EAvatarListItemChildIndex values. @@ -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<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("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<LLPanel>(NEARBY_TAB_NAME)->getChild<LLAvatarList>("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 <texture name="Pause_Off" file_name="icons/Pause_Off.png" preload="false" /> <texture name="Pause_Over" file_name="icons/Pause_Over.png" preload="false" /> <texture name="Pause_Press" file_name="icons/Pause_Press.png" preload="false" /> + + <texture name="Permission_Visible_Online" file_name="ff_visible_online_button.tga" preload="false" /> + <texture name="Permission_Visible_Map" file_name="ff_visible_map_button.tga" preload="false" /> + <texture name="Permission_Edit_Objects_Mine" file_name="ff_edit_mine_button.tga" preload="false" /> + <texture name="Permission_Edit_Objects_Theirs" file_name="ff_edit_theirs_button.tga" preload="false" /> + <texture name="Play_Off" file_name="icons/Play_Off.png" preload="false" /> <texture name="Play_Over" file_name="icons/Play_Over.png" preload="false" /> <texture name="Play_Press" file_name="icons/Play_Press.png" preload="false" /> - <texture name="ProgressBar" file_name="widgets/ProgressBar.png" preload="true" scale.left="4" scale.top="10" scale.right="48" scale.bottom="2" /> <texture name="ProgressTrack" file_name="widgets/ProgressTrack.png" preload="true" scale.left="4" scale.top="13" scale.right="148" scale.bottom="2" /> 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" /> </menu_item_check> + <menu_item_check name="view_permissions" label="View Permissions Granted"> + <menu_item_check.on_click + function="People.Friends.ViewSort.Action" + parameter="view_permissions" /> + <menu_item_check.on_check + function="CheckControl" + parameter="FriendsListShowPermissions" /> + </menu_item_check> <menu_item_separator layout="topleft" /> <menu_item_call name="show_blocked_list" label="Show Blocked Residents & Objects"> <menu_item_call.on_click function="SideTray.ShowPanel" parameter="panel_block_list_sidetray" /> 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" /> + <icon + height="20" + follows="right" + image_name="Permission_Visible_Online" + layout="topleft" + left_pad="3" + right="-141" + name="permission_online_icon" + tool_tip="This friend can see when you're online" + top="2" + width="20" /> + <icon + height="20" + follows="right" + image_name="Permission_Visible_Map" + layout="topleft" + left_pad="3" + tool_tip="This friend can locate you on the map" + right="-118" + name="permission_map_icon" + top_delta="0" + width="20" /> + <icon + height="20" + follows="right" + image_name="Permission_Edit_Objects_Mine" + layout="topleft" + left_pad="3" + right="-95" + name="permission_edit_mine_icon" + tool_tip="This friend can edit, delete or take your objects" + top_delta="0" + width="20" /> + <icon + height="20" + follows="right" + image_name="Permission_Edit_Objects_Theirs" + layout="topleft" + left_pad="3" + right="-72" + name="permission_edit_theirs_icon" + tool_tip="You can edit this friend's objects" + top_delta="0" + width="20" /> <button follows="right" height="16" @@ -79,7 +123,7 @@ left_pad="3" right="-53" name="info_btn" - top_delta="-2" + top_delta="2" width="16" /> <button follows="right" diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 7cd0d5b5f0..12bb4cc8c6 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -192,6 +192,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M left="0" multi_select="true" name="avatars_online" + show_permissions_granted="true" top="0" width="307" /> </accordion_tab> @@ -208,6 +209,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M left="0" multi_select="true" name="avatars_all" + show_permissions_granted="true" top="0" width="307" /> </accordion_tab> |