diff options
Diffstat (limited to 'indra/newview/llavatarlistitem.cpp')
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 97 |
1 files changed, 82 insertions, 15 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index d08943f825..9c63d9a820 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -61,12 +61,17 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) mAvatarIcon(NULL), mAvatarName(NULL), mLastInteractionTime(NULL), + mIconPermissionOnline(NULL), + mIconPermissionMap(NULL), + mIconPermissionEditMine(NULL), + mIconPermissionEditTheirs(NULL), mSpeakingIndicator(NULL), mInfoBtn(NULL), mProfileBtn(NULL), mOnlineStatus(E_UNKNOWN), mShowInfoBtn(true), - mShowProfileBtn(true) + mShowProfileBtn(true), + mShowPermissions(false) { if (not_from_ui_factory) { @@ -87,7 +92,16 @@ BOOL LLAvatarListItem::postBuild() mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); mAvatarName = getChild<LLTextBox>("avatar_name"); mLastInteractionTime = getChild<LLTextBox>("last_interaction"); - + + mIconPermissionOnline = getChild<LLIconCtrl>("permission_online_icon"); + mIconPermissionMap = getChild<LLIconCtrl>("permission_map_icon"); + mIconPermissionEditMine = getChild<LLIconCtrl>("permission_edit_mine_icon"); + mIconPermissionEditTheirs = getChild<LLIconCtrl>("permission_edit_theirs_icon"); + mIconPermissionOnline->setVisible(false); + mIconPermissionMap->setVisible(false); + mIconPermissionEditMine->setVisible(false); + mIconPermissionEditTheirs->setVisible(false); + mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator"); mInfoBtn = getChild<LLButton>("info_btn"); mProfileBtn = getChild<LLButton>("profile_btn"); @@ -126,8 +140,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(); } @@ -137,8 +153,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(); } @@ -147,6 +165,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) @@ -237,10 +261,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(); } @@ -251,17 +272,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; } @@ -280,7 +295,9 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible) { // Already done? Then do nothing. if (mAvatarIcon->getVisible() == (BOOL)visible) + { return; + } // Show/hide avatar icon. mAvatarIcon->setVisible(visible); @@ -449,10 +466,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->mIconPermissionEditTheirs->getRect().mLeft; + + // edit my objects permission icon width + padding + S32 permission_edit_mine_width = avatar_item->mIconPermissionEditTheirs->getRect().mLeft - avatar_item->mIconPermissionEditMine->getRect().mLeft; + + // map permission icon width + padding + S32 permission_map_width = avatar_item->mIconPermissionEditMine->getRect().mLeft - avatar_item->mIconPermissionMap->getRect().mLeft; + + // online permission icon width + padding + S32 permission_online_width = avatar_item->mIconPermissionMap->getRect().mLeft - avatar_item->mIconPermissionOnline->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->mIconPermissionOnline->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; @@ -462,9 +491,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() @@ -543,6 +577,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) + { + mIconPermissionOnline->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS)); + mIconPermissionMap->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)); + mIconPermissionEditMine->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)); + mIconPermissionEditTheirs->setVisible(relation->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS)); + } + else + { + mIconPermissionOnline->setVisible(false); + mIconPermissionMap->setVisible(false); + mIconPermissionEditMine->setVisible(false); + mIconPermissionEditTheirs->setVisible(false); + } + + return NULL != relation; +} + LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_index) { LLView* child_view = mAvatarName; @@ -559,7 +614,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 = mIconPermissionOnline; + break; + case ALIC_PERMISSION_MAP: + child_view = mIconPermissionMap; + break; + case ALIC_PERMISSION_EDIT_MINE: + child_view = mIconPermissionEditMine; + break; + case ALIC_PERMISSION_EDIT_THEIRS: + child_view = mIconPermissionEditTheirs; break; case ALIC_INFO_BUTTON: child_view = mInfoBtn; |