2016-06-06 10:29:51 +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.
|
2016-06-06 10:29:51 +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
|
2016-06-06 10:29:51 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2016-10-28 09:20:24 +00:00
|
|
|
namespace Ui {
|
2017-03-18 21:06:10 +00:00
|
|
|
template <typename Enum>
|
|
|
|
class RadioenumGroup;
|
|
|
|
template <typename Enum>
|
|
|
|
class Radioenum;
|
2018-05-20 17:42:30 +00:00
|
|
|
class InputField;
|
2016-10-28 09:20:24 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
class ReportBox : public BoxContent, public RPCSender {
|
2016-06-06 10:29:51 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-05-10 14:15:16 +00:00
|
|
|
ReportBox(QWidget*, not_null<PeerData*> peer);
|
|
|
|
ReportBox(QWidget*, not_null<PeerData*> peer, MessageIdsList ids);
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onReport();
|
2017-05-02 11:56:39 +00:00
|
|
|
void onReasonResized();
|
2016-12-20 13:03:51 +00:00
|
|
|
void onClose() {
|
|
|
|
closeBox();
|
|
|
|
}
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
protected:
|
2016-12-13 17:07:56 +00:00
|
|
|
void prepare() override;
|
|
|
|
void setInnerFocus() override;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
private:
|
2017-03-18 21:06:10 +00:00
|
|
|
enum class Reason {
|
|
|
|
Spam,
|
|
|
|
Violence,
|
|
|
|
Pornography,
|
|
|
|
Other,
|
|
|
|
};
|
|
|
|
void reasonChanged(Reason reason);
|
2016-06-06 10:29:51 +00:00
|
|
|
void updateMaxHeight();
|
|
|
|
|
|
|
|
void reportDone(const MTPBool &result);
|
|
|
|
bool reportFail(const RPCError &error);
|
|
|
|
|
2018-05-10 14:15:16 +00:00
|
|
|
not_null<PeerData*> _peer;
|
|
|
|
base::optional<MessageIdsList> _ids;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2017-03-18 21:06:10 +00:00
|
|
|
std::shared_ptr<Ui::RadioenumGroup<Reason>> _reasonGroup;
|
2018-05-10 14:15:16 +00:00
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonSpam = { nullptr };
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonViolence = { nullptr };
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonPornography = { nullptr };
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonOther = { nullptr };
|
2018-05-20 17:42:30 +00:00
|
|
|
object_ptr<Ui::InputField> _reasonOtherText = { nullptr };
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
mtpRequestId _requestId = 0;
|
|
|
|
|
|
|
|
};
|