summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-x[-rw-r--r--]indra/newview/llconversationmodel.h5
-rwxr-xr-x[-rw-r--r--]indra/newview/llconversationview.cpp143
-rwxr-xr-x[-rw-r--r--]indra/newview/llconversationview.h40
-rwxr-xr-x[-rw-r--r--]indra/newview/llimfloatercontainer.cpp5
-rwxr-xr-x[-rw-r--r--]indra/newview/llviewerfoldertype.cpp2
-rwxr-xr-xindra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml32
6 files changed, 216 insertions, 11 deletions
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index f95db9a9d7..c340194dd3 100644..100755
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -30,6 +30,7 @@
#include "llfolderviewitem.h"
#include "llfolderviewmodel.h"
#include "llavatarname.h"
+#include "llviewerfoldertype.h"
// Implementation of conversations list
@@ -56,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 NULL; }
+ 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; }
@@ -121,7 +122,7 @@ public:
virtual ~LLConversationItemSession() {}
/*virtual*/ bool hasChildren() const;
-
+ LLPointer<LLUIImage> getIcon() const { return NULL; }
void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; }
void addParticipant(LLConversationItemParticipant* participant);
void removeParticipant(LLConversationItemParticipant* participant);
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index 53971a3159..208a89cc8d 100644..100755
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -28,15 +28,21 @@
#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"
//
// Implementation of conversations list session widgets
//
static LLDefaultChildRegistry::Register<LLConversationViewSession> r_conversation_view_session("conversation_view_session");
+
+
LLConversationViewSession::Params::Params() :
container()
{}
@@ -303,14 +309,57 @@ void LLConversationViewSession::refresh()
// Implementation of conversations list participant (avatar) widgets
//
+static LLDefaultChildRegistry::Register<LLConversationViewParticipant> r("conversation_view_participant");
+bool LLConversationViewParticipant::sStaticInitialized = false;
+S32 LLConversationViewParticipant::sChildrenWidths[LLConversationViewParticipant::ALIC_COUNT];
+
LLConversationViewParticipant::Params::Params() :
- participant_id()
+container(),
+participant_id(),
+info_button("info_button"),
+output_monitor("output_monitor")
{}
LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ):
LLFolderViewItem(p),
- mUUID(p.participant_id)
+ mInfoBtn(NULL),
+ mSpeakingIndicator(NULL),
+ mUUID(p.participant_id)
+{
+
+}
+
+void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params)
+{
+ LLButton::Params info_button_params(params.info_button());
+ applyXUILayout(info_button_params, this);
+ LLButton * button = LLUICtrlFactory::create<LLButton>(info_button_params);
+ addChild(button);
+
+ LLOutputMonitorCtrl::Params output_monitor_params(params.output_monitor());
+ applyXUILayout(output_monitor_params, this);
+ LLOutputMonitorCtrl * outputMonitor = LLUICtrlFactory::create<LLOutputMonitorCtrl>(output_monitor_params);
+ addChild(outputMonitor);
+}
+
+BOOL LLConversationViewParticipant::postBuild()
{
+ mInfoBtn = getChild<LLButton>("info_btn");
+ mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this));
+ mInfoBtn->setVisible(false);
+
+ mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
+
+ 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()
@@ -325,4 +374,94 @@ void LLConversationViewParticipant::refresh()
LLFolderViewItem::refresh();
}
+void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder)
+{
+ //Add the item to the folder (conversation)
+ LLFolderViewItem::addToFolder(folder);
+
+ //Now retrieve the folder (conversation) UUID, which is the speaker session
+ LLConversationItem* vmi = this->getParentFolder() ? dynamic_cast<LLConversationItem*>(this->getParentFolder()->getViewModelItem()) : NULL;
+ if(vmi)
+ {
+ mSpeakingIndicator->setSpeakerId(mUUID,
+ vmi->getUUID()); //set the session id
+ }
+}
+
+void LLConversationViewParticipant::onInfoBtnClick()
+{
+ LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID));
+}
+
+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 ec99b2eb9b..3dbc36e811 100644..100755
--- a/indra/newview/llconversationview.h
+++ b/indra/newview/llconversationview.h
@@ -29,6 +29,9 @@
#include "llfolderviewitem.h"
+#include "llbutton.h"
+#include "lloutputmonitorctrl.h"
+
class LLTextBox;
class LLIMFloaterContainer;
class LLConversationViewSession;
@@ -54,7 +57,7 @@ protected:
public:
virtual ~LLConversationViewSession( void ) { }
- virtual void selectItem();
+ virtual void selectItem();
/*virtual*/ BOOL postBuild();
/*virtual*/ void draw();
@@ -75,26 +78,51 @@ private:
class LLConversationViewParticipant : public LLFolderViewItem
{
+
public:
+
struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
{
+ Optional<LLIMFloaterContainer*> container;
Optional<LLUUID> participant_id;
+ Optional<LLButton::Params> info_button;
+ Optional<LLOutputMonitorCtrl::Params> output_monitor;
Params();
};
+ virtual ~LLConversationViewParticipant( void ) { }
+ bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
+ virtual void refresh();
+ void addToFolder(LLFolderViewFolder* folder);
+
+ void onMouseEnter(S32 x, S32 y, MASK mask);
+ void onMouseLeave(S32 x, S32 y, MASK mask);
+
protected:
friend class LLUICtrlFactory;
LLConversationViewParticipant( const Params& p );
+ void initFromParams(const Params& params);
+ BOOL postBuild();
-public:
- virtual ~LLConversationViewParticipant( void ) { }
-
- bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
+ void onInfoBtnClick();
- virtual void refresh();
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 58b788d231..54a40627fb 100644..100755
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -711,6 +711,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL
LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item)
{
LLConversationViewParticipant::Params params;
+ LLRect panel_rect = mConversationsListPanel->getRect();
params.name = item->getDisplayName();
//params.icon = bridge->getIcon();
@@ -718,7 +719,9 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti
//params.creation_date = bridge->getCreationDate();
params.root = mConversationsRoot;
params.listener = item;
- params.rect = LLRect (0, 0, 0, 0);
+
+ //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 a179b61cff..0a402d8c42 100644..100755
--- a/indra/newview/llviewerfoldertype.cpp
+++ b/indra/newview/llviewerfoldertype.cpp
@@ -147,6 +147,8 @@ LLViewerFolderDictionary::LLViewerFolderDictionary()
addEntry((LLFolderType::EType)type, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, false));
}
#endif
+
+ addEntry(LLFolderType::FT_PROFILEXXXGGG, new ViewerFolderEntry("Profile", "Generic_Person", "Generic_Person", FALSE, false, "default"));
}
bool LLViewerFolderDictionary::initEnsemblesFromFile()
diff --git a/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml b/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml
new file mode 100755
index 0000000000..60015576b5
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/conversation_view_participant.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<conversation_view_participant
+ folder_arrow_image="ForSale_Badge"
+ folder_indentation="8"
+ item_height="20"
+ item_top_pad="4"
+ selection_image="Rounded_Square"
+ mouse_opaque="true"
+ follows="left|top|right"
+>
+<info_button
+ follows="right"
+ auto_update="true"
+ height="16"
+ image_pressed="Info_Press"
+ image_unselected="Info_Over"
+ layout="topleft"
+ right="-28"
+ name="info_btn"
+ width="16" />
+<output_monitor
+ follows="right"
+ auto_update="true"
+ draw_border="false"
+ height="16"
+ layout="topleft"
+ right="-3"
+ mouse_opaque="true"
+ name="speaking_indicator"
+ visible="true"
+ width="20" />
+</conversation_view_participant>