info_profile_values.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/flags.h"
  9. #include <rpl/producer.h>
  10. #include <rpl/map.h>
  11. struct ChannelLocation;
  12. namespace Data {
  13. class ForumTopic;
  14. class Thread;
  15. class Birthday;
  16. } // namespace Data
  17. namespace Main {
  18. class Session;
  19. } // namespace Main
  20. namespace Ui {
  21. class RpWidget;
  22. template <typename Widget>
  23. class SlideWrap;
  24. } // namespace Ui
  25. namespace Storage {
  26. enum class SharedMediaType : signed char;
  27. } // namespace Storage
  28. namespace Info::Profile {
  29. inline auto ToSingleLine() {
  30. return rpl::map([](const QString &text) {
  31. return TextUtilities::SingleLine(text);
  32. });
  33. }
  34. rpl::producer<not_null<PeerData*>> MigratedOrMeValue(
  35. not_null<PeerData*> peer);
  36. [[nodiscard]] rpl::producer<QString> NameValue(not_null<PeerData*> peer);
  37. [[nodiscard]] rpl::producer<QString> TitleValue(
  38. not_null<Data::ForumTopic*> topic);
  39. [[nodiscard]] rpl::producer<DocumentId> IconIdValue(
  40. not_null<Data::ForumTopic*> topic);
  41. [[nodiscard]] rpl::producer<int32> ColorIdValue(
  42. not_null<Data::ForumTopic*> topic);
  43. [[nodiscard]] rpl::producer<TextWithEntities> PhoneValue(
  44. not_null<UserData*> user);
  45. [[nodiscard]] rpl::producer<TextWithEntities> PhoneOrHiddenValue(
  46. not_null<UserData*> user);
  47. [[nodiscard]] rpl::producer<TextWithEntities> UsernameValue(
  48. not_null<PeerData*> peer,
  49. bool primary = false);
  50. [[nodiscard]] rpl::producer<std::vector<TextWithEntities>> UsernamesValue(
  51. not_null<PeerData*> peer);
  52. [[nodiscard]] QString UsernameUrl(
  53. not_null<PeerData*> peer,
  54. const QString &username,
  55. bool link = false);
  56. [[nodiscard]] TextWithEntities AboutWithEntities(
  57. not_null<PeerData*> peer,
  58. const QString &value);
  59. [[nodiscard]] rpl::producer<TextWithEntities> AboutValue(
  60. not_null<PeerData*> peer);
  61. struct LinkWithUrl {
  62. QString text;
  63. QString url;
  64. };
  65. [[nodiscard]] rpl::producer<LinkWithUrl> LinkValue(
  66. not_null<PeerData*> peer,
  67. bool primary = false);
  68. [[nodiscard]] rpl::producer<const ChannelLocation*> LocationValue(
  69. not_null<ChannelData*> channel);
  70. [[nodiscard]] rpl::producer<bool> NotificationsEnabledValue(
  71. not_null<PeerData*> peer);
  72. [[nodiscard]] rpl::producer<bool> NotificationsEnabledValue(
  73. not_null<Data::Thread*> thread);
  74. [[nodiscard]] rpl::producer<bool> IsContactValue(not_null<UserData*> user);
  75. [[nodiscard]] rpl::producer<QString> InviteToChatButton(
  76. not_null<UserData*> user);
  77. [[nodiscard]] rpl::producer<QString> InviteToChatAbout(
  78. not_null<UserData*> user);
  79. [[nodiscard]] rpl::producer<bool> CanShareContactValue(
  80. not_null<UserData*> user);
  81. [[nodiscard]] rpl::producer<bool> CanAddContactValue(
  82. not_null<UserData*> user);
  83. [[nodiscard]] rpl::producer<Data::Birthday> BirthdayValue(
  84. not_null<UserData*> user);
  85. [[nodiscard]] rpl::producer<ChannelData*> PersonalChannelValue(
  86. not_null<UserData*> user);
  87. [[nodiscard]] rpl::producer<bool> AmInChannelValue(
  88. not_null<ChannelData*> channel);
  89. [[nodiscard]] rpl::producer<int> MembersCountValue(not_null<PeerData*> peer);
  90. [[nodiscard]] rpl::producer<int> PendingRequestsCountValue(
  91. not_null<PeerData*> peer);
  92. [[nodiscard]] rpl::producer<int> AdminsCountValue(not_null<PeerData*> peer);
  93. [[nodiscard]] rpl::producer<int> RestrictionsCountValue(
  94. not_null<PeerData*> peer);
  95. [[nodiscard]] rpl::producer<int> RestrictedCountValue(
  96. not_null<ChannelData*> channel);
  97. [[nodiscard]] rpl::producer<int> KickedCountValue(
  98. not_null<ChannelData*> channel);
  99. [[nodiscard]] rpl::producer<int> SharedMediaCountValue(
  100. not_null<PeerData*> peer,
  101. MsgId topicRootId,
  102. PeerData *migrated,
  103. Storage::SharedMediaType type);
  104. [[nodiscard]] rpl::producer<int> CommonGroupsCountValue(
  105. not_null<UserData*> user);
  106. [[nodiscard]] rpl::producer<int> SimilarPeersCountValue(
  107. not_null<PeerData*> peer);
  108. [[nodiscard]] rpl::producer<int> SavedSublistCountValue(
  109. not_null<PeerData*> peer);
  110. [[nodiscard]] rpl::producer<int> PeerGiftsCountValue(
  111. not_null<PeerData*> peer);
  112. [[nodiscard]] rpl::producer<bool> CanAddMemberValue(
  113. not_null<PeerData*> peer);
  114. [[nodiscard]] rpl::producer<int> FullReactionsCountValue(
  115. not_null<Main::Session*> peer);
  116. [[nodiscard]] rpl::producer<bool> CanViewParticipantsValue(
  117. not_null<ChannelData*> megagroup);
  118. enum class BadgeType;
  119. [[nodiscard]] rpl::producer<BadgeType> BadgeValue(not_null<PeerData*> peer);
  120. [[nodiscard]] rpl::producer<EmojiStatusId> EmojiStatusIdValue(
  121. not_null<PeerData*> peer);
  122. [[nodiscard]] rpl::producer<QString> BirthdayLabelText(
  123. rpl::producer<Data::Birthday> birthday);
  124. [[nodiscard]] rpl::producer<QString> BirthdayValueText(
  125. rpl::producer<Data::Birthday> birthday);
  126. } // namespace Info::Profile