mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
Version 1.6.3: Add child abuse report reason (#5828)
This commit is contained in:
parent
a26d82eec6
commit
09ff556aa6
3 changed files with 17 additions and 2 deletions
|
@ -845,6 +845,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_report_message_title" = "Report message";
|
"lng_report_message_title" = "Report message";
|
||||||
"lng_report_reason_spam" = "Spam";
|
"lng_report_reason_spam" = "Spam";
|
||||||
"lng_report_reason_violence" = "Violence";
|
"lng_report_reason_violence" = "Violence";
|
||||||
|
"lng_report_reason_child_abuse" = "Child Abuse";
|
||||||
"lng_report_reason_pornography" = "Pornography";
|
"lng_report_reason_pornography" = "Pornography";
|
||||||
"lng_report_reason_other" = "Other";
|
"lng_report_reason_other" = "Other";
|
||||||
"lng_report_reason_description" = "Description";
|
"lng_report_reason_description" = "Description";
|
||||||
|
|
|
@ -64,6 +64,9 @@ void ReportBox::prepare() {
|
||||||
};
|
};
|
||||||
createButton(_reasonSpam, Reason::Spam, lng_report_reason_spam);
|
createButton(_reasonSpam, Reason::Spam, lng_report_reason_spam);
|
||||||
createButton(_reasonViolence, Reason::Violence, lng_report_reason_violence);
|
createButton(_reasonViolence, Reason::Violence, lng_report_reason_violence);
|
||||||
|
if (_ids) {
|
||||||
|
createButton(_reasonChildAbuse, Reason::ChildAbuse, lng_report_reason_child_abuse);
|
||||||
|
}
|
||||||
createButton(_reasonPornography, Reason::Pornography, lng_report_reason_pornography);
|
createButton(_reasonPornography, Reason::Pornography, lng_report_reason_pornography);
|
||||||
createButton(_reasonOther, Reason::Other, lng_report_reason_other);
|
createButton(_reasonOther, Reason::Other, lng_report_reason_other);
|
||||||
_reasonGroup->setChangedCallback([=](Reason value) {
|
_reasonGroup->setChangedCallback([=](Reason value) {
|
||||||
|
@ -78,7 +81,13 @@ void ReportBox::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
_reasonSpam->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top() + _reasonSpam->getMargins().top());
|
_reasonSpam->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top() + _reasonSpam->getMargins().top());
|
||||||
_reasonViolence->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonSpam->bottomNoMargins() + st::boxOptionListSkip);
|
_reasonViolence->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonSpam->bottomNoMargins() + st::boxOptionListSkip);
|
||||||
_reasonPornography->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonViolence->bottomNoMargins() + st::boxOptionListSkip);
|
if (_ids) {
|
||||||
|
_reasonChildAbuse->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonViolence->bottomNoMargins() + st::boxOptionListSkip);
|
||||||
|
_reasonPornography->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonChildAbuse->bottomNoMargins() + st::boxOptionListSkip);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
_reasonPornography->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonViolence->bottomNoMargins() + st::boxOptionListSkip);
|
||||||
|
}
|
||||||
_reasonOther->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonPornography->bottomNoMargins() + st::boxOptionListSkip);
|
_reasonOther->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _reasonPornography->bottomNoMargins() + st::boxOptionListSkip);
|
||||||
|
|
||||||
if (_reasonOtherText) {
|
if (_reasonOtherText) {
|
||||||
|
@ -136,6 +145,7 @@ void ReportBox::report() {
|
||||||
switch (_reasonGroup->value()) {
|
switch (_reasonGroup->value()) {
|
||||||
case Reason::Spam: return MTP_inputReportReasonSpam();
|
case Reason::Spam: return MTP_inputReportReasonSpam();
|
||||||
case Reason::Violence: return MTP_inputReportReasonViolence();
|
case Reason::Violence: return MTP_inputReportReasonViolence();
|
||||||
|
case Reason::ChildAbuse: return MTP_inputReportReasonChildAbuse();
|
||||||
case Reason::Pornography: return MTP_inputReportReasonPornography();
|
case Reason::Pornography: return MTP_inputReportReasonPornography();
|
||||||
case Reason::Other: return MTP_inputReportReasonOther(MTP_string(_reasonOtherText->getLastText()));
|
case Reason::Other: return MTP_inputReportReasonOther(MTP_string(_reasonOtherText->getLastText()));
|
||||||
}
|
}
|
||||||
|
@ -180,7 +190,9 @@ bool ReportBox::reportFail(const RPCError &error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportBox::updateMaxHeight() {
|
void ReportBox::updateMaxHeight() {
|
||||||
auto newHeight = st::boxOptionListPadding.top() + _reasonSpam->getMargins().top() + 4 * _reasonSpam->heightNoMargins() + 3 * st::boxOptionListSkip + _reasonSpam->getMargins().bottom() + st::boxOptionListPadding.bottom();
|
const auto buttonsCount = _ids ? 5 : 4;
|
||||||
|
auto newHeight = st::boxOptionListPadding.top() + _reasonSpam->getMargins().top() + buttonsCount * _reasonSpam->heightNoMargins() + (buttonsCount - 1) * st::boxOptionListSkip + _reasonSpam->getMargins().bottom() + st::boxOptionListPadding.bottom();
|
||||||
|
|
||||||
if (_reasonOtherText) {
|
if (_reasonOtherText) {
|
||||||
newHeight += st::newGroupDescriptionPadding.top() + _reasonOtherText->height() + st::newGroupDescriptionPadding.bottom();
|
newHeight += st::newGroupDescriptionPadding.top() + _reasonOtherText->height() + st::newGroupDescriptionPadding.bottom();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ private:
|
||||||
enum class Reason {
|
enum class Reason {
|
||||||
Spam,
|
Spam,
|
||||||
Violence,
|
Violence,
|
||||||
|
ChildAbuse,
|
||||||
Pornography,
|
Pornography,
|
||||||
Other,
|
Other,
|
||||||
};
|
};
|
||||||
|
@ -49,6 +50,7 @@ private:
|
||||||
std::shared_ptr<Ui::RadioenumGroup<Reason>> _reasonGroup;
|
std::shared_ptr<Ui::RadioenumGroup<Reason>> _reasonGroup;
|
||||||
object_ptr<Ui::Radioenum<Reason>> _reasonSpam = { nullptr };
|
object_ptr<Ui::Radioenum<Reason>> _reasonSpam = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<Reason>> _reasonViolence = { nullptr };
|
object_ptr<Ui::Radioenum<Reason>> _reasonViolence = { nullptr };
|
||||||
|
object_ptr<Ui::Radioenum<Reason>> _reasonChildAbuse = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<Reason>> _reasonPornography = { nullptr };
|
object_ptr<Ui::Radioenum<Reason>> _reasonPornography = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<Reason>> _reasonOther = { nullptr };
|
object_ptr<Ui::Radioenum<Reason>> _reasonOther = { nullptr };
|
||||||
object_ptr<Ui::InputField> _reasonOtherText = { nullptr };
|
object_ptr<Ui::InputField> _reasonOtherText = { nullptr };
|
||||||
|
|
Loading…
Add table
Reference in a new issue