Move AIAlert* into namespace AIAlert and rename classes.

Instead of having several AI* classes, it turned out to be easier to
have a namespace: this allows me to define the classes in llcommon but
add (new) 'add' and 'add_modal' functions to 'AIAlert' in llui.
This is needed to avoid a collision with the 'add' functions in
LLNotificationsUtil.

The new add/add_modal makes it a lot easier to just show a caught
alert, prepending or appending new text: it turns out that that is
way more common then a re-throw.

Adjusted code as appropriate.
This commit is contained in:
Aleric Inglewood
2013-11-05 22:30:02 +01:00
parent 8ab9039ff6
commit c516a71804
14 changed files with 300 additions and 230 deletions

View File

@@ -30,11 +30,46 @@
#include "llsd.h"
#include "llxmlnode.h" // apparently needed to call LLNotifications::instance()
LLNotificationPtr LLNotificationsUtil::add(AIAlert const& alert, unsigned int suppress_mask)
namespace AIAlert
{
return LLNotifications::instance().add(alert, suppress_mask);
LLNotificationPtr add(Error const& error, modal_nt type, unsigned int suppress_mask)
{
return LLNotifications::instance().add(error, type, suppress_mask);
}
LLNotificationPtr add(std::string const& xml_desc, modal_nt type)
{
return LLNotifications::instance().add(Error(Prefix(), type, xml_desc, AIArgs()), type, 0);
}
LLNotificationPtr add(std::string const& xml_desc, AIArgs const& args, modal_nt type)
{
return LLNotifications::instance().add(Error(Prefix(), type, xml_desc, args), type, 0);
}
LLNotificationPtr add(Error const& error, std::string const& xml_desc, unsigned int suppress_mask, modal_nt type)
{
return LLNotifications::instance().add(Error(Prefix(), type, error, xml_desc, AIArgs()), type, suppress_mask);
}
LLNotificationPtr add(Error const& error, std::string const& xml_desc, AIArgs const& args, unsigned int suppress_mask, modal_nt type)
{
return LLNotifications::instance().add(Error(Prefix(), type, error, xml_desc, args), type, suppress_mask);
}
LLNotificationPtr add(std::string const& xml_desc, Error const& error, unsigned int suppress_mask, modal_nt type)
{
return LLNotifications::instance().add(Error(Prefix(), type, xml_desc, AIArgs(), error), type, suppress_mask);
}
LLNotificationPtr add(std::string const& xml_desc, AIArgs const& args, Error const& error, unsigned int suppress_mask, modal_nt type)
{
return LLNotifications::instance().add(Error(Prefix(), type, xml_desc, args, error), type, suppress_mask);
}
} // namespace AIAlert
LLNotificationPtr LLNotificationsUtil::add(const std::string& name)
{
return LLNotifications::instance().add(