summaryrefslogtreecommitdiff
path: root/indra/newview/llchiclet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r--indra/newview/llchiclet.cpp129
1 files changed, 97 insertions, 32 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index c01202bb82..8efa814a2e 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -36,6 +36,7 @@
#include "llagent.h"
#include "llavataractions.h"
#include "llbottomtray.h"
+#include "lleventtimer.h"
#include "llgroupactions.h"
#include "lliconctrl.h"
#include "llimfloater.h"
@@ -47,9 +48,9 @@
#include "llnotificationsutil.h"
#include "lloutputmonitorctrl.h"
#include "llscriptfloater.h"
+#include "llspeakers.h"
#include "lltextbox.h"
#include "llvoiceclient.h"
-#include "llvoicecontrolpanel.h"
#include "llgroupmgr.h"
#include "llnotificationmanager.h"
#include "lltransientfloatermgr.h"
@@ -225,6 +226,10 @@ void LLSysWellChiclet::setNewMessagesState(bool new_messages)
mIsNewMessagesState = new_messages;
}
+void LLSysWellChiclet::updateWidget(bool is_window_empty)
+{
+ mButton->setEnabled(!is_window_empty);
+}
// virtual
BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
@@ -374,6 +379,13 @@ void LLNotificationChiclet::createMenu()
LLViewerMenuHolderGL::child_registry_t::instance());
}
+/*virtual*/
+void LLNotificationChiclet::setCounter(S32 counter)
+{
+ LLSysWellChiclet::setCounter(counter);
+ updateWidget(getCounter() == 0);
+
+}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -443,10 +455,19 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
, mNewMessagesIcon(NULL)
, mSpeakerCtrl(NULL)
, mCounterCtrl(NULL)
+, mChicletButton(NULL)
{
enableCounterControl(p.enable_counter);
}
+/* virtual*/
+BOOL LLIMChiclet::postBuild()
+{
+ mChicletButton = getChild<LLButton>("chiclet_button");
+ mChicletButton->setCommitCallback(boost::bind(&LLIMChiclet::onMouseDown, this));
+ mChicletButton->setDoubleClickCallback(boost::bind(&LLIMChiclet::onMouseDown, this));
+ return TRUE;
+}
void LLIMChiclet::setShowSpeaker(bool show)
{
bool needs_resize = getShowSpeaker() != show;
@@ -525,11 +546,17 @@ void LLIMChiclet::toggleSpeakerControl()
}
setRequiredWidth();
+ mSpeakerCtrl->setSpeakerId(LLUUID::null);
mSpeakerCtrl->setVisible(getShowSpeaker());
}
void LLIMChiclet::setCounter(S32 counter)
{
+ if (mCounterCtrl->getCounter() == counter)
+ {
+ return;
+ }
+
mCounterCtrl->setCounter(counter);
setShowCounter(counter);
setShowNewMessagesIcon(counter);
@@ -561,10 +588,9 @@ void LLIMChiclet::onMouseDown()
setCounter(0);
}
-BOOL LLIMChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
+void LLIMChiclet::setToggleState(bool toggle)
{
- onMouseDown();
- return LLChiclet::handleMouseDown(x, y, mask);
+ mChicletButton->setToggleState(toggle);
}
void LLIMChiclet::draw()
@@ -619,6 +645,7 @@ LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id)
LLIMP2PChiclet::Params::Params()
: avatar_icon("avatar_icon")
+, chiclet_button("chiclet_button")
, unread_notifications("unread_notifications")
, speaker("speaker")
, new_message_icon("new_message_icon")
@@ -631,6 +658,10 @@ LLIMP2PChiclet::LLIMP2PChiclet(const Params& p)
, mChicletIconCtrl(NULL)
, mPopupMenu(NULL)
{
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
+
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
addChild(mNewMessagesIcon);
@@ -745,6 +776,7 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data)
LLAdHocChiclet::Params::Params()
: avatar_icon("avatar_icon")
+, chiclet_button("chiclet_button")
, unread_notifications("unread_notifications")
, speaker("speaker")
, new_message_icon("new_message_icon")
@@ -758,6 +790,10 @@ LLAdHocChiclet::LLAdHocChiclet(const Params& p)
, mChicletIconCtrl(NULL)
, mPopupMenu(NULL)
{
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
+
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
addChild(mNewMessagesIcon);
@@ -872,6 +908,7 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
LLIMGroupChiclet::Params::Params()
: group_icon("group_icon")
+, chiclet_button("chiclet_button")
, unread_notifications("unread_notifications")
, speaker("speaker")
, new_message_icon("new_message_icon")
@@ -885,6 +922,10 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p)
, mChicletIconCtrl(NULL)
, mPopupMenu(NULL)
{
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
+
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
addChild(mNewMessagesIcon);
@@ -915,7 +956,10 @@ LLIMGroupChiclet::~LLIMGroupChiclet()
void LLIMGroupChiclet::draw()
{
- switchToCurrentSpeaker();
+ if(getShowSpeaker())
+ {
+ switchToCurrentSpeaker();
+ }
LLIMChiclet::draw();
}
@@ -1115,10 +1159,10 @@ void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
void object_chiclet_callback(const LLSD& data)
{
- LLUUID object_id = data["object_id"];
+ LLUUID notification_id = data["notification_id"];
bool new_message = data["new_message"];
- std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(object_id);
+ std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(notification_id);
std::list<LLChiclet *>::iterator iter;
for (iter = chiclets.begin(); iter != chiclets.end(); iter++)
{
@@ -1235,6 +1279,7 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index));
arrange();
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, chiclet);
return true;
}
@@ -1257,10 +1302,13 @@ void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD&param)
void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it)
{
- mScrollArea->removeChild(*it);
+ LLChiclet* chiclet = *it;
+ mScrollArea->removeChild(chiclet);
mChicletList.erase(it);
arrange();
+ LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, chiclet);
+ chiclet->die();
}
void LLChicletPanel::removeChiclet(S32 index)
@@ -1399,6 +1447,32 @@ S32 LLChicletPanel::notifyParent(const LLSD& info)
return LLPanel::notifyParent(info);
}
+void LLChicletPanel::setChicletToggleState(const LLUUID& session_id, bool toggle)
+{
+ if(session_id.isNull())
+ {
+ llwarns << "Null Session ID" << llendl;
+ }
+
+ // toggle off all chiclets, except specified
+ S32 size = getChicletCount();
+ for(int n = 0; n < size; ++n)
+ {
+ LLIMChiclet* chiclet = getChiclet<LLIMChiclet>(n);
+ if(chiclet && chiclet->getSessionId() != session_id)
+ {
+ chiclet->setToggleState(false);
+ }
+ }
+
+ // toggle specified chiclet
+ LLIMChiclet* chiclet = findChiclet<LLIMChiclet>(session_id);
+ if(chiclet)
+ {
+ chiclet->setToggleState(toggle);
+ }
+}
+
void LLChicletPanel::arrange()
{
if(mChicletList.empty())
@@ -1791,6 +1865,7 @@ LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p)
LLScriptChiclet::Params::Params()
: icon("icon")
+ , chiclet_button("chiclet_button")
, new_message_icon("new_message_icon")
{
}
@@ -1799,6 +1874,10 @@ LLScriptChiclet::LLScriptChiclet(const Params&p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
{
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
+
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
addChild(mNewMessagesIcon);
@@ -1815,12 +1894,8 @@ void LLScriptChiclet::setSessionId(const LLUUID& session_id)
setShowNewMessagesIcon( getSessionId() != session_id );
LLIMChiclet::setSessionId(session_id);
- LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(session_id);
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(notification)
- {
- setToolTip(notification->getSubstitutions()["TITLE"].asString());
- }
+
+ setToolTip(LLScriptFloaterManager::getObjectName(session_id));
}
void LLScriptChiclet::setCounter(S32 counter)
@@ -1833,12 +1908,6 @@ void LLScriptChiclet::onMouseDown()
LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId());
}
-BOOL LLScriptChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
-{
- onMouseDown();
- return LLChiclet::handleMouseDown(x, y, mask);
-}
-
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -1847,6 +1916,7 @@ static const std::string INVENTORY_USER_OFFER ("UserGiveItem");
LLInvOfferChiclet::Params::Params()
: icon("icon")
+ , chiclet_button("chiclet_button")
, new_message_icon("new_message_icon")
{
}
@@ -1855,6 +1925,10 @@ LLInvOfferChiclet::LLInvOfferChiclet(const Params&p)
: LLIMChiclet(p)
, mChicletIconCtrl(NULL)
{
+ LLButton::Params button_params = p.chiclet_button;
+ mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+ addChild(mChicletButton);
+
LLIconCtrl::Params new_msg_params = p.new_message_icon;
mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
addChild(mNewMessagesIcon);
@@ -1870,13 +1944,10 @@ void LLInvOfferChiclet::setSessionId(const LLUUID& session_id)
{
setShowNewMessagesIcon( getSessionId() != session_id );
+ setToolTip(LLScriptFloaterManager::getObjectName(session_id));
+
LLIMChiclet::setSessionId(session_id);
- LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(session_id);
- LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id);
- if(notification)
- {
- setToolTip(notification->getSubstitutions()["TITLE"].asString());
- }
+ LLNotificationPtr notification = LLNotifications::getInstance()->find(session_id);
if ( notification && notification->getName() == INVENTORY_USER_OFFER )
{
@@ -1898,10 +1969,4 @@ void LLInvOfferChiclet::onMouseDown()
LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId());
}
-BOOL LLInvOfferChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
-{
- onMouseDown();
- return LLChiclet::handleMouseDown(x, y, mask);
-}
-
// EOF