2021-02-23 15:35:40 +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
|
|
|
|
|
2021-03-21 12:38:33 +00:00
|
|
|
#include "editor/scene/scene_item_base.h"
|
2022-01-25 11:26:19 +00:00
|
|
|
#include "media/clip/media_clip_reader.h"
|
2021-02-23 15:35:40 +00:00
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
class DocumentMedia;
|
|
|
|
} // namespace Data
|
|
|
|
namespace Lottie {
|
|
|
|
class SinglePlayer;
|
|
|
|
} // namespace Lottie
|
|
|
|
class DocumentData;
|
|
|
|
|
|
|
|
namespace Editor {
|
|
|
|
|
|
|
|
class ItemSticker : public ItemBase {
|
|
|
|
public:
|
2021-07-06 23:10:13 +00:00
|
|
|
enum { Type = ItemBase::Type + 1 };
|
2021-02-23 15:35:40 +00:00
|
|
|
|
|
|
|
ItemSticker(
|
|
|
|
not_null<DocumentData*> document,
|
2021-07-04 12:57:07 +00:00
|
|
|
ItemBase::Data data);
|
2021-02-23 15:35:40 +00:00
|
|
|
void paint(
|
|
|
|
QPainter *p,
|
|
|
|
const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget) override;
|
2021-10-04 04:46:12 +00:00
|
|
|
[[nodiscard]] not_null<DocumentData*> sticker() const;
|
2021-03-14 09:46:17 +00:00
|
|
|
int type() const override;
|
2021-10-04 04:46:12 +00:00
|
|
|
|
2021-03-10 17:50:35 +00:00
|
|
|
protected:
|
|
|
|
void performFlip() override;
|
2021-07-04 12:57:07 +00:00
|
|
|
std::shared_ptr<ItemBase> duplicate(ItemBase::Data data) const override;
|
2021-10-04 04:46:12 +00:00
|
|
|
|
2021-02-23 15:35:40 +00:00
|
|
|
private:
|
|
|
|
const not_null<DocumentData*> _document;
|
2021-07-04 12:57:07 +00:00
|
|
|
const std::shared_ptr<::Data::DocumentMedia> _mediaView;
|
2021-02-23 15:35:40 +00:00
|
|
|
|
2022-08-04 10:35:08 +00:00
|
|
|
void updatePixmap(QImage &&image);
|
2021-03-21 17:00:56 +00:00
|
|
|
|
2021-02-23 15:35:40 +00:00
|
|
|
struct {
|
|
|
|
std::unique_ptr<Lottie::SinglePlayer> player;
|
|
|
|
rpl::lifetime lifetime;
|
|
|
|
} _lottie;
|
2022-01-25 11:26:19 +00:00
|
|
|
::Media::Clip::ReaderPointer _webm;
|
2022-08-04 10:35:08 +00:00
|
|
|
QImage _image;
|
2021-02-23 15:35:40 +00:00
|
|
|
|
|
|
|
rpl::lifetime _loadingLifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Editor
|