diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-09-07 17:55:10 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-09-07 17:55:10 +0100 |
commit | bd734e31982306f601a069dcd558b7270cd46ef9 (patch) | |
tree | 0c5222e85c8d04d57448ca35f4bcc3d52407fd5e | |
parent | ebfbaad9696ce0389ed1a9642d58dfb4a0abdc17 (diff) | |
parent | 65f0b633e0b5beeda3723708fb3f2c87e562a975 (diff) |
VWR-21253 MERGE Permission icons in the friends list
-rw-r--r-- | BuildParams | 1 | ||||
-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 |
12 files changed, 217 insertions, 21 deletions
diff --git a/BuildParams b/BuildParams index 6b7d15f6cc..b543f07501 100644 --- a/BuildParams +++ b/BuildParams @@ -56,6 +56,7 @@ viewer-release.build_viewer_update_version_manager = true viewer-development-import.build_debug_release_separately = true viewer-development-fixes.build_debug_release_separately = true +viewer-development-tweaks.build_debug_release_separately = true # ======================================= # brad diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6285df31c0..7873ab6251 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8890,6 +8890,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 1cd705c2f9..5241f20c0e 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::onItemDoubleClicked, this, _1, _2, _3, _4)); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 83faa53c28..9d3dcb75f3 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 341913edf7..e553f8adf5 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 06ba08b51c..d096b17145 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -522,8 +522,10 @@ BOOL LLPanelPeople::postBuild() mAllFriendList = friends_tab->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"); LLPanel* nearby_tab = getChild<LLPanel>(NEARBY_TAB_NAME); nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2)); @@ -1205,6 +1207,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 ce67cf0083..da8193641d 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 f58715be56..b385654010 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" @@ -80,7 +124,7 @@ right="-53" name="info_btn" tab_stop="false" - 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 059283ce09..ab8930c967 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> |