mirror-chatterino2/src/channel.hpp
Rasmus Karlsson 5aa892e834 Refactor ConcurrentMap
* Add operator[] to ConcurrentMap which returns a TValue reference
* BTTV/FFZ channel emotes are now stored in the Emote Manager, and each Channel object has a reference to their own BTTV/FFZ channel emote map.
* Restructure EmoteManager a bit (simplify the ConcurrentMap havoc).
* Add EmoteData struct which can store emote data (for now only messages::LazyLoadedImage*)
* Add CompletionManager that does nothing
2017-07-09 17:58:59 +02:00

82 lines
2 KiB
C++

#pragma once
#include "concurrentmap.hpp"
#include "emotemanager.hpp"
#include "logging/loggingchannel.hpp"
#include "messages/lazyloadedimage.hpp"
#include "messages/limitedqueue.hpp"
#include <QMap>
#include <QMutex>
#include <QString>
#include <QVector>
#include <boost/signals2.hpp>
#include <memory>
namespace chatterino {
namespace messages {
class Message;
}
class WindowManager;
class IrcManager;
class Channel
{
public:
explicit Channel(WindowManager &_windowManager, EmoteManager &_emoteManager,
IrcManager &_ircManager, const QString &channel, bool isSpecial = false);
boost::signals2::signal<void(messages::SharedMessage &)> messageRemovedFromStart;
boost::signals2::signal<void(messages::SharedMessage &)> messageAppended;
// properties
EmoteManager::EmoteMap &getBTTVChannelEmotes();
EmoteManager::EmoteMap &getFFZChannelEmotes();
bool isEmpty() const;
const QString &getName() const;
const QString &getSubLink() const;
const QString &getChannelLink() const;
const QString &getPopoutPlayerLink() const;
bool getIsLive() const;
int getStreamViewerCount() const;
const QString &getStreamStatus() const;
const QString &getStreamGame() const;
messages::LimitedQueueSnapshot<messages::SharedMessage> getMessageSnapshot();
// methods
void addMessage(messages::SharedMessage message);
void reloadChannelEmotes();
void sendMessage(const QString &message);
std::string roomID;
private:
WindowManager &windowManager;
EmoteManager &emoteManager;
IrcManager &ircManager;
// variabeles
messages::LimitedQueue<messages::SharedMessage> _messages;
QString _name;
EmoteManager::EmoteMap &bttvChannelEmotes;
EmoteManager::EmoteMap &ffzChannelEmotes;
QString _subLink;
QString _channelLink;
QString _popoutPlayerLink;
bool _isLive;
int _streamViewerCount;
QString _streamStatus;
QString _streamGame;
// std::shared_ptr<logging::Channel> _loggingChannel;
};
} // namespace chatterino