attach_bot_downloads.h 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Ui {
  9. class PopupMenu;
  10. } // namespace Ui
  11. namespace Ui::BotWebView {
  12. struct DownloadsProgress {
  13. uint64 ready = 0;
  14. uint64 total : 63 = 0;
  15. uint64 loading : 1 = 0;
  16. friend inline bool operator==(
  17. const DownloadsProgress &a,
  18. const DownloadsProgress &b) = default;
  19. };
  20. struct DownloadsEntry {
  21. uint32 id = 0;
  22. QString url;
  23. QString path;
  24. uint64 ready : 63 = 0;
  25. uint64 loading : 1 = 0;
  26. uint64 total : 63 = 0;
  27. uint64 failed : 1 = 0;
  28. };
  29. enum class DownloadsAction {
  30. Open,
  31. Retry,
  32. Cancel,
  33. };
  34. [[nodiscard]] auto FillAttachBotDownloadsSubmenu(
  35. rpl::producer<std::vector<DownloadsEntry>> content,
  36. Fn<void(uint32, DownloadsAction)> callback)
  37. -> FnMut<void(not_null<PopupMenu*>)>;
  38. } // namespace Ui::BotWebView