2018-06-26 14:09:39 +02:00
|
|
|
#include "singletons/helper/GifTimer.hpp"
|
2018-06-05 18:30:26 +02:00
|
|
|
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "Application.hpp"
|
2018-06-28 19:46:45 +02:00
|
|
|
#include "singletons/Settings.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "singletons/WindowManager.hpp"
|
2018-06-05 18:30:26 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
void GIFTimer::initialize()
|
|
|
|
{
|
|
|
|
this->timer.setInterval(30);
|
|
|
|
|
2018-10-31 19:45:51 +01:00
|
|
|
getSettings()->animateEmotes.connect([this](bool enabled, auto) {
|
2018-08-15 23:48:16 +02:00
|
|
|
if (enabled)
|
2018-06-05 18:30:26 +02:00
|
|
|
this->timer.start();
|
2018-08-15 23:48:16 +02:00
|
|
|
else
|
2018-06-05 18:30:26 +02:00
|
|
|
this->timer.stop();
|
|
|
|
});
|
|
|
|
|
|
|
|
QObject::connect(&this->timer, &QTimer::timeout, [this] {
|
2018-10-31 19:45:51 +01:00
|
|
|
if (getSettings()->animationsWhenFocused &&
|
2018-08-15 23:48:16 +02:00
|
|
|
qApp->activeWindow() == nullptr)
|
|
|
|
return;
|
|
|
|
|
2018-06-05 18:30:26 +02:00
|
|
|
this->signal.invoke();
|
2018-08-15 23:48:16 +02:00
|
|
|
getApp()->windows->repaintGifEmotes();
|
2018-06-05 18:30:26 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|