summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationscripthandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnotificationscripthandler.cpp')
-rw-r--r--indra/newview/llnotificationscripthandler.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index c74c967722..8472f9b2ae 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -42,13 +42,13 @@ LLScriptHandler::LLScriptHandler()
: LLSysHandler("Notifications", "notify")
{
// Getting a Channel for our notifications
- mChannel = LLChannelManager::getInstance()->createNotificationChannel();
- mChannel->setControlHovering(true);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
if(channel)
+ {
+ channel->setControlHovering(true);
channel->addOnRejectToastCallback(boost::bind(&LLScriptHandler::onRejectToast, this, _1));
-
+ mChannel = channel->getHandle();
+ }
}
//--------------------------------------------------------------------------
@@ -61,64 +61,64 @@ void LLScriptHandler::initChannel()
{
S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
- mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+ mChannel.get()->init(channel_right_bound - channel_width, channel_right_bound);
}
//--------------------------------------------------------------------------
bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
{
- if(!mChannel)
+ if(mChannel.isDead())
{
return false;
}
// arrange a channel on a screen
- if(!mChannel->getVisible())
+ if(!mChannel.get()->getVisible())
{
initChannel();
}
if (notification->canLogToIM())
- {
- LLHandlerUtil::logToIMP2P(notification);
- }
+ {
+ LLHandlerUtil::logToIMP2P(notification);
+ }
if(notification->hasFormElements())
- {
- LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
- }
- else
- {
- LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(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);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
{
- channel->addToast(p);
+ LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
}
+ else
+ {
+ LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(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);
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ {
+ channel->addToast(p);
+ }
}
-
+
return false;
-}
+ }
void LLScriptHandler::onDelete( LLNotificationPtr notification )
-{
- if(notification->hasFormElements())
- {
- LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
- }
- else
{
- mChannel->killToastByNotificationID(notification->getID());
+ if(notification->hasFormElements())
+ {
+ LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
+ }
+ else
+ {
+ mChannel.get()->killToastByNotificationID(notification->getID());
+ }
}
-}
//--------------------------------------------------------------------------