background_box.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. class PeerData;
  10. namespace Window {
  11. class SessionController;
  12. } // namespace Window
  13. namespace Data {
  14. class WallPaper;
  15. } // namespace Data
  16. class BackgroundBox : public Ui::BoxContent {
  17. public:
  18. BackgroundBox(
  19. QWidget*,
  20. not_null<Window::SessionController*> controller,
  21. PeerData *forPeer = nullptr);
  22. protected:
  23. void prepare() override;
  24. private:
  25. class Inner;
  26. void chosen(const Data::WallPaper &paper);
  27. [[nodiscard]] bool hasDefaultForPeer() const;
  28. [[nodiscard]] bool chosenDefaultForPeer(
  29. const Data::WallPaper &paper) const;
  30. void removePaper(const Data::WallPaper &paper);
  31. void resetForPeer();
  32. [[nodiscard]] bool forChannel() const;
  33. void chooseFromFile();
  34. const not_null<Window::SessionController*> _controller;
  35. QPointer<Inner> _inner;
  36. PeerData *_forPeer = nullptr;
  37. };