2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Load and show video thumbnails in the panel.

This commit is contained in:
John Preston
2020-05-22 15:15:09 +04:00
parent 33c1c48ad9
commit 3c9ca2eb94
11 changed files with 206 additions and 17 deletions

View File

@@ -159,10 +159,18 @@ public:
[[nodiscard]] bool thumbnailLoading() const;
[[nodiscard]] bool thumbnailFailed() const;
void loadThumbnail(Data::FileOrigin origin);
const ImageLocation &thumbnailLocation() const;
[[nodiscard]] bool hasVideoThumbnail() const;
[[nodiscard]] bool videoThumbnailLoading() const;
[[nodiscard]] bool videoThumbnailFailed() const;
void loadVideoThumbnail(Data::FileOrigin origin);
const ImageLocation &videoThumbnailLocation() const;
void updateThumbnails(
const QByteArray &inlineThumbnailBytes,
const ImageWithLocation &thumbnail);
const ImageLocation &thumbnailLocation() const;
const ImageWithLocation &thumbnail,
const ImageWithLocation &videoThumbnail);
[[nodiscard]] QByteArray inlineThumbnailBytes() const {
return _inlineThumbnailBytes;
@@ -247,6 +255,7 @@ private:
DownloadCancelled = 0x10,
LoadedInMediaCache = 0x20,
ThumbnailFailed = 0x40,
VideoThumbnailFailed = 0x80,
};
using Flags = base::flags<Flag>;
friend constexpr bool is_flag_type(Flag) { return true; };
@@ -300,8 +309,11 @@ private:
QByteArray _inlineThumbnailBytes;
ImageLocation _thumbnailLocation;
ImageLocation _videoThumbnailLocation;
std::unique_ptr<FileLoader> _thumbnailLoader;
std::unique_ptr<FileLoader> _videoThumbnailLoader;
int _thumbnailByteSize = 0;
int _videoThumbnailByteSize = 0;
std::unique_ptr<Data::ReplyPreview> _replyPreview;
std::weak_ptr<Data::DocumentMedia> _media;
PhotoData *_goodThumbnailPhoto = nullptr;