2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add hierarchy of GIF pausing inside a window.

GIFs get paused if some other layer is displayed above.
Media preview > Box or layer > Saved GIFs panel > Inline bot results.
If any of those is displayed, GIFs inside message history pause too.
This commit is contained in:
John Preston
2017-04-03 17:13:55 +03:00
parent 6003ac2132
commit ffc9585196
19 changed files with 89 additions and 80 deletions

View File

@@ -372,6 +372,32 @@ PeerData *MainWindow::ui_getPeerForMouseAction() {
return nullptr;
}
void MainWindow::enableGifPauseReason(GifPauseReason reason) {
if (!(_gifPauseReasons & reason)) {
auto notify = (static_cast<int>(_gifPauseReasons) < static_cast<int>(reason));
_gifPauseReasons |= reason;
if (notify) {
_gifPauseLevelChanged.notify();
}
}
}
void MainWindow::disableGifPauseReason(GifPauseReason reason) {
if (_gifPauseReasons & reason) {
_gifPauseReasons &= ~qFlags(reason);
if (static_cast<int>(_gifPauseReasons) < static_cast<int>(reason)) {
_gifPauseLevelChanged.notify();
}
}
}
bool MainWindow::isGifPausedAtLeastFor(GifPauseReason reason) const {
if (reason == GifPauseReason::Any) {
return (_gifPauseReasons != 0) || !isActive();
}
return (static_cast<int>(_gifPauseReasons) >= 2 * static_cast<int>(reason)) || !isActive();
}
MainWindow::~MainWindow() = default;
} // namespace Window