Add icons to report reason selectors.

This commit is contained in:
John Preston 2022-03-22 09:18:17 +04:00
parent 5e02da6fb7
commit 32eca14a81
21 changed files with 62 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -954,3 +954,9 @@ shortInfoCover: ShortInfoCover {
thickness: 2px;
}
}
reportReasonTopSkip: 8px;
reportReasonButton: SettingsButton(infoProfileButton) {
style: boxTextStyle;
padding: margins(62px, 7px, 8px, 7px);
}

View file

@ -9,12 +9,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/layers/generic_box.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "ui/toast/toast.h"
#include "info/profile/info_profile_icon.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_profile.h"
#include "styles/style_info.h"
#include "Styles/style_menu_icons.h"
namespace Ui {
namespace {
@ -39,27 +43,62 @@ void ReportReasonBox(
}
Unexpected("'source' in ReportReasonBox.");
}());
const auto add = [&](Reason reason, tr::phrase<> text) {
auto margin = style::margins{ 0, st::reportReasonTopSkip, 0, 0 };
const auto add = [&](
Reason reason,
tr::phrase<> text,
const style::icon &icon) {
const auto &st = st::reportReasonButton;
const auto layout = box->verticalLayout();
const auto button = layout->add(
object_ptr<SettingsButton>(layout, text()));
object_ptr<Ui::SettingsButton>(layout.get(), text(), st),
margin);
margin = {};
button->setClickedCallback([=] {
done(reason);
});
const auto height = st.padding.top()
+ st.height
+ st.padding.bottom();
object_ptr<Info::Profile::FloatingIcon>(
button,
icon,
QPoint{
st::infoSharedMediaButtonIconPosition.x(),
(height - icon.height()) / 2,
});
};
add(Reason::Spam, tr::lng_report_reason_spam);
add(Reason::Spam, tr::lng_report_reason_spam, st::menuIconDelete);
if (source != Source::Message) {
add(Reason::Fake, tr::lng_report_reason_fake);
add(Reason::Fake, tr::lng_report_reason_fake, st::menuIconFake);
}
add(Reason::Violence, tr::lng_report_reason_violence);
add(Reason::ChildAbuse, tr::lng_report_reason_child_abuse);
add(Reason::Pornography, tr::lng_report_reason_pornography);
add(Reason::Copyright, tr::lng_report_reason_copyright);
add(
Reason::Violence,
tr::lng_report_reason_violence,
st::menuIconViolence);
add(
Reason::ChildAbuse,
tr::lng_report_reason_child_abuse,
st::menuIconBlock);
add(
Reason::Pornography,
tr::lng_report_reason_pornography,
st::menuIconPorn);
add(
Reason::Copyright,
tr::lng_report_reason_copyright,
st::menuIconCopyright);
if (source == Source::Message) {
add(Reason::IllegalDrugs, tr::lng_report_reason_illegal_drugs);
add(Reason::PersonalDetails, tr::lng_report_reason_personal_details);
add(
Reason::IllegalDrugs,
tr::lng_report_reason_illegal_drugs,
st::menuIconDrugs);
add(
Reason::PersonalDetails,
tr::lng_report_reason_personal_details,
st::menuIconPersonal);
}
add(Reason::Other, tr::lng_report_reason_other);
add(Reason::Other, tr::lng_report_reason_other, st::menuIconReport);
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
}

View file

@ -87,6 +87,12 @@ menuIconImportTheme: icon {{ "menu/import_theme", menuIconColor }};
menuIconExportTheme: icon {{ "menu/export_theme", menuIconColor }};
menuIconRestore: icon {{ "menu/restore", menuIconColor }};
menuIconSettings: icon {{ "menu/settings", menuIconColor }};
menuIconCopyright: icon {{ "menu/copyright", menuIconColor }};
menuIconDrugs: icon {{ "menu/drugs", menuIconColor }};
menuIconFake: icon {{ "menu/fake", menuIconColor }};
menuIconPersonal: icon {{ "menu/personal", menuIconColor }};
menuIconPorn: icon {{ "menu/porn", menuIconColor }};
menuIconViolence: icon {{ "menu/violence", menuIconColor }};
mediaMenuIconStickers: icon {{ "menu/stickers", mediaviewMenuFg }};
mediaMenuIconCancel: icon {{ "menu/cancel", mediaviewMenuFg }};