mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added channel bttv and ffz emotes
This commit is contained in:
parent
49f3a41b7e
commit
50df4966a8
23
channel.cpp
23
channel.cpp
|
@ -30,6 +30,8 @@ Channel::Channel(const QString &channel)
|
|||
// addMessage(std::shared_ptr<messages::Message>(
|
||||
// new messages::Message("test xD test")));
|
||||
// }
|
||||
|
||||
reloadChannelEmotes();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -65,10 +67,11 @@ Channel::reloadBttvEmotes()
|
|||
|
||||
this->getBttvChannelEmotes().insert(
|
||||
code,
|
||||
Emotes::getBttvChannelEmoteFromCaches().getOrAdd(id, [=] {
|
||||
return new messages::LazyLoadedImage(
|
||||
url, 1, code, code + "\nChannel Bttv Emote");
|
||||
}));
|
||||
Emotes::getBttvChannelEmoteFromCaches().getOrAdd(
|
||||
id, [&code, &url] {
|
||||
return new messages::LazyLoadedImage(
|
||||
url, 1, code, code + "\nChannel Bttv Emote");
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +85,7 @@ Channel::reloadFfzEmotes()
|
|||
{
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager();
|
||||
|
||||
QUrl url("https://api.frankerfacez.com/v1/set/global");
|
||||
QUrl url("http://api.frankerfacez.com/v1/room/" + this->name);
|
||||
QNetworkRequest request(url);
|
||||
|
||||
QNetworkReply *reply = manager->get(request);
|
||||
|
@ -109,9 +112,13 @@ Channel::reloadFfzEmotes()
|
|||
QJsonObject urls = object.value("urls").toObject();
|
||||
QString url1 = "http:" + urls.value("1").toString();
|
||||
|
||||
Emotes::getBttvEmotes().insert(
|
||||
code, new messages::LazyLoadedImage(
|
||||
url1, 1, code, code + "\nGlobal Ffz Emote"));
|
||||
this->getFfzChannelEmotes().insert(
|
||||
code,
|
||||
Emotes::getFfzChannelEmoteFromCaches().getOrAdd(
|
||||
id, [&code, &url1] {
|
||||
return new messages::LazyLoadedImage(
|
||||
url1, 1, code, code + "\nGlobal Ffz Emote");
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,13 +21,13 @@ public:
|
|||
Channel(const QString &channel);
|
||||
|
||||
// properties
|
||||
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
getBttvChannelEmotes()
|
||||
{
|
||||
return bttvChannelEmotes;
|
||||
}
|
||||
|
||||
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
getFfzChannelEmotes()
|
||||
{
|
||||
return ffzChannelEmotes;
|
||||
|
|
129
channel.h.zT7500
129
channel.h.zT7500
|
@ -1,129 +0,0 @@
|
|||
#ifndef CHANNEL_H
|
||||
#define CHANNEL_H
|
||||
|
||||
#include "concurrentmap.h"
|
||||
#include "messages/lazyloadedimage.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QMutex>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
namespace chatterino {
|
||||
namespace messages {
|
||||
class Message;
|
||||
}
|
||||
|
||||
class Channel
|
||||
{
|
||||
public:
|
||||
Channel(const QString &channel);
|
||||
|
||||
// properties
|
||||
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
getBttvChannelEmotes() const
|
||||
{
|
||||
return bttvChannelEmotes;
|
||||
}
|
||||
|
||||
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
getFfzChannelEmotes() const
|
||||
{
|
||||
return ffzChannelEmotes;
|
||||
}
|
||||
|
||||
const QMutex &
|
||||
getMessageMutex() const
|
||||
{
|
||||
return messageMutex;
|
||||
}
|
||||
|
||||
const QString &
|
||||
getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
int
|
||||
getRoomID() const
|
||||
{
|
||||
return roomID;
|
||||
}
|
||||
|
||||
const QString &
|
||||
getSubLink() const
|
||||
{
|
||||
return subLink;
|
||||
}
|
||||
const QString &
|
||||
getChannelLink() const
|
||||
{
|
||||
return channelLink;
|
||||
}
|
||||
const QString &
|
||||
getPopoutPlayerLink() const
|
||||
{
|
||||
return popoutPlayerLink;
|
||||
}
|
||||
|
||||
bool
|
||||
getIsLive() const
|
||||
{
|
||||
return isLive;
|
||||
}
|
||||
int
|
||||
getStreamViewerCount() const
|
||||
{
|
||||
return streamViewerCount;
|
||||
}
|
||||
const QString &
|
||||
getStreamStatus() const
|
||||
{
|
||||
return streamStatus;
|
||||
}
|
||||
const QString &
|
||||
getStreamGame() const
|
||||
{
|
||||
return streamGame;
|
||||
}
|
||||
|
||||
// methods
|
||||
void addMessage(std::shared_ptr<messages::Message> message);
|
||||
|
||||
QVector<std::shared_ptr<messages::Message>> getMessagesClone();
|
||||
|
||||
QVector<std::shared_ptr<messages::Message>> &
|
||||
getMessages() const
|
||||
{
|
||||
return messages;
|
||||
}
|
||||
|
||||
QMutex &
|
||||
getMessageMutes() const
|
||||
{
|
||||
return messageMutex;
|
||||
}
|
||||
|
||||
private:
|
||||
QVector<std::shared_ptr<messages::Message>> messages;
|
||||
|
||||
QString name;
|
||||
int roomID;
|
||||
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> bttvChannelEmotes;
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> ffzChannelEmotes;
|
||||
QMutex messageMutex;
|
||||
|
||||
QString subLink;
|
||||
QString channelLink;
|
||||
QString popoutPlayerLink;
|
||||
|
||||
bool isLive;
|
||||
int streamViewerCount;
|
||||
QString streamStatus;
|
||||
QString streamGame;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CHANNEL_H
|
|
@ -22,7 +22,7 @@ ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::ffzEmotes;
|
|||
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::chatterinoEmotes;
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||
Emotes::bttvChannelEmoteFromCaches;
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||
ConcurrentMap<int, messages::LazyLoadedImage *>
|
||||
Emotes::ffzChannelEmoteFromCaches;
|
||||
ConcurrentMap<long, messages::LazyLoadedImage *> Emotes::twitchEmoteFromCache;
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::miscImageFromCache;
|
||||
|
|
4
emotes.h
4
emotes.h
|
@ -43,7 +43,7 @@ public:
|
|||
return bttvChannelEmoteFromCaches;
|
||||
}
|
||||
|
||||
static ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||
static ConcurrentMap<int, messages::LazyLoadedImage *> &
|
||||
getFfzChannelEmoteFromCaches()
|
||||
{
|
||||
return ffzChannelEmoteFromCaches;
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
static ConcurrentMap<QString, messages::LazyLoadedImage *> chatterinoEmotes;
|
||||
static ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||
bttvChannelEmoteFromCaches;
|
||||
static ConcurrentMap<QString, messages::LazyLoadedImage *>
|
||||
static ConcurrentMap<int, messages::LazyLoadedImage *>
|
||||
ffzChannelEmoteFromCaches;
|
||||
static ConcurrentMap<long, messages::LazyLoadedImage *>
|
||||
twitchEmoteFromCache;
|
||||
|
|
Loading…
Reference in a new issue