1 #include "singletons/helper/GifTimer.hpp" 2 3 #include "Application.hpp" 4 #include "singletons/Settings.hpp" 5 #include "singletons/WindowManager.hpp" 6 7 namespace chatterino { 8 initialize()9void GIFTimer::initialize() 10 { 11 this->timer.setInterval(30); 12 13 getSettings()->animateEmotes.connect([this](bool enabled, auto) { 14 if (enabled) 15 this->timer.start(); 16 else 17 this->timer.stop(); 18 }); 19 20 QObject::connect(&this->timer, &QTimer::timeout, [this] { 21 if (getSettings()->animationsWhenFocused && 22 qApp->activeWindow() == nullptr) 23 return; 24 25 this->position_ += gifFrameLength; 26 this->signal.invoke(); 27 getApp()->windows->repaintGifEmotes(); 28 }); 29 } 30 31 } // namespace chatterino 32