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:
Daniel Pasch
2020-05-10 12:11:10 +02:00
committed by GitHub
parent 1a4a468ab1
commit 8532c6d3bc
11 changed files with 140 additions and 27 deletions
+4
View File
@@ -9,6 +9,7 @@ class TooltipPreviewImage
public:
static TooltipPreviewImage &instance();
void setImage(ImagePtr image);
void setImageScale(int w, int h);
TooltipPreviewImage(const TooltipPreviewImage &) = delete;
@@ -17,6 +18,9 @@ private:
private:
ImagePtr image_ = nullptr;
int imageWidth_ = 0;
int imageHeight_ = 0;
std::vector<pajlada::Signals::ScopedConnection> connections_;
// attemptRefresh is set to true in case we want to preview an image that has not loaded yet (if pixmapOrLoad fails)