mirror-chatterino2/channel.h

129 lines
2.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 <QMap>
#include <QMutex>
2017-01-11 18:52:09 +01:00
#include <QString>
2017-01-07 20:43:55 +01:00
#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-11 18:52:09 +01:00
// static
2017-01-07 20:43:55 +01:00
public:
2017-01-07 20:43:55 +01:00
static Channel whispers;
static Channel mentions;
2017-01-11 18:52:09 +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:
2017-01-11 18:52:09 +01:00
static QMap<QString, Channel *> channels;
2017-01-07 20:43:55 +01:00
2017-01-11 18:52:09 +01:00
// members
2017-01-07 20:43:55 +01:00
public:
// properties
2017-01-11 18:52:09 +01:00
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;
}
const QString &
subLink() const
{
return m_subLink;
}
const QString &
channelLink() const
{
return m_channelLink;
}
const QString &
popoutPlayerLink() const
{
return m_popoutPlayerLink;
}
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-11 18:52:09 +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-11 18:52:09 +01:00
int m_roomID;
2017-01-13 18:59:11 +01:00
ConcurrentMap<QString, LazyLoadedImage *> m_bttvChannelEmotes;
ConcurrentMap<QString, LazyLoadedImage *> m_ffzChannelEmotes;
QMutex m_messageMutex;
2017-01-07 20:43:55 +01:00
QString m_subLink;
QString m_channelLink;
QString m_popoutPlayerLink;
2017-01-11 18:52:09 +01:00
bool m_isLive;
int m_streamViewerCount;
2017-01-07 20:43:55 +01:00
QString m_streamStatus;
QString m_streamGame;
};
2017-01-11 18:52:09 +01:00
#endif // CHANNEL_H