Streamlined previous fix for ACME-1471

master
Cho 2014-05-29 03:53:43 +01:00
parent e143ceb9db
commit 6e74c0de6a
2 changed files with 27 additions and 34 deletions

View File

@ -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);

View File

@ -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<LLScreenChannel*>(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<LLScreenChannel*>(mChannel.get());
if(channel)
{
channel->addToast(p);
}
addToastWithNotification(notification);
}
return false;
@ -121,22 +127,8 @@ void LLScriptHandler::onChange( LLNotificationPtr notification )
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(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);
}
}