mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
8532c6d3bc
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>
35 lines
847 B
C++
35 lines
847 B
C++
#pragma once
|
|
|
|
#include "messages/Image.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
class TooltipPreviewImage
|
|
{
|
|
public:
|
|
static TooltipPreviewImage &instance();
|
|
void setImage(ImagePtr image);
|
|
void setImageScale(int w, int h);
|
|
|
|
TooltipPreviewImage(const TooltipPreviewImage &) = delete;
|
|
|
|
private:
|
|
TooltipPreviewImage();
|
|
|
|
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)
|
|
bool attemptRefresh{false};
|
|
|
|
// Refresh the pixmap used in the Tooltip Widget
|
|
// Called from setImage and from the "gif repaint" signal if the image is animated
|
|
void refreshTooltipWidgetPixmap();
|
|
};
|
|
|
|
} // namespace chatterino
|