mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
parent
fc0e89edf3
commit
355b80680d
5 changed files with 31 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "messages/image.hpp"
|
#include "messages/image.hpp"
|
||||||
|
|
||||||
#include "application.hpp"
|
#include "application.hpp"
|
||||||
|
#include "debug/log.hpp"
|
||||||
#include "singletons/emotemanager.hpp"
|
#include "singletons/emotemanager.hpp"
|
||||||
#include "singletons/ircmanager.hpp"
|
#include "singletons/ircmanager.hpp"
|
||||||
#include "singletons/windowmanager.hpp"
|
#include "singletons/windowmanager.hpp"
|
||||||
|
@ -209,6 +210,15 @@ const QString &Image::getName() const
|
||||||
return this->name;
|
return this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &Image::getCopyString() const
|
||||||
|
{
|
||||||
|
if (this->copyString.isEmpty()) {
|
||||||
|
return this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->copyString;
|
||||||
|
}
|
||||||
|
|
||||||
const QString &Image::getTooltip() const
|
const QString &Image::getTooltip() const
|
||||||
{
|
{
|
||||||
return this->tooltip;
|
return this->tooltip;
|
||||||
|
@ -258,5 +268,10 @@ int Image::getScaledHeight() const
|
||||||
getApp()->settings->emoteScale.getValue());
|
getApp()->settings->emoteScale.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Image::setCopyString(const QString &newCopyString)
|
||||||
|
{
|
||||||
|
this->copyString = newCopyString;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace messages
|
} // namespace messages
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
qreal getScale() const;
|
qreal getScale() const;
|
||||||
const QString &getUrl() const;
|
const QString &getUrl() const;
|
||||||
const QString &getName() const;
|
const QString &getName() const;
|
||||||
|
const QString &getCopyString() const;
|
||||||
const QString &getTooltip() const;
|
const QString &getTooltip() const;
|
||||||
const QMargins &getMargin() const;
|
const QMargins &getMargin() const;
|
||||||
bool isAnimated() const;
|
bool isAnimated() const;
|
||||||
|
@ -34,6 +35,8 @@ public:
|
||||||
int getHeight() const;
|
int getHeight() const;
|
||||||
int getScaledHeight() const;
|
int getScaledHeight() const;
|
||||||
|
|
||||||
|
void setCopyString(const QString &newCopyString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct FrameData {
|
struct FrameData {
|
||||||
QPixmap *image;
|
QPixmap *image;
|
||||||
|
@ -50,6 +53,7 @@ private:
|
||||||
|
|
||||||
QString url;
|
QString url;
|
||||||
QString name;
|
QString name;
|
||||||
|
QString copyString;
|
||||||
QString tooltip;
|
QString tooltip;
|
||||||
bool animated = false;
|
bool animated = false;
|
||||||
QMargins margin;
|
QMargins margin;
|
||||||
|
|
|
@ -74,7 +74,7 @@ ImageLayoutElement::ImageLayoutElement(MessageElement &_creator, Image *_image,
|
||||||
|
|
||||||
void ImageLayoutElement::addCopyTextToString(QString &str, int from, int to) const
|
void ImageLayoutElement::addCopyTextToString(QString &str, int from, int to) const
|
||||||
{
|
{
|
||||||
str += this->image->getName();
|
str += this->image->getCopyString();
|
||||||
|
|
||||||
if (this->hasTrailingSpace()) {
|
if (this->hasTrailingSpace()) {
|
||||||
str += " ";
|
str += " ";
|
||||||
|
|
|
@ -85,7 +85,8 @@ EmoteElement::EmoteElement(const util::EmoteData &_data, MessageElement::Flags f
|
||||||
{
|
{
|
||||||
if (_data.isValid()) {
|
if (_data.isValid()) {
|
||||||
this->setTooltip(data.image1x->getTooltip());
|
this->setTooltip(data.image1x->getTooltip());
|
||||||
this->textElement.reset(new TextElement(_data.image1x->getName(), MessageElement::Misc));
|
this->textElement.reset(
|
||||||
|
new TextElement(_data.image1x->getCopyString(), MessageElement::Misc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,13 +120,22 @@ util::EmoteData TwitchEmotes::getEmoteById(const QString &id, const QString &emo
|
||||||
|
|
||||||
return _twitchEmoteFromCache.getOrAdd(id, [&emoteName, &_emoteName, &id] {
|
return _twitchEmoteFromCache.getOrAdd(id, [&emoteName, &_emoteName, &id] {
|
||||||
util::EmoteData newEmoteData;
|
util::EmoteData newEmoteData;
|
||||||
|
auto cleanCode = cleanUpCode(emoteName);
|
||||||
|
cleanCode.replace("<", "<");
|
||||||
|
cleanCode.replace(">", ">");
|
||||||
newEmoteData.image1x = new messages::Image(getEmoteLink(id, "1.0"), 1, emoteName,
|
newEmoteData.image1x = new messages::Image(getEmoteLink(id, "1.0"), 1, emoteName,
|
||||||
_emoteName + "<br/>Twitch Emote 1x");
|
_emoteName + "<br/>Twitch Emote 1x");
|
||||||
|
newEmoteData.image1x->setCopyString(cleanCode);
|
||||||
|
|
||||||
newEmoteData.image2x = new messages::Image(getEmoteLink(id, "2.0"), .5, emoteName,
|
newEmoteData.image2x = new messages::Image(getEmoteLink(id, "2.0"), .5, emoteName,
|
||||||
_emoteName + "<br/>Twitch Emote 2x");
|
_emoteName + "<br/>Twitch Emote 2x");
|
||||||
|
newEmoteData.image2x->setCopyString(cleanCode);
|
||||||
|
|
||||||
newEmoteData.image3x = new messages::Image(getEmoteLink(id, "3.0"), .25, emoteName,
|
newEmoteData.image3x = new messages::Image(getEmoteLink(id, "3.0"), .25, emoteName,
|
||||||
_emoteName + "<br/>Twitch Emote 3x");
|
_emoteName + "<br/>Twitch Emote 3x");
|
||||||
|
|
||||||
|
newEmoteData.image3x->setCopyString(cleanCode);
|
||||||
|
|
||||||
return newEmoteData;
|
return newEmoteData;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue