diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index b000c917a..a08ee6f9b 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -20,9 +20,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/scroll_area.h" #include "ui/image/image.h" #include "ui/ui_utility.h" -#include "main/main_session.h" #include "chat_helpers/stickers.h" #include "base/unixtime.h" +#include "window/window_session_controller.h" #include "facades.h" #include "app.h" #include "styles/style_history.h" @@ -33,14 +33,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL FieldAutocomplete::FieldAutocomplete( QWidget *parent, - not_null session) + not_null controller) : RpWidget(parent) -, _session(session) +, _controller(controller) , _scroll(this, st::mentionScroll) { _scroll->setGeometry(rect()); _inner = _scroll->setOwnedWidget( object_ptr( + _controller, this, &_mrows, &_hrows, @@ -169,7 +170,7 @@ inline int indexOfInFirstN(const T &v, const U &elem, int last) { internal::StickerRows FieldAutocomplete::getStickerSuggestions() { const auto list = Stickers::GetListByEmoji( - _session, + &_controller->session(), _emoji, _stickersSeed ); @@ -584,12 +585,14 @@ bool FieldAutocomplete::eventFilter(QObject *obj, QEvent *e) { namespace internal { FieldAutocompleteInner::FieldAutocompleteInner( + not_null controller, not_null parent, not_null mrows, not_null hrows, not_null brows, not_null srows) -: _parent(parent) +: _controller(controller) +, _parent(parent) , _mrows(mrows) , _hrows(hrows) , _brows(brows) @@ -665,7 +668,6 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) { } if (sticker.animated && sticker.animated->ready()) { const auto frame = sticker.animated->frame(); - sticker.animated->markFrameShown(); const auto size = frame.size() / cIntRetinaFactor(); const auto ppos = pos + QPoint( (st::stickerPanSize.width() - size.width()) / 2, @@ -673,6 +675,11 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) { p.drawImage( QRect(ppos, size), frame); + const auto paused = _controller->isGifPausedAtLeastFor( + Window::GifPauseReason::SavedGifs); + if (!paused) { + sticker.animated->markFrameShown(); + } } else if (const auto image = document->getStickerSmall()) { QPoint ppos = pos + QPoint((st::stickerPanSize.width() - w) / 2, (st::stickerPanSize.height() - h) / 2); p.drawPixmapLeft(ppos, width(), image->pix(document->stickerSetOrigin(), w, h)); diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.h b/Telegram/SourceFiles/chat_helpers/field_autocomplete.h index 67b151c35..594293075 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.h +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.h @@ -22,9 +22,9 @@ class SinglePlayer; class FrameRenderer; } // namespace Lottie; -namespace Main { -class Session; -} // namespace Main +namespace Window { +class SessionController; +} // namespace Window namespace internal { @@ -46,7 +46,9 @@ class FieldAutocomplete final : public Ui::RpWidget { Q_OBJECT public: - FieldAutocomplete(QWidget *parent, not_null session); + FieldAutocomplete( + QWidget *parent, + not_null controller); ~FieldAutocomplete(); bool clearFilteredBotCommands(); @@ -109,7 +111,7 @@ private: void recount(bool resetScroll = false); internal::StickerRows getStickerSuggestions(); - const not_null _session; + const not_null _controller; QPixmap _cache; internal::MentionRows _mrows; internal::HashtagRows _hrows; @@ -160,6 +162,7 @@ class FieldAutocompleteInner final public: FieldAutocompleteInner( + not_null controller, not_null parent, not_null mrows, not_null hrows, @@ -204,11 +207,12 @@ private: void repaintSticker(not_null document); std::shared_ptr getLottieRenderer(); - not_null _parent; - not_null _mrows; - not_null _hrows; - not_null _brows; - not_null _srows; + const not_null _controller; + const not_null _parent; + const not_null _mrows; + const not_null _hrows; + const not_null _brows; + const not_null _srows; rpl::lifetime _stickersLifetime; std::weak_ptr _lottieRenderer; int _stickersPerRow = 1; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index c844479e6..fb63f0672 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -263,7 +263,7 @@ HistoryWidget::HistoryWidget( , _scroll(this, st::historyScroll, false) , _historyDown(_scroll, st::historyToDown) , _unreadMentions(_scroll, st::historyUnreadMentions) -, _fieldAutocomplete(this, &session()) +, _fieldAutocomplete(this, controller) , _supportAutocomplete(session().supportMode() ? object_ptr(this, &session()) : nullptr) diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 1a234059f..640e5fc7f 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -104,7 +104,9 @@ class HistoryWidget final public: using FieldHistoryAction = Ui::InputField::HistoryAction; - HistoryWidget(QWidget *parent, not_null controller); + HistoryWidget( + QWidget *parent, + not_null controller); void start(); diff --git a/Telegram/ThirdParty/rlottie b/Telegram/ThirdParty/rlottie index 3c280ce86..e0ea6af51 160000 --- a/Telegram/ThirdParty/rlottie +++ b/Telegram/ThirdParty/rlottie @@ -1 +1 @@ -Subproject commit 3c280ce86f649c1ea07c7ace5ed58162607c0edd +Subproject commit e0ea6af518345c4a46195c4951e023e621a9eb8f