From 1ea65f0285d7022ce20ef84d4e35e3c94bcb3fbd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Mar 2012 22:56:02 -0700 Subject: CHUI-51 WIP notifications routig code cleanup phase 1, removal of most of llnotificationhandler --- indra/newview/llnotificationgrouphandler.cpp | 50 +++++++++++----------------- 1 file changed, 19 insertions(+), 31 deletions(-) (limited to 'indra/newview/llnotificationgrouphandler.cpp') diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index 9b7fdaef82..2ce51fa094 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -37,15 +37,14 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- -LLGroupHandler::LLGroupHandler(e_notification_type type, const LLSD& id) +LLGroupHandler::LLGroupHandler() +: LLSysHandler("Group Notifications", "groupnotify") { - mType = type; - // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel(); LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) - channel->setOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1)); + channel->addOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1)); } //-------------------------------------------------------------------------- @@ -62,48 +61,37 @@ void LLGroupHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLGroupHandler::processNotification(const LLSD& notify) +bool LLGroupHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") - { - LLHandlerUtil::logGroupNoticeToIMGroup(notification); + LLHandlerUtil::logGroupNoticeToIMGroup(notification); + + LLPanel* notify_box = new LLToastGroupNotifyPanel(notification); + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1); - LLPanel* notify_box = new LLToastGroupNotifyPanel(notification); - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1); + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); + // send a signal to the counter manager + mNewNotificationSignal(); - // send a signal to the counter manager - mNewNotificationSignal(); + LLGroupActions::refresh_notices(); - LLGroupActions::refresh_notices(); - } - else if (notify["sigtype"].asString() == "delete") - { - mChannel->killToastByNotificationID(notification->getID()); - } return false; } @@ -123,7 +111,7 @@ void LLGroupHandler::onRejectToast(LLUUID& id) { LLNotificationPtr notification = LLNotifications::instance().find(id); - if (notification && LLNotificationManager::getInstance()->getHandlerForNotification(notification->getType()) == this) + if (notification && mItems.find(notification) != mItems.end()) { LLNotifications::instance().cancel(notification); } -- cgit v1.2.3 From 2fa1c42aadbe2a29e1bcced9a487c0e5abf0602b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 29 Mar 2012 23:48:29 -0700 Subject: CHUI-51 WIP notifications routig code cleanup phase 2, removal of extraneous signaling in favor of llnotificationchannels made notificationchannels work better with overrides and lifetime managed by creator --- indra/newview/llnotificationgrouphandler.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llnotificationgrouphandler.cpp') diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index 2ce51fa094..97e382e42f 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -87,25 +87,11 @@ bool LLGroupHandler::processNotification(const LLNotificationPtr& notification) if(channel) channel->addToast(p); - // send a signal to the counter manager - mNewNotificationSignal(); - LLGroupActions::refresh_notices(); return false; } -//-------------------------------------------------------------------------- -void LLGroupHandler::onDeleteToast(LLToast* toast) -{ - // send a signal to the counter manager - mDelNotificationSignal(); - - // send a signal to a listener to let him perform some action - // in this case listener is a SysWellWindow and it will remove a corresponding item from its list - mNotificationIDSignal(toast->getNotificationID()); -} - //-------------------------------------------------------------------------- void LLGroupHandler::onRejectToast(LLUUID& id) { -- cgit v1.2.3