2020-06-08 17:24:36 +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
|
|
|
|
|
2022-01-24 12:33:31 +00:00
|
|
|
namespace base {
|
|
|
|
template <typename Enum>
|
|
|
|
class Flags;
|
|
|
|
} // namespace base
|
|
|
|
|
2020-06-08 17:24:36 +00:00
|
|
|
namespace Storage {
|
|
|
|
namespace Cache {
|
|
|
|
struct Key;
|
|
|
|
} // namespace Cache
|
|
|
|
} // namespace Storage
|
|
|
|
|
2022-01-24 12:33:31 +00:00
|
|
|
namespace Media::Clip {
|
|
|
|
class ReaderPointer;
|
|
|
|
enum class Notification;
|
|
|
|
} // namespace Media::Clip
|
|
|
|
|
2020-06-08 17:24:36 +00:00
|
|
|
namespace Lottie {
|
|
|
|
class SinglePlayer;
|
|
|
|
class MultiPlayer;
|
|
|
|
class FrameRenderer;
|
|
|
|
class Animation;
|
|
|
|
enum class Quality : char;
|
|
|
|
struct ColorReplacements;
|
|
|
|
} // namespace Lottie
|
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2021-07-02 15:29:13 +00:00
|
|
|
namespace Ui {
|
|
|
|
class PathShiftGradient;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2020-06-08 17:24:36 +00:00
|
|
|
namespace Data {
|
|
|
|
class DocumentMedia;
|
|
|
|
class StickersSetThumbnailView;
|
2022-01-24 12:33:31 +00:00
|
|
|
enum class StickersSetFlag;
|
|
|
|
using StickersSetFlags = base::flags<StickersSetFlag>;
|
2020-06-08 17:24:36 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace ChatHelpers {
|
|
|
|
|
2022-06-28 13:13:20 +00:00
|
|
|
enum class StickerLottieSize : uint8 {
|
2020-06-08 17:24:36 +00:00
|
|
|
MessageHistory,
|
|
|
|
StickerSet,
|
|
|
|
StickersPanel,
|
|
|
|
StickersFooter,
|
|
|
|
SetsListThumbnail,
|
|
|
|
InlineResults,
|
2021-09-15 14:49:06 +00:00
|
|
|
EmojiInteraction,
|
2021-09-17 16:23:52 +00:00
|
|
|
EmojiInteractionReserved1,
|
|
|
|
EmojiInteractionReserved2,
|
|
|
|
EmojiInteractionReserved3,
|
2022-05-27 15:42:05 +00:00
|
|
|
EmojiInteractionReserved4,
|
|
|
|
EmojiInteractionReserved5,
|
|
|
|
EmojiInteractionReserved6,
|
|
|
|
EmojiInteractionReserved7,
|
|
|
|
PremiumReactionPreview,
|
2020-06-08 17:24:36 +00:00
|
|
|
};
|
2022-06-28 13:13:20 +00:00
|
|
|
[[nodiscard]] uint8 LottieCacheKeyShift(
|
|
|
|
uint8 replacementsTag,
|
|
|
|
StickerLottieSize sizeTag);
|
2020-06-08 17:24:36 +00:00
|
|
|
|
|
|
|
[[nodiscard]] std::unique_ptr<Lottie::SinglePlayer> LottiePlayerFromDocument(
|
|
|
|
not_null<Data::DocumentMedia*> media,
|
|
|
|
StickerLottieSize sizeTag,
|
|
|
|
QSize box,
|
|
|
|
Lottie::Quality quality = Lottie::Quality(),
|
|
|
|
std::shared_ptr<Lottie::FrameRenderer> renderer = nullptr);
|
|
|
|
[[nodiscard]] std::unique_ptr<Lottie::SinglePlayer> LottiePlayerFromDocument(
|
|
|
|
not_null<Data::DocumentMedia*> media,
|
|
|
|
const Lottie::ColorReplacements *replacements,
|
|
|
|
StickerLottieSize sizeTag,
|
|
|
|
QSize box,
|
|
|
|
Lottie::Quality quality = Lottie::Quality(),
|
|
|
|
std::shared_ptr<Lottie::FrameRenderer> renderer = nullptr);
|
|
|
|
[[nodiscard]] not_null<Lottie::Animation*> LottieAnimationFromDocument(
|
|
|
|
not_null<Lottie::MultiPlayer*> player,
|
|
|
|
not_null<Data::DocumentMedia*> media,
|
|
|
|
StickerLottieSize sizeTag,
|
|
|
|
QSize box);
|
|
|
|
|
|
|
|
[[nodiscard]] bool HasLottieThumbnail(
|
2022-01-24 12:33:31 +00:00
|
|
|
Data::StickersSetFlags flags,
|
2020-06-08 17:24:36 +00:00
|
|
|
Data::StickersSetThumbnailView *thumb,
|
|
|
|
Data::DocumentMedia *media);
|
|
|
|
[[nodiscard]] std::unique_ptr<Lottie::SinglePlayer> LottieThumbnail(
|
|
|
|
Data::StickersSetThumbnailView *thumb,
|
|
|
|
Data::DocumentMedia *media,
|
|
|
|
StickerLottieSize sizeTag,
|
|
|
|
QSize box,
|
|
|
|
std::shared_ptr<Lottie::FrameRenderer> renderer = nullptr);
|
|
|
|
|
2022-01-24 12:33:31 +00:00
|
|
|
[[nodiscard]] bool HasWebmThumbnail(
|
|
|
|
Data::StickersSetFlags flags,
|
|
|
|
Data::StickersSetThumbnailView *thumb,
|
|
|
|
Data::DocumentMedia *media);
|
|
|
|
[[nodiscard]] Media::Clip::ReaderPointer WebmThumbnail(
|
|
|
|
Data::StickersSetThumbnailView *thumb,
|
|
|
|
Data::DocumentMedia *media,
|
|
|
|
Fn<void(Media::Clip::Notification)> callback);
|
|
|
|
|
2021-07-02 10:13:48 +00:00
|
|
|
bool PaintStickerThumbnailPath(
|
|
|
|
QPainter &p,
|
|
|
|
not_null<Data::DocumentMedia*> media,
|
|
|
|
QRect target,
|
2022-04-25 06:31:34 +00:00
|
|
|
QLinearGradient *gradient = nullptr,
|
|
|
|
bool mirrorHorizontal = false);
|
2021-07-02 15:29:13 +00:00
|
|
|
|
|
|
|
bool PaintStickerThumbnailPath(
|
|
|
|
QPainter &p,
|
|
|
|
not_null<Data::DocumentMedia*> media,
|
|
|
|
QRect target,
|
2022-04-25 06:31:34 +00:00
|
|
|
not_null<Ui::PathShiftGradient*> gradient,
|
|
|
|
bool mirrorHorizontal = false);
|
2021-07-02 10:13:48 +00:00
|
|
|
|
2022-01-24 21:40:26 +00:00
|
|
|
[[nodiscard]] QSize ComputeStickerSize(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
QSize box);
|
|
|
|
|
2020-06-08 17:24:36 +00:00
|
|
|
} // namespace ChatHelpers
|