2017-05-02 11:56:39 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-05-02 11:56:39 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-05-02 11:56:39 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "boxes/abstract_box.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
2021-10-21 23:25:01 +00:00
|
|
|
|
2018-05-20 17:42:30 +00:00
|
|
|
class InputField;
|
2017-05-02 11:56:39 +00:00
|
|
|
class IconButton;
|
2021-10-21 23:25:01 +00:00
|
|
|
enum class InputSubmitSettings;
|
2019-07-25 18:55:11 +00:00
|
|
|
|
2019-11-27 08:02:56 +00:00
|
|
|
class RateCallBox : public Ui::BoxContent {
|
2017-05-02 11:56:39 +00:00
|
|
|
public:
|
2021-10-21 23:25:01 +00:00
|
|
|
RateCallBox(QWidget*, InputSubmitSettings sendWay);
|
|
|
|
|
|
|
|
struct Result {
|
|
|
|
int rating = 0;
|
|
|
|
QString comment;
|
|
|
|
};
|
|
|
|
|
|
|
|
[[nodiscard]] rpl::producer<Result> sends() const;
|
2017-05-02 11:56:39 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
void setInnerFocus() override;
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateMaxHeight();
|
|
|
|
void ratingChanged(int value);
|
2018-05-31 12:20:28 +00:00
|
|
|
void send();
|
|
|
|
void commentResized();
|
2017-05-02 11:56:39 +00:00
|
|
|
|
2021-10-21 23:25:01 +00:00
|
|
|
const InputSubmitSettings _sendWay;
|
2017-05-02 11:56:39 +00:00
|
|
|
int _rating = 0;
|
|
|
|
|
|
|
|
std::vector<object_ptr<Ui::IconButton>> _stars;
|
2018-05-20 17:42:30 +00:00
|
|
|
object_ptr<Ui::InputField> _comment = { nullptr };
|
2017-05-02 11:56:39 +00:00
|
|
|
|
2021-10-21 23:25:01 +00:00
|
|
|
rpl::event_stream<Result> _sends;
|
2017-05-02 11:56:39 +00:00
|
|
|
|
|
|
|
};
|
2021-10-21 23:25:01 +00:00
|
|
|
|
|
|
|
} // namespace Ui
|