Files
chatterino2/src/singletons/TooltipPreviewImage.hpp
Rasmus Karlsson 7a08d73434 Fix preview on hover not working when Animated emotes options was disabled.
Fixes #1546

This change introduces a "window timer" that runs every 100ms that we
use to update the pixmap if necessary, since there is no signal for "let
me know when this image is done loading".
2020-02-15 17:16:10 +01:00

31 lines
757 B
C++

#pragma once
#include "messages/Image.hpp"
namespace chatterino {
class TooltipPreviewImage
{
public:
static TooltipPreviewImage &instance();
void setImage(ImagePtr image);
TooltipPreviewImage(const TooltipPreviewImage &) = delete;
private:
TooltipPreviewImage();
private:
ImagePtr image_ = nullptr;
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