7a08d73434
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".
31 lines
757 B
C++
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
|