mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed twitch emotes
This commit is contained in:
parent
a5e7ef9980
commit
1828fe1ec9
2 changed files with 15 additions and 7 deletions
|
@ -18,10 +18,10 @@ Channel::Channel(const QString &channel)
|
|||
, channelLink("https://twitch.tv/" + name)
|
||||
, popoutPlayerLink("https://player.twitch.tv/?channel=" + name)
|
||||
{
|
||||
for (int i = 0; i < 40; i++) {
|
||||
addMessage(std::shared_ptr<messages::Message>(
|
||||
new messages::Message("test xD test")));
|
||||
}
|
||||
// for (int i = 0; i < 40; i++) {
|
||||
// addMessage(std::shared_ptr<messages::Message>(
|
||||
// new messages::Message("test xD test")));
|
||||
// }
|
||||
}
|
||||
|
||||
QVector<std::shared_ptr<messages::Message>>
|
||||
|
|
14
emotes.cpp
14
emotes.cpp
|
@ -1,6 +1,8 @@
|
|||
#include "emotes.h"
|
||||
#include "resources.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
QString Emotes::twitchEmoteTemplate(
|
||||
|
@ -26,7 +28,10 @@ Emotes::Emotes()
|
|||
messages::LazyLoadedImage *
|
||||
Emotes::getTwitchEmoteById(const QString &name, long id)
|
||||
{
|
||||
return Emotes::twitchEmoteFromCache.getOrAdd(id, [&name, id] {
|
||||
qDebug() << "loading twitch emote: " << id;
|
||||
|
||||
return Emotes::twitchEmoteFromCache.getOrAdd(id, [&name, &id] {
|
||||
qDebug() << "loading twitch emote: " << id;
|
||||
qreal scale;
|
||||
QString url = getTwitchEmoteLink(id, scale);
|
||||
return new messages::LazyLoadedImage(url, scale, name,
|
||||
|
@ -39,8 +44,11 @@ Emotes::getTwitchEmoteLink(long id, qreal &scale)
|
|||
{
|
||||
scale = .5;
|
||||
|
||||
return Emotes::twitchEmoteTemplate.replace("{id}", QString::number(id))
|
||||
.replace("{scale}", "2");
|
||||
QString value = Emotes::twitchEmoteTemplate;
|
||||
|
||||
value.detach();
|
||||
|
||||
return value.replace("{id}", QString::number(id)).replace("{scale}", "2");
|
||||
}
|
||||
|
||||
messages::LazyLoadedImage *
|
||||
|
|
Loading…
Reference in a new issue