Skip to content

Commit

Permalink
Add icons to report reason selectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Mar 22, 2022
1 parent 5e02da6 commit 32eca14
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 11 deletions.
Binary file added Telegram/Resources/icons/menu/copyright.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/copyright@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/copyright@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/drugs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/drugs@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/drugs@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/fake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/fake@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/fake@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/personal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/personal@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/personal@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/porn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/porn@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/porn@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/violence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/violence@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/violence@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Telegram/SourceFiles/info/info.style
Original file line number Diff line number Diff line change
Expand Up @@ -954,3 +954,9 @@ shortInfoCover: ShortInfoCover {
thickness: 2px;
}
}

reportReasonTopSkip: 8px;
reportReasonButton: SettingsButton(infoProfileButton) {
style: boxTextStyle;
padding: margins(62px, 7px, 8px, 7px);
}
61 changes: 50 additions & 11 deletions Telegram/SourceFiles/ui/boxes/report_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ For license and copyright information please follow this link:

#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"

This comment has been minimized.

Copy link
@scresante

scresante Mar 22, 2022

Styles here must be styles #24232


namespace Ui {
namespace {
Expand All @@ -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(); });
}
Expand Down
6 changes: 6 additions & 0 deletions Telegram/SourceFiles/ui/menu_icons.style
Original file line number Diff line number Diff line change
Expand Up @@ -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 }};
Expand Down

1 comment on commit 32eca14

@aLUNAR21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

помогите пожалуйста с установкой

Please sign in to comment.