mirror-chatterino2/channel.h

81 lines
2 KiB
C
Raw Normal View History

#ifndef CHANNEL_H
#define CHANNEL_H
2017-01-07 20:43:55 +01:00
#include "concurrentmap.h"
#include "lazyloadedimage.h"
#include <QString>
#include <QMap>
#include <QMutex>
#include <QVector>
2017-01-11 01:08:20 +01:00
#include <memory>
2017-01-05 16:07:20 +01:00
class Message;
class Channel
{
2017-01-07 20:43:55 +01:00
// static
public:
2017-01-07 20:43:55 +01:00
static Channel whispers;
static Channel mentions;
2017-01-03 21:19:33 +01:00
static Channel* addChannel(const QString &channel);
static Channel* getChannel(const QString &channel);
static void removeChannel(const QString &channel);
2017-01-01 18:43:52 +01:00
2017-01-07 20:43:55 +01:00
private:
static QMap<QString, Channel*> channels;
// members
public:
// properties
const ConcurrentMap<QString, LazyLoadedImage*>& bttvChannelEmotes() const { return m_bttvChannelEmotes; }
const ConcurrentMap<QString, LazyLoadedImage*>& ffzChannelEmotes() const { return m_ffzChannelEmotes; }
const QMutex& messageMutex() const { return m_messageMutex; }
const QString& name() const { return m_name; }
int roomID() const { return m_roomID; }
2017-01-07 20:43:55 +01:00
const QString& subLink() const { return m_subLink; }
const QString& channelLink() const { return m_channelLink; }
const QString& popoutPlayerLink() const { return m_popoutPlayerLink; }
2017-01-07 20:43:55 +01:00
bool isLive() const { return m_isLive; }
int streamViewerCount() const { return m_streamViewerCount; }
const QString& streamStatus() const { return m_streamStatus; }
const QString& streamGame() const { return m_streamGame; }
2017-01-05 20:49:33 +01:00
2017-01-07 20:43:55 +01:00
// methods
2017-01-11 01:08:20 +01:00
void addMessage(std::shared_ptr<Message> message);
2017-01-05 16:07:20 +01:00
2017-01-11 01:08:20 +01:00
QVector<std::shared_ptr<Message>> getMessagesClone();
2017-01-05 16:07:20 +01:00
private:
Channel(QString channel);
2017-01-07 20:43:55 +01:00
ConcurrentMap<QString, LazyLoadedImage*> m_bttvChannelEmotes;
ConcurrentMap<QString, LazyLoadedImage*> m_ffzChannelEmotes;
QMutex m_messageMutex;
2017-01-05 16:07:20 +01:00
2017-01-07 20:43:55 +01:00
int m_referenceCount = 0;
2017-01-03 21:19:33 +01:00
2017-01-11 01:08:20 +01:00
QVector<std::shared_ptr<Message>> m_messages;
2017-01-05 20:49:33 +01:00
QString m_name;
2017-01-07 20:43:55 +01:00
int m_roomID;
2017-01-07 20:43:55 +01:00
QString m_subLink;
QString m_channelLink;
QString m_popoutPlayerLink;
2017-01-07 20:43:55 +01:00
bool m_isLive;
int m_streamViewerCount;
QString m_streamStatus;
QString m_streamGame;
};
#endif // CHANNEL_H