2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 16:05:57 +00:00

Move GIF pausing methods to Window::Controller.

This commit is contained in:
John Preston
2017-04-07 21:10:49 +03:00
parent cd3c5e4ade
commit 570cd9bdfa
27 changed files with 214 additions and 127 deletions

View File

@@ -20,3 +20,34 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "window/window_controller.h"
#include "window/main_window.h"
namespace Window {
void Controller::enableGifPauseReason(GifPauseReason reason) {
if (!(_gifPauseReasons & reason)) {
auto notify = (static_cast<int>(_gifPauseReasons) < static_cast<int>(reason));
_gifPauseReasons |= reason;
if (notify) {
_gifPauseLevelChanged.notify();
}
}
}
void Controller::disableGifPauseReason(GifPauseReason reason) {
if (_gifPauseReasons & reason) {
_gifPauseReasons &= ~qFlags(reason);
if (static_cast<int>(_gifPauseReasons) < static_cast<int>(reason)) {
_gifPauseLevelChanged.notify();
}
}
}
bool Controller::isGifPausedAtLeastFor(GifPauseReason reason) const {
if (reason == GifPauseReason::Any) {
return (_gifPauseReasons != 0) || !window()->isActive();
}
return (static_cast<int>(_gifPauseReasons) >= 2 * static_cast<int>(reason)) || !window()->isActive();
}
} // namespace Window