Added arrow icon to divider link in moderation box.
This commit is contained in:
parent
629da68cfc
commit
82293c98eb
3 changed files with 55 additions and 17 deletions
|
@ -2858,10 +2858,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_restrict_users" = "Restrict users";
|
"lng_restrict_users" = "Restrict users";
|
||||||
"lng_delete_all_from_user" = "Delete all from {user}";
|
"lng_delete_all_from_user" = "Delete all from {user}";
|
||||||
"lng_delete_all_from_users" = "Delete all from users";
|
"lng_delete_all_from_users" = "Delete all from users";
|
||||||
"lng_restrict_user_part" = "Partially restrict this user";
|
"lng_restrict_user_part" = "Partially restrict this user {emoji}";
|
||||||
"lng_restrict_users_part" = "Partially restrict users";
|
"lng_restrict_users_part" = "Partially restrict users {emoji}";
|
||||||
"lng_restrict_user_full" = "Fully ban this user";
|
"lng_restrict_user_full" = "Fully ban this user {emoji}";
|
||||||
"lng_restrict_users_full" = "Fully ban users";
|
"lng_restrict_users_full" = "Fully ban users {emoji}";
|
||||||
"lng_restrict_users_part_single_header" = "What can this user do?";
|
"lng_restrict_users_part_single_header" = "What can this user do?";
|
||||||
"lng_restrict_users_part_header#one" = "What can {count} selected user do?";
|
"lng_restrict_users_part_header#one" = "What can {count} selected user do?";
|
||||||
"lng_restrict_users_part_header#other" = "What can {count} selected users do?";
|
"lng_restrict_users_part_header#other" = "What can {count} selected users do?";
|
||||||
|
|
|
@ -1087,3 +1087,10 @@ moderateBoxExpandInnerSkip: 2px;
|
||||||
moderateBoxExpandFont: font(11px);
|
moderateBoxExpandFont: font(11px);
|
||||||
moderateBoxExpandToggleSize: 4px;
|
moderateBoxExpandToggleSize: 4px;
|
||||||
moderateBoxExpandToggleFourStrokes: 3px;
|
moderateBoxExpandToggleFourStrokes: 3px;
|
||||||
|
moderateBoxExpandIcon: icon{{ "info/edit/expand_arrow_small-flip_vertical", windowActiveTextFg }};
|
||||||
|
moderateBoxExpandIconDown: icon{{ "info/edit/expand_arrow_small", windowActiveTextFg }};
|
||||||
|
moderateBoxDividerLabel: FlatLabel(boxDividerLabel) {
|
||||||
|
palette: TextPalette(defaultTextPalette) {
|
||||||
|
selectLinkFg: windowActiveTextFg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "boxes/delete_messages_box.h"
|
#include "boxes/delete_messages_box.h"
|
||||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||||
|
#include "core/ui_integration.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_chat_participant_status.h"
|
#include "data/data_chat_participant_status.h"
|
||||||
|
@ -19,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -481,21 +483,29 @@ void CreateModerateMessagesBox(
|
||||||
const auto wrap = inner->add(std::move(ownedWrap));
|
const auto wrap = inner->add(std::move(ownedWrap));
|
||||||
const auto container = wrap->entity();
|
const auto container = wrap->entity();
|
||||||
wrap->toggle(false, anim::type::instant);
|
wrap->toggle(false, anim::type::instant);
|
||||||
|
|
||||||
|
const auto session = &users.front()->session();
|
||||||
|
const auto emojiMargin = QMargins(
|
||||||
|
-st::moderateBoxExpandInnerSkip,
|
||||||
|
-st::moderateBoxExpandInnerSkip / 2,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
const auto emojiUp = Ui::Text::SingleCustomEmoji(
|
||||||
|
session->data().customEmojiManager().registerInternalEmoji(
|
||||||
|
st::moderateBoxExpandIcon,
|
||||||
|
emojiMargin,
|
||||||
|
false));
|
||||||
|
const auto emojiDown = Ui::Text::SingleCustomEmoji(
|
||||||
|
session->data().customEmojiManager().registerInternalEmoji(
|
||||||
|
st::moderateBoxExpandIconDown,
|
||||||
|
emojiMargin,
|
||||||
|
false));
|
||||||
|
|
||||||
auto label = object_ptr<Ui::FlatLabel>(
|
auto label = object_ptr<Ui::FlatLabel>(
|
||||||
inner,
|
inner,
|
||||||
wrap->toggledValue(
|
QString(),
|
||||||
) | rpl::map([isSingle](bool toggled) {
|
st::moderateBoxDividerLabel);
|
||||||
return Ui::Text::Link(
|
const auto raw = label.data();
|
||||||
((toggled && isSingle)
|
|
||||||
? tr::lng_restrict_user_part
|
|
||||||
: (toggled && !isSingle)
|
|
||||||
? tr::lng_restrict_users_part
|
|
||||||
: isSingle
|
|
||||||
? tr::lng_restrict_user_full
|
|
||||||
: tr::lng_restrict_users_full)(tr::now),
|
|
||||||
u"internal:"_q);
|
|
||||||
}),
|
|
||||||
st::boxDividerLabel);
|
|
||||||
|
|
||||||
auto &lifetime = wrap->lifetime();
|
auto &lifetime = wrap->lifetime();
|
||||||
const auto scrollLifetime = lifetime.make_state<rpl::lifetime>();
|
const auto scrollLifetime = lifetime.make_state<rpl::lifetime>();
|
||||||
|
@ -521,6 +531,27 @@ void CreateModerateMessagesBox(
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
wrap->toggledValue(
|
||||||
|
) | rpl::map([isSingle, emojiUp, emojiDown](bool toggled) {
|
||||||
|
return ((toggled && isSingle)
|
||||||
|
? tr::lng_restrict_user_part
|
||||||
|
: (toggled && !isSingle)
|
||||||
|
? tr::lng_restrict_users_part
|
||||||
|
: isSingle
|
||||||
|
? tr::lng_restrict_user_full
|
||||||
|
: tr::lng_restrict_users_full)(
|
||||||
|
lt_emoji,
|
||||||
|
rpl::single(toggled ? emojiUp : emojiDown),
|
||||||
|
Ui::Text::WithEntities);
|
||||||
|
}) | rpl::flatten_latest(
|
||||||
|
) | rpl::start_with_next([=](const TextWithEntities &text) {
|
||||||
|
raw->setMarkedText(
|
||||||
|
Ui::Text::Link(text, u"internal:"_q),
|
||||||
|
Core::MarkedTextContext{
|
||||||
|
.session = session,
|
||||||
|
.customEmojiRepaint = [=] { raw->update(); },
|
||||||
|
});
|
||||||
|
}, label->lifetime());
|
||||||
|
|
||||||
Ui::AddSkip(inner);
|
Ui::AddSkip(inner);
|
||||||
inner->add(object_ptr<Ui::DividerLabel>(
|
inner->add(object_ptr<Ui::DividerLabel>(
|
||||||
|
|
Loading…
Reference in a new issue