From 6e74c0de6aed31bc4c27fca1b14e7ab8ef301d34 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 29 May 2014 03:53:43 +0100 Subject: Streamlined previous fix for ACME-1471 --- indra/newview/llnotificationhandler.h | 1 + indra/newview/llnotificationscripthandler.cpp | 60 ++++++++++++--------------- 2 files changed, 27 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index e3270547c1..3e7f05b5e1 100755 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -171,6 +171,7 @@ public: virtual void onDelete(LLNotificationPtr p); virtual void onChange(LLNotificationPtr p); virtual bool processNotification(const LLNotificationPtr& p); + virtual void addToastWithNotification(const LLNotificationPtr& p); protected: virtual void onDeleteToast(LLToast* toast); diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index 267d3ac092..7acb2f9e90 100755 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -67,6 +67,30 @@ void LLScriptHandler::initChannel() mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound); } +//-------------------------------------------------------------------------- +void LLScriptHandler::addToastWithNotification(const LLNotificationPtr& notification) +{ + LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); + if(gAgent.isDoNotDisturb()) + { + p.force_show = notification->getName() == "SystemMessage" + || notification->getName() == "GodMessage" + || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; + } + + LLScreenChannel* channel = dynamic_cast(mChannel.get()); + if(channel) + { + channel->addToast(p); + } +} + //-------------------------------------------------------------------------- bool LLScriptHandler::processNotification(const LLNotificationPtr& notification) { @@ -92,25 +116,7 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification) } else if (notification->canShowToast()) { - LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); - if(gAgent.isDoNotDisturb()) - { - p.force_show = notification->getName() == "SystemMessage" - || notification->getName() == "GodMessage" - || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; - } - - LLScreenChannel* channel = dynamic_cast(mChannel.get()); - if(channel) - { - channel->addToast(p); - } + addToastWithNotification(notification); } return false; @@ -121,22 +127,8 @@ void LLScriptHandler::onChange( LLNotificationPtr notification ) LLScreenChannel* channel = dynamic_cast(mChannel.get()); if (channel) { - LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); - if(gAgent.isDoNotDisturb()) - { - p.force_show = notification->getName() == "SystemMessage" - || notification->getName() == "GodMessage" - || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; - } - channel->removeToastByNotificationID(notification->getID()); - channel->addToast(p); + addToastWithNotification(notification); } } -- cgit v1.2.3