mirror-chatterino2/channel.h

134 lines
2.3 KiB
C
Raw Normal View History

#ifndef CHANNEL_H
#define CHANNEL_H
2017-01-07 20:43:55 +01:00
#include "concurrentmap.h"
2017-01-18 21:30:23 +01:00
#include "messages/lazyloadedimage.h"
2017-01-07 20:43:55 +01:00
#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
2017-01-18 21:30:23 +01:00
namespace chatterino {
namespace messages {
2017-01-05 16:07:20 +01:00
class Message;
2017-01-18 21:30:23 +01:00
}
class Channel
{
public:
Channel(const QString &channel);
2017-01-07 20:43:55 +01:00
// properties
2017-01-26 18:22:04 +01:00
ConcurrentMap<QString, messages::LazyLoadedImage *> &
2017-01-26 17:48:14 +01:00
getBttvChannelEmotes()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return bttvChannelEmotes;
2017-01-11 18:52:09 +01:00
}
2017-01-18 21:30:23 +01:00
2017-01-26 18:22:04 +01:00
ConcurrentMap<QString, messages::LazyLoadedImage *> &
2017-01-26 17:48:14 +01:00
getFfzChannelEmotes()
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return ffzChannelEmotes;
2017-01-11 18:52:09 +01:00
}
const QMutex &
2017-01-18 04:33:30 +01:00
getMessageMutex() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return messageMutex;
2017-01-11 18:52:09 +01:00
}
const QString &
2017-01-18 04:33:30 +01:00
getName() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return name;
2017-01-11 18:52:09 +01:00
}
2017-01-18 04:33:30 +01:00
2017-01-11 18:52:09 +01:00
int
2017-01-18 04:33:30 +01:00
getRoomID() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return roomID;
2017-01-11 18:52:09 +01:00
}
const QString &
2017-01-18 04:33:30 +01:00
getSubLink() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return subLink;
2017-01-11 18:52:09 +01:00
}
const QString &
2017-01-18 04:33:30 +01:00
getChannelLink() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return channelLink;
2017-01-11 18:52:09 +01:00
}
const QString &
2017-01-18 04:33:30 +01:00
getPopoutPlayerLink() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return popoutPlayerLink;
2017-01-11 18:52:09 +01:00
}
bool
2017-01-18 04:33:30 +01:00
getIsLive() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return isLive;
2017-01-11 18:52:09 +01:00
}
int
2017-01-18 04:33:30 +01:00
getStreamViewerCount() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return streamViewerCount;
2017-01-11 18:52:09 +01:00
}
const QString &
2017-01-18 04:33:30 +01:00
getStreamStatus() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return streamStatus;
2017-01-11 18:52:09 +01:00
}
const QString &
2017-01-18 04:33:30 +01:00
getStreamGame() const
2017-01-11 18:52:09 +01:00
{
2017-01-18 04:33:30 +01:00
return streamGame;
2017-01-11 18:52:09 +01:00
}
2017-01-05 20:49:33 +01:00
2017-01-07 20:43:55 +01:00
// methods
2017-01-18 21:52:36 +01:00
void addMessage(std::shared_ptr<messages::Message> message);
2017-01-05 16:07:20 +01:00
2017-01-18 21:52:36 +01:00
QVector<std::shared_ptr<messages::Message>> getMessagesClone();
2017-01-05 16:07:20 +01:00
2017-01-26 04:26:40 +01:00
QVector<std::shared_ptr<messages::Message>> &
getMessages()
{
return messages;
}
2017-01-26 17:26:20 +01:00
void
reloadChannelEmotes()
{
reloadBttvEmotes();
reloadFfzEmotes();
}
private:
2017-01-18 21:52:36 +01:00
QVector<std::shared_ptr<messages::Message>> messages;
2017-01-18 04:33:30 +01:00
QString name;
int roomID;
2017-01-18 21:52:36 +01:00
ConcurrentMap<QString, messages::LazyLoadedImage *> bttvChannelEmotes;
ConcurrentMap<QString, messages::LazyLoadedImage *> ffzChannelEmotes;
2017-01-18 04:33:30 +01:00
QMutex messageMutex;
2017-01-13 18:59:11 +01:00
2017-01-18 04:33:30 +01:00
QString subLink;
QString channelLink;
QString popoutPlayerLink;
2017-01-18 04:33:30 +01:00
bool isLive;
int streamViewerCount;
QString streamStatus;
QString streamGame;
2017-01-26 17:26:20 +01:00
void reloadBttvEmotes();
void reloadFfzEmotes();
};
2017-01-18 21:30:23 +01:00
}
2017-01-11 18:52:09 +01:00
#endif // CHANNEL_H