Chatterino
TooltipPreviewImage.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "messages/Image.hpp"
4 
5 #include <pajlada/signals/signalholder.hpp>
6 
7 namespace chatterino {
8 
10 {
11 public:
12  static TooltipPreviewImage &instance();
13  void setImage(ImagePtr image);
14  void setImageScale(int w, int h);
15 
16  TooltipPreviewImage(const TooltipPreviewImage &) = delete;
17 
18 private:
20 
21 private:
22  ImagePtr image_ = nullptr;
23  int imageWidth_ = 0;
24  int imageHeight_ = 0;
25 
26  pajlada::Signals::SignalHolder connections_;
27 
28  // attemptRefresh is set to true in case we want to preview an image that has not loaded yet (if pixmapOrLoad fails)
29  bool attemptRefresh{false};
30 
31  // Refresh the pixmap used in the Tooltip Widget
32  // Called from setImage and from the "gif repaint" signal if the image is animated
33  void refreshTooltipWidgetPixmap();
34 };
35 
36 } // namespace chatterino
Definition: Application.cpp:48
Definition: TooltipPreviewImage.hpp:9
static TooltipPreviewImage & instance()
Definition: TooltipPreviewImage.cpp:9
void setImage(ImagePtr image)
Definition: TooltipPreviewImage.cpp:34
std::shared_ptr< Image > ImagePtr
Definition: ModerationAction.hpp:14
void setImageScale(int w, int h)
Definition: TooltipPreviewImage.cpp:41