self_destruction_box.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "ui/layers/box_content.h"
  9. #include "mtproto/sender.h"
  10. namespace Ui {
  11. class RadiobuttonGroup;
  12. class Radiobutton;
  13. class FlatLabel;
  14. } // namespace Ui
  15. namespace Main {
  16. class Session;
  17. } // namespace Main
  18. class SelfDestructionBox : public Ui::BoxContent {
  19. public:
  20. enum class Type {
  21. Account,
  22. Sessions,
  23. };
  24. SelfDestructionBox(
  25. QWidget*,
  26. not_null<Main::Session*> session,
  27. Type type,
  28. rpl::producer<int> preloaded);
  29. static QString DaysLabel(int days);
  30. protected:
  31. void prepare() override;
  32. private:
  33. void gotCurrent(int days);
  34. void showContent();
  35. const Type _type;
  36. const not_null<Main::Session*> _session;
  37. bool _prepared = false;
  38. std::vector<int> _ttlValues;
  39. object_ptr<Ui::FlatLabel> _description = { nullptr };
  40. object_ptr<Ui::FlatLabel> _loading;
  41. std::shared_ptr<Ui::RadiobuttonGroup> _ttlGroup;
  42. };