2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add some icons to popup menus.

This commit is contained in:
John Preston
2021-12-09 21:56:24 +04:00
parent 535fd8d523
commit 2c36623cfb
212 changed files with 581 additions and 263 deletions

View File

@@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/ui_utility.h"
#include "window/window_session_controller.h"
#include "history/history.h"
#include "styles/style_menu_icons.h"
namespace {
@@ -1521,7 +1522,9 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
const auto channel = _peer->asChannel();
const auto participant = row->peer();
const auto user = participant->asUser();
auto result = base::make_unique_q<Ui::PopupMenu>(parent);
auto result = base::make_unique_q<Ui::PopupMenu>(
parent,
st::popupMenuWithIcons);
if (_navigation) {
result->addAction(
(participant->isUser()
@@ -1530,7 +1533,10 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
? tr::lng_context_view_channel
: tr::lng_context_view_group)(tr::now),
crl::guard(this, [=] {
_navigation->showPeerInfo(participant); }));
_navigation->showPeerInfo(participant); }),
(participant->isUser()
? &st::menuIconProfile
: &st::menuIconInfo));
}
if (_role == Role::Kicked) {
if (_peer->isMegagroup()
@@ -1538,11 +1544,13 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
if (user && channel->canAddMembers()) {
result->addAction(
tr::lng_context_add_to_group(tr::now),
crl::guard(this, [=] { unkickParticipant(user); }));
crl::guard(this, [=] { unkickParticipant(user); }),
&st::menuIconInvite);
}
result->addAction(
tr::lng_profile_delete_removed(tr::now),
crl::guard(this, [=] { removeKickedWithRow(participant); }));
crl::guard(this, [=] { removeKickedWithRow(participant); }),
&st::menuIconDelete);
}
return result;
}
@@ -1553,7 +1561,10 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
(isAdmin
? tr::lng_context_edit_permissions
: tr::lng_context_promote_admin)(tr::now),
crl::guard(this, [=] { showAdmin(user); }));
crl::guard(this, [=] { showAdmin(user); }),
(isAdmin
? &st::menuIconAdmin
: &st::menuIconPromote));
}
if (user && _additional.canRestrictParticipant(participant)) {
const auto canRestrictWithoutKick = [&] {
@@ -1565,7 +1576,8 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
if (canRestrictWithoutKick) {
result->addAction(
tr::lng_context_restrict_user(tr::now),
crl::guard(this, [=] { showRestricted(user); }));
crl::guard(this, [=] { showRestricted(user); }),
&st::menuIconRestrict);
}
}
if (user && _additional.canRemoveParticipant(participant)) {
@@ -1575,7 +1587,8 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
(isGroup
? tr::lng_context_remove_from_group
: tr::lng_profile_kick)(tr::now),
crl::guard(this, [=] { kickParticipant(user); }));
crl::guard(this, [=] { kickParticipant(user); }),
&st::menuIconRemove);
}
}
return result;