Added support for Twitch's Chat Replies (#3722)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -126,6 +126,12 @@ enum class MessageElementFlag : int64_t {
|
||||
// e.g. BTTV's SoSnowy during christmas season
|
||||
ZeroWidthEmote = (1LL << 31),
|
||||
|
||||
// for elements of the message reply
|
||||
RepliedMessage = (1LL << 32),
|
||||
|
||||
// for the reply button element
|
||||
ReplyButton = (1LL << 33),
|
||||
|
||||
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage |
|
||||
BttvEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
||||
AlwaysShow,
|
||||
@@ -209,6 +215,22 @@ private:
|
||||
ImagePtr image_;
|
||||
};
|
||||
|
||||
// contains a image with a circular background color
|
||||
class CircularImageElement : public MessageElement
|
||||
{
|
||||
public:
|
||||
CircularImageElement(ImagePtr image, int padding, QColor background,
|
||||
MessageElementFlags flags);
|
||||
|
||||
void addToContainer(MessageLayoutContainer &container,
|
||||
MessageElementFlags flags) override;
|
||||
|
||||
private:
|
||||
ImagePtr image_;
|
||||
int padding_;
|
||||
QColor background_;
|
||||
};
|
||||
|
||||
// contains a text, it will split it into words
|
||||
class TextElement : public MessageElement
|
||||
{
|
||||
@@ -232,6 +254,29 @@ private:
|
||||
std::vector<Word> words_;
|
||||
};
|
||||
|
||||
// contains a text that will be truncated to one line
|
||||
class SingleLineTextElement : public MessageElement
|
||||
{
|
||||
public:
|
||||
SingleLineTextElement(const QString &text, MessageElementFlags flags,
|
||||
const MessageColor &color = MessageColor::Text,
|
||||
FontStyle style = FontStyle::ChatMedium);
|
||||
~SingleLineTextElement() override = default;
|
||||
|
||||
void addToContainer(MessageLayoutContainer &container,
|
||||
MessageElementFlags flags) override;
|
||||
|
||||
private:
|
||||
MessageColor color_;
|
||||
FontStyle style_;
|
||||
|
||||
struct Word {
|
||||
QString text;
|
||||
int width = -1;
|
||||
};
|
||||
std::vector<Word> words_;
|
||||
};
|
||||
|
||||
// contains emote data and will pick the emote based on :
|
||||
// a) are images for the emote type enabled
|
||||
// b) which size it wants
|
||||
@@ -355,4 +400,18 @@ public:
|
||||
private:
|
||||
ImageSet images_;
|
||||
};
|
||||
|
||||
class ReplyCurveElement : public MessageElement
|
||||
{
|
||||
public:
|
||||
ReplyCurveElement();
|
||||
|
||||
void addToContainer(MessageLayoutContainer &container,
|
||||
MessageElementFlags flags) override;
|
||||
|
||||
private:
|
||||
int neededMargin_;
|
||||
QSize size_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user