PageRenderTime 36ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llchannelmanager.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 118 lines | 46 code | 26 blank | 46 comment | 2 complexity | 942aae4eabf6859ac8d9ea6062185587 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llchannelmanager.h
  3. * @brief This class rules screen notification channels.
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLCHANNELMANAGER_H
  27. #define LL_LLCHANNELMANAGER_H
  28. #include "llscreenchannel.h"
  29. #include "lluuid.h"
  30. #include <map>
  31. #include <boost/shared_ptr.hpp>
  32. namespace LLNotificationsUI
  33. {
  34. /**
  35. * Manager for screen channels.
  36. * Responsible for instantiating and retrieving screen channels.
  37. */
  38. class LLChannelManager : public LLSingleton<LLChannelManager>
  39. {
  40. public:
  41. struct ChannelElem
  42. {
  43. LLUUID id;
  44. LLHandle<LLScreenChannelBase> channel;
  45. ChannelElem() { }
  46. ChannelElem(const ChannelElem &elem)
  47. {
  48. id = elem.id;
  49. channel = elem.channel;
  50. }
  51. bool operator == (const LLUUID &id_op) const
  52. {
  53. return (id == id_op);
  54. }
  55. };
  56. LLChannelManager();
  57. virtual ~LLChannelManager();
  58. // On LoginCompleted - show StartUp toast
  59. void onLoginCompleted();
  60. // removes a channel intended for the startup toast and allows other channels to show their toasts
  61. void onStartUpToastClose();
  62. // creates a new ScreenChannel according to the given parameters or returns existing if present
  63. LLScreenChannelBase* getChannel(LLScreenChannelBase::Params& p);
  64. LLScreenChannelBase* addChannel(LLScreenChannelBase* channel);
  65. // returns a channel by its ID
  66. LLScreenChannelBase* findChannelByID(const LLUUID& id);
  67. // creator of the Notification channel, that is used in more than one handler
  68. LLScreenChannel* createNotificationChannel();
  69. // remove channel methods
  70. void removeChannelByID(const LLUUID& id);
  71. /**
  72. * Manages toasts showing for all channels.
  73. *
  74. * @param mute Flag to disable/enable toasts showing.
  75. */
  76. void muteAllChannels(bool mute);
  77. /**
  78. * Kills matched toasts from specified toast screen channel.
  79. */
  80. void killToastsFromChannel(const LLUUID& channel_id, const LLScreenChannel::Matcher& matcher);
  81. /**
  82. * Returns notification screen channel.
  83. */
  84. static LLNotificationsUI::LLScreenChannel* getNotificationScreenChannel();
  85. std::vector<ChannelElem>& getChannelList() { return mChannelList;}
  86. private:
  87. LLScreenChannel* createChannel(LLScreenChannelBase::Params& p);
  88. LLScreenChannel* mStartUpChannel;
  89. std::vector<ChannelElem> mChannelList;
  90. };
  91. }
  92. #endif