export_settings.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 "base/flat_map.h"
  10. namespace Export {
  11. namespace Output {
  12. enum class Format;
  13. } // namespace Output
  14. struct MediaSettings {
  15. bool validate() const;
  16. enum class Type {
  17. Photo = 0x01,
  18. Video = 0x02,
  19. VoiceMessage = 0x04,
  20. VideoMessage = 0x08,
  21. Sticker = 0x10,
  22. GIF = 0x20,
  23. File = 0x40,
  24. MediaMask = Photo | Video | VoiceMessage | VideoMessage,
  25. AllMask = MediaMask | Sticker | GIF | File,
  26. };
  27. using Types = base::flags<Type>;
  28. friend inline constexpr auto is_flag_type(Type) { return true; };
  29. Types types = DefaultTypes();
  30. int64 sizeLimit = 8 * 1024 * 1024;
  31. static inline Types DefaultTypes() {
  32. return Type::Photo;
  33. }
  34. };
  35. struct Settings {
  36. bool validate() const;
  37. enum class Type {
  38. PersonalInfo = 0x001,
  39. Userpics = 0x002,
  40. Contacts = 0x004,
  41. Sessions = 0x008,
  42. OtherData = 0x010,
  43. PersonalChats = 0x020,
  44. BotChats = 0x040,
  45. PrivateGroups = 0x080,
  46. PublicGroups = 0x100,
  47. PrivateChannels = 0x200,
  48. PublicChannels = 0x400,
  49. Stories = 0x800,
  50. GroupsMask = PrivateGroups | PublicGroups,
  51. ChannelsMask = PrivateChannels | PublicChannels,
  52. GroupsChannelsMask = GroupsMask | ChannelsMask,
  53. NonChannelChatsMask = PersonalChats | BotChats | PrivateGroups,
  54. AnyChatsMask = PersonalChats | BotChats | GroupsChannelsMask,
  55. NonChatsMask = (PersonalInfo
  56. | Userpics
  57. | Contacts
  58. | Stories
  59. | Sessions),
  60. AllMask = NonChatsMask | OtherData | AnyChatsMask,
  61. };
  62. using Types = base::flags<Type>;
  63. friend inline constexpr auto is_flag_type(Type) { return true; };
  64. QString path;
  65. bool forceSubPath = false;
  66. Output::Format format = Output::Format();
  67. Types types = DefaultTypes();
  68. Types fullChats = DefaultFullChats();
  69. MediaSettings media;
  70. MTPInputPeer singlePeer = MTP_inputPeerEmpty();
  71. TimeId singlePeerFrom = 0;
  72. TimeId singlePeerTill = 0;
  73. TimeId availableAt = 0;
  74. bool onlySinglePeer() const {
  75. return singlePeer.type() != mtpc_inputPeerEmpty;
  76. }
  77. static inline Types DefaultTypes() {
  78. return Type::PersonalInfo
  79. | Type::Userpics
  80. | Type::Contacts
  81. | Type::Stories
  82. | Type::PersonalChats
  83. | Type::PrivateGroups;
  84. }
  85. static inline Types DefaultFullChats() {
  86. return Type::PersonalChats
  87. | Type::BotChats;
  88. }
  89. };
  90. struct Environment {
  91. QString internalLinksDomain;
  92. QByteArray aboutTelegram;
  93. QByteArray aboutContacts;
  94. QByteArray aboutFrequent;
  95. QByteArray aboutSessions;
  96. QByteArray aboutWebSessions;
  97. QByteArray aboutChats;
  98. QByteArray aboutLeftChats;
  99. };
  100. } // namespace Export