info_members_widget.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 "info/info_content_widget.h"
  9. struct PeerListState;
  10. namespace Info {
  11. namespace Profile {
  12. class Members;
  13. struct MembersState;
  14. } // namespace Profile
  15. namespace Members {
  16. using SavedState = Profile::MembersState;
  17. class Memento final : public ContentMemento {
  18. public:
  19. Memento(not_null<Controller*> controller);
  20. Memento(not_null<PeerData*> peer, PeerId migratedPeerId);
  21. object_ptr<ContentWidget> createWidget(
  22. QWidget *parent,
  23. not_null<Controller*> controller,
  24. const QRect &geometry) override;
  25. Section section() const override;
  26. void setState(std::unique_ptr<SavedState> state);
  27. std::unique_ptr<SavedState> state();
  28. ~Memento();
  29. private:
  30. std::unique_ptr<SavedState> _state;
  31. };
  32. class Widget final : public ContentWidget {
  33. public:
  34. Widget(
  35. QWidget *parent,
  36. not_null<Controller*> controller);
  37. bool showInternal(
  38. not_null<ContentMemento*> memento) override;
  39. void setInternalState(
  40. const QRect &geometry,
  41. not_null<Memento*> memento);
  42. rpl::producer<QString> title() override;
  43. private:
  44. void saveState(not_null<Memento*> memento);
  45. void restoreState(not_null<Memento*> memento);
  46. std::shared_ptr<ContentMemento> doCreateMemento() override;
  47. Profile::Members *_inner = nullptr;
  48. };
  49. } // namespace Members
  50. } // namespace Info