calls_userpic.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #include "ui/rp_widget.h"
  9. #include "ui/userpic_view.h"
  10. #include "ui/effects/animations.h"
  11. class PeerData;
  12. class Image;
  13. namespace Data {
  14. class PhotoMedia;
  15. } // namespace Data
  16. namespace Calls {
  17. class Userpic final {
  18. public:
  19. Userpic(
  20. not_null<QWidget*> parent,
  21. not_null<PeerData*> peer,
  22. rpl::producer<bool> muted);
  23. ~Userpic();
  24. void setVisible(bool visible);
  25. void setGeometry(int x, int y, int size);
  26. void setMuteLayout(QPoint position, int size, int stroke);
  27. [[nodiscard]] rpl::lifetime &lifetime() {
  28. return _content.lifetime();
  29. }
  30. private:
  31. void setup(rpl::producer<bool> muted);
  32. void paint();
  33. void setMuted(bool muted);
  34. [[nodiscard]] int size() const;
  35. void processPhoto();
  36. void refreshPhoto();
  37. [[nodiscard]] bool isGoodPhoto(PhotoData *photo) const;
  38. void createCache(Image *image);
  39. Ui::RpWidget _content;
  40. not_null<PeerData*> _peer;
  41. Ui::PeerUserpicView _userpic;
  42. std::shared_ptr<Data::PhotoMedia> _photo;
  43. Ui::Animations::Simple _mutedAnimation;
  44. QPixmap _userPhoto;
  45. PhotoId _userPhotoId = 0;
  46. QPoint _mutePosition;
  47. int _muteSize = 0;
  48. int _muteStroke = 0;
  49. bool _userPhotoFull = false;
  50. bool _muted = false;
  51. };
  52. } // namespace Calls