mirror of https://github.com/procxx/kepka.git
Use tr:: instead of Lang::Viewer.
This commit is contained in:
parent
f35085800a
commit
7af0dd105e
|
@ -63,14 +63,14 @@ void AutoDownloadBox::setupContent() {
|
|||
};
|
||||
|
||||
const auto values = Ui::CreateChild<base::flat_map<Type, int>>(content);
|
||||
const auto add = [&](Type type, LangKey label) {
|
||||
const auto add = [&](Type type, rpl::producer<QString> label) {
|
||||
if (ranges::find(kHidden, type) != end(kHidden)) {
|
||||
return;
|
||||
}
|
||||
const auto value = settings->bytesLimit(_source, type);
|
||||
AddButton(
|
||||
content,
|
||||
label,
|
||||
std::move(label),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(value > 0)
|
||||
|
@ -80,13 +80,13 @@ void AutoDownloadBox::setupContent() {
|
|||
}, content->lifetime());
|
||||
values->emplace(type, value);
|
||||
};
|
||||
add(Type::Photo, lng_media_photo_title);
|
||||
add(Type::VoiceMessage, lng_media_audio_title);
|
||||
add(Type::VideoMessage, lng_media_video_messages_title);
|
||||
add(Type::Video, lng_media_video_title);
|
||||
add(Type::File, lng_media_file_title);
|
||||
add(Type::Music, lng_media_music_title);
|
||||
add(Type::GIF, lng_media_animation_title);
|
||||
add(Type::Photo, tr::lng_media_photo_title());
|
||||
add(Type::VoiceMessage, tr::lng_media_audio_title());
|
||||
add(Type::VideoMessage, tr::lng_media_video_messages_title());
|
||||
add(Type::Video, tr::lng_media_video_title());
|
||||
add(Type::File, tr::lng_media_file_title());
|
||||
add(Type::Music, tr::lng_media_music_title());
|
||||
add(Type::GIF, tr::lng_media_animation_title());
|
||||
|
||||
const auto limits = Ui::CreateChild<rpl::event_stream<int>>(content);
|
||||
using Pair = base::flat_map<Type, int>::value_type;
|
||||
|
@ -98,7 +98,7 @@ void AutoDownloadBox::setupContent() {
|
|||
const auto limit = Ui::CreateChild<int>(content, initialLimit);
|
||||
AddButtonWithLabel(
|
||||
content,
|
||||
lng_media_size_limit,
|
||||
tr::lng_media_size_limit(),
|
||||
limits->events_starting_with_copy(
|
||||
initialLimit
|
||||
) | rpl::map([](int value) {
|
||||
|
|
|
@ -350,9 +350,7 @@ void ChangePhoneBox::prepare() {
|
|||
|
||||
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
this,
|
||||
Lang::Viewer(
|
||||
lng_change_phone_about
|
||||
) | Ui::Text::ToRichLangValue(),
|
||||
tr::lng_change_phone_about(Ui::Text::RichLangValue),
|
||||
st::changePhoneDescription);
|
||||
label->moveToLeft((st::boxWideWidth - label->width()) / 2, st::changePhoneDescriptionTop);
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
|
|||
not_null<Ui::VerticalLayout*> container) {
|
||||
using namespace Settings;
|
||||
|
||||
AddSubsectionTitle(container, lng_polls_create_question);
|
||||
AddSubsectionTitle(container, tr::lng_polls_create_question());
|
||||
const auto question = container->add(
|
||||
object_ptr<Ui::InputField>(
|
||||
container,
|
||||
|
@ -645,7 +645,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
|||
const auto question = setupQuestion(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_polls_create_options);
|
||||
AddSubsectionTitle(container, tr::lng_polls_create_options());
|
||||
const auto options = lifetime().make_state<Options>(
|
||||
getDelegate()->outerContainer(),
|
||||
container);
|
||||
|
|
|
@ -311,13 +311,13 @@ void EditPrivacyBox::setupContent() {
|
|||
content,
|
||||
object_ptr<Button>(
|
||||
content,
|
||||
Lang::Viewer(text),
|
||||
rpl::duplicate(text),
|
||||
st::settingsButton)));
|
||||
CreateRightLabel(
|
||||
button->entity(),
|
||||
std::move(label),
|
||||
st::settingsButton,
|
||||
text);
|
||||
std::move(text));
|
||||
button->toggleOn(rpl::duplicate(
|
||||
optionValue
|
||||
) | rpl::map([=] {
|
||||
|
@ -344,7 +344,7 @@ void EditPrivacyBox::setupContent() {
|
|||
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_edit_privacy_exceptions);
|
||||
AddSubsectionTitle(content, tr::lng_edit_privacy_exceptions());
|
||||
const auto always = addExceptionLink(Exception::Always);
|
||||
const auto never = addExceptionLink(Exception::Never);
|
||||
addLabel(content, _controller->exceptionsDescription());
|
||||
|
|
|
@ -43,12 +43,12 @@ public:
|
|||
[[nodiscard]] virtual bool hasOption(Option option) {
|
||||
return true;
|
||||
}
|
||||
[[nodiscard]] virtual LangKey optionsTitleKey() = 0;
|
||||
[[nodiscard]] virtual rpl::producer<QString> optionsTitleKey() = 0;
|
||||
[[nodiscard]] virtual LangKey optionLabelKey(Option option);
|
||||
[[nodiscard]] virtual rpl::producer<QString> warning() {
|
||||
return rpl::never<QString>();
|
||||
}
|
||||
[[nodiscard]] virtual LangKey exceptionButtonTextKey(
|
||||
[[nodiscard]] virtual rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) = 0;
|
||||
[[nodiscard]] virtual QString exceptionBoxTitle(
|
||||
Exception exception) = 0;
|
||||
|
|
|
@ -99,7 +99,7 @@ void Controller::setupCover() {
|
|||
_user,
|
||||
_window->sessionController(),
|
||||
(_phone.isEmpty()
|
||||
? Lang::Viewer(lng_contact_mobile_hidden)
|
||||
? tr::lng_contact_mobile_hidden()
|
||||
: rpl::single(App::formatPhone(_phone)))),
|
||||
style::margins())->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
}
|
||||
|
|
|
@ -248,10 +248,9 @@ object_ptr<Ui::RpWidget> SetupUnlink(
|
|||
Fn<void(ChannelData*)> callback) {
|
||||
auto result = object_ptr<Info::Profile::Button>(
|
||||
parent,
|
||||
Lang::Viewer(channel->isBroadcast()
|
||||
? lng_manage_discussion_group_unlink
|
||||
: lng_manage_linked_channel_unlink
|
||||
) | Ui::Text::ToUpper(),
|
||||
(channel->isBroadcast()
|
||||
? tr::lng_manage_discussion_group_unlink
|
||||
: tr::lng_manage_linked_channel_unlink)() | Ui::Text::ToUpper(),
|
||||
st::infoUnlinkChatButton);
|
||||
result->addClickHandler([=] {
|
||||
callback(nullptr);
|
||||
|
|
|
@ -320,7 +320,7 @@ void EditAdminBox::prepare() {
|
|||
: channel->anyoneCanAddMembers();
|
||||
auto [checkboxes, getChecked, changes] = CreateEditAdminRights(
|
||||
this,
|
||||
lng_rights_edit_admin_header,
|
||||
tr::lng_rights_edit_admin_header(),
|
||||
prepareFlags,
|
||||
disabledMessages,
|
||||
isGroup,
|
||||
|
@ -401,9 +401,9 @@ not_null<Ui::SlideWrap<Ui::RpWidget>*> EditAdminBox::setupTransferButton(
|
|||
addDivider();
|
||||
container->add(EditPeerInfoBox::CreateButton(
|
||||
this,
|
||||
Lang::Viewer(isGroup
|
||||
? lng_rights_transfer_group
|
||||
: lng_rights_transfer_channel),
|
||||
(isGroup
|
||||
? tr::lng_rights_transfer_group
|
||||
: tr::lng_rights_transfer_channel)(),
|
||||
rpl::single(QString()),
|
||||
[=] { transferOwnership(); },
|
||||
st::peerPermissionsButton));
|
||||
|
@ -620,7 +620,7 @@ void EditRestrictedBox::prepare() {
|
|||
|
||||
auto [checkboxes, getRestrictions, changes] = CreateEditRestrictions(
|
||||
this,
|
||||
lng_rights_user_restrictions_header,
|
||||
tr::lng_rights_user_restrictions_header(),
|
||||
prepareFlags,
|
||||
disabledMessages);
|
||||
addControl(std::move(checkboxes), QMargins());
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace {
|
|||
void AddRadioButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
HistoryVisibility value,
|
||||
LangKey groupTextKey,
|
||||
LangKey groupAboutKey,
|
||||
const QString &groupText,
|
||||
rpl::producer<QString> groupAbout,
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
|
@ -36,13 +36,13 @@ void AddRadioButton(
|
|||
container,
|
||||
historyVisibility,
|
||||
value,
|
||||
lang(groupTextKey),
|
||||
groupText,
|
||||
st::defaultBoxCheckbox));
|
||||
container->add(object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(groupAboutKey),
|
||||
std::move(groupAbout),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins));
|
||||
}
|
||||
|
@ -80,16 +80,16 @@ void FillContent(
|
|||
AddRadioButton(
|
||||
container,
|
||||
HistoryVisibility::Visible,
|
||||
lng_manage_history_visibility_shown,
|
||||
lng_manage_history_visibility_shown_about,
|
||||
tr::lng_manage_history_visibility_shown(tr::now),
|
||||
tr::lng_manage_history_visibility_shown_about(),
|
||||
historyVisibility);
|
||||
AddRadioButton(
|
||||
container,
|
||||
HistoryVisibility::Hidden,
|
||||
lng_manage_history_visibility_hidden,
|
||||
tr::lng_manage_history_visibility_hidden(tr::now),
|
||||
(peer->isChat()
|
||||
? lng_manage_history_visibility_hidden_legacy
|
||||
: lng_manage_history_visibility_hidden_about),
|
||||
? tr::lng_manage_history_visibility_hidden_legacy
|
||||
: tr::lng_manage_history_visibility_hidden_about)(),
|
||||
historyVisibility);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -336,7 +336,7 @@ void EditPeerPermissionsBox::prepare() {
|
|||
|
||||
auto [checkboxes, getRestrictions, changes] = CreateEditRestrictions(
|
||||
this,
|
||||
lng_rights_default_restrictions_header,
|
||||
tr::lng_rights_default_restrictions_header(),
|
||||
restrictions,
|
||||
disabledMessages);
|
||||
|
||||
|
@ -367,7 +367,7 @@ void EditPeerPermissionsBox::addBannedButtons(
|
|||
const auto navigation = App::wnd()->sessionController();
|
||||
container->add(EditPeerInfoBox::CreateButton(
|
||||
container,
|
||||
Lang::Viewer(lng_manage_peer_exceptions),
|
||||
tr::lng_manage_peer_exceptions(),
|
||||
(channel
|
||||
? Info::Profile::RestrictedCountValue(channel)
|
||||
: rpl::single(0)) | ToPositiveNumberString(),
|
||||
|
@ -381,7 +381,7 @@ void EditPeerPermissionsBox::addBannedButtons(
|
|||
if (channel) {
|
||||
container->add(EditPeerInfoBox::CreateButton(
|
||||
container,
|
||||
Lang::Viewer(lng_manage_peer_removed_users),
|
||||
tr::lng_manage_peer_removed_users(),
|
||||
Info::Profile::KickedCountValue(channel)
|
||||
| ToPositiveNumberString(),
|
||||
[=] {
|
||||
|
@ -400,7 +400,7 @@ template <
|
|||
typename FlagLabelPairs>
|
||||
EditFlagsControl<Flags> CreateEditFlags(
|
||||
QWidget *parent,
|
||||
LangKey header,
|
||||
rpl::producer<QString> header,
|
||||
Flags checked,
|
||||
const DisabledMessagePairs &disabledMessagePairs,
|
||||
const FlagLabelPairs &flagLabelPairs) {
|
||||
|
@ -433,7 +433,7 @@ EditFlagsControl<Flags> CreateEditFlags(
|
|||
container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(header),
|
||||
std::move(header),
|
||||
st::rightsHeaderLabel),
|
||||
st::rightsHeaderMargin);
|
||||
|
||||
|
@ -490,7 +490,7 @@ EditFlagsControl<Flags> CreateEditFlags(
|
|||
|
||||
EditFlagsControl<MTPDchatBannedRights::Flags> CreateEditRestrictions(
|
||||
QWidget *parent,
|
||||
LangKey header,
|
||||
rpl::producer<QString> header,
|
||||
MTPDchatBannedRights::Flags restrictions,
|
||||
std::map<MTPDchatBannedRights::Flags, QString> disabledMessages) {
|
||||
auto result = CreateEditFlags(
|
||||
|
@ -511,7 +511,7 @@ EditFlagsControl<MTPDchatBannedRights::Flags> CreateEditRestrictions(
|
|||
|
||||
EditFlagsControl<MTPDchatAdminRights::Flags> CreateEditAdminRights(
|
||||
QWidget *parent,
|
||||
LangKey header,
|
||||
rpl::producer<QString> header,
|
||||
MTPDchatAdminRights::Flags rights,
|
||||
std::map<MTPDchatAdminRights::Flags, QString> disabledMessages,
|
||||
bool isGroup,
|
||||
|
|
|
@ -44,13 +44,13 @@ struct EditFlagsControl {
|
|||
|
||||
EditFlagsControl<MTPDchatBannedRights::Flags> CreateEditRestrictions(
|
||||
QWidget *parent,
|
||||
LangKey header,
|
||||
rpl::producer<QString> header,
|
||||
MTPDchatBannedRights::Flags restrictions,
|
||||
std::map<MTPDchatBannedRights::Flags, QString> disabledMessages);
|
||||
|
||||
EditFlagsControl<MTPDchatAdminRights::Flags> CreateEditAdminRights(
|
||||
QWidget *parent,
|
||||
LangKey header,
|
||||
rpl::producer<QString> header,
|
||||
MTPDchatAdminRights::Flags rights,
|
||||
std::map<MTPDchatAdminRights::Flags, QString> disabledMessages,
|
||||
bool isGroup,
|
||||
|
|
|
@ -78,9 +78,9 @@ public:
|
|||
return _controls.privacy->value();
|
||||
}
|
||||
|
||||
void showError(LangKey key) {
|
||||
void showError(rpl::producer<QString> text) {
|
||||
_controls.usernameInput->showError();
|
||||
showUsernameError(Lang::Viewer(key));
|
||||
showUsernameError(std::move(text));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -129,10 +129,10 @@ private:
|
|||
void addRoundButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
Privacy value,
|
||||
LangKey groupTextKey,
|
||||
LangKey channelTextKey,
|
||||
LangKey groupAboutKey,
|
||||
LangKey channelAboutKey);
|
||||
const QString &groupText,
|
||||
const QString &channelText,
|
||||
rpl::producer<QString> groupAbout,
|
||||
rpl::producer<QString> channelAbout);
|
||||
|
||||
bool inviteLinkShown();
|
||||
QString inviteLinkText();
|
||||
|
@ -197,21 +197,21 @@ void Controller::createContent() {
|
|||
void Controller::addRoundButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
Privacy value,
|
||||
LangKey groupTextKey,
|
||||
LangKey channelTextKey,
|
||||
LangKey groupAboutKey,
|
||||
LangKey channelAboutKey) {
|
||||
const QString &groupText,
|
||||
const QString &channelText,
|
||||
rpl::producer<QString> groupAbout,
|
||||
rpl::producer<QString> channelAbout) {
|
||||
container->add(object_ptr<Ui::Radioenum<Privacy>>(
|
||||
container,
|
||||
_controls.privacy,
|
||||
value,
|
||||
lang(_isGroup ? groupTextKey : channelTextKey),
|
||||
(_isGroup ? groupText : channelText),
|
||||
st::editPeerPrivacyBoxCheckbox));
|
||||
container->add(object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(_isGroup ? groupAboutKey : channelAboutKey),
|
||||
std::move(_isGroup ? groupAbout : channelAbout),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPrivacyLabelMargins));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
|
@ -249,17 +249,17 @@ void Controller::fillPrivaciesButtons(
|
|||
addRoundButton(
|
||||
container,
|
||||
Privacy::Public,
|
||||
lng_create_public_group_title,
|
||||
lng_create_public_channel_title,
|
||||
lng_create_public_group_about,
|
||||
lng_create_public_channel_about);
|
||||
tr::lng_create_public_group_title(tr::now),
|
||||
tr::lng_create_public_channel_title(tr::now),
|
||||
tr::lng_create_public_group_about(),
|
||||
tr::lng_create_public_channel_about());
|
||||
addRoundButton(
|
||||
container,
|
||||
Privacy::Private,
|
||||
lng_create_private_group_title,
|
||||
lng_create_private_channel_title,
|
||||
lng_create_private_group_about,
|
||||
lng_create_private_channel_about);
|
||||
tr::lng_create_private_group_title(tr::now),
|
||||
tr::lng_create_private_channel_title(tr::now),
|
||||
tr::lng_create_private_group_about(),
|
||||
tr::lng_create_private_channel_about());
|
||||
|
||||
_controls.privacy->setChangedCallback([=](Privacy value) {
|
||||
privacyChanged(value);
|
||||
|
@ -303,7 +303,7 @@ object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
|
|||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_create_group_link),
|
||||
tr::lng_create_group_link(),
|
||||
st::editPeerSectionLabel),
|
||||
st::editPeerUsernameTitleLabelMargins));
|
||||
|
||||
|
@ -334,7 +334,7 @@ object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
|
|||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_create_channel_link_about),
|
||||
tr::lng_create_channel_link_about(),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerUsernameAboutLabelMargins));
|
||||
|
||||
|
@ -415,8 +415,7 @@ void Controller::checkUsernameAvailability() {
|
|||
return;
|
||||
}
|
||||
if (!mtpIsTrue(result) && checking != username) {
|
||||
showUsernameError(
|
||||
Lang::Viewer(lng_create_channel_link_occupied));
|
||||
showUsernameError(tr::lng_create_channel_link_occupied());
|
||||
} else {
|
||||
showUsernameGood();
|
||||
}
|
||||
|
@ -438,12 +437,10 @@ void Controller::checkUsernameAvailability() {
|
|||
setFocusUsername();
|
||||
}
|
||||
} else if (type == qstr("USERNAME_INVALID")) {
|
||||
showUsernameError(
|
||||
Lang::Viewer(lng_create_channel_link_invalid));
|
||||
showUsernameError(tr::lng_create_channel_link_invalid());
|
||||
} else if (type == qstr("USERNAME_OCCUPIED")
|
||||
&& checking != username) {
|
||||
showUsernameError(
|
||||
Lang::Viewer(lng_create_channel_link_occupied));
|
||||
showUsernameError(tr::lng_create_channel_link_occupied());
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
@ -475,11 +472,9 @@ void Controller::usernameChanged() {
|
|||
&& (ch != '_');
|
||||
}) != username.end();
|
||||
if (bad) {
|
||||
showUsernameError(
|
||||
Lang::Viewer(lng_create_channel_link_bad_symbols));
|
||||
showUsernameError(tr::lng_create_channel_link_bad_symbols());
|
||||
} else if (username.size() < kMinUsernameLength) {
|
||||
showUsernameError(
|
||||
Lang::Viewer(lng_create_channel_link_too_short));
|
||||
showUsernameError(tr::lng_create_channel_link_too_short());
|
||||
} else {
|
||||
_controls.usernameResult = nullptr;
|
||||
_checkUsernameTimer.callOnce(kUsernameCheckTimeout);
|
||||
|
@ -494,7 +489,7 @@ void Controller::showUsernameError(rpl::producer<QString> &&error) {
|
|||
void Controller::showUsernameGood() {
|
||||
_isAllowSave = true;
|
||||
showUsernameResult(
|
||||
Lang::Viewer(lng_create_channel_link_available),
|
||||
tr::lng_create_channel_link_available(),
|
||||
&st::editPeerUsernameGood);
|
||||
}
|
||||
|
||||
|
@ -585,7 +580,7 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkEdit() {
|
|||
if (!_isInviteLink) {
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_profile_invite_link_section),
|
||||
tr::lng_profile_invite_link_section(),
|
||||
st::editPeerSectionLabel));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
|
@ -659,7 +654,7 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkCreate() {
|
|||
if (!_isInviteLink) {
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_profile_invite_link_section),
|
||||
tr::lng_profile_invite_link_section(),
|
||||
st::editPeerSectionLabel));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
|
@ -700,7 +695,7 @@ EditPeerTypeBox::EditPeerTypeBox(
|
|||
std::optional<FnMut<void(Privacy, QString)>> savedCallback,
|
||||
std::optional<Privacy> privacySaved,
|
||||
std::optional<QString> usernameSaved,
|
||||
std::optional<LangKey> usernameError)
|
||||
std::optional<rpl::producer<QString>> usernameError)
|
||||
: _peer(peer)
|
||||
, _savedCallback(std::move(savedCallback))
|
||||
, _privacySavedValue(privacySaved)
|
||||
|
@ -728,7 +723,7 @@ void EditPeerTypeBox::prepare() {
|
|||
[=] {
|
||||
controller->setFocusUsername();
|
||||
if (_usernameError.has_value()) {
|
||||
controller->showError(*_usernameError);
|
||||
controller->showError(std::move(*_usernameError));
|
||||
_usernameError = std::nullopt;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
std::optional<FnMut<void(Privacy, QString)>> savedCallback = {},
|
||||
std::optional<Privacy> privacySaved = {},
|
||||
std::optional<QString> usernameSaved = {},
|
||||
std::optional<LangKey> usernameError = {});
|
||||
std::optional<rpl::producer<QString>> usernameError = {});
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
std::optional<Privacy> _privacySavedValue;
|
||||
std::optional<QString> _usernameSavedValue;
|
||||
std::optional<LangKey> _usernameError;
|
||||
std::optional<rpl::producer<QString>> _usernameError;
|
||||
|
||||
rpl::event_stream<> _focusRequests;
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ void SessionsBox::Inner::setupContent() {
|
|||
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
AddSubsectionTitle(content, lng_sessions_header);
|
||||
AddSubsectionTitle(content, tr::lng_sessions_header());
|
||||
_current = content->add(object_ptr<List>(content));
|
||||
const auto terminateWrap = content->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
|
@ -369,12 +369,10 @@ void SessionsBox::Inner::setupContent() {
|
|||
_terminateAll = terminateInner->add(
|
||||
object_ptr<Info::Profile::Button>(
|
||||
terminateInner,
|
||||
Lang::Viewer(lng_sessions_terminate_all),
|
||||
tr::lng_sessions_terminate_all(),
|
||||
st::terminateSessionsButton));
|
||||
AddSkip(terminateInner);
|
||||
AddDividerText(
|
||||
terminateInner,
|
||||
Lang::Viewer(lng_sessions_terminate_all_about));
|
||||
AddDividerText(terminateInner, tr::lng_sessions_terminate_all_about());
|
||||
|
||||
const auto incompleteWrap = content->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
|
@ -382,12 +380,10 @@ void SessionsBox::Inner::setupContent() {
|
|||
object_ptr<Ui::VerticalLayout>(content)))->setDuration(0);
|
||||
const auto incompleteInner = incompleteWrap->entity();
|
||||
AddSkip(incompleteInner);
|
||||
AddSubsectionTitle(incompleteInner, lng_sessions_incomplete);
|
||||
AddSubsectionTitle(incompleteInner, tr::lng_sessions_incomplete());
|
||||
_incomplete = incompleteInner->add(object_ptr<List>(incompleteInner));
|
||||
AddSkip(incompleteInner);
|
||||
AddDividerText(
|
||||
incompleteInner,
|
||||
Lang::Viewer(lng_sessions_incomplete_about));
|
||||
AddDividerText(incompleteInner, tr::lng_sessions_incomplete_about());
|
||||
|
||||
const auto listWrap = content->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
|
@ -395,7 +391,7 @@ void SessionsBox::Inner::setupContent() {
|
|||
object_ptr<Ui::VerticalLayout>(content)))->setDuration(0);
|
||||
const auto listInner = listWrap->entity();
|
||||
AddSkip(listInner);
|
||||
AddSubsectionTitle(listInner, lng_sessions_other_header);
|
||||
AddSubsectionTitle(listInner, tr::lng_sessions_other_header());
|
||||
_list = listInner->add(object_ptr<List>(listInner));
|
||||
AddSkip(listInner);
|
||||
|
||||
|
@ -404,7 +400,7 @@ void SessionsBox::Inner::setupContent() {
|
|||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
Lang::Viewer(lng_sessions_other_desc),
|
||||
tr::lng_sessions_other_desc(),
|
||||
st::boxDividerLabel),
|
||||
st::settingsDividerLabelPadding))->setDuration(0);
|
||||
|
||||
|
|
|
@ -142,9 +142,9 @@ void PanelController::activatePanel() {
|
|||
void PanelController::createPanel() {
|
||||
const auto singlePeer = _settings->onlySinglePeer();
|
||||
_panel = base::make_unique_q<Ui::SeparatePanel>();
|
||||
_panel->setTitle(Lang::Viewer(singlePeer
|
||||
? lng_export_header_chats
|
||||
: lng_export_title));
|
||||
_panel->setTitle((singlePeer
|
||||
? tr::lng_export_header_chats
|
||||
: tr::lng_export_title)());
|
||||
_panel->setInnerSize(st::exportPanelSize);
|
||||
_panel->closeRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
|
@ -268,7 +268,7 @@ void PanelController::showProgress() {
|
|||
_settings->availableAt = 0;
|
||||
ClearSuggestStart();
|
||||
|
||||
_panel->setTitle(Lang::Viewer(lng_export_progress_title));
|
||||
_panel->setTitle(tr::lng_export_progress_title());
|
||||
|
||||
auto progress = base::make_unique_q<ProgressWidget>(
|
||||
_panel.get(),
|
||||
|
@ -365,7 +365,7 @@ void PanelController::updateState(State &&state) {
|
|||
} else if (const auto error = base::get_if<OutputErrorState>(&_state)) {
|
||||
showError(*error);
|
||||
} else if (_state.is<FinishedState>()) {
|
||||
_panel->setTitle(Lang::Viewer(lng_export_title));
|
||||
_panel->setTitle(tr::lng_export_title());
|
||||
_panel->setHideOnDeactivate(false);
|
||||
} else if (_state.is<CancelledState>()) {
|
||||
LOG(("Export Info: Stop Panel After Cancel."));
|
||||
|
|
|
@ -154,12 +154,9 @@ object_ptr<Ui::FlatButton> SetupDiscussButton(
|
|||
QString(),
|
||||
st::historyComposeButton);
|
||||
const auto button = result.data();
|
||||
auto text = Lang::Viewer(
|
||||
lng_channel_discuss
|
||||
) | Ui::Text::ToUpper();
|
||||
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
button,
|
||||
rpl::duplicate(text),
|
||||
tr::lng_channel_discuss() | Ui::Text::ToUpper(),
|
||||
st::historyComposeButtonLabel);
|
||||
const auto badge = Ui::CreateChild<Ui::UnreadBadge>(button);
|
||||
label->show();
|
||||
|
|
|
@ -551,78 +551,76 @@ rpl::producer<QString> TitleValue(
|
|||
const Section §ion,
|
||||
Key key,
|
||||
bool isStackBottom) {
|
||||
return Lang::Viewer([&] {
|
||||
const auto peer = key.peer();
|
||||
const auto peer = key.peer();
|
||||
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
/*if (const auto feed = key.feed()) {
|
||||
return lng_info_feed_title;
|
||||
} else */if (const auto user = peer->asUser()) {
|
||||
return (user->isBot() && !user->isSupport())
|
||||
? lng_info_bot_title
|
||||
: lng_info_user_title;
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
return channel->isMegagroup()
|
||||
? lng_info_group_title
|
||||
: lng_info_channel_title;
|
||||
} else if (peer->isChat()) {
|
||||
return lng_info_group_title;
|
||||
}
|
||||
Unexpected("Bad peer type in Info::TitleValue()");
|
||||
|
||||
case Section::Type::Media:
|
||||
if (peer->isSelf() && isStackBottom) {
|
||||
return lng_profile_shared_media;
|
||||
}
|
||||
switch (section.mediaType()) {
|
||||
case Section::MediaType::Photo:
|
||||
return lng_media_type_photos;
|
||||
case Section::MediaType::Video:
|
||||
return lng_media_type_videos;
|
||||
case Section::MediaType::MusicFile:
|
||||
return lng_media_type_songs;
|
||||
case Section::MediaType::File:
|
||||
return lng_media_type_files;
|
||||
case Section::MediaType::RoundVoiceFile:
|
||||
return lng_media_type_audios;
|
||||
case Section::MediaType::Link:
|
||||
return lng_media_type_links;
|
||||
case Section::MediaType::RoundFile:
|
||||
return lng_media_type_rounds;
|
||||
}
|
||||
Unexpected("Bad media type in Info::TitleValue()");
|
||||
|
||||
case Section::Type::CommonGroups:
|
||||
return lng_profile_common_groups_section;
|
||||
|
||||
case Section::Type::Members:
|
||||
return lng_profile_participants_section;
|
||||
|
||||
//case Section::Type::Channels: // #feed
|
||||
// return lng_info_feed_channels;
|
||||
|
||||
case Section::Type::Settings:
|
||||
switch (section.settingsType()) {
|
||||
case Section::SettingsType::Main:
|
||||
return lng_menu_settings;
|
||||
case Section::SettingsType::Information:
|
||||
return lng_settings_section_info;
|
||||
case Section::SettingsType::Notifications:
|
||||
return lng_settings_section_notify;
|
||||
case Section::SettingsType::PrivacySecurity:
|
||||
return lng_settings_section_privacy;
|
||||
case Section::SettingsType::Advanced:
|
||||
return lng_settings_advanced;
|
||||
case Section::SettingsType::Chat:
|
||||
return lng_settings_section_chat_settings;
|
||||
case Section::SettingsType::Calls:
|
||||
return lng_settings_section_call_settings;
|
||||
}
|
||||
Unexpected("Bad settings type in Info::TitleValue()");
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
/*if (const auto feed = key.feed()) {
|
||||
return tr::lng_info_feed_title();
|
||||
} else */if (const auto user = peer->asUser()) {
|
||||
return (user->isBot() && !user->isSupport())
|
||||
? tr::lng_info_bot_title()
|
||||
: tr::lng_info_user_title();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
return channel->isMegagroup()
|
||||
? tr::lng_info_group_title()
|
||||
: tr::lng_info_channel_title();
|
||||
} else if (peer->isChat()) {
|
||||
return tr::lng_info_group_title();
|
||||
}
|
||||
Unexpected("Bad section type in Info::TitleValue()");
|
||||
}());
|
||||
Unexpected("Bad peer type in Info::TitleValue()");
|
||||
|
||||
case Section::Type::Media:
|
||||
if (peer->isSelf() && isStackBottom) {
|
||||
return tr::lng_profile_shared_media();
|
||||
}
|
||||
switch (section.mediaType()) {
|
||||
case Section::MediaType::Photo:
|
||||
return tr::lng_media_type_photos();
|
||||
case Section::MediaType::Video:
|
||||
return tr::lng_media_type_videos();
|
||||
case Section::MediaType::MusicFile:
|
||||
return tr::lng_media_type_songs();
|
||||
case Section::MediaType::File:
|
||||
return tr::lng_media_type_files();
|
||||
case Section::MediaType::RoundVoiceFile:
|
||||
return tr::lng_media_type_audios();
|
||||
case Section::MediaType::Link:
|
||||
return tr::lng_media_type_links();
|
||||
case Section::MediaType::RoundFile:
|
||||
return tr::lng_media_type_rounds();
|
||||
}
|
||||
Unexpected("Bad media type in Info::TitleValue()");
|
||||
|
||||
case Section::Type::CommonGroups:
|
||||
return tr::lng_profile_common_groups_section();
|
||||
|
||||
case Section::Type::Members:
|
||||
return tr::lng_profile_participants_section();
|
||||
|
||||
//case Section::Type::Channels: // #feed
|
||||
// return tr::lng_info_feed_channels();
|
||||
|
||||
case Section::Type::Settings:
|
||||
switch (section.settingsType()) {
|
||||
case Section::SettingsType::Main:
|
||||
return tr::lng_menu_settings();
|
||||
case Section::SettingsType::Information:
|
||||
return tr::lng_settings_section_info();
|
||||
case Section::SettingsType::Notifications:
|
||||
return tr::lng_settings_section_notify();
|
||||
case Section::SettingsType::PrivacySecurity:
|
||||
return tr::lng_settings_section_privacy();
|
||||
case Section::SettingsType::Advanced:
|
||||
return tr::lng_settings_advanced();
|
||||
case Section::SettingsType::Chat:
|
||||
return tr::lng_settings_section_chat_settings();
|
||||
case Section::SettingsType::Calls:
|
||||
return tr::lng_settings_section_call_settings();
|
||||
}
|
||||
Unexpected("Bad settings type in Info::TitleValue()");
|
||||
}
|
||||
Unexpected("Bad section type in Info::TitleValue()");
|
||||
}
|
||||
|
||||
} // namespace Info
|
||||
|
|
|
@ -216,12 +216,12 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
auto result = object_ptr<Ui::VerticalLayout>(_wrap);
|
||||
auto tracker = Ui::MultiSlideTracker();
|
||||
auto addInfoLineGeneric = [&](
|
||||
rpl::producer<QString> label,
|
||||
rpl::producer<QString> &&label,
|
||||
rpl::producer<TextWithEntities> &&text,
|
||||
const style::FlatLabel &textSt = st::infoLabeled) {
|
||||
auto line = CreateTextWithLabel(
|
||||
result,
|
||||
std::move(label) | WithEmptyEntities(),
|
||||
std::move(label) | Ui::Text::ToWithEntities(),
|
||||
std::move(text),
|
||||
textSt,
|
||||
st::infoProfileLabeledPadding);
|
||||
|
@ -229,20 +229,20 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
return line.text;
|
||||
};
|
||||
auto addInfoLine = [&](
|
||||
LangKey label,
|
||||
rpl::producer<QString> &&label,
|
||||
rpl::producer<TextWithEntities> &&text,
|
||||
const style::FlatLabel &textSt = st::infoLabeled) {
|
||||
return addInfoLineGeneric(
|
||||
Lang::Viewer(label),
|
||||
std::move(label),
|
||||
std::move(text),
|
||||
textSt);
|
||||
};
|
||||
auto addInfoOneLine = [&](
|
||||
LangKey label,
|
||||
rpl::producer<QString> &&label,
|
||||
rpl::producer<TextWithEntities> &&text,
|
||||
const QString &contextCopyText) {
|
||||
auto result = addInfoLine(
|
||||
label,
|
||||
std::move(label),
|
||||
std::move(text),
|
||||
st::infoLabeledOneLine);
|
||||
result->setDoubleClickSelectsParagraph(true);
|
||||
|
@ -257,16 +257,16 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
}
|
||||
|
||||
addInfoOneLine(
|
||||
lng_info_mobile_label,
|
||||
tr::lng_info_mobile_label(),
|
||||
PhoneValue(user),
|
||||
lang(lng_profile_copy_phone));
|
||||
if (user->botInfo) {
|
||||
addInfoLine(lng_info_about_label, AboutValue(user));
|
||||
addInfoLine(tr::lng_info_about_label(), AboutValue(user));
|
||||
} else {
|
||||
addInfoLine(lng_info_bio_label, BioValue(user));
|
||||
addInfoLine(tr::lng_info_bio_label(), BioValue(user));
|
||||
}
|
||||
addInfoOneLine(
|
||||
lng_info_username_label,
|
||||
tr::lng_info_username_label(),
|
||||
UsernameValue(user),
|
||||
lang(lng_context_copy_mention));
|
||||
} else {
|
||||
|
@ -288,7 +288,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
return result;
|
||||
});
|
||||
auto link = addInfoOneLine(
|
||||
lng_info_link_label,
|
||||
tr::lng_info_link_label(),
|
||||
std::move(linkText),
|
||||
QString());
|
||||
link->setClickHandlerFilter([peer = _peer](auto&&...) {
|
||||
|
@ -300,7 +300,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
}
|
||||
return false;
|
||||
});
|
||||
addInfoLine(lng_info_about_label, AboutValue(_peer));
|
||||
addInfoLine(tr::lng_info_about_label(), AboutValue(_peer));
|
||||
}
|
||||
if (!_peer->isSelf()) {
|
||||
// No notifications toggle for Self => no separator.
|
||||
|
@ -325,7 +325,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupMuteToggle() {
|
|||
const auto peer = _peer;
|
||||
auto result = object_ptr<Button>(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_enable_notifications),
|
||||
tr::lng_profile_enable_notifications(),
|
||||
st::infoNotificationsButton);
|
||||
result->toggleOn(
|
||||
NotificationsEnabledValue(peer)
|
||||
|
@ -384,7 +384,7 @@ Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
|
|||
};
|
||||
AddMainButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_send_message),
|
||||
tr::lng_profile_send_message(),
|
||||
std::move(sendMessageVisible),
|
||||
std::move(sendMessage),
|
||||
tracker);
|
||||
|
@ -410,7 +410,7 @@ Ui::MultiSlideTracker DetailsFiller::fillUserButtons(
|
|||
const auto window = &_controller->parentController()->window()->controller();
|
||||
AddMainButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_info_add_as_contact),
|
||||
tr::lng_info_add_as_contact(),
|
||||
CanAddContactValue(user),
|
||||
[=] { window->show(Box(EditContactBox, window, user)); },
|
||||
tracker);
|
||||
|
@ -439,7 +439,7 @@ Ui::MultiSlideTracker DetailsFiller::fillChannelButtons(
|
|||
};
|
||||
AddMainButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_view_channel),
|
||||
tr::lng_profile_view_channel(),
|
||||
std::move(viewChannelVisible),
|
||||
std::move(viewChannel),
|
||||
tracker);
|
||||
|
@ -472,7 +472,7 @@ void ActionsFiller::addInviteToGroupAction(
|
|||
not_null<UserData*> user) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_invite_to_group),
|
||||
tr::lng_profile_invite_to_group(),
|
||||
CanInviteBotToGroupValue(user),
|
||||
[user] { AddBotToGroupBoxController::Start(user); });
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ void ActionsFiller::addInviteToGroupAction(
|
|||
void ActionsFiller::addShareContactAction(not_null<UserData*> user) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_info_share_contact),
|
||||
tr::lng_info_share_contact(),
|
||||
CanShareContactValue(user),
|
||||
[user] { Window::PeerMenuShareContactBox(user); });
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ void ActionsFiller::addEditContactAction(not_null<UserData*> user) {
|
|||
const auto window = &_controller->parentController()->window()->controller();
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_info_edit_contact),
|
||||
tr::lng_info_edit_contact(),
|
||||
IsContactValue(user),
|
||||
[=] { window->show(Box(EditContactBox, window, user)); });
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ void ActionsFiller::addDeleteContactAction(
|
|||
not_null<UserData*> user) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_info_delete_contact),
|
||||
tr::lng_info_delete_contact(),
|
||||
IsContactValue(user),
|
||||
[user] { Window::PeerMenuDeleteContact(user); });
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ void ActionsFiller::addDeleteContactAction(
|
|||
void ActionsFiller::addClearHistoryAction(not_null<UserData*> user) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_clear_history),
|
||||
tr::lng_profile_clear_history(),
|
||||
rpl::single(true),
|
||||
Window::ClearHistoryHandler(user));
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ void ActionsFiller::addDeleteConversationAction(
|
|||
not_null<UserData*> user) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_delete_conversation),
|
||||
tr::lng_profile_delete_conversation(),
|
||||
rpl::single(true),
|
||||
Window::DeleteAndLeaveHandler(user));
|
||||
}
|
||||
|
@ -550,23 +550,25 @@ void ActionsFiller::addBotCommandActions(not_null<UserData*> user) {
|
|||
App::sendBotCommand(user, user, '/' + original);
|
||||
}
|
||||
};
|
||||
auto addBotCommand = [=](LangKey key, const QString &command) {
|
||||
auto addBotCommand = [=](
|
||||
rpl::producer<QString> text,
|
||||
const QString &command) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(key),
|
||||
std::move(text),
|
||||
hasBotCommandValue(command),
|
||||
[=] { sendBotCommand(command); });
|
||||
};
|
||||
addBotCommand(lng_profile_bot_help, qsl("help"));
|
||||
addBotCommand(lng_profile_bot_settings, qsl("settings"));
|
||||
addBotCommand(lng_profile_bot_privacy, qsl("privacy"));
|
||||
addBotCommand(tr::lng_profile_bot_help(), qsl("help"));
|
||||
addBotCommand(tr::lng_profile_bot_settings(), qsl("settings"));
|
||||
addBotCommand(tr::lng_profile_bot_privacy(), qsl("privacy"));
|
||||
}
|
||||
|
||||
void ActionsFiller::addReportAction() {
|
||||
const auto peer = _peer;
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_report),
|
||||
tr::lng_profile_report(),
|
||||
rpl::single(true),
|
||||
[=] { Ui::show(Box<ReportBox>(peer)); },
|
||||
st::infoBlockButton);
|
||||
|
@ -581,14 +583,14 @@ void ActionsFiller::addBlockAction(not_null<UserData*> user) {
|
|||
) | rpl::map([user] {
|
||||
switch (user->blockStatus()) {
|
||||
case UserData::BlockStatus::Blocked:
|
||||
return Lang::Viewer((user->isBot() && !user->isSupport())
|
||||
? lng_profile_restart_bot
|
||||
: lng_profile_unblock_user);
|
||||
return ((user->isBot() && !user->isSupport())
|
||||
? tr::lng_profile_restart_bot
|
||||
: tr::lng_profile_unblock_user)();
|
||||
case UserData::BlockStatus::NotBlocked:
|
||||
default:
|
||||
return Lang::Viewer((user->isBot() && !user->isSupport())
|
||||
? lng_profile_block_bot
|
||||
: lng_profile_block_user);
|
||||
return ((user->isBot() && !user->isSupport())
|
||||
? tr::lng_profile_block_bot
|
||||
: tr::lng_profile_block_user)();
|
||||
}
|
||||
}) | rpl::flatten_latest(
|
||||
) | rpl::start_spawning(_wrap->lifetime());
|
||||
|
@ -622,7 +624,7 @@ void ActionsFiller::addLeaveChannelAction(
|
|||
not_null<ChannelData*> channel) {
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_leave_channel),
|
||||
tr::lng_profile_leave_channel(),
|
||||
AmInChannelValue(channel),
|
||||
Window::DeleteAndLeaveHandler(channel));
|
||||
}
|
||||
|
@ -635,7 +637,7 @@ void ActionsFiller::addJoinChannelAction(
|
|||
| rpl::start_spawning(_wrap->lifetime());
|
||||
AddActionButton(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_profile_join_channel),
|
||||
tr::lng_profile_join_channel(),
|
||||
rpl::duplicate(joinVisible),
|
||||
[channel] { Auth().api().joinChannel(channel); });
|
||||
_wrap->add(object_ptr<Ui::SlideWrap<Ui::FixedHeightWidget>>(
|
||||
|
@ -736,7 +738,7 @@ object_ptr<Ui::RpWidget> ActionsFiller::fill() {
|
|||
// const auto feedId = _feed->id();
|
||||
// auto result = object_ptr<Button>(
|
||||
// _wrap,
|
||||
// Lang::Viewer(lng_info_feed_is_default),
|
||||
// tr::lng_info_feed_is_default(),
|
||||
// st::infoNotificationsButton);
|
||||
// result->toggleOn(
|
||||
// Auth().data().defaultFeedIdValue(
|
||||
|
|
|
@ -447,7 +447,7 @@ void SharedMediaCover::createLabel() {
|
|||
using namespace rpl::mappers;
|
||||
auto label = object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
Lang::Viewer(lng_profile_shared_media) | Ui::Text::ToUpper(),
|
||||
tr::lng_profile_shared_media() | Ui::Text::ToUpper(),
|
||||
st::infoBlockHeaderLabel);
|
||||
label->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/application.h"
|
||||
#include "auth_session.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_shared_media.h"
|
||||
#include "data/data_folder.h"
|
||||
|
@ -30,7 +31,7 @@ rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer) {
|
|||
Notify::PeerUpdate::Flag::NameChanged
|
||||
) | rpl::map([=] {
|
||||
return App::peerName(peer);
|
||||
}) | WithEmptyEntities();
|
||||
}) | Ui::Text::ToWithEntities();
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user) {
|
||||
|
@ -39,7 +40,7 @@ rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user) {
|
|||
Notify::PeerUpdate::Flag::UserPhoneChanged
|
||||
) | rpl::map([user] {
|
||||
return App::formatPhone(user->phone());
|
||||
}) | WithEmptyEntities();
|
||||
}) | Ui::Text::ToWithEntities();
|
||||
}
|
||||
|
||||
auto PlainBioValue(not_null<UserData*> user) {
|
||||
|
@ -52,7 +53,7 @@ auto PlainBioValue(not_null<UserData*> user) {
|
|||
rpl::producer<TextWithEntities> BioValue(not_null<UserData*> user) {
|
||||
return PlainBioValue(user)
|
||||
| ToSingleLine()
|
||||
| WithEmptyEntities();
|
||||
| Ui::Text::ToWithEntities();
|
||||
}
|
||||
|
||||
auto PlainUsernameValue(not_null<PeerData*> peer) {
|
||||
|
@ -71,7 +72,7 @@ rpl::producer<TextWithEntities> UsernameValue(not_null<UserData*> user) {
|
|||
return username.isEmpty()
|
||||
? QString()
|
||||
: ('@' + username);
|
||||
}) | WithEmptyEntities();
|
||||
}) | Ui::Text::ToWithEntities();
|
||||
}
|
||||
|
||||
rpl::producer<QString> PlainAboutValue(not_null<PeerData*> peer) {
|
||||
|
@ -95,7 +96,7 @@ rpl::producer<TextWithEntities> AboutValue(not_null<PeerData*> peer) {
|
|||
}
|
||||
return PlainAboutValue(
|
||||
peer
|
||||
) | WithEmptyEntities(
|
||||
) | Ui::Text::ToWithEntities(
|
||||
) | rpl::map([=](TextWithEntities &&text) {
|
||||
TextUtilities::ParseEntities(text, flags);
|
||||
return std::move(text);
|
||||
|
|
|
@ -30,12 +30,6 @@ inline auto ToSingleLine() {
|
|||
});
|
||||
}
|
||||
|
||||
inline auto WithEmptyEntities() {
|
||||
return rpl::map([](QString &&text) {
|
||||
return TextWithEntities{ std::move(text), {} };
|
||||
});
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer);
|
||||
rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user);
|
||||
rpl::producer<TextWithEntities> BioValue(not_null<UserData*> user);
|
||||
|
|
|
@ -780,18 +780,21 @@ Instance &Current() {
|
|||
return Core::App().langpack();
|
||||
}
|
||||
|
||||
namespace details {
|
||||
|
||||
QString Current(LangKey key) {
|
||||
return Current().getValue(key);
|
||||
return Lang::Current().getValue(key);
|
||||
}
|
||||
|
||||
rpl::producer<QString> Viewer(LangKey key) {
|
||||
return rpl::single(
|
||||
Current().getValue(key)
|
||||
Lang::Current().getValue(key)
|
||||
) | then(base::ObservableViewer(
|
||||
Current().updated()
|
||||
Lang::Current().updated()
|
||||
) | rpl::map([=] {
|
||||
return Current().getValue(key);
|
||||
return Lang::Current().getValue(key);
|
||||
}));
|
||||
}
|
||||
|
||||
} // namespace details
|
||||
} // namespace Lang
|
||||
|
|
|
@ -56,9 +56,6 @@ Language DefaultLanguage();
|
|||
class Instance;
|
||||
Instance &Current();
|
||||
|
||||
QString Current(LangKey key);
|
||||
rpl::producer<QString> Viewer(LangKey key);
|
||||
|
||||
enum class Pack {
|
||||
None,
|
||||
Current,
|
||||
|
@ -162,4 +159,10 @@ private:
|
|||
|
||||
};
|
||||
|
||||
namespace details {
|
||||
|
||||
QString Current(LangKey key);
|
||||
rpl::producer<QString> Viewer(LangKey key);
|
||||
|
||||
} // namespace details
|
||||
} // namespace Lang
|
||||
|
|
|
@ -13,14 +13,13 @@ enum LangKey : int;
|
|||
enum lngtag_count : int;
|
||||
|
||||
namespace Lang {
|
||||
|
||||
QString Current(LangKey key);
|
||||
rpl::producer<QString> Viewer(LangKey key);
|
||||
|
||||
namespace details {
|
||||
|
||||
inline constexpr auto kPluralCount = 6;
|
||||
|
||||
QString Current(LangKey key);
|
||||
rpl::producer<QString> Viewer(LangKey key);
|
||||
|
||||
template <typename Tag> struct TagValue;
|
||||
|
||||
template <int Index, typename Type, typename Tuple>
|
||||
|
@ -90,7 +89,9 @@ struct Producer {
|
|||
typename T = decltype(std::declval<P>()(QString())),
|
||||
typename ...Values>
|
||||
static T Current(LangKey base, P p, const Values &...values) {
|
||||
return ReplaceUnwrap<Tags...>::template Call(p(Lang::Current(base)), values...);
|
||||
return ReplaceUnwrap<Tags...>::template Call(
|
||||
p(Lang::details::Current(base)),
|
||||
values...);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -107,7 +108,7 @@ struct Producer<> {
|
|||
typename P,
|
||||
typename T = decltype(std::declval<P>()(QString()))>
|
||||
static T Current(LangKey base, P p) {
|
||||
return p(Lang::Current(base));
|
||||
return p(Lang::details::Current(base));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -169,7 +170,7 @@ struct Producer<lngtag_count, Tags...> {
|
|||
auto plural = Plural(base, count, type);
|
||||
return ReplaceUnwrap<Tags...>::template Call(
|
||||
ReplaceTag<T>::Call(
|
||||
p(Lang::Current(LangKey(base + plural.keyShift))),
|
||||
p(Lang::details::Current(LangKey(base + plural.keyShift))),
|
||||
type,
|
||||
StartReplacements<T>::Call(
|
||||
std::move(plural.replacement))),
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Passport {
|
|||
Panel::Panel(not_null<PanelController*> controller)
|
||||
: _controller(controller)
|
||||
, _widget(std::make_unique<Ui::SeparatePanel>()) {
|
||||
_widget->setTitle(Lang::Viewer(lng_passport_title));
|
||||
_widget->setTitle(tr::lng_passport_title());
|
||||
_widget->setInnerSize(st::passportPanelSize);
|
||||
|
||||
_widget->closeRequests(
|
||||
|
|
|
@ -829,21 +829,21 @@ auto PanelController::deleteValueLabel() const
|
|||
Expects(_editScope != nullptr);
|
||||
|
||||
if (hasValueDocument()) {
|
||||
return Lang::Viewer(lng_passport_delete_document);
|
||||
return tr::lng_passport_delete_document();
|
||||
} else if (!hasValueFields()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
switch (_editScope->type) {
|
||||
case Scope::Type::PersonalDetails:
|
||||
case Scope::Type::Identity:
|
||||
return Lang::Viewer(lng_passport_delete_details);
|
||||
return tr::lng_passport_delete_details();
|
||||
case Scope::Type::AddressDetails:
|
||||
case Scope::Type::Address:
|
||||
return Lang::Viewer(lng_passport_delete_address);
|
||||
return tr::lng_passport_delete_address();
|
||||
case Scope::Type::Email:
|
||||
return Lang::Viewer(lng_passport_delete_email);
|
||||
return tr::lng_passport_delete_email();
|
||||
case Scope::Type::Phone:
|
||||
return Lang::Viewer(lng_passport_delete_phone);
|
||||
return tr::lng_passport_delete_phone();
|
||||
}
|
||||
Unexpected("Type in PanelController::deleteValueLabel.");
|
||||
}
|
||||
|
|
|
@ -234,15 +234,11 @@ void PanelEditContact::setupControls(
|
|||
_content->add(
|
||||
object_ptr<Info::Profile::Button>(
|
||||
_content,
|
||||
Lang::Viewer(
|
||||
lng_passport_use_existing__tagged
|
||||
) | rpl::map([=] {
|
||||
return lng_passport_use_existing(
|
||||
lt_existing,
|
||||
(_scheme.format
|
||||
? _scheme.format(existing)
|
||||
: existing));
|
||||
}),
|
||||
tr::lng_passport_use_existing(
|
||||
lt_existing,
|
||||
rpl::single(_scheme.format
|
||||
? _scheme.format(existing)
|
||||
: existing)),
|
||||
st::passportUploadButton),
|
||||
st::passportUploadButtonPadding
|
||||
)->addClickHandler([=] {
|
||||
|
|
|
@ -210,9 +210,9 @@ Ui::SlideWrap<ScanButton> *EditScans::List::nonDeletedErrorRow() const {
|
|||
}
|
||||
|
||||
rpl::producer<QString> EditScans::List::uploadButtonText() const {
|
||||
return Lang::Viewer(files.empty()
|
||||
? lng_passport_upload_scans
|
||||
: lng_passport_upload_more) | Ui::Text::ToUpper();
|
||||
return (files.empty()
|
||||
? tr::lng_passport_upload_scans
|
||||
: tr::lng_passport_upload_more)() | Ui::Text::ToUpper();
|
||||
}
|
||||
|
||||
void EditScans::List::hideError() {
|
||||
|
@ -611,37 +611,37 @@ void EditScans::setupSpecialScans(
|
|||
}
|
||||
Unexpected("Type in special row title.");
|
||||
};
|
||||
const auto uploadKey = [=](FileType type, bool hasScan) {
|
||||
const auto uploadText = [=](FileType type, bool hasScan) {
|
||||
switch (type) {
|
||||
case FileType::FrontSide:
|
||||
return requiresBothSides
|
||||
? (hasScan
|
||||
? lng_passport_reupload_front_side
|
||||
: lng_passport_upload_front_side)
|
||||
? tr::lng_passport_reupload_front_side
|
||||
: tr::lng_passport_upload_front_side)
|
||||
: (hasScan
|
||||
? lng_passport_reupload_main_page
|
||||
: lng_passport_upload_main_page);
|
||||
? tr::lng_passport_reupload_main_page
|
||||
: tr::lng_passport_upload_main_page);
|
||||
case FileType::ReverseSide:
|
||||
return hasScan
|
||||
? lng_passport_reupload_reverse_side
|
||||
: lng_passport_upload_reverse_side;
|
||||
? tr::lng_passport_reupload_reverse_side
|
||||
: tr::lng_passport_upload_reverse_side;
|
||||
case FileType::Selfie:
|
||||
return hasScan
|
||||
? lng_passport_reupload_selfie
|
||||
: lng_passport_upload_selfie;
|
||||
? tr::lng_passport_reupload_selfie
|
||||
: tr::lng_passport_upload_selfie;
|
||||
}
|
||||
Unexpected("Type in special row upload key.");
|
||||
};
|
||||
const auto description = [&](FileType type) {
|
||||
switch (type) {
|
||||
case FileType::FrontSide:
|
||||
return lang(requiresBothSides
|
||||
? lng_passport_front_side_description
|
||||
: lng_passport_main_page_description);
|
||||
return requiresBothSides
|
||||
? tr::lng_passport_front_side_description
|
||||
: tr::lng_passport_main_page_description;
|
||||
case FileType::ReverseSide:
|
||||
return lang(lng_passport_reverse_side_description);
|
||||
return tr::lng_passport_reverse_side_description;
|
||||
case FileType::Selfie:
|
||||
return lang(lng_passport_selfie_description);
|
||||
return tr::lng_passport_selfie_description;
|
||||
}
|
||||
Unexpected("Type in special row upload key.");
|
||||
};
|
||||
|
@ -684,7 +684,7 @@ void EditScans::setupSpecialScans(
|
|||
}
|
||||
auto label = scan.rowCreated.value(
|
||||
) | rpl::map([=, type = type](bool created) {
|
||||
return Lang::Viewer(uploadKey(type, created));
|
||||
return uploadText(type, created)();
|
||||
}) | rpl::flatten_latest(
|
||||
) | Ui::Text::ToUpper();
|
||||
scan.upload = inner->add(
|
||||
|
@ -701,7 +701,7 @@ void EditScans::setupSpecialScans(
|
|||
inner,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
inner,
|
||||
description(type),
|
||||
description(type)(tr::now),
|
||||
st::boxDividerLabel),
|
||||
st::passportFormLabelPadding));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ void SetupConnectionType(not_null<Ui::VerticalLayout*> container) {
|
|||
};
|
||||
const auto button = AddButtonWithLabel(
|
||||
container,
|
||||
lng_settings_connection_type,
|
||||
tr::lng_settings_connection_type(),
|
||||
rpl::single(
|
||||
rpl::empty_value()
|
||||
) | rpl::then(base::ObservableViewer(
|
||||
|
@ -88,7 +88,7 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
|
|||
currentVersionText());
|
||||
const auto toggle = AddButton(
|
||||
container,
|
||||
lng_settings_update_automatically,
|
||||
tr::lng_settings_update_automatically(),
|
||||
st::settingsUpdateToggle);
|
||||
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
toggle.get(),
|
||||
|
@ -102,16 +102,16 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
|
|||
const auto inner = options->entity();
|
||||
const auto install = cAlphaVersion() ? nullptr : AddButton(
|
||||
inner,
|
||||
lng_settings_install_beta,
|
||||
tr::lng_settings_install_beta(),
|
||||
st::settingsButton).get();
|
||||
|
||||
const auto check = AddButton(
|
||||
inner,
|
||||
lng_settings_check_now,
|
||||
tr::lng_settings_check_now(),
|
||||
st::settingsButton);
|
||||
const auto update = Ui::CreateChild<Button>(
|
||||
check.get(),
|
||||
Lang::Viewer(lng_update_telegram) | Ui::Text::ToUpper(),
|
||||
tr::lng_update_telegram() | Ui::Text::ToUpper(),
|
||||
st::settingsUpdate);
|
||||
update->hide();
|
||||
check->widthValue() | rpl::start_with_next([=](int width) {
|
||||
|
@ -403,7 +403,7 @@ void SetupTray(not_null<Ui::VerticalLayout*> container) {
|
|||
void SetupAnimations(not_null<Ui::VerticalLayout*> container) {
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_enable_animations,
|
||||
tr::lng_settings_enable_animations(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(!anim::Disabled())
|
||||
|
@ -421,7 +421,7 @@ void SetupPerformance(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_autoplay_gifs,
|
||||
tr::lng_settings_autoplay_gifs(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(cAutoPlayGif())
|
||||
|
@ -442,10 +442,10 @@ void SetupSystemIntegration(
|
|||
Fn<void(Type)> showOther) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_system_integration);
|
||||
AddSubsectionTitle(container, tr::lng_settings_system_integration());
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_section_call_settings,
|
||||
tr::lng_settings_section_call_settings(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
showOther(Type::Calls);
|
||||
|
@ -478,7 +478,7 @@ void Advanced::setupContent() {
|
|||
if (HasUpdate()) {
|
||||
addDivider();
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_version_info);
|
||||
AddSubsectionTitle(content, tr::lng_settings_version_info());
|
||||
SetupUpdate(content);
|
||||
AddSkip(content);
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ void Advanced::setupContent() {
|
|||
if (HasConnectionType()) {
|
||||
addDivider();
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_network_proxy);
|
||||
AddSubsectionTitle(content, tr::lng_settings_network_proxy());
|
||||
SetupConnectionType(content);
|
||||
AddSkip(content);
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ void Advanced::setupContent() {
|
|||
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_performance);
|
||||
AddSubsectionTitle(content, tr::lng_settings_performance());
|
||||
SetupPerformance(content);
|
||||
AddSkip(content);
|
||||
|
||||
|
|
|
@ -96,10 +96,10 @@ void Calls::setupContent() {
|
|||
}();
|
||||
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_call_section_output);
|
||||
AddSubsectionTitle(content, tr::lng_settings_call_section_output());
|
||||
AddButtonWithLabel(
|
||||
content,
|
||||
lng_settings_call_output_device,
|
||||
tr::lng_settings_call_output_device(),
|
||||
rpl::single(
|
||||
currentOutputName
|
||||
) | rpl::then(
|
||||
|
@ -171,10 +171,10 @@ void Calls::setupContent() {
|
|||
AddSkip(content);
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_call_section_input);
|
||||
AddSubsectionTitle(content, tr::lng_settings_call_section_input());
|
||||
AddButtonWithLabel(
|
||||
content,
|
||||
lng_settings_call_input_device,
|
||||
tr::lng_settings_call_input_device(),
|
||||
rpl::single(
|
||||
currentInputName
|
||||
) | rpl::then(
|
||||
|
@ -276,12 +276,12 @@ void Calls::setupContent() {
|
|||
AddSkip(content);
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_call_section_other);
|
||||
AddSubsectionTitle(content, tr::lng_settings_call_section_other());
|
||||
|
||||
#if defined Q_OS_MAC && !defined OS_MAC_STORE
|
||||
AddButton(
|
||||
content,
|
||||
lng_settings_call_audio_ducking,
|
||||
tr::lng_settings_call_audio_ducking(),
|
||||
st::settingsButton
|
||||
)->toggleOn(
|
||||
rpl::single(Global::CallAudioDuckingEnabled())
|
||||
|
@ -298,7 +298,7 @@ void Calls::setupContent() {
|
|||
|
||||
AddButton(
|
||||
content,
|
||||
lng_settings_call_open_system_prefs,
|
||||
tr::lng_settings_call_open_system_prefs(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
const auto opened = Platform::OpenSystemSettings(
|
||||
|
|
|
@ -419,7 +419,7 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_stickers_emoji);
|
||||
AddSubsectionTitle(container, tr::lng_settings_stickers_emoji());
|
||||
|
||||
auto wrap = object_ptr<Ui::VerticalLayout>(container);
|
||||
const auto inner = wrap.data();
|
||||
|
@ -471,7 +471,7 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddButton(
|
||||
container,
|
||||
lng_stickers_you_have,
|
||||
tr::lng_stickers_you_have(),
|
||||
st::settingsChatButton,
|
||||
&st::settingsIconStickers,
|
||||
st::settingsChatIconLeft
|
||||
|
@ -481,7 +481,7 @@ void SetupStickersEmoji(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddButton(
|
||||
container,
|
||||
lng_emoji_manage_sets,
|
||||
tr::lng_emoji_manage_sets(),
|
||||
st::settingsChatButton,
|
||||
&st::settingsIconEmoji,
|
||||
st::settingsChatIconLeft
|
||||
|
@ -496,7 +496,7 @@ void SetupMessages(not_null<Ui::VerticalLayout*> container) {
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_messages);
|
||||
AddSubsectionTitle(container, tr::lng_settings_messages());
|
||||
|
||||
AddSkip(container, st::settingsSendTypeSkip);
|
||||
|
||||
|
@ -546,7 +546,7 @@ void SetupMessages(not_null<Ui::VerticalLayout*> container) {
|
|||
void SetupExport(not_null<Ui::VerticalLayout*> container) {
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_export_data,
|
||||
tr::lng_settings_export_data(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
Ui::hideSettingsAndLayer();
|
||||
|
@ -560,7 +560,7 @@ void SetupExport(not_null<Ui::VerticalLayout*> container) {
|
|||
void SetupLocalStorage(not_null<Ui::VerticalLayout*> container) {
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_manage_local_storage,
|
||||
tr::lng_settings_manage_local_storage(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
LocalStorageBox::Show(
|
||||
|
@ -575,11 +575,11 @@ void SetupDataStorage(not_null<Ui::VerticalLayout*> container) {
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_data_storage);
|
||||
AddSubsectionTitle(container, tr::lng_settings_data_storage());
|
||||
|
||||
const auto ask = AddButton(
|
||||
container,
|
||||
lng_download_path_ask,
|
||||
tr::lng_download_path_ask(),
|
||||
st::settingsButton
|
||||
)->toggleOn(rpl::single(Global::AskDownloadPath()));
|
||||
|
||||
|
@ -590,7 +590,7 @@ void SetupDataStorage(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
object_ptr<Button>(
|
||||
container,
|
||||
Lang::Viewer(lng_download_path),
|
||||
tr::lng_download_path(),
|
||||
st::settingsButton)));
|
||||
auto pathtext = rpl::single(
|
||||
rpl::empty_value()
|
||||
|
@ -603,7 +603,7 @@ void SetupDataStorage(not_null<Ui::VerticalLayout*> container) {
|
|||
path->entity(),
|
||||
std::move(pathtext),
|
||||
st::settingsButton,
|
||||
lng_download_path);
|
||||
tr::lng_download_path());
|
||||
path->entity()->addClickHandler([] {
|
||||
Ui::show(Box<DownloadPathBox>());
|
||||
});
|
||||
|
@ -633,21 +633,21 @@ void SetupAutoDownload(not_null<Ui::VerticalLayout*> container) {
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_media_auto_settings);
|
||||
AddSubsectionTitle(container, tr::lng_media_auto_settings());
|
||||
|
||||
using Source = Data::AutoDownload::Source;
|
||||
const auto add = [&](LangKey label, Source source) {
|
||||
const auto add = [&](rpl::producer<QString> label, Source source) {
|
||||
AddButton(
|
||||
container,
|
||||
label,
|
||||
std::move(label),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<AutoDownloadBox>(source));
|
||||
});
|
||||
};
|
||||
add(lng_media_auto_in_private, Source::User);
|
||||
add(lng_media_auto_in_groups, Source::Group);
|
||||
add(lng_media_auto_in_channels, Source::Channel);
|
||||
add(tr::lng_media_auto_in_private(), Source::User);
|
||||
add(tr::lng_media_auto_in_groups(), Source::Group);
|
||||
add(tr::lng_media_auto_in_channels(), Source::Channel);
|
||||
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ void SetupChatBackground(not_null<Ui::VerticalLayout*> container) {
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_section_background);
|
||||
AddSubsectionTitle(container, tr::lng_settings_section_background());
|
||||
|
||||
container->add(
|
||||
object_ptr<BackgroundRow>(container),
|
||||
|
@ -905,7 +905,7 @@ void SetupDefaultThemes(not_null<Ui::VerticalLayout*> container) {
|
|||
void SetupThemeOptions(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container, st::settingsPrivacySkip);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_themes);
|
||||
AddSubsectionTitle(container, tr::lng_settings_themes());
|
||||
|
||||
AddSkip(container, st::settingsThemesTopSkip);
|
||||
SetupDefaultThemes(container);
|
||||
|
@ -913,7 +913,7 @@ void SetupThemeOptions(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_bg_edit_theme,
|
||||
tr::lng_settings_bg_edit_theme(),
|
||||
st::settingsChatButton,
|
||||
&st::settingsIconThemes,
|
||||
st::settingsChatIconLeft
|
||||
|
|
|
@ -77,15 +77,6 @@ void AddDividerText(
|
|||
st::settingsDividerLabelPadding));
|
||||
}
|
||||
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon,
|
||||
int iconLeft) {
|
||||
return AddButton(container, Lang::Viewer(text), st, leftIcon, iconLeft);
|
||||
}
|
||||
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
|
@ -127,13 +118,13 @@ void CreateRightLabel(
|
|||
not_null<Button*> button,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st,
|
||||
LangKey buttonText) {
|
||||
rpl::producer<QString> buttonText) {
|
||||
const auto name = Ui::CreateChild<Ui::FlatLabel>(
|
||||
button.get(),
|
||||
st::settingsButtonRight);
|
||||
rpl::combine(
|
||||
button->widthValue(),
|
||||
Lang::Viewer(buttonText),
|
||||
std::move(buttonText),
|
||||
std::move(label)
|
||||
) | rpl::start_with_next([=, &st](
|
||||
int width,
|
||||
|
@ -153,13 +144,18 @@ void CreateRightLabel(
|
|||
|
||||
not_null<Button*> AddButtonWithLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon,
|
||||
int iconLeft) {
|
||||
const auto button = AddButton(container, text, st, leftIcon, iconLeft);
|
||||
CreateRightLabel(button, std::move(label), st, text);
|
||||
const auto button = AddButton(
|
||||
container,
|
||||
rpl::duplicate(text),
|
||||
st,
|
||||
leftIcon,
|
||||
iconLeft);
|
||||
CreateRightLabel(button, std::move(label), st, std::move(text));
|
||||
return button;
|
||||
}
|
||||
|
||||
|
@ -174,12 +170,6 @@ void AddSubsectionTitle(
|
|||
st::settingsSubsectionTitlePadding);
|
||||
}
|
||||
|
||||
void AddSubsectionTitle(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text) {
|
||||
AddSubsectionTitle(container, Lang::Viewer(text));
|
||||
}
|
||||
|
||||
void FillMenu(Fn<void(Type)> showOther, MenuCallback addAction) {
|
||||
if (!Auth().supportMode()) {
|
||||
addAction(
|
||||
|
|
|
@ -9,8 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
enum LangKey : int;
|
||||
|
||||
namespace Ui {
|
||||
class VerticalLayout;
|
||||
} // namespace Ui
|
||||
|
@ -71,12 +69,6 @@ void AddDivider(not_null<Ui::VerticalLayout*> container);
|
|||
void AddDividerText(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text);
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon = nullptr,
|
||||
int iconLeft = 0);
|
||||
not_null<Button*> AddButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
|
@ -85,7 +77,7 @@ not_null<Button*> AddButton(
|
|||
int iconLeft = 0);
|
||||
not_null<Button*> AddButtonWithLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey text,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon = nullptr,
|
||||
|
@ -94,13 +86,10 @@ void CreateRightLabel(
|
|||
not_null<Button*> button,
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st,
|
||||
LangKey buttonText);
|
||||
rpl::producer<QString> buttonText);
|
||||
void AddSubsectionTitle(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text);
|
||||
void AddSubsectionTitle(
|
||||
not_null<Ui::VerticalLayout*> conatiner,
|
||||
LangKey text);
|
||||
|
||||
using MenuCallback = Fn<QAction*(
|
||||
const QString &text,
|
||||
|
|
|
@ -218,17 +218,17 @@ void SetupRows(
|
|||
|
||||
AddRow(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_name_label),
|
||||
tr::lng_settings_name_label(),
|
||||
Info::Profile::NameValue(self),
|
||||
lang(lng_profile_copy_fullname),
|
||||
tr::lng_profile_copy_fullname(tr::now),
|
||||
[=] { Ui::show(Box<EditNameBox>(self)); },
|
||||
st::settingsInfoName);
|
||||
|
||||
AddRow(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_phone_label),
|
||||
tr::lng_settings_phone_label(),
|
||||
Info::Profile::PhoneValue(self),
|
||||
lang(lng_profile_copy_phone),
|
||||
tr::lng_profile_copy_phone(tr::now),
|
||||
[] { Ui::show(Box<ChangePhoneBox>()); },
|
||||
st::settingsInfoPhone);
|
||||
|
||||
|
@ -239,14 +239,14 @@ void SetupRows(
|
|||
return username.text.isEmpty();
|
||||
});
|
||||
auto label = rpl::combine(
|
||||
Lang::Viewer(lng_settings_username_label),
|
||||
tr::lng_settings_username_label(),
|
||||
std::move(empty)
|
||||
) | rpl::map([](const QString &label, bool empty) {
|
||||
return empty ? "t.me/username" : label;
|
||||
});
|
||||
auto value = rpl::combine(
|
||||
std::move(username),
|
||||
Lang::Viewer(lng_settings_username_add)
|
||||
tr::lng_settings_username_add()
|
||||
) | rpl::map([](const TextWithEntities &username, const QString &add) {
|
||||
if (!username.text.isEmpty()) {
|
||||
return username;
|
||||
|
@ -263,7 +263,7 @@ void SetupRows(
|
|||
container,
|
||||
std::move(label),
|
||||
std::move(value),
|
||||
lang(lng_context_copy_mention),
|
||||
tr::lng_context_copy_mention(tr::now),
|
||||
[=] { Ui::show(Box<UsernameBox>()); },
|
||||
st::settingsInfoUsername);
|
||||
|
||||
|
@ -392,7 +392,7 @@ BioManager SetupBio(
|
|||
container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_about_bio),
|
||||
tr::lng_settings_about_bio(),
|
||||
st::boxDividerLabel),
|
||||
st::settingsBioLabelPadding);
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ void IntroWidget::forceContentRepaint() {
|
|||
|
||||
void IntroWidget::createTopBar() {
|
||||
_topBar.create(this, st::infoLayerTopBar);
|
||||
_topBar->setTitle(Lang::Viewer(lng_menu_settings));
|
||||
_topBar->setTitle(tr::lng_menu_settings());
|
||||
auto close = _topBar->addButton(
|
||||
base::make_unique_q<Ui::IconButton>(
|
||||
_topBar,
|
||||
|
|
|
@ -34,7 +34,7 @@ void SetupLanguageButton(
|
|||
bool icon) {
|
||||
const auto button = AddButtonWithLabel(
|
||||
container,
|
||||
lng_settings_language,
|
||||
tr::lng_settings_language(),
|
||||
rpl::single(Lang::Current().nativeName()),
|
||||
icon ? st::settingsSectionButton : st::settingsButton,
|
||||
icon ? &st::settingsIconLanguage : nullptr);
|
||||
|
@ -56,12 +56,12 @@ void SetupSections(
|
|||
AddSkip(container);
|
||||
|
||||
const auto addSection = [&](
|
||||
LangKey label,
|
||||
rpl::producer<QString> label,
|
||||
Type type,
|
||||
const style::icon *icon) {
|
||||
AddButton(
|
||||
container,
|
||||
label,
|
||||
std::move(label),
|
||||
st::settingsSectionButton,
|
||||
icon
|
||||
)->addClickHandler([=] { showOther(type); });
|
||||
|
@ -73,24 +73,24 @@ void SetupSections(
|
|||
AddSkip(container);
|
||||
} else {
|
||||
addSection(
|
||||
lng_settings_information,
|
||||
tr::lng_settings_information(),
|
||||
Type::Information,
|
||||
&st::settingsIconInformation);
|
||||
}
|
||||
addSection(
|
||||
lng_settings_section_notify,
|
||||
tr::lng_settings_section_notify(),
|
||||
Type::Notifications,
|
||||
&st::settingsIconNotifications);
|
||||
addSection(
|
||||
lng_settings_section_privacy,
|
||||
tr::lng_settings_section_privacy(),
|
||||
Type::PrivacySecurity,
|
||||
&st::settingsIconPrivacySecurity);
|
||||
addSection(
|
||||
lng_settings_section_chat_settings,
|
||||
tr::lng_settings_section_chat_settings(),
|
||||
Type::Chat,
|
||||
&st::settingsIconChat);
|
||||
addSection(
|
||||
lng_settings_advanced,
|
||||
tr::lng_settings_advanced(),
|
||||
Type::Advanced,
|
||||
&st::settingsIconGeneral);
|
||||
|
||||
|
@ -116,7 +116,7 @@ void SetupInterfaceScale(
|
|||
const auto switched = (cConfigScale() == kInterfaceScaleAuto);
|
||||
const auto button = AddButton(
|
||||
container,
|
||||
lng_settings_default_scale,
|
||||
tr::lng_settings_default_scale(),
|
||||
icon ? st::settingsSectionButton : st::settingsButton,
|
||||
icon ? &st::settingsIconInterfaceScale : nullptr
|
||||
)->toggleOn(toggled->events_starting_with_copy(switched));
|
||||
|
@ -216,7 +216,7 @@ void OpenFaq() {
|
|||
void SetupFaq(not_null<Ui::VerticalLayout*> container, bool icon) {
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_faq,
|
||||
tr::lng_settings_faq(),
|
||||
icon ? st::settingsSectionButton : st::settingsButton,
|
||||
icon ? &st::settingsIconFaq : nullptr
|
||||
)->addClickHandler(OpenFaq);
|
||||
|
@ -231,7 +231,7 @@ void SetupHelp(not_null<Ui::VerticalLayout*> container) {
|
|||
if (AuthSession::Exists()) {
|
||||
const auto button = AddButton(
|
||||
container,
|
||||
lng_settings_ask_question,
|
||||
tr::lng_settings_ask_question(),
|
||||
st::settingsSectionButton);
|
||||
button->addClickHandler([=] {
|
||||
const auto ready = crl::guard(button, [](const MTPUser &data) {
|
||||
|
|
|
@ -491,14 +491,14 @@ void SetupAdvancedNotifications(not_null<Ui::VerticalLayout*> container) {
|
|||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddDivider(container);
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddSubsectionTitle(container, lng_settings_notifications_position);
|
||||
AddSubsectionTitle(container, tr::lng_settings_notifications_position());
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
|
||||
const auto position = container->add(
|
||||
object_ptr<NotificationsCount>(container));
|
||||
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddSubsectionTitle(container, lng_settings_notifications_count);
|
||||
AddSubsectionTitle(container, tr::lng_settings_notifications_count());
|
||||
|
||||
const auto count = container->add(
|
||||
object_ptr<Ui::SettingsSlider>(container, st::settingsSlider),
|
||||
|
@ -515,7 +515,7 @@ void SetupAdvancedNotifications(not_null<Ui::VerticalLayout*> container) {
|
|||
}
|
||||
|
||||
void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSubsectionTitle(container, lng_settings_notify_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_notify_title());
|
||||
|
||||
const auto checkbox = [&](LangKey label, bool checked) {
|
||||
return object_ptr<Ui::Checkbox>(
|
||||
|
@ -552,7 +552,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
|
|||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddDivider(container);
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddSubsectionTitle(container, lng_settings_badge_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_badge_title());
|
||||
|
||||
const auto muted = addCheckbox(
|
||||
lng_settings_include_muted,
|
||||
|
@ -565,7 +565,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
|
|||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddDivider(container);
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddSubsectionTitle(container, lng_settings_events_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_events_title());
|
||||
|
||||
const auto joined = addCheckbox(
|
||||
lng_settings_events_joined,
|
||||
|
@ -615,7 +615,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
|
|||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddDivider(container);
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddSubsectionTitle(container, lng_settings_native_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_native_title());
|
||||
return addCheckbox(nativeKey, Global::NativeNotifications());
|
||||
}();
|
||||
|
||||
|
|
|
@ -315,21 +315,21 @@ QString PhoneNumberPrivacyController::title() {
|
|||
return lang(lng_edit_privacy_phone_number_title);
|
||||
}
|
||||
|
||||
LangKey PhoneNumberPrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_phone_number_header;
|
||||
rpl::producer<QString> PhoneNumberPrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_phone_number_header();
|
||||
}
|
||||
|
||||
rpl::producer<QString> PhoneNumberPrivacyController::warning() {
|
||||
return Lang::Viewer(lng_edit_privacy_phone_number_warning);
|
||||
return tr::lng_edit_privacy_phone_number_warning();
|
||||
}
|
||||
|
||||
LangKey PhoneNumberPrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> PhoneNumberPrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always:
|
||||
return lng_edit_privacy_phone_number_always_empty;
|
||||
return tr::lng_edit_privacy_phone_number_always_empty();
|
||||
case Exception::Never:
|
||||
return lng_edit_privacy_phone_number_never_empty;
|
||||
return tr::lng_edit_privacy_phone_number_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ QString PhoneNumberPrivacyController::exceptionBoxTitle(Exception exception) {
|
|||
}
|
||||
|
||||
rpl::producer<QString> PhoneNumberPrivacyController::exceptionsDescription() {
|
||||
return Lang::Viewer(lng_edit_privacy_phone_number_exceptions);
|
||||
return tr::lng_edit_privacy_phone_number_exceptions();
|
||||
}
|
||||
|
||||
ApiWrap::Privacy::Key LastSeenPrivacyController::key() {
|
||||
|
@ -358,21 +358,21 @@ QString LastSeenPrivacyController::title() {
|
|||
return lang(lng_edit_privacy_lastseen_title);
|
||||
}
|
||||
|
||||
LangKey LastSeenPrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_lastseen_header;
|
||||
rpl::producer<QString> LastSeenPrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_lastseen_header();
|
||||
}
|
||||
|
||||
rpl::producer<QString> LastSeenPrivacyController::warning() {
|
||||
return Lang::Viewer(lng_edit_privacy_lastseen_warning);
|
||||
return tr::lng_edit_privacy_lastseen_warning();
|
||||
}
|
||||
|
||||
LangKey LastSeenPrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> LastSeenPrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always:
|
||||
return lng_edit_privacy_lastseen_always_empty;
|
||||
return tr::lng_edit_privacy_lastseen_always_empty();
|
||||
case Exception::Never:
|
||||
return lng_edit_privacy_lastseen_never_empty;
|
||||
return tr::lng_edit_privacy_lastseen_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ QString LastSeenPrivacyController::exceptionBoxTitle(Exception exception) {
|
|||
}
|
||||
|
||||
rpl::producer<QString> LastSeenPrivacyController::exceptionsDescription() {
|
||||
return Lang::Viewer(lng_edit_privacy_lastseen_exceptions);
|
||||
return tr::lng_edit_privacy_lastseen_exceptions();
|
||||
}
|
||||
|
||||
void LastSeenPrivacyController::confirmSave(bool someAreDisallowed, FnMut<void()> saveCallback) {
|
||||
|
@ -427,15 +427,15 @@ bool GroupsInvitePrivacyController::hasOption(Option option) {
|
|||
return (option != Option::Nobody);
|
||||
}
|
||||
|
||||
LangKey GroupsInvitePrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_groups_header;
|
||||
rpl::producer<QString> GroupsInvitePrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_groups_header();
|
||||
}
|
||||
|
||||
LangKey GroupsInvitePrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> GroupsInvitePrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always: return lng_edit_privacy_groups_always_empty;
|
||||
case Exception::Never: return lng_edit_privacy_groups_never_empty;
|
||||
case Exception::Always: return tr::lng_edit_privacy_groups_always_empty();
|
||||
case Exception::Never: return tr::lng_edit_privacy_groups_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ QString GroupsInvitePrivacyController::exceptionBoxTitle(Exception exception) {
|
|||
|
||||
auto GroupsInvitePrivacyController::exceptionsDescription()
|
||||
-> rpl::producer<QString> {
|
||||
return Lang::Viewer(lng_edit_privacy_groups_exceptions);
|
||||
return tr::lng_edit_privacy_groups_exceptions();
|
||||
}
|
||||
|
||||
ApiWrap::Privacy::Key CallsPrivacyController::key() {
|
||||
|
@ -465,15 +465,15 @@ QString CallsPrivacyController::title() {
|
|||
return lang(lng_edit_privacy_calls_title);
|
||||
}
|
||||
|
||||
LangKey CallsPrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_calls_header;
|
||||
rpl::producer<QString> CallsPrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_calls_header();
|
||||
}
|
||||
|
||||
LangKey CallsPrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> CallsPrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always: return lng_edit_privacy_calls_always_empty;
|
||||
case Exception::Never: return lng_edit_privacy_calls_never_empty;
|
||||
case Exception::Always: return tr::lng_edit_privacy_calls_always_empty();
|
||||
case Exception::Never: return tr::lng_edit_privacy_calls_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ QString CallsPrivacyController::exceptionBoxTitle(Exception exception) {
|
|||
}
|
||||
|
||||
rpl::producer<QString> CallsPrivacyController::exceptionsDescription() {
|
||||
return Lang::Viewer(lng_edit_privacy_calls_exceptions);
|
||||
return tr::lng_edit_privacy_calls_exceptions();
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> CallsPrivacyController::setupBelowWidget(
|
||||
|
@ -497,10 +497,10 @@ object_ptr<Ui::RpWidget> CallsPrivacyController::setupBelowWidget(
|
|||
|
||||
AddDivider(content);
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, lng_settings_calls_peer_to_peer_title);
|
||||
AddSubsectionTitle(content, tr::lng_settings_calls_peer_to_peer_title());
|
||||
Settings::AddPrivacyButton(
|
||||
content,
|
||||
lng_settings_calls_peer_to_peer_button,
|
||||
tr::lng_settings_calls_peer_to_peer_button(),
|
||||
ApiWrap::Privacy::Key::CallsPeer2Peer,
|
||||
[] { return std::make_unique<CallsPeer2PeerPrivacyController>(); });
|
||||
AddSkip(content);
|
||||
|
@ -520,8 +520,8 @@ QString CallsPeer2PeerPrivacyController::title() {
|
|||
return lang(lng_edit_privacy_calls_p2p_title);
|
||||
}
|
||||
|
||||
LangKey CallsPeer2PeerPrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_calls_p2p_header;
|
||||
rpl::producer<QString> CallsPeer2PeerPrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_calls_p2p_header();
|
||||
}
|
||||
|
||||
LangKey CallsPeer2PeerPrivacyController::optionLabelKey(
|
||||
|
@ -535,14 +535,14 @@ LangKey CallsPeer2PeerPrivacyController::optionLabelKey(
|
|||
}
|
||||
|
||||
rpl::producer<QString> CallsPeer2PeerPrivacyController::warning() {
|
||||
return Lang::Viewer(lng_settings_peer_to_peer_about);
|
||||
return tr::lng_settings_peer_to_peer_about();
|
||||
}
|
||||
|
||||
LangKey CallsPeer2PeerPrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> CallsPeer2PeerPrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always: return lng_edit_privacy_calls_p2p_always_empty;
|
||||
case Exception::Never: return lng_edit_privacy_calls_p2p_never_empty;
|
||||
case Exception::Always: return tr::lng_edit_privacy_calls_p2p_always_empty();
|
||||
case Exception::Never: return tr::lng_edit_privacy_calls_p2p_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ QString CallsPeer2PeerPrivacyController::exceptionBoxTitle(Exception exception)
|
|||
}
|
||||
|
||||
rpl::producer<QString> CallsPeer2PeerPrivacyController::exceptionsDescription() {
|
||||
return Lang::Viewer(lng_edit_privacy_calls_p2p_exceptions);
|
||||
return tr::lng_edit_privacy_calls_p2p_exceptions();
|
||||
}
|
||||
|
||||
ApiWrap::Privacy::Key ForwardsPrivacyController::key() {
|
||||
|
@ -571,19 +571,19 @@ QString ForwardsPrivacyController::title() {
|
|||
return lang(lng_edit_privacy_forwards_title);
|
||||
}
|
||||
|
||||
LangKey ForwardsPrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_forwards_header;
|
||||
rpl::producer<QString> ForwardsPrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_forwards_header();
|
||||
}
|
||||
|
||||
rpl::producer<QString> ForwardsPrivacyController::warning() {
|
||||
return Lang::Viewer(lng_edit_privacy_forwards_warning);
|
||||
return tr::lng_edit_privacy_forwards_warning();
|
||||
}
|
||||
|
||||
LangKey ForwardsPrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> ForwardsPrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always: return lng_edit_privacy_forwards_always_empty;
|
||||
case Exception::Never: return lng_edit_privacy_forwards_never_empty;
|
||||
case Exception::Always: return tr::lng_edit_privacy_forwards_always_empty();
|
||||
case Exception::Never: return tr::lng_edit_privacy_forwards_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ QString ForwardsPrivacyController::exceptionBoxTitle(Exception exception) {
|
|||
|
||||
auto ForwardsPrivacyController::exceptionsDescription()
|
||||
-> rpl::producer<QString> {
|
||||
return Lang::Viewer(lng_edit_privacy_forwards_exceptions);
|
||||
return tr::lng_edit_privacy_forwards_exceptions();
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> ForwardsPrivacyController::setupAboveWidget(
|
||||
|
@ -767,15 +767,15 @@ bool ProfilePhotoPrivacyController::hasOption(Option option) {
|
|||
return (option != Option::Nobody);
|
||||
}
|
||||
|
||||
LangKey ProfilePhotoPrivacyController::optionsTitleKey() {
|
||||
return lng_edit_privacy_profile_photo_header;
|
||||
rpl::producer<QString> ProfilePhotoPrivacyController::optionsTitleKey() {
|
||||
return tr::lng_edit_privacy_profile_photo_header();
|
||||
}
|
||||
|
||||
LangKey ProfilePhotoPrivacyController::exceptionButtonTextKey(
|
||||
rpl::producer<QString> ProfilePhotoPrivacyController::exceptionButtonTextKey(
|
||||
Exception exception) {
|
||||
switch (exception) {
|
||||
case Exception::Always: return lng_edit_privacy_profile_photo_always_empty;
|
||||
case Exception::Never: return lng_edit_privacy_profile_photo_never_empty;
|
||||
case Exception::Always: return tr::lng_edit_privacy_profile_photo_always_empty();
|
||||
case Exception::Never: return tr::lng_edit_privacy_profile_photo_never_empty();
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ QString ProfilePhotoPrivacyController::exceptionBoxTitle(Exception exception) {
|
|||
|
||||
auto ProfilePhotoPrivacyController::exceptionsDescription()
|
||||
-> rpl::producer<QString> {
|
||||
return Lang::Viewer(lng_edit_privacy_profile_photo_exceptions);
|
||||
return tr::lng_edit_privacy_profile_photo_exceptions();
|
||||
}
|
||||
|
||||
} // namespace Settings
|
||||
|
|
|
@ -46,9 +46,10 @@ public:
|
|||
MTPInputPrivacyKey apiKey() override;
|
||||
|
||||
QString title() override;
|
||||
LangKey optionsTitleKey() override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
rpl::producer<QString> warning() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
|
@ -63,13 +64,16 @@ public:
|
|||
MTPInputPrivacyKey apiKey() override;
|
||||
|
||||
QString title() override;
|
||||
LangKey optionsTitleKey() override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
rpl::producer<QString> warning() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
void confirmSave(bool someAreDisallowed, FnMut<void()> saveCallback) override;
|
||||
void confirmSave(
|
||||
bool someAreDisallowed,
|
||||
FnMut<void()> saveCallback) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -83,8 +87,9 @@ public:
|
|||
|
||||
QString title() override;
|
||||
bool hasOption(Option option) override;
|
||||
LangKey optionsTitleKey() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
|
@ -99,8 +104,9 @@ public:
|
|||
MTPInputPrivacyKey apiKey() override;
|
||||
|
||||
QString title() override;
|
||||
LangKey optionsTitleKey() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
|
@ -118,10 +124,11 @@ public:
|
|||
MTPInputPrivacyKey apiKey() override;
|
||||
|
||||
QString title() override;
|
||||
LangKey optionsTitleKey() override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
LangKey optionLabelKey(EditPrivacyBox::Option option) override;
|
||||
rpl::producer<QString> warning() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
|
@ -138,9 +145,10 @@ public:
|
|||
MTPInputPrivacyKey apiKey() override;
|
||||
|
||||
QString title() override;
|
||||
LangKey optionsTitleKey() override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
rpl::producer<QString> warning() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
|
@ -170,8 +178,9 @@ public:
|
|||
|
||||
QString title() override;
|
||||
bool hasOption(Option option) override;
|
||||
LangKey optionsTitleKey() override;
|
||||
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||
rpl::producer<QString> optionsTitleKey() override;
|
||||
rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) override;
|
||||
QString exceptionBoxTitle(Exception exception) override;
|
||||
rpl::producer<QString> exceptionsDescription() override;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ rpl::producer<int> BlockedUsersCount() {
|
|||
|
||||
void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container, st::settingsPrivacySkip);
|
||||
AddSubsectionTitle(container, lng_settings_privacy_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_privacy_title());
|
||||
|
||||
auto count = BlockedUsersCount(
|
||||
) | rpl::map([](int count) {
|
||||
|
@ -114,7 +114,7 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
|||
});
|
||||
AddButtonWithLabel(
|
||||
container,
|
||||
lng_settings_blocked_users,
|
||||
tr::lng_settings_blocked_users(),
|
||||
std::move(count),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
|
@ -132,38 +132,39 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
|||
});
|
||||
|
||||
using Key = Privacy::Key;
|
||||
const auto add = [&](LangKey label, Key key, auto controller) {
|
||||
AddPrivacyButton(container, label, key, controller);
|
||||
const auto add = [&](
|
||||
rpl::producer<QString> label,
|
||||
Key key,
|
||||
auto controller) {
|
||||
AddPrivacyButton(container, std::move(label), key, controller);
|
||||
};
|
||||
add(
|
||||
lng_settings_phone_number_privacy,
|
||||
tr::lng_settings_phone_number_privacy(),
|
||||
Key::PhoneNumber,
|
||||
[] { return std::make_unique<PhoneNumberPrivacyController>(); });
|
||||
add(
|
||||
lng_settings_last_seen,
|
||||
tr::lng_settings_last_seen(),
|
||||
Key::LastSeen,
|
||||
[] { return std::make_unique<LastSeenPrivacyController>(); });
|
||||
add(
|
||||
lng_settings_forwards_privacy,
|
||||
tr::lng_settings_forwards_privacy(),
|
||||
Key::Forwards,
|
||||
[] { return std::make_unique<ForwardsPrivacyController>(); });
|
||||
add(
|
||||
lng_settings_profile_photo_privacy,
|
||||
tr::lng_settings_profile_photo_privacy(),
|
||||
Key::ProfilePhoto,
|
||||
[] { return std::make_unique<ProfilePhotoPrivacyController>(); });
|
||||
add(
|
||||
lng_settings_calls,
|
||||
tr::lng_settings_calls(),
|
||||
Key::Calls,
|
||||
[] { return std::make_unique<CallsPrivacyController>(); });
|
||||
add(
|
||||
lng_settings_groups_invite,
|
||||
tr::lng_settings_groups_invite(),
|
||||
Key::Invites,
|
||||
[] { return std::make_unique<GroupsInvitePrivacyController>(); });
|
||||
|
||||
AddSkip(container, st::settingsPrivacySecurityPadding);
|
||||
AddDividerText(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_group_privacy_about));
|
||||
AddDividerText(container, tr::lng_settings_group_privacy_about());
|
||||
}
|
||||
|
||||
not_null<Ui::SlideWrap<Ui::PlainShadow>*> AddSeparator(
|
||||
|
@ -177,15 +178,15 @@ not_null<Ui::SlideWrap<Ui::PlainShadow>*> AddSeparator(
|
|||
|
||||
void SetupLocalPasscode(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_passcode_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_passcode_title());
|
||||
|
||||
auto has = PasscodeChanges(
|
||||
) | rpl::map([] {
|
||||
return Global::LocalPasscode();
|
||||
});
|
||||
auto text = rpl::combine(
|
||||
Lang::Viewer(lng_passcode_change),
|
||||
Lang::Viewer(lng_passcode_turn_on),
|
||||
tr::lng_passcode_change(),
|
||||
tr::lng_passcode_turn_on(),
|
||||
base::duplicate(has),
|
||||
[](const QString &change, const QString &create, bool has) {
|
||||
return has ? change : create;
|
||||
|
@ -207,15 +208,15 @@ void SetupLocalPasscode(not_null<Ui::VerticalLayout*> container) {
|
|||
inner->add(
|
||||
object_ptr<Button>(
|
||||
inner,
|
||||
Lang::Viewer(lng_settings_passcode_disable),
|
||||
tr::lng_settings_passcode_disable(),
|
||||
st::settingsButton)
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<PasscodeBox>(true));
|
||||
});
|
||||
|
||||
const auto label = Platform::LastUserInputTimeSupported()
|
||||
? lng_passcode_autolock_away
|
||||
: lng_passcode_autolock_inactive;
|
||||
? tr::lng_passcode_autolock_away
|
||||
: tr::lng_passcode_autolock_inactive;
|
||||
auto value = PasscodeChanges(
|
||||
) | rpl::map([] {
|
||||
const auto autolock = Global::AutoLock();
|
||||
|
@ -226,7 +227,7 @@ void SetupLocalPasscode(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddButtonWithLabel(
|
||||
inner,
|
||||
label,
|
||||
label(),
|
||||
std::move(value),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
|
@ -244,7 +245,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_password_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_password_title());
|
||||
|
||||
auto has = rpl::single(
|
||||
false
|
||||
|
@ -300,8 +301,8 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
|||
}, label->lifetime());
|
||||
|
||||
auto text = rpl::combine(
|
||||
Lang::Viewer(lng_cloud_password_set),
|
||||
Lang::Viewer(lng_cloud_password_edit),
|
||||
tr::lng_cloud_password_set(),
|
||||
tr::lng_cloud_password_edit(),
|
||||
base::duplicate(has)
|
||||
) | rpl::map([](const QString &set, const QString &edit, bool has) {
|
||||
return has ? edit : set;
|
||||
|
@ -331,7 +332,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
object_ptr<Button>(
|
||||
container,
|
||||
Lang::Viewer(lng_cloud_password_confirm),
|
||||
tr::lng_cloud_password_confirm(),
|
||||
st::settingsButton)));
|
||||
confirm->toggleOn(rpl::single(
|
||||
false
|
||||
|
@ -372,7 +373,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
object_ptr<Button>(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_password_disable),
|
||||
tr::lng_settings_password_disable(),
|
||||
st::settingsButton)));
|
||||
disable->toggleOn(rpl::combine(
|
||||
rpl::duplicate(has),
|
||||
|
@ -385,7 +386,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
object_ptr<Button>(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_password_abort),
|
||||
tr::lng_settings_password_abort(),
|
||||
st::settingsAttentionButton)));
|
||||
abort->toggleOn(rpl::combine(
|
||||
rpl::duplicate(has),
|
||||
|
@ -412,7 +413,7 @@ void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
|||
void SetupSelfDestruction(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_destroy_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_destroy_title());
|
||||
|
||||
Auth().api().reloadSelfDestruct();
|
||||
const auto label = [] {
|
||||
|
@ -424,7 +425,7 @@ void SetupSelfDestruction(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
AddButtonWithLabel(
|
||||
container,
|
||||
lng_settings_destroy_if,
|
||||
tr::lng_settings_destroy_if(),
|
||||
label(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
|
@ -436,19 +437,17 @@ void SetupSelfDestruction(not_null<Ui::VerticalLayout*> container) {
|
|||
|
||||
void SetupSessionsList(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_sessions_title);
|
||||
AddSubsectionTitle(container, tr::lng_settings_sessions_title());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_show_sessions,
|
||||
tr::lng_settings_show_sessions(),
|
||||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<SessionsBox>());
|
||||
});
|
||||
AddSkip(container, st::settingsPrivacySecurityPadding);
|
||||
AddDividerText(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_sessions_about));
|
||||
AddDividerText(container, tr::lng_settings_sessions_about());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -541,13 +540,13 @@ object_ptr<BoxContent> CloudPasswordAppOutdatedBox() {
|
|||
|
||||
void AddPrivacyButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey label,
|
||||
rpl::producer<QString> label,
|
||||
Privacy::Key key,
|
||||
Fn<std::unique_ptr<EditPrivacyController>()> controller) {
|
||||
const auto shower = Ui::CreateChild<rpl::lifetime>(container.get());
|
||||
AddButtonWithLabel(
|
||||
container,
|
||||
label,
|
||||
std::move(label),
|
||||
PrivacyString(key),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
|
|
|
@ -23,7 +23,7 @@ object_ptr<BoxContent> CloudPasswordAppOutdatedBox();
|
|||
|
||||
void AddPrivacyButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
LangKey label,
|
||||
rpl::producer<QString> label,
|
||||
ApiWrap::Privacy::Key key,
|
||||
Fn<std::unique_ptr<EditPrivacyController>()> controller);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ Bar::Bar(not_null<QWidget*> parent, QDate date)
|
|||
: _date(date)
|
||||
, _title(
|
||||
this,
|
||||
Lang::Viewer(lng_outdated_title) | Ui::Text::ToUpper(),
|
||||
tr::lng_outdated_title() | Ui::Text::ToUpper(),
|
||||
st::windowOutdatedTitle)
|
||||
, _details(this,
|
||||
QString(),
|
||||
|
|
Loading…
Reference in New Issue