| 748 | } |
| 749 | |
| 750 | void DocumentData::updateThumbnails( |
| 751 | const InlineImageLocation &inlineThumbnail, |
| 752 | const ImageWithLocation &thumbnail, |
| 753 | const ImageWithLocation &videoThumbnail, |
| 754 | bool isPremiumSticker) { |
| 755 | if (!_filename.isEmpty() |
| 756 | && !Core::NameTypeAllowsThumbnail(Core::DetectNameType(_filename))) { |
| 757 | return; |
| 758 | } |
| 759 | if (!inlineThumbnail.bytes.isEmpty() |
| 760 | && _inlineThumbnailBytes.isEmpty()) { |
| 761 | _inlineThumbnailBytes = inlineThumbnail.bytes; |
| 762 | if (inlineThumbnail.isPath) { |
| 763 | _flags |= Flag::InlineThumbnailIsPath; |
| 764 | } else { |
| 765 | _flags &= ~Flag::InlineThumbnailIsPath; |
| 766 | } |
| 767 | } |
| 768 | if (!sticker() || sticker()->setType != Data::StickersType::Emoji) { |
| 769 | if (isPremiumSticker) { |
| 770 | _flags |= Flag::PremiumSticker; |
| 771 | } else { |
| 772 | _flags &= ~Flag::PremiumSticker; |
| 773 | } |
| 774 | } |
| 775 | Data::UpdateCloudFile( |
| 776 | _thumbnail, |
| 777 | thumbnail, |
| 778 | owner().cache(), |
| 779 | Data::kImageCacheTag, |
| 780 | [&](Data::FileOrigin origin) { loadThumbnail(origin); }, |
| 781 | [&](QImage preloaded, QByteArray) { |
| 782 | if (const auto media = activeMediaView()) { |
| 783 | media->setThumbnail(std::move(preloaded)); |
| 784 | } |
| 785 | }); |
| 786 | Data::UpdateCloudFile( |
| 787 | _videoThumbnail, |
| 788 | videoThumbnail, |
| 789 | owner().cache(), |
| 790 | Data::kAnimationCacheTag, |
| 791 | [&](Data::FileOrigin origin) { loadVideoThumbnail(origin); }); |
| 792 | } |
| 793 | |
| 794 | bool DocumentData::isWallPaper() const { |
| 795 | return (type == WallPaperDocument); |
no test coverage detected