rate_call_box.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. namespace Ui {
  10. class InputField;
  11. class IconButton;
  12. enum class InputSubmitSettings;
  13. class RateCallBox : public Ui::BoxContent {
  14. public:
  15. RateCallBox(QWidget*, InputSubmitSettings sendWay);
  16. struct Result {
  17. int rating = 0;
  18. QString comment;
  19. };
  20. [[nodiscard]] rpl::producer<Result> sends() const;
  21. protected:
  22. void prepare() override;
  23. void setInnerFocus() override;
  24. void resizeEvent(QResizeEvent *e) override;
  25. private:
  26. void updateMaxHeight();
  27. void ratingChanged(int value);
  28. void send();
  29. void commentResized();
  30. const InputSubmitSettings _sendWay;
  31. int _rating = 0;
  32. std::vector<object_ptr<Ui::IconButton>> _stars;
  33. object_ptr<Ui::InputField> _comment = { nullptr };
  34. rpl::event_stream<Result> _sends;
  35. };
  36. } // namespace Ui