2019-06-11 20:03:04 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "messages/Image.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
2020-02-15 17:16:10 +01:00
|
|
|
|
2019-06-12 00:31:02 +02:00
|
|
|
class TooltipPreviewImage
|
|
|
|
{
|
|
|
|
public:
|
2019-10-07 22:42:34 +02:00
|
|
|
static TooltipPreviewImage &instance();
|
2019-06-12 00:31:02 +02:00
|
|
|
void setImage(ImagePtr image);
|
2019-06-11 20:03:04 +02:00
|
|
|
|
2019-06-12 00:31:02 +02:00
|
|
|
TooltipPreviewImage(const TooltipPreviewImage &) = delete;
|
2019-06-11 21:04:57 +02:00
|
|
|
|
2019-06-12 00:31:02 +02:00
|
|
|
private:
|
|
|
|
TooltipPreviewImage();
|
2019-06-11 20:03:04 +02:00
|
|
|
|
2019-06-12 00:31:02 +02:00
|
|
|
private:
|
|
|
|
ImagePtr image_ = nullptr;
|
|
|
|
std::vector<pajlada::Signals::ScopedConnection> connections_;
|
2020-02-15 17:16:10 +01:00
|
|
|
|
|
|
|
// 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
|
|
|
};
|
2020-02-15 17:16:10 +01:00
|
|
|
|
2019-06-11 20:03:04 +02:00
|
|
|
} // namespace chatterino
|