compose_controls_common.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. namespace Api {
  9. enum class SendProgressType;
  10. struct SendOptions;
  11. struct SendAction;
  12. } // namespace Api
  13. class History;
  14. namespace HistoryView::Controls {
  15. struct MessageToEdit {
  16. FullMsgId fullId;
  17. Api::SendOptions options;
  18. TextWithTags textWithTags;
  19. bool spoilered = false;
  20. };
  21. struct VoiceToSend {
  22. QByteArray bytes;
  23. VoiceWaveform waveform;
  24. crl::time duration = 0;
  25. Api::SendOptions options;
  26. bool video = false;
  27. };
  28. struct SendActionUpdate {
  29. Api::SendProgressType type = Api::SendProgressType();
  30. int progress = 0;
  31. bool cancel = false;
  32. };
  33. enum class WriteRestrictionType {
  34. None,
  35. Rights,
  36. PremiumRequired,
  37. };
  38. struct WriteRestriction {
  39. using Type = WriteRestrictionType;
  40. QString text;
  41. QString button;
  42. Type type = Type::None;
  43. int boostsToLift = false;
  44. [[nodiscard]] bool empty() const {
  45. return (type == Type::None);
  46. }
  47. explicit operator bool() const {
  48. return !empty();
  49. }
  50. friend inline bool operator==(
  51. const WriteRestriction &a,
  52. const WriteRestriction &b) = default;
  53. };
  54. struct SetHistoryArgs {
  55. required<History*> history;
  56. MsgId topicRootId = 0;
  57. Fn<bool()> showSlowmodeError;
  58. Fn<Api::SendAction()> sendActionFactory;
  59. rpl::producer<int> slowmodeSecondsLeft;
  60. rpl::producer<bool> sendDisabledBySlowmode;
  61. rpl::producer<bool> liked;
  62. rpl::producer<WriteRestriction> writeRestriction;
  63. };
  64. struct ReplyNextRequest {
  65. enum class Direction {
  66. Next,
  67. Previous,
  68. };
  69. const FullMsgId replyId;
  70. const Direction direction;
  71. };
  72. } // namespace HistoryView::Controls