2022-05-26 08:30:50 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "styles/style_widgets.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class Show;
|
2022-07-15 14:52:36 +00:00
|
|
|
class RpWidget;
|
2022-05-26 08:30:50 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Ui::Toast {
|
|
|
|
class Instance;
|
|
|
|
} // namespace Ui::Toast
|
|
|
|
|
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
namespace HistoryView {
|
|
|
|
|
|
|
|
class StickerToast final {
|
|
|
|
public:
|
|
|
|
StickerToast(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
Fn<void()> destroy);
|
|
|
|
~StickerToast();
|
|
|
|
|
2022-10-25 08:48:48 +00:00
|
|
|
enum class Section {
|
|
|
|
Message,
|
|
|
|
TopicIcon,
|
|
|
|
};
|
|
|
|
void showFor(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
Section section = Section::Message);
|
2022-05-26 08:30:50 +00:00
|
|
|
|
|
|
|
private:
|
2022-06-23 05:31:32 +00:00
|
|
|
void requestSet();
|
|
|
|
void cancelRequest();
|
|
|
|
void showWithTitle(const QString &title);
|
|
|
|
[[nodiscard]] QString lookupTitle() const;
|
|
|
|
|
2022-07-15 14:52:36 +00:00
|
|
|
void setupEmojiPreview(not_null<Ui::RpWidget*> widget, int size);
|
|
|
|
void setupLottiePreview(not_null<Ui::RpWidget*> widget, int size);
|
2022-08-04 13:35:50 +00:00
|
|
|
void clearHiddenHiding();
|
2022-07-15 14:52:36 +00:00
|
|
|
|
2022-05-26 08:30:50 +00:00
|
|
|
const not_null<Window::SessionController*> _controller;
|
|
|
|
const not_null<QWidget*> _parent;
|
2022-10-25 08:48:48 +00:00
|
|
|
Section _section = {};
|
2022-05-26 08:30:50 +00:00
|
|
|
style::Toast _st;
|
|
|
|
base::weak_ptr<Ui::Toast::Instance> _weak;
|
2022-08-04 13:35:50 +00:00
|
|
|
std::vector<base::weak_ptr<Ui::Toast::Instance>> _hiding;
|
2022-05-26 08:30:50 +00:00
|
|
|
DocumentData *_for = nullptr;
|
|
|
|
Fn<void()> _destroy;
|
|
|
|
|
2022-06-23 05:31:32 +00:00
|
|
|
mtpRequestId _setRequestId = 0;
|
|
|
|
|
2022-05-26 08:30:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace HistoryView
|