PageRenderTime 130ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #include "llnotificationsutil.h"
  27. #include "llnotifications.h"
  28. #include "llsd.h"
  29. #include "llxmlnode.h" // apparently needed to call LLNotifications::instance()
  30. LLNotificationPtr LLNotificationsUtil::add(const std::string& name)
  31. {
  32. LLNotification::Params::Functor functor_p;
  33. functor_p.name = name;
  34. return LLNotifications::instance().add(
  35. LLNotification::Params().name(name).substitutions(LLSD()).payload(LLSD()).functor(functor_p));
  36. }
  37. LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
  38. const LLSD& substitutions)
  39. {
  40. LLNotification::Params::Functor functor_p;
  41. functor_p.name = name;
  42. return LLNotifications::instance().add(
  43. LLNotification::Params().name(name).substitutions(substitutions).payload(LLSD()).functor(functor_p));
  44. }
  45. LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
  46. const LLSD& substitutions,
  47. const LLSD& payload)
  48. {
  49. LLNotification::Params::Functor functor_p;
  50. functor_p.name = name;
  51. return LLNotifications::instance().add(
  52. LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
  53. }
  54. LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
  55. const LLSD& substitutions,
  56. const LLSD& payload,
  57. const std::string& functor_name)
  58. {
  59. LLNotification::Params::Functor functor_p;
  60. functor_p.name = functor_name;
  61. return LLNotifications::instance().add(
  62. LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
  63. }
  64. LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
  65. const LLSD& substitutions,
  66. const LLSD& payload,
  67. boost::function<void (const LLSD&, const LLSD&)> functor)
  68. {
  69. LLNotification::Params::Functor functor_p;
  70. functor_p.function = functor;
  71. return LLNotifications::instance().add(
  72. LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
  73. }
  74. S32 LLNotificationsUtil::getSelectedOption(const LLSD& notification, const LLSD& response)
  75. {
  76. return LLNotification::getSelectedOption(notification, response);
  77. }
  78. void LLNotificationsUtil::cancel(LLNotificationPtr pNotif)
  79. {
  80. LLNotifications::instance().cancel(pNotif);
  81. }
  82. LLNotificationPtr LLNotificationsUtil::find(LLUUID uuid)
  83. {
  84. return LLNotifications::instance().find(uuid);
  85. }