data_reply_preview.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. class Image;
  9. class DocumentData;
  10. class PhotoData;
  11. namespace Data {
  12. class PhotoMedia;
  13. class DocumentMedia;
  14. struct FileOrigin;
  15. class ReplyPreview {
  16. public:
  17. explicit ReplyPreview(not_null<DocumentData*> document);
  18. explicit ReplyPreview(not_null<PhotoData*> photo);
  19. ~ReplyPreview();
  20. [[nodiscard]] Image *image(
  21. Data::FileOrigin origin,
  22. not_null<PeerData*> context,
  23. bool spoiler);
  24. [[nodiscard]] bool loaded(bool spoiler) const;
  25. private:
  26. void prepare(
  27. not_null<Image*> image,
  28. Images::Options options,
  29. bool spoiler = false);
  30. std::unique_ptr<Image> _regular;
  31. std::unique_ptr<Image> _spoilered;
  32. PhotoData *_photo = nullptr;
  33. DocumentData *_document = nullptr;
  34. std::shared_ptr<PhotoMedia> _photoMedia;
  35. std::shared_ptr<DocumentMedia> _documentMedia;
  36. bool _good = false;
  37. bool _checkedRegular = false;
  38. bool _checkedSpoilered = false;
  39. };
  40. } // namespace Data