Add thumbnails to link tooltips if available (#1664)
This feature is off by default and can be enabled in the settings with the "Show link thumbnail" setting. This feature also requires the "Show link info when hovering" setting to be enabled. thumbnails support is only there for direct image links, twitch clips, and youtube links. can be expanded in the future in the /api repo Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -122,14 +122,23 @@ public:
|
||||
Update_Images = 4,
|
||||
Update_All = Update_Text | Update_Emotes | Update_Images
|
||||
};
|
||||
enum ThumbnailType : char {
|
||||
Link_Thumbnail = 1,
|
||||
};
|
||||
|
||||
virtual ~MessageElement();
|
||||
|
||||
MessageElement *setLink(const Link &link);
|
||||
MessageElement *setText(const QString &text);
|
||||
MessageElement *setTooltip(const QString &tooltip);
|
||||
MessageElement *setThumbnailType(const ThumbnailType type);
|
||||
MessageElement *setThumbnail(const ImagePtr &thumbnail);
|
||||
|
||||
MessageElement *setTrailingSpace(bool value);
|
||||
const QString &getTooltip() const;
|
||||
const ImagePtr &getThumbnail() const;
|
||||
const ThumbnailType &getThumbnailType() const;
|
||||
|
||||
const Link &getLink() const;
|
||||
bool hasTrailingSpace() const;
|
||||
MessageElementFlags getFlags() const;
|
||||
@@ -148,6 +157,8 @@ private:
|
||||
QString text_;
|
||||
Link link_;
|
||||
QString tooltip_;
|
||||
ImagePtr thumbnail_;
|
||||
ThumbnailType thumbnailType_;
|
||||
MessageElementFlags flags_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user