2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-25 11:47:29 +00:00
tdesktop/Telegram/SourceFiles/ui/chat/attach/attach_single_media_preview.h

57 lines
1.3 KiB
C
Raw Normal View History

2020-10-13 20:15:52 +03: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-07-12 14:02:35 +03:00
#include "ui/chat/attach/attach_abstract_single_media_preview.h"
2020-10-13 20:15:52 +03:00
#include "media/clip/media_clip_reader.h"
namespace Lottie {
class SinglePlayer;
} // namespace Lottie
namespace Ui {
struct PreparedFile;
2021-07-12 14:02:35 +03:00
class SingleMediaPreview final : public AbstractSingleMediaPreview {
2020-10-13 20:15:52 +03:00
public:
static SingleMediaPreview *Create(
QWidget *parent,
Fn<bool()> gifPaused,
const PreparedFile &file,
AttachControls::Type type = AttachControls::Type::Full);
2020-10-13 20:15:52 +03:00
SingleMediaPreview(
QWidget *parent,
Fn<bool()> gifPaused,
QImage preview,
bool animated,
bool sticker,
const QString &animatedPreviewPath,
AttachControls::Type type);
2020-10-13 20:15:52 +03:00
2021-07-12 14:02:35 +03:00
protected:
bool drawBackground() const override;
2022-09-17 00:23:27 +04:00
bool tryPaintAnimation(QPainter &p) override;
2021-07-12 14:02:35 +03:00
bool isAnimatedPreviewReady() const override;
2020-10-13 20:15:52 +03:00
private:
2021-07-12 14:02:35 +03:00
void prepareAnimatedPreview(
const QString &animatedPreviewPath,
bool animated);
2020-10-13 20:15:52 +03:00
void clipCallback(Media::Clip::Notification notification);
2021-07-12 14:02:35 +03:00
const Fn<bool()> _gifPaused;
const bool _sticker = false;
2020-10-13 20:15:52 +03:00
Media::Clip::ReaderPointer _gifPreview;
std::unique_ptr<Lottie::SinglePlayer> _lottiePreview;
};
} // namespace Ui