diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-09-13 19:10:28 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-09-13 19:10:28 -0700 |
commit | c6863d18d7c981756c57bbcd52baa06af00d1551 (patch) | |
tree | d968114a72319e178fcab9687f16fbc8fe9d8a2e /indra/newview | |
parent | 6b597ad40dcec2f494988eddf76376ae439c1059 (diff) |
CHUI-283: Now upon the information icon and speaker icon do not overlap the username text. Instead the username text will be truncated with an ellipse to prevent the overlap. Also did a code cleanup.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llconversationmodel.h | 2 | ||||
-rwxr-xr-x | indra/newview/llconversationview.cpp | 78 | ||||
-rwxr-xr-x | indra/newview/llconversationview.h | 20 | ||||
-rwxr-xr-x | indra/newview/llimfloatercontainer.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llviewerfoldertype.cpp | 2 |
5 files changed, 90 insertions, 14 deletions
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 4f13d3d3a1..e1713f9db7 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -57,7 +57,7 @@ public: virtual const std::string& getSearchableName() const { return mName; } virtual const LLUUID& getUUID() const { return mUUID; } virtual time_t getCreationDate() const { return 0; } - virtual LLPointer<LLUIImage> getIcon() const { return LLUI::getUIImage(LLViewerFolderType::lookupIconName(LLFolderType::FT_PROFILE, FALSE)); } + virtual LLPointer<LLUIImage> getIcon() const { return LLUI::getUIImage(LLViewerFolderType::lookupIconName(LLFolderType::FT_PROFILEXXXGGG, FALSE)); } virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 7b1c9ef912..bc85cd68bc 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -28,13 +28,13 @@ #include "llviewerprecompiledheaders.h" #include "llconversationview.h" + +#include <boost/bind.hpp> #include "llconversationmodel.h" #include "llimconversation.h" #include "llimfloatercontainer.h" #include "llfloaterreg.h" - #include "lluictrlfactory.h" -#include "llavatariconctrl.h" // // Implementation of conversations list session widgets @@ -120,6 +120,8 @@ void LLConversationViewSession::refresh() // static LLDefaultChildRegistry::Register<LLConversationViewParticipant> r("conversation_view_participant"); +bool LLConversationViewParticipant::sStaticInitialized = false; +S32 LLConversationViewParticipant::sChildrenWidths[LLConversationViewParticipant::ALIC_COUNT]; LLConversationViewParticipant::Params::Params() : container(), @@ -130,6 +132,8 @@ output_monitor("output_monitor") LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ): LLFolderViewItem(p), + mInfoBtn(NULL), + mSpeakingIndicator(NULL), mUUID(p.participant_id) { @@ -156,8 +160,16 @@ BOOL LLConversationViewParticipant::postBuild() mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator"); - LLFolderViewItem::postBuild(); - return TRUE; + if (!sStaticInitialized) + { + // Remember children widths including their padding from the next sibling, + // so that we can hide and show them again later. + initChildrenWidths(this); + sStaticInitialized = true; + } + + computeLabelRightPadding(); + return LLFolderViewItem::postBuild(); } void LLConversationViewParticipant::refresh() @@ -194,14 +206,72 @@ void LLConversationViewParticipant::onInfoBtnClick() void LLConversationViewParticipant::onMouseEnter(S32 x, S32 y, MASK mask) { mInfoBtn->setVisible(true); + computeLabelRightPadding(); LLFolderViewItem::onMouseEnter(x, y, mask); } void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) { mInfoBtn->setVisible(false); + computeLabelRightPadding(); LLFolderViewItem::onMouseEnter(x, y, mask); } +// static +void LLConversationViewParticipant::initChildrenWidths(LLConversationViewParticipant* self) +{ + //speaking indicator width + padding + S32 speaking_indicator_width = self->getRect().getWidth() - self->mSpeakingIndicator->getRect().mLeft; + + //info btn width + padding + S32 info_btn_width = self->mSpeakingIndicator->getRect().mLeft - self->mInfoBtn->getRect().mLeft; + + S32 index = ALIC_COUNT; + sChildrenWidths[--index] = info_btn_width; + sChildrenWidths[--index] = speaking_indicator_width; + llassert(index == 0); +} + +void LLConversationViewParticipant::computeLabelRightPadding() +{ + mLabelPaddingRight = DEFAULT_TEXT_PADDING_RIGHT; + LLView* control; + S32 ctrl_width; + + for (S32 i = 0; i < ALIC_COUNT; ++i) + { + control = getItemChildView((EAvatarListItemChildIndex)i); + + // skip invisible views + if (!control->getVisible()) continue; + + ctrl_width = sChildrenWidths[i]; // including space between current & left controls + // accumulate the amount of space taken by the controls + mLabelPaddingRight += ctrl_width; + } +} + +LLView* LLConversationViewParticipant::getItemChildView(EAvatarListItemChildIndex child_view_index) +{ + LLView* child_view = NULL; + + switch (child_view_index) + { + case ALIC_SPEAKER_INDICATOR: + child_view = mSpeakingIndicator; + break; + case ALIC_INFO_BUTTON: + child_view = mInfoBtn; + break; + default: + LL_WARNS("AvatarItemReshape") << "Unexpected child view index is passed: " << child_view_index << LL_ENDL; + llassert(0); + break; + // leave child_view untouched + } + + return child_view; +} + // EOF diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 0dcf6542a3..686a79ad39 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -29,12 +29,6 @@ #include "llfolderviewitem.h" - - - -#include "llstyle.h" -#include "llcallbackmap.h" -#include "lltextbox.h" #include "llbutton.h" #include "lloutputmonitorctrl.h" @@ -71,8 +65,6 @@ public: // Implementation of conversations list participant (avatar) widgets -class LLAvatarIconCtrl; - class LLConversationViewParticipant : public LLFolderViewItem { @@ -108,6 +100,18 @@ private: LLButton * mInfoBtn; LLOutputMonitorCtrl* mSpeakingIndicator; LLUUID mUUID; // UUID of the participant + + typedef enum e_avatar_item_child { + ALIC_SPEAKER_INDICATOR, + ALIC_INFO_BUTTON, + ALIC_COUNT, + } EAvatarListItemChildIndex; + + static bool sStaticInitialized; // this variable is introduced to improve code readability + static S32 sChildrenWidths[ALIC_COUNT]; + static void initChildrenWidths(LLConversationViewParticipant* self); + void computeLabelRightPadding(); + LLView* getItemChildView(EAvatarListItemChildIndex child_view_index); }; #endif // LL_LLCONVERSATIONVIEW_H diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9320117eb5..299d38298e 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -724,6 +724,8 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti //params.creation_date = bridge->getCreationDate(); params.root = mConversationsRoot; params.listener = item; + + //16 and panel_rect.getWidth() are used since that is currently the values used in repositioningWidgets() params.rect = LLRect (0, 16, panel_rect.getWidth(), 0); params.tool_tip = params.name; params.participant_id = item->getUUID(); diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index d470abb8c5..0a402d8c42 100755 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -148,7 +148,7 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() } #endif - addEntry(LLFolderType::FT_PROFILE, new ViewerFolderEntry("Profile", "Generic_Person", "Generic_Person", FALSE, false, "default")); + addEntry(LLFolderType::FT_PROFILEXXXGGG, new ViewerFolderEntry("Profile", "Generic_Person", "Generic_Person", FALSE, false, "default")); } bool LLViewerFolderDictionary::initEnsemblesFromFile() |