star_gift_box.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 "data/data_star_gift.h"
  9. namespace ChatHelpers {
  10. class Show;
  11. } // namespace ChatHelpers
  12. namespace Data {
  13. struct UniqueGift;
  14. struct GiftCode;
  15. struct CreditsHistoryEntry;
  16. } // namespace Data
  17. namespace Payments {
  18. enum class CheckoutResult;
  19. } // namespace Payments
  20. namespace Settings {
  21. struct GiftWearBoxStyleOverride;
  22. struct CreditsEntryBoxStyleOverrides;
  23. } // namespace Settings
  24. namespace Window {
  25. class SessionController;
  26. } // namespace Window
  27. namespace Ui::Text {
  28. class CustomEmoji;
  29. } // namespace Ui::Text
  30. namespace Ui {
  31. class PopupMenu;
  32. class GenericBox;
  33. class VerticalLayout;
  34. void ChooseStarGiftRecipient(
  35. not_null<Window::SessionController*> controller);
  36. void ShowStarGiftBox(
  37. not_null<Window::SessionController*> controller,
  38. not_null<PeerData*> peer);
  39. void AddUniqueGiftCover(
  40. not_null<VerticalLayout*> container,
  41. rpl::producer<Data::UniqueGift> data,
  42. rpl::producer<QString> subtitleOverride = nullptr);
  43. void AddWearGiftCover(
  44. not_null<VerticalLayout*> container,
  45. const Data::UniqueGift &data,
  46. not_null<PeerData*> peer);
  47. void ShowUniqueGiftWearBox(
  48. std::shared_ptr<ChatHelpers::Show> show,
  49. not_null<PeerData*> peer,
  50. const Data::UniqueGift &gift,
  51. Settings::GiftWearBoxStyleOverride st);
  52. struct PatternPoint {
  53. QPointF position;
  54. float64 scale = 1.;
  55. float64 opacity = 1.;
  56. };
  57. [[nodiscard]] const std::vector<PatternPoint> &PatternPoints();
  58. [[nodiscard]] const std::vector<PatternPoint> &PatternPointsSmall();
  59. void PaintPoints(
  60. QPainter &p,
  61. const std::vector<PatternPoint> &points,
  62. base::flat_map<float64, QImage> &cache,
  63. not_null<Text::CustomEmoji*> emoji,
  64. const Data::UniqueGift &gift,
  65. const QRect &rect,
  66. float64 shown = 1.);
  67. struct StarGiftUpgradeArgs {
  68. not_null<Window::SessionController*> controller;
  69. base::required<uint64> stargiftId;
  70. Fn<void(bool)> ready;
  71. not_null<PeerData*> peer;
  72. Data::SavedStarGiftId savedId;
  73. int cost = 0;
  74. bool canAddSender = false;
  75. bool canAddComment = false;
  76. bool canAddMyComment = false;
  77. bool addDetailsDefault = false;
  78. };
  79. void ShowStarGiftUpgradeBox(StarGiftUpgradeArgs &&args);
  80. void AddUniqueCloseButton(
  81. not_null<GenericBox*> box,
  82. Settings::CreditsEntryBoxStyleOverrides st,
  83. Fn<void(not_null<PopupMenu*>)> fillMenu = nullptr);
  84. void RequestStarsFormAndSubmit(
  85. not_null<Window::SessionController*> window,
  86. MTPInputInvoice invoice,
  87. Fn<void(Payments::CheckoutResult, const MTPUpdates *)> done);
  88. void ShowGiftTransferredToast(
  89. base::weak_ptr<Window::SessionController> weak,
  90. not_null<PeerData*> to,
  91. const Data::UniqueGift &gift);
  92. } // namespace Ui