mirror-chatterino2/src/singletons/TooltipPreviewImage.hpp

31 lines
757 B
C++
Raw Normal View History

#pragma once
#include "messages/Image.hpp"
namespace chatterino {
2019-06-12 00:31:02 +02:00
class TooltipPreviewImage
{
public:
static TooltipPreviewImage &instance();
2019-06-12 00:31:02 +02:00
void setImage(ImagePtr image);
2019-06-12 00:31:02 +02:00
TooltipPreviewImage(const TooltipPreviewImage &) = delete;
2019-06-12 00:31:02 +02:00
private:
TooltipPreviewImage();
2019-06-12 00:31:02 +02:00
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();
2019-06-12 00:31:02 +02:00
};
} // namespace chatterino