ran clang

This commit is contained in:
apa420 2019-06-12 00:31:02 +02:00
parent 70bb63d20f
commit 3226ab6c68
2 changed files with 38 additions and 32 deletions

View file

@ -5,28 +5,33 @@
#include "widgets/TooltipWidget.hpp" #include "widgets/TooltipWidget.hpp"
namespace chatterino { namespace chatterino {
TooltipPreviewImage &TooltipPreviewImage::getInstance() { TooltipPreviewImage &TooltipPreviewImage::getInstance()
{
static TooltipPreviewImage *instance = new TooltipPreviewImage(); static TooltipPreviewImage *instance = new TooltipPreviewImage();
return *instance; return *instance;
} }
TooltipPreviewImage::TooltipPreviewImage() { TooltipPreviewImage::TooltipPreviewImage()
connections_.push_back(getApp()->windows->gifRepaintRequested.connect( {
[&] { connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] {
auto tooltipWidget = TooltipWidget::getInstance(); auto tooltipWidget = TooltipWidget::getInstance();
if (this->image_ && !tooltipWidget->isHidden()) { if (this->image_ && !tooltipWidget->isHidden())
{
auto pixmap = this->image_->pixmap(); auto pixmap = this->image_->pixmap();
if (pixmap) { if (pixmap)
{
tooltipWidget->setImage(*pixmap); tooltipWidget->setImage(*pixmap);
} }
} else { }
else
{
tooltipWidget->clearImage(); tooltipWidget->clearImage();
} }
})); }));
}
} void TooltipPreviewImage::setImage(ImagePtr image)
{
void TooltipPreviewImage::setImage(ImagePtr image) {
this->image_ = image; this->image_ = image;
} }
} // namespace chatterino } // namespace chatterino

View file

@ -3,18 +3,19 @@
#include "messages/Image.hpp" #include "messages/Image.hpp"
namespace chatterino { namespace chatterino {
class TooltipPreviewImage { class TooltipPreviewImage
public: {
public:
static TooltipPreviewImage &getInstance(); static TooltipPreviewImage &getInstance();
void setImage(ImagePtr image); void setImage(ImagePtr image);
TooltipPreviewImage(const TooltipPreviewImage&) = delete; TooltipPreviewImage(const TooltipPreviewImage &) = delete;
private: private:
TooltipPreviewImage(); TooltipPreviewImage();
private: private:
ImagePtr image_ = nullptr; ImagePtr image_ = nullptr;
std::vector<pajlada::Signals::ScopedConnection> connections_; std::vector<pajlada::Signals::ScopedConnection> connections_;
}; };
} // namespace chatterino } // namespace chatterino