PageRenderTime 108ms CodeModel.GetById 96ms app.highlight 7ms RepoModel.GetById 2ms 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
  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
 27#ifndef LL_LLCHANNELMANAGER_H
 28#define LL_LLCHANNELMANAGER_H
 29
 30
 31#include "llscreenchannel.h"
 32
 33#include "lluuid.h"
 34
 35#include <map>
 36#include <boost/shared_ptr.hpp>
 37
 38namespace LLNotificationsUI
 39{
 40/**
 41 * Manager for screen channels.
 42 * Responsible for instantiating and retrieving screen channels.
 43 */
 44class LLChannelManager : public LLSingleton<LLChannelManager>
 45{
 46public:
 47
 48
 49	struct ChannelElem
 50	{
 51		LLUUID							id;
 52		LLHandle<LLScreenChannelBase>	channel;
 53
 54		ChannelElem() { }
 55
 56		ChannelElem(const ChannelElem &elem)
 57		{
 58			id = elem.id;
 59			channel = elem.channel;
 60		}
 61
 62		bool operator == (const LLUUID &id_op) const
 63		{
 64			return (id == id_op);
 65		}
 66	};
 67
 68	LLChannelManager();	
 69	virtual ~LLChannelManager();
 70
 71	// On LoginCompleted - show StartUp toast
 72	void onLoginCompleted();
 73	// removes a channel intended for the startup toast and allows other channels to show their toasts
 74	void onStartUpToastClose();
 75
 76	// creates a new ScreenChannel according to the given parameters or returns existing if present
 77	LLScreenChannelBase*	getChannel(LLScreenChannelBase::Params& p);
 78
 79	LLScreenChannelBase*	addChannel(LLScreenChannelBase* channel);
 80
 81	// returns a channel by its ID
 82	LLScreenChannelBase*	findChannelByID(const LLUUID& id);
 83
 84	// creator of the Notification channel, that is used in more than one handler
 85	LLScreenChannel*		createNotificationChannel();
 86
 87	// remove channel methods
 88	void	removeChannelByID(const LLUUID& id);
 89
 90	/**
 91	 * Manages toasts showing for all channels.
 92	 *
 93	 * @param mute Flag to disable/enable toasts showing.
 94	 */
 95	void muteAllChannels(bool mute);
 96
 97	/**
 98	 * Kills matched toasts from specified  toast screen channel.
 99	 */
100	void killToastsFromChannel(const LLUUID& channel_id, const LLScreenChannel::Matcher& matcher);
101
102	/**
103	 * Returns notification screen channel.
104	 */
105	static LLNotificationsUI::LLScreenChannel* getNotificationScreenChannel();
106
107	std::vector<ChannelElem>& getChannelList() { return mChannelList;}
108private:
109
110	LLScreenChannel* createChannel(LLScreenChannelBase::Params& p);
111
112	LLScreenChannel*			mStartUpChannel;
113	std::vector<ChannelElem>	mChannelList;
114};
115
116}
117#endif
118