replace_boost_box.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "base/object_ptr.h"
  9. class ChannelData;
  10. namespace Main {
  11. class Session;
  12. } // namespace Main
  13. namespace Ui {
  14. struct BoostCounters;
  15. struct BoostFeatures;
  16. class BoxContent;
  17. class RpWidget;
  18. } // namespace Ui
  19. struct TakenBoostSlot {
  20. int id = 0;
  21. TimeId expires = 0;
  22. PeerId peerId = 0;
  23. TimeId cooldown = 0;
  24. };
  25. struct ForChannelBoostSlots {
  26. std::vector<int> free;
  27. std::vector<int> already;
  28. std::vector<TakenBoostSlot> other;
  29. };
  30. [[nodiscard]] ForChannelBoostSlots ParseForChannelBoostSlots(
  31. not_null<ChannelData*> channel,
  32. const QVector<MTPMyBoost> &boosts);
  33. [[nodiscard]] Ui::BoostCounters ParseBoostCounters(
  34. const MTPpremium_BoostsStatus &status);
  35. [[nodiscard]] Ui::BoostFeatures LookupBoostFeatures(
  36. not_null<ChannelData*> channel);
  37. [[nodiscard]] int BoostsForGift(not_null<Main::Session*> session);
  38. object_ptr<Ui::BoxContent> ReassignBoostsBox(
  39. not_null<ChannelData*> to,
  40. std::vector<TakenBoostSlot> from,
  41. Fn<void(std::vector<int> slots, int groups, int channels)> reassign,
  42. Fn<void()> cancel);
  43. enum class UserpicsTransferType {
  44. BoostReplace,
  45. StarRefJoin,
  46. };
  47. [[nodiscard]] object_ptr<Ui::RpWidget> CreateUserpicsTransfer(
  48. not_null<Ui::RpWidget*> parent,
  49. rpl::producer<std::vector<not_null<PeerData*>>> from,
  50. not_null<PeerData*> to,
  51. UserpicsTransferType type);
  52. [[nodiscard]] object_ptr<Ui::RpWidget> CreateUserpicsWithMoreBadge(
  53. not_null<Ui::RpWidget*> parent,
  54. rpl::producer<std::vector<not_null<PeerData*>>> peers,
  55. int limit);