mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 15:45:12 +00:00
Use tr:: instead of Lang::Viewer.
This commit is contained in:
@@ -193,7 +193,8 @@ private:
|
||||
|
||||
bool canEditInformation() const;
|
||||
void refreshHistoryVisibility(anim::type animated = anim::type::normal);
|
||||
void showEditPeerTypeBox(std::optional<LangKey> error = std::nullopt);
|
||||
void showEditPeerTypeBox(
|
||||
std::optional<rpl::producer<QString>> error = {});
|
||||
void showEditLinkedChatBox();
|
||||
void fillPrivacyTypeButton();
|
||||
void fillLinkedChatButton();
|
||||
@@ -449,7 +450,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
||||
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_group_stickers),
|
||||
tr::lng_group_stickers(),
|
||||
st::editPeerSectionLabel));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
@@ -457,7 +458,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
||||
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_group_stickers_description),
|
||||
tr::lng_group_stickers_description(),
|
||||
st::editPeerPrivacyLabel));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
@@ -465,7 +466,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
||||
|
||||
container->add(object_ptr<Ui::LinkButton>(
|
||||
_wrap,
|
||||
lang(lng_group_stickers_add),
|
||||
tr::lng_group_stickers_add(tr::now),
|
||||
st::editPeerInviteLinkButton)
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<StickersBox>(channel), LayerOption::KeepOther);
|
||||
@@ -493,7 +494,8 @@ void Controller::refreshHistoryVisibility(anim::type animated) {
|
||||
animated);
|
||||
};
|
||||
|
||||
void Controller::showEditPeerTypeBox(std::optional<LangKey> error) {
|
||||
void Controller::showEditPeerTypeBox(
|
||||
std::optional<rpl::producer<QString>> error) {
|
||||
const auto boxCallback = crl::guard(this, [=](
|
||||
Privacy checked, QString publicLink) {
|
||||
_privacyTypeUpdates.fire(std::move(checked));
|
||||
@@ -575,19 +577,19 @@ void Controller::fillPrivacyTypeButton() {
|
||||
const auto isGroup = (_peer->isChat() || _peer->isMegagroup());
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(isGroup
|
||||
? lng_manage_peer_group_type
|
||||
: lng_manage_peer_channel_type),
|
||||
(isGroup
|
||||
? tr::lng_manage_peer_group_type
|
||||
: tr::lng_manage_peer_channel_type)(),
|
||||
_privacyTypeUpdates.events(
|
||||
) | rpl::map([=](Privacy flag) {
|
||||
return lang(Privacy::Public == flag
|
||||
return (Privacy::Public == flag
|
||||
? (isGroup
|
||||
? lng_manage_public_group_title
|
||||
: lng_manage_public_peer_title)
|
||||
? tr::lng_manage_public_group_title
|
||||
: tr::lng_manage_public_peer_title)
|
||||
: (isGroup
|
||||
? lng_manage_private_group_title
|
||||
: lng_manage_private_peer_title));
|
||||
}),
|
||||
? tr::lng_manage_private_group_title
|
||||
: tr::lng_manage_private_peer_title))();
|
||||
}) | rpl::flatten_latest(),
|
||||
[=] { showEditPeerTypeBox(); });
|
||||
|
||||
_privacyTypeUpdates.fire_copy(*_privacySavedValue);
|
||||
@@ -602,10 +604,10 @@ void Controller::fillLinkedChatButton() {
|
||||
|
||||
const auto isGroup = (_peer->isChat() || _peer->isMegagroup());
|
||||
auto text = !isGroup
|
||||
? Lang::Viewer(lng_manage_discussion_group)
|
||||
? tr::lng_manage_discussion_group()
|
||||
: rpl::combine(
|
||||
Lang::Viewer(lng_manage_linked_channel),
|
||||
Lang::Viewer(lng_manage_linked_channel_restore),
|
||||
tr::lng_manage_linked_channel(),
|
||||
tr::lng_manage_linked_channel_restore(),
|
||||
_linkedChatUpdates.events()
|
||||
) | rpl::map([=](
|
||||
const QString &edit,
|
||||
@@ -619,7 +621,7 @@ void Controller::fillLinkedChatButton() {
|
||||
return chat ? chat->name : QString();
|
||||
}) | rpl::type_erased()
|
||||
: rpl::combine(
|
||||
Lang::Viewer(lng_manage_discussion_group_add),
|
||||
tr::lng_manage_discussion_group_add(),
|
||||
_linkedChatUpdates.events()
|
||||
) | rpl::map([=](const QString &add, ChannelData *chat) {
|
||||
return chat
|
||||
@@ -645,7 +647,7 @@ void Controller::fillInviteLinkButton() {
|
||||
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_profile_invite_link_section),
|
||||
tr::lng_profile_invite_link_section(),
|
||||
rpl::single(QString()), //Empty text.
|
||||
buttonCallback);
|
||||
}
|
||||
@@ -657,7 +659,7 @@ void Controller::fillSignaturesButton() {
|
||||
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_edit_sign_messages),
|
||||
tr::lng_edit_sign_messages(),
|
||||
rpl::single(QString()),
|
||||
[=] {}
|
||||
)->toggleOn(rpl::single(channel->addsSignature())
|
||||
@@ -701,13 +703,13 @@ void Controller::fillHistoryVisibilityButton() {
|
||||
};
|
||||
AddButtonWithText(
|
||||
container,
|
||||
Lang::Viewer(lng_manage_history_visibility_title),
|
||||
tr::lng_manage_history_visibility_title(),
|
||||
updateHistoryVisibility->events(
|
||||
) | rpl::map([](HistoryVisibility flag) {
|
||||
return lang((HistoryVisibility::Visible == flag)
|
||||
? lng_manage_history_visibility_shown
|
||||
: lng_manage_history_visibility_hidden);
|
||||
}),
|
||||
return (HistoryVisibility::Visible == flag
|
||||
? tr::lng_manage_history_visibility_shown
|
||||
: tr::lng_manage_history_visibility_hidden)();
|
||||
}) | rpl::flatten_latest(),
|
||||
buttonCallback);
|
||||
|
||||
updateHistoryVisibility->fire_copy(*_historyVisibilitySavedValue);
|
||||
@@ -824,7 +826,7 @@ void Controller::fillManageSection() {
|
||||
if (canEditPermissions) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_manage_peer_permissions),
|
||||
tr::lng_manage_peer_permissions(),
|
||||
Info::Profile::RestrictionsCountValue(_peer)
|
||||
| ToPositiveNumberStringRestrictions(),
|
||||
[=] { ShowEditPermissions(_peer); },
|
||||
@@ -833,7 +835,7 @@ void Controller::fillManageSection() {
|
||||
if (canViewAdmins) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_manage_peer_administrators),
|
||||
tr::lng_manage_peer_administrators(),
|
||||
Info::Profile::AdminsCountValue(_peer)
|
||||
| ToPositiveNumberString(),
|
||||
[=] {
|
||||
@@ -847,7 +849,7 @@ void Controller::fillManageSection() {
|
||||
if (canViewMembers) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_manage_peer_members),
|
||||
tr::lng_manage_peer_members(),
|
||||
Info::Profile::MembersCountValue(_peer)
|
||||
| ToPositiveNumberString(),
|
||||
[=] {
|
||||
@@ -861,7 +863,7 @@ void Controller::fillManageSection() {
|
||||
if (canViewKicked) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_manage_peer_removed_users),
|
||||
tr::lng_manage_peer_removed_users(),
|
||||
Info::Profile::KickedCountValue(channel)
|
||||
| ToPositiveNumberString(),
|
||||
[=] {
|
||||
@@ -875,7 +877,7 @@ void Controller::fillManageSection() {
|
||||
if (hasRecentActions) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(lng_manage_peer_recent_actions),
|
||||
tr::lng_manage_peer_recent_actions(),
|
||||
rpl::single(QString()), //Empty count.
|
||||
[=] {
|
||||
navigation->showSection(AdminLog::SectionMemento(channel));
|
||||
@@ -895,9 +897,9 @@ void Controller::fillManageSection() {
|
||||
if (canDeleteChannel) {
|
||||
AddButtonDelete(
|
||||
_controls.buttonsLayout,
|
||||
Lang::Viewer(_isGroup
|
||||
? lng_profile_delete_group
|
||||
: lng_profile_delete_channel),
|
||||
(_isGroup
|
||||
? tr::lng_profile_delete_group
|
||||
: tr::lng_profile_delete_channel)(),
|
||||
[=]{ deleteWithConfirmation(); }
|
||||
);
|
||||
}
|
||||
@@ -1079,17 +1081,17 @@ void Controller::saveUsername() {
|
||||
continueSave();
|
||||
return;
|
||||
}
|
||||
const auto errorKey = [&] {
|
||||
|
||||
// Very rare case.
|
||||
showEditPeerTypeBox([&] {
|
||||
if (type == qstr("USERNAME_INVALID")) {
|
||||
return lng_create_channel_link_invalid;
|
||||
return tr::lng_create_channel_link_invalid();
|
||||
} else if (type == qstr("USERNAME_OCCUPIED")
|
||||
|| type == qstr("USERNAMES_UNAVAILABLE")) {
|
||||
return lng_create_channel_link_occupied;
|
||||
return tr::lng_create_channel_link_occupied();
|
||||
}
|
||||
return lng_create_channel_link_invalid;
|
||||
}();
|
||||
// Very rare case.
|
||||
showEditPeerTypeBox(errorKey);
|
||||
return tr::lng_create_channel_link_invalid();
|
||||
}());
|
||||
cancelSave();
|
||||
}).send();
|
||||
}
|
||||
|
Reference in New Issue
Block a user