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)
|
, channelLink("https://twitch.tv/" + name)
|
||||||
, popoutPlayerLink("https://player.twitch.tv/?channel=" + name)
|
, popoutPlayerLink("https://player.twitch.tv/?channel=" + name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 40; i++) {
|
// for (int i = 0; i < 40; i++) {
|
||||||
addMessage(std::shared_ptr<messages::Message>(
|
// addMessage(std::shared_ptr<messages::Message>(
|
||||||
new messages::Message("test xD test")));
|
// new messages::Message("test xD test")));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<std::shared_ptr<messages::Message>>
|
QVector<std::shared_ptr<messages::Message>>
|
||||||
|
|
14
emotes.cpp
14
emotes.cpp
|
@ -1,6 +1,8 @@
|
||||||
#include "emotes.h"
|
#include "emotes.h"
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
QString Emotes::twitchEmoteTemplate(
|
QString Emotes::twitchEmoteTemplate(
|
||||||
|
@ -26,7 +28,10 @@ Emotes::Emotes()
|
||||||
messages::LazyLoadedImage *
|
messages::LazyLoadedImage *
|
||||||
Emotes::getTwitchEmoteById(const QString &name, long id)
|
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;
|
qreal scale;
|
||||||
QString url = getTwitchEmoteLink(id, scale);
|
QString url = getTwitchEmoteLink(id, scale);
|
||||||
return new messages::LazyLoadedImage(url, scale, name,
|
return new messages::LazyLoadedImage(url, scale, name,
|
||||||
|
@ -39,8 +44,11 @@ Emotes::getTwitchEmoteLink(long id, qreal &scale)
|
||||||
{
|
{
|
||||||
scale = .5;
|
scale = .5;
|
||||||
|
|
||||||
return Emotes::twitchEmoteTemplate.replace("{id}", QString::number(id))
|
QString value = Emotes::twitchEmoteTemplate;
|
||||||
.replace("{scale}", "2");
|
|
||||||
|
value.detach();
|
||||||
|
|
||||||
|
return value.replace("{id}", QString::number(id)).replace("{scale}", "2");
|
||||||
}
|
}
|
||||||
|
|
||||||
messages::LazyLoadedImage *
|
messages::LazyLoadedImage *
|
||||||
|
|
Loading…
Reference in a new issue