CHUI-494: WIP First pass at getting the suppression of events in DND working.

master
William Todd Stinson 2012-12-06 20:28:25 -08:00
parent 329001c782
commit 9da625d439
13 changed files with 184 additions and 100 deletions

View File

@ -35,6 +35,11 @@
using namespace LLNotificationsUI;
LLBrowserNotification::LLBrowserNotification()
: LLSystemNotificationHandler("Browser", "browser")
{
}
bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification)
{
LLUUID media_id = notification->getPayload()["media_id"].asUUID();

View File

@ -49,6 +49,11 @@
/// LLOutboxNotification class
///----------------------------------------------------------------------------
LLNotificationsUI::LLOutboxNotification::LLOutboxNotification()
: LLSystemNotificationHandler("Outbox", "outbox")
{
}
bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotificationPtr& notify)
{
LLFloaterOutbox* outbox_floater = LLFloaterReg::getTypedInstance<LLFloaterOutbox>("outbox");
@ -60,10 +65,10 @@ bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotifi
void LLNotificationsUI::LLOutboxNotification::onDelete(LLNotificationPtr p)
{
LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
if (sys_handler)
LLNotificationsUI::LLNotificationHandler * notification_handler = dynamic_cast<LLNotificationsUI::LLNotificationHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
if (notification_handler)
{
sys_handler->onDelete(p);
notification_handler->onDelete(p);
}
}
@ -524,9 +529,9 @@ void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content)
void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification)
{
LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
llassert(sys_handler);
LLNotificationsUI::LLNotificationHandler * notification_handler = dynamic_cast<LLNotificationsUI::LLNotificationHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
llassert(notification_handler);
sys_handler->processNotification(notification);
notification_handler->processNotification(notification);
}

View File

@ -38,7 +38,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLIMHandler::LLIMHandler()
: LLSysHandler("IM Notifications", "notifytoast")
: LLCommunicationNotificationHandler("IM Notifications", "notifytoast")
{
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->createNotificationChannel()->getHandle();

View File

@ -29,6 +29,7 @@
#include "llnotificationhandler.h"
#include "llagentcamera.h"
#include "llnotifications.h"
#include "llprogressview.h"
#include "lltoastnotifypanel.h"
@ -41,7 +42,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal)
: LLSysHandler(name, notification_type),
: LLSystemNotificationHandler(name, notification_type),
mIsModal(is_modal)
{
LLScreenChannelBase::Params p;
@ -123,3 +124,28 @@ void LLAlertHandler::onChange( LLNotificationPtr notification )
if(channel)
channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
}
//--------------------------------------------------------------------------
LLViewerAlertHandler::LLViewerAlertHandler(const std::string& name, const std::string& notification_type)
: LLSystemNotificationHandler(name, notification_type)
{
}
bool LLViewerAlertHandler::processNotification(const LLNotificationPtr& p)
{
if (gHeadlessClient)
{
LL_INFOS("LLViewerAlertHandler") << "Alert: " << p->getName() << LL_ENDL;
}
// If we're in mouselook, the mouse is hidden and so the user can't click
// the dialog buttons. In that case, change to First Person instead.
if( gAgentCamera.cameraMouselook() )
{
gAgentCamera.changeCameraToDefault();
}
return false;
}

View File

@ -38,7 +38,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLGroupHandler::LLGroupHandler()
: LLSysHandler("Group Notifications", "groupnotify")
: LLCommunicationNotificationHandler("Group Notifications", "groupnotify")
{
// Getting a Channel for our notifications
LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();

View File

@ -27,6 +27,7 @@
#ifndef LL_LLNOTIFICATIONHANDLER_H
#define LL_LLNOTIFICATIONHANDLER_H
#include <boost/intrusive_ptr.hpp>
#include "llwindow.h"
@ -86,23 +87,39 @@ protected:
/**
* Handler for system notifications.
*/
class LLSysHandler : public LLEventHandler, public LLNotificationChannel
class LLNotificationHandler : public LLEventHandler, public LLNotificationChannel
{
public:
LLSysHandler(const std::string& name, const std::string& notification_type);
virtual ~LLSysHandler() {};
LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName);
virtual ~LLNotificationHandler() {};
// base interface functions
/*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
virtual void onAdd(LLNotificationPtr p) { processNotification(p); }
virtual void onChange(LLNotificationPtr p) { processNotification(p); }
virtual void onLoad(LLNotificationPtr p) { processNotification(p); }
virtual void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
virtual bool processNotification(const LLNotificationPtr& notify)=0;
virtual bool processNotification(const LLNotificationPtr& notify) = 0;
};
class LLSystemNotificationHandler : public LLNotificationHandler
{
public:
LLSystemNotificationHandler(const std::string& name, const std::string& notification_type);
virtual ~LLSystemNotificationHandler() {};
};
class LLCommunicationNotificationHandler : public LLNotificationHandler
{
public:
LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type);
virtual ~LLCommunicationNotificationHandler() {};
};
/**
* Handler for chat message notifications.
* Handler for chat message notifications.
*/
// XXX stinson 12/06/2012 : can I just remove the LLChatHandler class?
class LLChatHandler : public LLEventHandler
{
public:
@ -115,67 +132,62 @@ public:
* Handler for IM notifications.
* It manages life time of IMs, group messages.
*/
class LLIMHandler : public LLSysHandler
class LLIMHandler : public LLCommunicationNotificationHandler
{
public:
LLIMHandler();
virtual ~LLIMHandler();
bool processNotification(const LLNotificationPtr& p);
protected:
bool processNotification(const LLNotificationPtr& p);
/*virtual*/ void initChannel();
virtual void initChannel();
};
/**
* Handler for system informational notices.
* It manages life time of tip notices.
*/
class LLTipHandler : public LLSysHandler
class LLTipHandler : public LLSystemNotificationHandler
{
public:
LLTipHandler();
virtual ~LLTipHandler();
// base interface functions
/*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ bool processNotification(const LLNotificationPtr& p);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
/*virtual*/ void initChannel();
virtual void initChannel();
};
/**
* Handler for system informational notices.
* It manages life time of script notices.
*/
class LLScriptHandler : public LLSysHandler
class LLScriptHandler : public LLSystemNotificationHandler
{
public:
LLScriptHandler();
virtual ~LLScriptHandler();
/*virtual*/ void onDelete(LLNotificationPtr p);
// base interface functions
/*virtual*/ bool processNotification(const LLNotificationPtr& p);
virtual void onDelete(LLNotificationPtr p);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
/*virtual*/ void onDeleteToast(LLToast* toast);
/*virtual*/ void initChannel();
virtual void onDeleteToast(LLToast* toast);
virtual void initChannel();
};
/**
* Handler for group system notices.
*/
class LLGroupHandler : public LLSysHandler
class LLGroupHandler : public LLCommunicationNotificationHandler
{
public:
LLGroupHandler();
virtual ~LLGroupHandler();
// base interface functions
/*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ bool processNotification(const LLNotificationPtr& p);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void initChannel();
@ -184,15 +196,14 @@ protected:
/**
* Handler for alert system notices.
*/
class LLAlertHandler : public LLSysHandler
class LLAlertHandler : public LLSystemNotificationHandler
{
public:
LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal);
virtual ~LLAlertHandler();
/*virtual*/ void onChange(LLNotificationPtr p);
/*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ bool processNotification(const LLNotificationPtr& p);
virtual void onChange(LLNotificationPtr p);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void initChannel();
@ -200,67 +211,87 @@ protected:
bool mIsModal;
};
class LLViewerAlertHandler : public LLSystemNotificationHandler
{
LOG_CLASS(LLViewerAlertHandler);
public:
LLViewerAlertHandler(const std::string& name, const std::string& notification_type);
virtual ~LLViewerAlertHandler() {};
virtual void onDelete(LLNotificationPtr p) {};
virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void initChannel() {};
};
typedef boost::intrusive_ptr<LLViewerAlertHandler> LLViewerAlertHandlerPtr;
/**
* Handler for offers notices.
* It manages life time of offer notices.
*/
class LLOfferHandler : public LLSysHandler
class LLOfferHandler : public LLCommunicationNotificationHandler
{
public:
LLOfferHandler();
virtual ~LLOfferHandler();
// base interface functions
/*virtual*/ void onChange(LLNotificationPtr p);
/*virtual*/ void onDelete(LLNotificationPtr notification);
/*virtual*/ bool processNotification(const LLNotificationPtr& p);
virtual void onChange(LLNotificationPtr p);
virtual void onDelete(LLNotificationPtr notification);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
/*virtual*/ void initChannel();
virtual void initChannel();
};
/**
* Handler for UI hints.
*/
class LLHintHandler : public LLNotificationChannel
class LLHintHandler : public LLSystemNotificationHandler
{
public:
LLHintHandler() : LLNotificationChannel("Hints", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "hint"))
{}
LLHintHandler();
virtual ~LLHintHandler() {}
/*virtual*/ void onAdd(LLNotificationPtr p);
/*virtual*/ void onLoad(LLNotificationPtr p);
/*virtual*/ void onDelete(LLNotificationPtr p);
virtual void onAdd(LLNotificationPtr p);
virtual void onLoad(LLNotificationPtr p);
virtual void onDelete(LLNotificationPtr p);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void initChannel() {};
};
/**
* Handler for browser notifications
*/
class LLBrowserNotification : public LLNotificationChannel
class LLBrowserNotification : public LLSystemNotificationHandler
{
public:
LLBrowserNotification()
: LLNotificationChannel("Browser", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "browser"))
{}
/*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
bool processNotification(const LLNotificationPtr& p);
LLBrowserNotification();
virtual ~LLBrowserNotification() {}
virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void initChannel() {};
};
/**
* Handler for outbox notifications
*/
class LLOutboxNotification : public LLNotificationChannel
class LLOutboxNotification : public LLSystemNotificationHandler
{
public:
LLOutboxNotification()
: LLNotificationChannel("Outbox", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "outbox"))
{}
/*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
/*virtual*/ void onChange(LLNotificationPtr p) { }
/*virtual*/ void onDelete(LLNotificationPtr p);
bool processNotification(const LLNotificationPtr& p);
LLOutboxNotification();
virtual ~LLOutboxNotification() {};
virtual void onChange(LLNotificationPtr p) { }
virtual void onDelete(LLNotificationPtr p);
virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void initChannel() {};
};
class LLHandlerUtil

View File

@ -41,8 +41,16 @@
using namespace LLNotificationsUI;
LLSysHandler::LLSysHandler(const std::string& name, const std::string& notification_type)
: LLNotificationChannel(name, "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
LLNotificationHandler::LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName)
: LLNotificationChannel(name, parentName, LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
{}
LLSystemNotificationHandler::LLSystemNotificationHandler(const std::string& name, const std::string& notification_type)
: LLNotificationHandler(name, notification_type, "System")
{}
LLCommunicationNotificationHandler::LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type)
: LLNotificationHandler(name, notification_type, "Communication")
{}
// static

View File

@ -33,6 +33,27 @@
using namespace LLNotificationsUI;
void LLHintHandler::onAdd(LLNotificationPtr p) { LLHints::show(p); }
void LLHintHandler::onLoad(LLNotificationPtr p) { LLHints::show(p); }
void LLHintHandler::onDelete(LLNotificationPtr p) { LLHints::hide(p); }
LLHintHandler::LLHintHandler()
: LLSystemNotificationHandler("Hints", "hint")
{
}
void LLHintHandler::onAdd(LLNotificationPtr p)
{
LLHints::show(p);
}
void LLHintHandler::onLoad(LLNotificationPtr p)
{
LLHints::show(p);
}
void LLHintHandler::onDelete(LLNotificationPtr p)
{
LLHints::hide(p);
}
bool LLHintHandler::processNotification(const LLNotificationPtr& p)
{
return false;
}

View File

@ -41,7 +41,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLOfferHandler::LLOfferHandler()
: LLSysHandler("Offer", "offer")
: LLCommunicationNotificationHandler("Offer", "offer")
{
// Getting a Channel for our notifications
LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();

View File

@ -39,7 +39,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLScriptHandler::LLScriptHandler()
: LLSysHandler("Notifications", "notify")
: LLSystemNotificationHandler("Notifications", "notify")
{
// Getting a Channel for our notifications
LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();

View File

@ -42,7 +42,7 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLTipHandler::LLTipHandler()
: LLSysHandler("NotificationTips", "notifytip")
: LLSystemNotificationHandler("NotificationTips", "notifytip")
{
// Getting a Channel for our notifications
LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();

View File

@ -39,6 +39,7 @@
#include "llagentcamera.h"
#include "llfloaterreg.h"
#include "llmeshrepository.h"
#include "llnotificationhandler.h"
#include "llpanellogin.h"
#include "llviewerkeyboard.h"
#include "llviewermenu.h"
@ -127,6 +128,7 @@
#include "llmorphview.h"
#include "llmoveview.h"
#include "llnavigationbar.h"
#include "llnotificationhandler.h"
#include "llpanelpathfindingrebakenavmesh.h"
#include "llpaneltopinfobar.h"
#include "llpopupview.h"
@ -1554,11 +1556,13 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard)));
mViewerWindowListener.reset(new LLViewerWindowListener(this));
mAlertsChannel.reset(new LLNotificationChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert")));
mModalAlertsChannel.reset(new LLNotificationChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal")));
mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything));
mCommunicationChannel.reset(new LLNotificationChannel("Communication", "Visible", boost::bind(&LLAgent::isDoNotDisturb, &gAgent)));
mAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alerts", "alert"));
mModalAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alertmodal", "alertmodal"));
mAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
mModalAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
//mAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
//mModalAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
bool ignore = gSavedSettings.getBOOL("IgnoreAllNotifications");
LLNotifications::instance().setIgnoreAllNotifications(ignore);
if (ignore)
@ -5001,25 +5005,6 @@ LLRect LLViewerWindow::getChatConsoleRect()
//----------------------------------------------------------------------------
//static
bool LLViewerWindow::onAlert(const LLSD& notify)
{
LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
if (gHeadlessClient)
{
llinfos << "Alert: " << notification->getName() << llendl;
}
// If we're in mouselook, the mouse is hidden and so the user can't click
// the dialog buttons. In that case, change to First Person instead.
if( gAgentCamera.cameraMouselook() )
{
gAgentCamera.changeCameraToDefault();
}
return false;
}
void LLViewerWindow::setUIVisibility(bool visible)
{
mUIVisible = visible;

View File

@ -43,6 +43,8 @@
#include "lltimer.h"
#include "llstat.h"
#include "llmousehandler.h"
#include "llnotifications.h"
#include "llnotificationhandler.h"
#include "llhandle.h"
#include "llinitparam.h"
@ -401,7 +403,6 @@ public:
private:
bool shouldShowToolTipFor(LLMouseHandler *mh);
static bool onAlert(const LLSD& notify);
void switchToolByMask(MASK mask);
void destroyWindow();
@ -418,8 +419,10 @@ private:
bool mActive;
bool mUIVisible;
boost::shared_ptr<class LLNotificationChannel> mAlertsChannel,
mModalAlertsChannel;
LLNotificationChannelPtr mSystemChannel;
LLNotificationChannelPtr mCommunicationChannel;
LLNotificationsUI::LLViewerAlertHandlerPtr mAlertsChannel;
LLNotificationsUI::LLViewerAlertHandlerPtr mModalAlertsChannel;
LLRect mWindowRectRaw; // whole window, including UI
LLRect mWindowRectScaled; // whole window, scaled by UI size