2016-06-06 10:29:51 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2017-01-11 18:31:31 +00:00
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
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;
|
2016-11-15 11:56:49 +00:00
|
|
|
class InputArea;
|
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:
|
2016-12-13 17:07:56 +00:00
|
|
|
ReportBox(QWidget*, PeerData *peer);
|
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);
|
|
|
|
|
2016-12-09 06:19:55 +00:00
|
|
|
PeerData *_peer;
|
2016-06-06 10:29:51 +00:00
|
|
|
|
2017-03-18 21:06:10 +00:00
|
|
|
std::shared_ptr<Ui::RadioenumGroup<Reason>> _reasonGroup;
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonSpam;
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonViolence;
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonPornography;
|
|
|
|
object_ptr<Ui::Radioenum<Reason>> _reasonOther;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::InputArea> _reasonOtherText = { nullptr };
|
2016-06-06 10:29:51 +00:00
|
|
|
|
|
|
|
mtpRequestId _requestId = 0;
|
|
|
|
|
|
|
|
};
|