summaryrefslogtreecommitdiff
path: root/indra/newview/llchiclet.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-16 11:05:33 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-16 11:05:33 -0500
commit95cbf689f343ba4c0c352993273b5bb20812e36c (patch)
treedabc2ffc10bc027da8c60168e0190a0da98b5722 /indra/newview/llchiclet.cpp
parent59eb2815bfea9b0a826e006090d0fef80ae1f6b8 (diff)
parent6f52f1e502cf030ceb4e14963fdda1021ea33023 (diff)
merge
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r--indra/newview/llchiclet.cpp55
1 files changed, 42 insertions, 13 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index b919195fb2..9e290c8c04 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -54,10 +54,12 @@ static LLDefaultChildRegistry::Register<LLChicletPanel> t1("chiclet_panel");
static LLDefaultChildRegistry::Register<LLNotificationChiclet> t2("chiclet_notification");
static LLDefaultChildRegistry::Register<LLIMP2PChiclet> t3("chiclet_im_p2p");
static LLDefaultChildRegistry::Register<LLIMGroupChiclet> t4("chiclet_im_group");
+static LLDefaultChildRegistry::Register<LLAdHocChiclet> t5("chiclet_im_adhoc");
static const LLRect CHICLET_RECT(0, 25, 25, 0);
-static const LLRect CHICLET_ICON_RECT(0, 24, 24, 0);
+static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0);
static const LLRect VOICE_INDICATOR_RECT(25, 25, 45, 0);
+static const S32 OVERLAY_ICON_SHIFT = 2; // used for shifting of an overlay icon for new massages in a chiclet
// static
const S32 LLChicletPanel::s_scroll_ratio = 10;
@@ -217,13 +219,15 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
icon_params.visible = false;
icon_params.image = LLUI::getUIImage(p.new_messages_icon_name);
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+ addChild(mNewMessagesIcon);
+
// adjust size and position of an icon
LLRect chiclet_rect = p.rect;
- LLRect overlay_icon_rect = LLRect(chiclet_rect.getWidth()/2, chiclet_rect.mTop, chiclet_rect.mRight, chiclet_rect.getHeight()/2);
- // shift an icon a little bit to the right and up corner of a chiclet
- overlay_icon_rect.translate(overlay_icon_rect.getWidth()/5, overlay_icon_rect.getHeight()/5);
+ LLRect overlay_icon_rect = LLRect(chiclet_rect.getWidth()/2, chiclet_rect.getHeight(), chiclet_rect.getWidth(), chiclet_rect.getHeight()/2);
mNewMessagesIcon->setRect(overlay_icon_rect);
- addChild(mNewMessagesIcon);
+
+ // shift an icon a little bit to the right and up corner of a chiclet
+ overlay_icon_rect.translate(OVERLAY_ICON_SHIFT, OVERLAY_ICON_SHIFT);
setShowCounter(false);
}
@@ -423,7 +427,6 @@ void LLIMP2PChiclet::updateMenuItems()
bool is_friend = LLAvatarActions::isFriend(getOtherParticipantId());
mPopupMenu->getChild<LLUICtrl>("Add Friend")->setEnabled(!is_friend);
- mPopupMenu->getChild<LLUICtrl>("Remove Friend")->setEnabled(is_friend);
}
BOOL LLIMP2PChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
@@ -602,6 +605,9 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
LLIMGroupChiclet::Params::Params()
: group_icon("group_icon")
+, unread_notifications("unread_notifications")
+, speaker("speaker")
+, show_speaker("show_speaker")
{
rect(CHICLET_RECT);
@@ -830,8 +836,17 @@ LLChicletPanel::~LLChicletPanel()
void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
LLUUID session_id = data["session_id"].asUUID();
+ LLUUID from_id = data["from_id"].asUUID();
+ const std::string from = data["from"].asString();
S32 unread = data["num_unread"].asInteger();
+ // if new message came
+ if(unread != 0)
+ {
+ //we do not show balloon (indicator of new messages) for system messages and our own messages
+ if (from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from) return;
+ }
+
LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
if (im_floater && im_floater->getVisible())
{
@@ -851,7 +866,6 @@ void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
llwarns << "Unable to set counter for chiclet " << session_id << llendl;
}
}
-
}
@@ -880,19 +894,34 @@ BOOL LLChicletPanel::postBuild()
void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id)
{
- for(chiclet_list_t::iterator it = mChicletList.begin(); it != mChicletList.end(); ++it)
+ static LLUUID s_previous_active_voice_session_id;
+
+ std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(session_id);
+
+ for(std::list<LLChiclet *>::iterator it = chiclets.begin(); it != chiclets.end(); ++it)
{
LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
if(chiclet)
{
- if(chiclet->getSessionId() == session_id)
+ chiclet->setShowSpeaker(true);
+ }
+ }
+
+ if(!s_previous_active_voice_session_id.isNull() && s_previous_active_voice_session_id != session_id)
+ {
+ chiclets = LLIMChiclet::sFindChicletsSignal(s_previous_active_voice_session_id);
+
+ for(std::list<LLChiclet *>::iterator it = chiclets.begin(); it != chiclets.end(); ++it)
+ {
+ LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
+ if(chiclet)
{
- chiclet->setShowSpeaker(true);
- continue;
+ chiclet->setShowSpeaker(false);
}
- chiclet->setShowSpeaker(false);
- }
+ }
}
+
+ s_previous_active_voice_session_id = session_id;
}
S32 LLChicletPanel::calcChickletPanleWidth()