mirror of https://github.com/procxx/kepka.git
Pause by-emoji stickers on sticker preview.
This commit is contained in:
parent
cd75a45673
commit
c7878f9d21
|
@ -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<Main::Session*> session)
|
||||
not_null<Window::SessionController*> controller)
|
||||
: RpWidget(parent)
|
||||
, _session(session)
|
||||
, _controller(controller)
|
||||
, _scroll(this, st::mentionScroll) {
|
||||
_scroll->setGeometry(rect());
|
||||
|
||||
_inner = _scroll->setOwnedWidget(
|
||||
object_ptr<internal::FieldAutocompleteInner>(
|
||||
_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<Window::SessionController*> controller,
|
||||
not_null<FieldAutocomplete*> parent,
|
||||
not_null<MentionRows*> mrows,
|
||||
not_null<HashtagRows*> hrows,
|
||||
not_null<BotCommandRows*> brows,
|
||||
not_null<StickerRows*> 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));
|
||||
|
|
|
@ -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<Main::Session*> session);
|
||||
FieldAutocomplete(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller);
|
||||
~FieldAutocomplete();
|
||||
|
||||
bool clearFilteredBotCommands();
|
||||
|
@ -109,7 +111,7 @@ private:
|
|||
void recount(bool resetScroll = false);
|
||||
internal::StickerRows getStickerSuggestions();
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
QPixmap _cache;
|
||||
internal::MentionRows _mrows;
|
||||
internal::HashtagRows _hrows;
|
||||
|
@ -160,6 +162,7 @@ class FieldAutocompleteInner final
|
|||
|
||||
public:
|
||||
FieldAutocompleteInner(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<FieldAutocomplete*> parent,
|
||||
not_null<MentionRows*> mrows,
|
||||
not_null<HashtagRows*> hrows,
|
||||
|
@ -204,11 +207,12 @@ private:
|
|||
void repaintSticker(not_null<DocumentData*> document);
|
||||
std::shared_ptr<Lottie::FrameRenderer> getLottieRenderer();
|
||||
|
||||
not_null<FieldAutocomplete*> _parent;
|
||||
not_null<MentionRows*> _mrows;
|
||||
not_null<HashtagRows*> _hrows;
|
||||
not_null<BotCommandRows*> _brows;
|
||||
not_null<StickerRows*> _srows;
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
const not_null<FieldAutocomplete*> _parent;
|
||||
const not_null<MentionRows*> _mrows;
|
||||
const not_null<HashtagRows*> _hrows;
|
||||
const not_null<BotCommandRows*> _brows;
|
||||
const not_null<StickerRows*> _srows;
|
||||
rpl::lifetime _stickersLifetime;
|
||||
std::weak_ptr<Lottie::FrameRenderer> _lottieRenderer;
|
||||
int _stickersPerRow = 1;
|
||||
|
|
|
@ -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<Support::Autocomplete>(this, &session())
|
||||
: nullptr)
|
||||
|
|
|
@ -104,7 +104,9 @@ class HistoryWidget final
|
|||
public:
|
||||
using FieldHistoryAction = Ui::InputField::HistoryAction;
|
||||
|
||||
HistoryWidget(QWidget *parent, not_null<Window::SessionController*> controller);
|
||||
HistoryWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller);
|
||||
|
||||
void start();
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3c280ce86f649c1ea07c7ace5ed58162607c0edd
|
||||
Subproject commit e0ea6af518345c4a46195c4951e023e621a9eb8f
|
Loading…
Reference in New Issue