diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-09-11 23:50:59 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-09-11 23:50:59 +0000 |
commit | 7df79382a075646a51f21bed0d7f8de883fc3608 (patch) | |
tree | e7a71ed0dc7e05e4091066e3a0455343dfcfce4f /indra/newview/llavatarlistitem.cpp | |
parent | 56449313529145a3d3c0e231967d9502b549056c (diff) |
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1634 https://svn.aws.productengine.com/secondlife/pe/stable-2@1648 -> viewer-2.0.0-3
* Bugs: EXT-888 EXT-866 EXT-861 EXT-858 EXT-864 EXT-875 EXT-884 EXT-718 EXT-786 EXT-885 EXT-910 EXT-845 EXT-312 EXT-823 EXT-868
* New Development: EXT-748 EXT-863 EXT-835
QA: Please test Recent List to verify it has no troubles.
Diffstat (limited to 'indra/newview/llavatarlistitem.cpp')
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 221 |
1 files changed, 56 insertions, 165 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 253c2ee9a6..feae8202bc 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -2,9 +2,9 @@ * @file llavatarlistitem.cpp * @avatar list item source file * - * $LicenseInfo:firstyear=2004&license=viewergpl$ + * $LicenseInfo:firstyear=2009&license=viewergpl$ * - * Copyright (c) 2004-2009, Linden Research, Inc. + * Copyright (c) 2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -33,70 +33,39 @@ #include "llviewerprecompiledheaders.h" -#include "llfloaterreg.h" #include "llavatarlistitem.h" -#include "llagent.h" - - -//--------------------------------------------------------------------------------- -LLAvatarListItem::LLAvatarListItem(const Params& p) : LLPanel() +#include "llfloaterreg.h" +#include "llagent.h" +#include "lloutputmonitorctrl.h" +#include "llavatariconctrl.h" +#include "llbutton.h" + + +LLAvatarListItem::LLAvatarListItem() +: LLPanel(), + mAvatarIcon(NULL), + mAvatarName(NULL), + mStatus(NULL), + mSpeakingIndicator(NULL), + mInfoBtn(NULL) { - mNeedsArrange = false; LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); - - mStatus = NULL; - mInfo = NULL; - mProfile = NULL; - mInspector = NULL; - - mAvatar = getChild<LLAvatarIconCtrl>("avatar_icon"); - //mAvatar->setValue(p.avatar_icon); - mName = getChild<LLTextBox>("name"); - //mName->setText(p.user_name); - - init(p); - - } -//--------------------------------------------------------------------------------- -void LLAvatarListItem::init(const Params& p) +BOOL LLAvatarListItem::postBuild() { - mLocator = getChild<LLIconCtrl>("locator"); - - mStatus = getChild<LLTextBox>("user_status"); - - mInfo = getChild<LLButton>("info_btn"); - mInfo->setVisible(false); - - mProfile = getChild<LLButton>("profile_btn"); - mProfile->setVisible(false); - - if(!p.buttons.locator) - { - mLocator->setVisible(false); - delete mLocator; - mLocator = NULL; - } + mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); + mAvatarName = getChild<LLTextBox>("avatar_name"); + mStatus = getChild<LLTextBox>("avatar_status"); - if(!p.buttons.status) - { - mStatus->setVisible(false); - delete mStatus; - mStatus = NULL; - } + mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator"); + mInfoBtn = getChild<LLButton>("info_btn"); - if(!p.buttons.info) - { - delete mInfo; - mInfo = NULL; - } - else - { - mInfo->setClickedCallback(boost::bind(&LLAvatarListItem::onInfoBtnClick, this)); - } + mInfoBtn->setVisible(false); + mInfoBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onInfoBtnClick, this)); +/* if(!p.buttons.profile) { delete mProfile; @@ -125,150 +94,72 @@ void LLAvatarListItem::init(const Params& p) mInfo->setRect(rect); } } - +*/ + return TRUE; } -//--------------------------------------------------------------------------------- -void LLAvatarListItem::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - if(!mNeedsArrange) - { - LLView::reshape(width, height, called_from_parent); - return; - } - - LLRect rect; - S32 profile_delta = 0; - S32 width_delta = getRect().getWidth() - width; - - if(!mProfile) - { - profile_delta = 30; - } - else - { - rect.setLeftTopAndSize(mProfile->getRect().mLeft - width_delta, mProfile->getRect().mTop, mProfile->getRect().getWidth(), mProfile->getRect().getHeight()); - mProfile->setRect(rect); - } - - width_delta += profile_delta; - - if(mInfo) - { - rect.setLeftTopAndSize(mInfo->getRect().mLeft - width_delta, mInfo->getRect().mTop, mInfo->getRect().getWidth(), mInfo->getRect().getHeight()); - mInfo->setRect(rect); - } - - if(mLocator) - { - rect.setLeftTopAndSize(mLocator->getRect().mLeft - width_delta, mLocator->getRect().mTop, mLocator->getRect().getWidth(), mLocator->getRect().getHeight()); - mLocator->setRect(rect); - } - - if(mStatus) - { - rect.setLeftTopAndSize(mStatus->getRect().mLeft - width_delta, mStatus->getRect().mTop, mStatus->getRect().getWidth(), mStatus->getRect().getHeight()); - mStatus->setRect(rect); - } - - mNeedsArrange = false; - LLView::reshape(width, height, called_from_parent); -} - -//--------------------------------------------------------------------------------- -LLAvatarListItem::~LLAvatarListItem() -{ -} -//--------------------------------------------------------------------------------- - -//--------------------------------------------------------------------------------- -BOOL LLAvatarListItem::handleHover(S32 x, S32 y, MASK mask) -{ - mYPos = y; - mXPos = x; - - return true; -} - -//--------------------------------------------------------------------------------- void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) { - setTransparentColor( *(new LLColor4((F32)0.4, (F32)0.4, (F32)0.4)) ); + childSetVisible("hovered_icon", true); + mInfoBtn->setVisible(true); - if(mInfo) - mInfo->setVisible(true); - - if(mProfile) - mProfile->setVisible(true); + LLPanel::onMouseEnter(x, y, mask); } -//--------------------------------------------------------------------------------- void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask) { - if(mInfo) - { - if( mInfo->getRect().pointInRect(x, y) ) - return; - - mInfo->setVisible(false); - } - - if(mProfile) - { - if( mProfile->getRect().pointInRect(x, y) ) - return; - - mProfile->setVisible(false); - } + childSetVisible("hovered_icon", false); + mInfoBtn->setVisible(false); - setTransparentColor( *(new LLColor4((F32)0.3, (F32)0.3, (F32)0.3)) ); + LLPanel::onMouseLeave(x, y, mask); } -//--------------------------------------------------------------------------------- -void LLAvatarListItem::setStatus(int status) +void LLAvatarListItem::setStatus(const std::string& status) { + mStatus->setValue(status); } -//--------------------------------------------------------------------------------- -void LLAvatarListItem::setName(std::string name) +void LLAvatarListItem::setName(const std::string& name) { + mAvatarName->setValue(name); + mAvatarName->setToolTip(name); } -//--------------------------------------------------------------------------------- -void LLAvatarListItem::setAvatar(LLSD& data) +void LLAvatarListItem::setAvatarId(const LLUUID& id) { + mAvatarIcon->setValue(id); + mSpeakingIndicator->setSpeakerId(id); } -//--------------------------------------------------------------------------------- void LLAvatarListItem::onInfoBtnClick() { - mInspector = LLFloaterReg::showInstance("inspect_avatar", gAgent.getID()); - - if (!mInspector) - return; + LLFloaterReg::showInstance("inspect_avatar", mAvatarIcon->getValue()); - LLRect rect; + /* TODO fix positioning of inspector localPointToScreen(mXPos, mYPos, &mXPos, &mYPos); + + LLRect rect; // *TODO Vadim: rewrite this. "+= -" looks weird. - S32 delta = mYPos - mInspector->getRect().getHeight(); + S32 delta = mYPos - inspector->getRect().getHeight(); if(delta < 0) { mYPos += -delta; } - + rect.setLeftTopAndSize(mXPos, mYPos, - mInspector->getRect().getWidth(), mInspector->getRect().getHeight()); - mInspector->setRect(rect); - mInspector->setFrontmost(true); - mInspector->setVisible(true); - + inspector->getRect().getWidth(), inspector->getRect().getHeight()); + inspector->setRect(rect); + inspector->setFrontmost(true); + inspector->setVisible(true); + */ } -//--------------------------------------------------------------------------------- -void LLAvatarListItem::onProfileBtnClick() +void LLAvatarListItem::setValue( const LLSD& value ) { + if (!value.isMap()) return;; + if (!value.has("selected")) return; + childSetVisible("selected_icon", value["selected"]); } -//--------------------------------------------------------------------------------- |