PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llnotificationsutil.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 95 lines | 61 code | 10 blank | 24 comment | 0 complexity | d02b4cc05aba68472c881b5551ccc154 MD5 | raw file
 1/**
 2 * @file llnotificationsutil.cpp
 3 *
 4 * $LicenseInfo:firstyear=2008&license=viewerlgpl$
 5 * Second Life Viewer Source Code
 6 * Copyright (C) 2010, Linden Research, Inc.
 7 * 
 8 * This library is free software; you can redistribute it and/or
 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation;
11 * version 2.1 of the License only.
12 * 
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 * 
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 * 
22 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
23 * $/LicenseInfo$
24 */
25#include "linden_common.h"
26
27#include "llnotificationsutil.h"
28
29#include "llnotifications.h"
30#include "llsd.h"
31#include "llxmlnode.h"	// apparently needed to call LLNotifications::instance()
32
33LLNotificationPtr LLNotificationsUtil::add(const std::string& name)
34{
35	LLNotification::Params::Functor functor_p;
36	functor_p.name = name;
37	return LLNotifications::instance().add(
38		LLNotification::Params().name(name).substitutions(LLSD()).payload(LLSD()).functor(functor_p));	
39}
40
41LLNotificationPtr LLNotificationsUtil::add(const std::string& name, 
42					  const LLSD& substitutions)
43{
44	LLNotification::Params::Functor functor_p;
45	functor_p.name = name;
46	return LLNotifications::instance().add(
47		LLNotification::Params().name(name).substitutions(substitutions).payload(LLSD()).functor(functor_p));	
48}
49
50LLNotificationPtr LLNotificationsUtil::add(const std::string& name, 
51					  const LLSD& substitutions, 
52					  const LLSD& payload)
53{
54	LLNotification::Params::Functor functor_p;
55	functor_p.name = name;
56	return LLNotifications::instance().add(
57		LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));	
58}
59
60LLNotificationPtr LLNotificationsUtil::add(const std::string& name, 
61					  const LLSD& substitutions, 
62					  const LLSD& payload, 
63					  const std::string& functor_name)
64{
65	LLNotification::Params::Functor functor_p;
66	functor_p.name = functor_name;
67	return LLNotifications::instance().add(
68		LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));	
69}
70
71LLNotificationPtr LLNotificationsUtil::add(const std::string& name, 
72					  const LLSD& substitutions, 
73					  const LLSD& payload, 
74					  boost::function<void (const LLSD&, const LLSD&)> functor)
75{
76	LLNotification::Params::Functor functor_p;
77	functor_p.function = functor;
78	return LLNotifications::instance().add(
79		LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));	
80}
81
82S32 LLNotificationsUtil::getSelectedOption(const LLSD& notification, const LLSD& response)
83{
84	return LLNotification::getSelectedOption(notification, response);
85}
86
87void LLNotificationsUtil::cancel(LLNotificationPtr pNotif)
88{
89	LLNotifications::instance().cancel(pNotif);
90}
91
92LLNotificationPtr LLNotificationsUtil::find(LLUUID uuid)
93{
94	return LLNotifications::instance().find(uuid);
95}