From 08a979e638f0218d1db8a90e8747c2c96502433e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 15 Dec 2025 12:15:25 +0400 Subject: [PATCH] Use more simple tr::... text helpers. --- Telegram/SourceFiles/api/api_bot.cpp | 2 +- Telegram/SourceFiles/api/api_chat_filters.cpp | 10 +- Telegram/SourceFiles/api/api_chat_invite.cpp | 10 +- Telegram/SourceFiles/api/api_suggest_post.cpp | 36 +- Telegram/SourceFiles/apiwrap.cpp | 4 +- Telegram/SourceFiles/boxes/about_box.cpp | 22 +- .../SourceFiles/boxes/about_sponsored_box.cpp | 4 +- .../SourceFiles/boxes/add_contact_box.cpp | 4 +- .../SourceFiles/boxes/choose_filter_box.cpp | 6 +- Telegram/SourceFiles/boxes/connection_box.cpp | 2 +- .../SourceFiles/boxes/delete_messages_box.cpp | 32 +- .../SourceFiles/boxes/edit_privacy_box.cpp | 10 +- .../boxes/filters/edit_filter_links.cpp | 4 +- .../SourceFiles/boxes/gift_credits_box.cpp | 6 +- .../SourceFiles/boxes/gift_premium_box.cpp | 203 +++++---- .../boxes/moderate_messages_box.cpp | 28 +- Telegram/SourceFiles/boxes/passcode_box.cpp | 8 +- .../boxes/peer_list_controllers.cpp | 6 +- .../boxes/peers/add_participants_box.cpp | 32 +- .../boxes/peers/choose_peer_box.cpp | 18 +- .../boxes/peers/edit_contact_box.cpp | 16 +- .../boxes/peers/edit_discussion_link_box.cpp | 30 +- .../boxes/peers/edit_participant_box.cpp | 22 +- .../boxes/peers/edit_participants_box.cpp | 6 +- .../boxes/peers/edit_peer_color_box.cpp | 24 +- .../boxes/peers/edit_peer_info_box.cpp | 18 +- .../boxes/peers/edit_peer_invite_link.cpp | 17 +- .../boxes/peers/edit_peer_permissions_box.cpp | 4 +- .../boxes/peers/edit_peer_reactions.cpp | 15 +- .../boxes/peers/edit_peer_requests_box.cpp | 4 +- .../boxes/peers/edit_peer_usernames_list.cpp | 4 +- .../boxes/peers/peer_short_info_box.cpp | 12 +- .../boxes/peers/replace_boost_box.cpp | 18 +- .../boxes/peers/toggle_topics_box.cpp | 4 +- .../boxes/peers/verify_peers_box.cpp | 8 +- .../SourceFiles/boxes/premium_limits_box.cpp | 50 +- .../SourceFiles/boxes/premium_preview_box.cpp | 26 +- .../boxes/self_destruction_box.cpp | 2 +- .../SourceFiles/boxes/send_credits_box.cpp | 28 +- Telegram/SourceFiles/boxes/send_files_box.cpp | 6 +- Telegram/SourceFiles/boxes/star_gift_box.cpp | 93 ++-- .../boxes/star_gift_resale_box.cpp | 6 +- .../SourceFiles/boxes/sticker_set_box.cpp | 4 +- .../SourceFiles/boxes/transfer_gift_box.cpp | 48 +- Telegram/SourceFiles/boxes/translate_box.cpp | 4 +- Telegram/SourceFiles/boxes/url_auth_box.cpp | 10 +- Telegram/SourceFiles/boxes/username_box.cpp | 12 +- .../calls/calls_box_controller.cpp | 2 +- .../calls/calls_emoji_fingerprint.cpp | 2 +- .../calls/group/calls_choose_join_as.cpp | 12 +- .../calls/group/calls_group_call.cpp | 30 +- .../calls/group/calls_group_common.cpp | 22 +- .../group/calls_group_invite_controller.cpp | 6 +- .../calls/group/calls_group_messages_ui.cpp | 6 +- .../calls/group/calls_group_panel.cpp | 2 +- .../calls/group/calls_group_rtmp.cpp | 2 +- .../calls/group/calls_group_settings.cpp | 4 +- .../calls/group/calls_group_toasts.cpp | 12 +- .../group/ui/calls_group_stars_coloring.cpp | 6 +- .../chat_helpers/message_field.cpp | 16 +- .../share_message_phrase_factory.cpp | 8 +- .../chat_helpers/tabbed_selector.cpp | 2 +- .../chat_helpers/ttl_media_layer_widget.cpp | 6 +- .../SourceFiles/core/local_url_handlers.cpp | 20 +- .../components/recent_shared_media_gifts.cpp | 4 +- .../data/components/sponsored_messages.cpp | 4 +- .../data/data_chat_participant_status.cpp | 2 +- .../data/data_document_resolver.cpp | 6 +- Telegram/SourceFiles/data/data_folder.cpp | 4 +- .../SourceFiles/data/data_media_types.cpp | 6 +- Telegram/SourceFiles/data/data_stories.cpp | 4 +- Telegram/SourceFiles/data/data_story.cpp | 4 +- .../data/stickers/data_stickers.cpp | 12 +- .../dialogs/dialogs_inner_widget.cpp | 12 +- .../dialogs/dialogs_search_tags.cpp | 2 +- .../dialogs/dialogs_top_bar_suggestion.cpp | 20 +- .../SourceFiles/dialogs/ui/chat_search_in.cpp | 6 +- .../SourceFiles/dialogs/ui/dialogs_layout.cpp | 2 +- .../dialogs/ui/dialogs_stories_list.cpp | 12 +- .../dialogs/ui/dialogs_suggestions.cpp | 14 +- .../dialogs/ui/posts_search_intro.cpp | 8 +- .../export/view/export_view_settings.cpp | 18 +- .../export/view/export_view_top_bar.cpp | 2 +- .../admin_log/history_admin_log_inner.cpp | 4 +- .../admin_log/history_admin_log_item.cpp | 178 ++++---- Telegram/SourceFiles/history/history.cpp | 4 +- Telegram/SourceFiles/history/history_item.cpp | 428 +++++++++--------- .../history/history_item_components.cpp | 24 +- .../history/history_item_helpers.cpp | 36 +- .../SourceFiles/history/history_widget.cpp | 16 +- .../history_view_compose_controls.cpp | 6 +- .../controls/history_view_suggest_options.cpp | 14 +- .../history_view_voice_record_bar.cpp | 4 +- .../history/view/history_view_about_view.cpp | 32 +- .../view/history_view_chat_section.cpp | 2 +- .../view/history_view_contact_status.cpp | 26 +- .../view/history_view_context_menu.cpp | 16 +- .../history/view/history_view_element.cpp | 24 +- .../history/view/history_view_message.cpp | 12 +- .../view/history_view_paid_reaction_toast.cpp | 6 +- .../view/history_view_reaction_preview.cpp | 2 +- .../history/view/history_view_reply.cpp | 4 +- .../view/history_view_schedule_box.cpp | 6 +- .../view/history_view_scheduled_section.cpp | 6 +- .../history_view_self_forwards_tagger.cpp | 2 +- .../view/history_view_sticker_toast.cpp | 8 +- .../view/history_view_translate_bar.cpp | 6 +- .../history/view/history_view_view_button.cpp | 3 +- .../history_view_birthday_suggestion.cpp | 4 +- .../view/media/history_view_document.cpp | 4 +- .../view/media/history_view_giveaway.cpp | 30 +- .../history/view/media/history_view_media.cpp | 2 +- .../view/media/history_view_media_common.cpp | 20 +- .../history/view/media/history_view_poll.cpp | 4 +- .../media/history_view_similar_channels.cpp | 6 +- .../media/history_view_suggest_decision.cpp | 40 +- .../view/media/history_view_todo_list.cpp | 6 +- .../view/media/history_view_unique_gift.cpp | 12 +- .../media/history_view_userpic_suggestion.cpp | 6 +- .../view/media/history_view_web_page.cpp | 8 +- .../history_view_reactions_selector.cpp | 4 +- .../bot/starref/info_bot_starref_common.cpp | 36 +- .../starref/info_bot_starref_join_widget.cpp | 25 +- .../starref/info_bot_starref_setup_widget.cpp | 12 +- .../boosts/create_giveaway_box.cpp | 27 +- .../earn/info_channel_earn_list.cpp | 18 +- .../peer_gifts/info_peer_gifts_common.cpp | 2 +- .../peer_gifts/info_peer_gifts_widget.cpp | 14 +- .../polls/info_polls_results_inner_widget.cpp | 2 +- .../info/profile/info_profile_actions.cpp | 33 +- .../info/profile/info_profile_members.cpp | 5 +- .../info/profile/info_profile_phone_menu.cpp | 4 +- .../profile/info_profile_status_label.cpp | 4 +- .../info/profile/info_profile_top_bar.cpp | 8 +- .../info/profile/info_profile_values.cpp | 16 +- .../info/saved/info_saved_music_widget.cpp | 4 +- .../info_similar_peers_widget.cpp | 5 +- .../stories/info_stories_inner_widget.cpp | 8 +- .../inline_bots/bot_attach_web_view.cpp | 46 +- .../inline_bots/inline_bot_downloads.cpp | 4 +- .../inline_bots/inline_results_inner.cpp | 2 +- Telegram/SourceFiles/intro/intro_code.cpp | 6 +- .../intro/intro_password_check.cpp | 4 +- Telegram/SourceFiles/intro/intro_qr.cpp | 4 +- Telegram/SourceFiles/intro/intro_widget.cpp | 4 +- .../SourceFiles/lang/lang_cloud_manager.cpp | 14 +- Telegram/SourceFiles/lang/lang_text_entity.h | 34 ++ Telegram/SourceFiles/mainwidget.cpp | 8 +- .../stories/media_stories_controller.cpp | 8 +- .../media/stories/media_stories_header.cpp | 20 +- .../media/stories/media_stories_stealth.cpp | 6 +- .../media/view/media_view_overlay_widget.cpp | 12 +- .../menu/menu_antispam_validator.cpp | 6 +- .../menu/menu_item_download_files.cpp | 4 +- Telegram/SourceFiles/menu/menu_send.cpp | 4 +- Telegram/SourceFiles/menu/menu_sponsored.cpp | 26 +- .../SourceFiles/menu/menu_ttl_validator.cpp | 4 +- .../SourceFiles/overview/overview_layout.cpp | 4 +- .../passport/passport_panel_edit_contact.cpp | 3 +- .../passport/passport_panel_edit_document.cpp | 3 +- .../passport/passport_panel_edit_scans.cpp | 8 +- .../passport/passport_panel_form.cpp | 12 +- .../payments/payments_non_panel_process.cpp | 4 +- .../payments/payments_reaction_process.cpp | 2 +- .../payments/ui/payments_form_summary.cpp | 2 +- .../payments/ui/payments_panel.cpp | 8 +- .../business/settings_away_message.cpp | 2 +- .../settings/business/settings_chat_links.cpp | 12 +- .../settings/business/settings_chatbots.cpp | 6 +- .../settings/business/settings_greeting.cpp | 2 +- .../settings/business/settings_location.cpp | 4 +- .../business/settings_quick_replies.cpp | 2 +- .../business/settings_shortcut_messages.cpp | 10 +- .../business/settings_working_hours.cpp | 2 +- .../settings/settings_business.cpp | 13 +- .../SourceFiles/settings/settings_credits.cpp | 8 +- .../settings/settings_credits_graphics.cpp | 148 +++--- .../SourceFiles/settings/settings_folders.cpp | 6 +- .../settings/settings_global_ttl.cpp | 10 +- .../settings/settings_information.cpp | 14 +- .../SourceFiles/settings/settings_main.cpp | 11 +- .../settings/settings_notifications.cpp | 2 +- .../settings/settings_passkeys.cpp | 6 +- .../SourceFiles/settings/settings_premium.cpp | 25 +- .../settings/settings_privacy_controllers.cpp | 28 +- .../settings/settings_privacy_security.cpp | 6 +- .../settings/settings_shortcuts.cpp | 2 +- Telegram/SourceFiles/ui/boxes/boost_box.cpp | 73 +-- .../SourceFiles/ui/boxes/choose_date_time.cpp | 6 +- .../ui/boxes/collectible_info_box.cpp | 10 +- .../ui/boxes/confirm_phone_box.cpp | 4 +- .../ui/boxes/edit_invite_link_session.cpp | 6 +- .../ui/boxes/show_or_premium_box.cpp | 8 +- .../ui/chat/attach/attach_bot_downloads.cpp | 4 +- .../ui/chat/attach/attach_bot_webview.cpp | 2 +- .../SourceFiles/ui/chat/choose_send_as.cpp | 6 +- .../ui/chat/choose_theme_controller.cpp | 4 +- .../SourceFiles/ui/controls/download_bar.cpp | 4 +- .../ui/controls/filter_link_header.cpp | 14 +- .../ui/controls/location_picker.cpp | 2 +- .../SourceFiles/ui/controls/stars_rating.cpp | 18 +- .../ui/controls/userpic_button.cpp | 4 +- .../ui/controls/window_outdated_bar.cpp | 7 +- .../ui/effects/premium_graphics.cpp | 2 +- Telegram/SourceFiles/ui/vertical_list.cpp | 4 +- .../ui/widgets/expandable_peer_list.cpp | 5 +- .../window/notifications_manager.cpp | 14 +- .../window/notifications_manager_default.cpp | 2 +- .../window/themes/window_theme_editor_box.cpp | 6 +- .../SourceFiles/window/window_main_menu.cpp | 8 +- .../SourceFiles/window/window_peer_menu.cpp | 26 +- .../window/window_session_controller.cpp | 2 +- Telegram/lib_ui | 2 +- 213 files changed, 1657 insertions(+), 1643 deletions(-) diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index 5592dd0269..57338013e0 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -218,7 +218,7 @@ void SendBotCallbackDataWithPassword( session, tr::lng_bots_password_confirm_check_about( tr::now, - Ui::Text::WithEntities)); + tr::marked)); if (box) { show->showBox(std::move(box), Ui::LayerOption::CloseOther); } else { diff --git a/Telegram/SourceFiles/api/api_chat_filters.cpp b/Telegram/SourceFiles/api/api_chat_filters.cpp index a3ef0d82e5..cb3c1f0323 100644 --- a/Telegram/SourceFiles/api/api_chat_filters.cpp +++ b/Telegram/SourceFiles/api/api_chat_filters.cpp @@ -116,24 +116,24 @@ private: tr::now, lt_folder, std::move(boldTitle), - Ui::Text::WithEntities) + tr::marked) : (type == Type::AddingChats) ? tr::lng_filters_by_link_more_sure( tr::now, lt_folder, std::move(boldTitle), - Ui::Text::WithEntities) + tr::marked) : (type == Type::AllAdded) ? tr::lng_filters_by_link_already_about( tr::now, lt_folder, std::move(boldTitle), - Ui::Text::WithEntities) + tr::marked) : tr::lng_filters_by_link_remove_sure( tr::now, lt_folder, std::move(boldTitle), - Ui::Text::WithEntities); + tr::marked); } void InitFilterLinkHeader( @@ -547,7 +547,7 @@ void ShowImportToast( ? tr::lng_filters_added_title : tr::lng_filters_updated_title; auto text = Ui::Text::Wrapped( - phrase(tr::now, lt_folder, title.text, Ui::Text::WithEntities), + phrase(tr::now, lt_folder, title.text, tr::marked), EntityType::Bold); if (added > 0) { const auto phrase = created diff --git a/Telegram/SourceFiles/api/api_chat_invite.cpp b/Telegram/SourceFiles/api/api_chat_invite.cpp index ccbab9fca1..f1a3f81d1c 100644 --- a/Telegram/SourceFiles/api/api_chat_invite.cpp +++ b/Telegram/SourceFiles/api/api_chat_invite.cpp @@ -224,13 +224,13 @@ void ConfirmSubscriptionBox( box, tr::lng_channel_invite_subscription_about( lt_channel, - rpl::single(Ui::Text::Bold(name)), + rpl::single(tr::bold(name)), lt_price, tr::lng_credits_summary_options_credits( lt_count, rpl::single(amount) | tr::to_count(), - Ui::Text::Bold), - Ui::Text::WithEntities), + tr::bold), + tr::marked), st::inviteLinkSubscribeBoxAbout), style::al_top); Ui::AddSkip(content); @@ -243,9 +243,9 @@ void ConfirmSubscriptionBox( tr::lng_paid_react_agree_link(), tr::lng_group_invite_subscription_about_url() ) | rpl::map([](const QString &text, const QString &url) { - return Ui::Text::Link(text, url); + return tr::link(text, url); }), - Ui::Text::RichLangValue), + tr::rich), st::inviteLinkSubscribeBoxTerms), style::al_top); diff --git a/Telegram/SourceFiles/api/api_suggest_post.cpp b/Telegram/SourceFiles/api/api_suggest_post.cpp index b72a245700..668966bffb 100644 --- a/Telegram/SourceFiles/api/api_suggest_post.cpp +++ b/Telegram/SourceFiles/api/api_suggest_post.cpp @@ -154,13 +154,13 @@ void ConfirmApproval( ? tr::lng_suggest_accept_text( tr::now, lt_from, - Ui::Text::Bold(item->from()->shortName()), - Ui::Text::WithEntities) + tr::bold(item->from()->shortName()), + tr::marked) : tr::lng_suggest_accept_text_to( tr::now, lt_channel, - Ui::Text::Bold(channelName), - Ui::Text::WithEntities); + tr::bold(channelName), + tr::marked); if (price) { text.append("\n\n").append(admin ? (scheduleDate @@ -171,12 +171,12 @@ void ConfirmApproval( lt_count_decimal, amount.value(), lt_channel, - Ui::Text::Bold(channelName), + tr::bold(channelName), lt_percent, TextWithEntities{ commission }, lt_date, - Ui::Text::Bold(date), - Ui::Text::RichLangValue) + tr::bold(date), + tr::rich) : (amount.stars() ? tr::lng_suggest_accept_receive_now_stars : tr::lng_suggest_accept_receive_now_ton)( @@ -184,10 +184,10 @@ void ConfirmApproval( lt_count_decimal, amount.value(), lt_channel, - Ui::Text::Bold(channelName), + tr::bold(channelName), lt_percent, TextWithEntities{ commission }, - Ui::Text::RichLangValue)) + tr::rich)) : (scheduleDate ? (amount.stars() ? tr::lng_suggest_accept_pay_stars @@ -196,25 +196,25 @@ void ConfirmApproval( lt_count_decimal, amount.value(), lt_date, - Ui::Text::Bold(date), - Ui::Text::RichLangValue) + tr::bold(date), + tr::rich) : (amount.stars() ? tr::lng_suggest_accept_pay_now_stars : tr::lng_suggest_accept_pay_now_ton)( tr::now, lt_count_decimal, amount.value(), - Ui::Text::RichLangValue))); + tr::rich))); if (admin) { text.append(' ').append( tr::lng_suggest_accept_receive_if( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); if (price.stars()) { text.append("\n\n").append( tr::lng_suggest_options_stars_warning( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); } } } @@ -321,12 +321,12 @@ void RequestDeclineComment( .text = (admin ? tr::lng_suggest_decline_text( lt_from, - rpl::single(Ui::Text::Bold(item->from()->shortName())), - Ui::Text::WithEntities) + rpl::single(tr::bold(item->from()->shortName())), + tr::marked) : tr::lng_suggest_decline_text_to( lt_channel, - rpl::single(Ui::Text::Bold(channelName)), - Ui::Text::WithEntities)), + rpl::single(tr::bold(channelName)), + tr::marked)), .confirmed = [=](Fn close) { (*callback)(); close(); }, .confirmText = tr::lng_suggest_action_decline(), .confirmStyle = &st::attentionBoxButton, diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index e982a1a779..7436e8ab39 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -487,7 +487,7 @@ void ApiWrap::sendMessageFail( PeerFloodErrorText(&session(), PeerFloodType::Send)), Ui::LayerOption::CloseOther); } else if (show && error == u"USER_BANNED_IN_CHANNEL"_q) { - const auto link = Ui::Text::Link( + const auto link = tr::link( tr::lng_cant_more_info(tr::now), session().createInternalLinkFull(u"spambot"_q)); show->showBox( @@ -496,7 +496,7 @@ void ApiWrap::sendMessageFail( tr::now, lt_more_info, link, - Ui::Text::WithEntities)), + tr::marked)), Ui::LayerOption::CloseOther); } else if (error.startsWith(u"SLOWMODE_WAIT_"_q)) { const auto chop = u"SLOWMODE_WAIT_"_q.size(); diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index 664799d0f1..972c2d0fd2 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -36,29 +36,29 @@ namespace { rpl::producer Text1() { return tr::lng_about_text1( lt_api_link, - tr::lng_about_text1_api( - ) | Ui::Text::ToLink("https://core.telegram.org/api"), - Ui::Text::WithEntities); + tr::lng_about_text1_api(tr::url(u"https://core.telegram.org/api"_q)), + tr::marked); + tr::link; } rpl::producer Text2() { return tr::lng_about_text2( lt_gpl_link, - rpl::single(Ui::Text::Link( + rpl::single(tr::link( "GNU GPL", "https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE")), lt_github_link, - rpl::single(Ui::Text::Link( + rpl::single(tr::link( "GitHub", "https://github.com/telegramdesktop/tdesktop")), - Ui::Text::WithEntities); + tr::marked); } rpl::producer Text3() { return tr::lng_about_text3( lt_faq_link, - tr::lng_about_text3_faq() | Ui::Text::ToLink(telegramFaqLink()), - Ui::Text::WithEntities); + tr::lng_about_text3_faq(tr::url(telegramFaqLink())), + tr::marked); } } // namespace @@ -217,11 +217,11 @@ void ArchiveHintBox( lt_emoji, rpl::single( Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link(std::move(text), 1); + return tr::link(std::move(text), 1); }), - Ui::Text::RichLangValue), + tr::rich), st::channelEarnHistoryRecipientLabel)); label->resizeToWidth(box->width() - rect::m::sum::h(st::boxRowPadding)); diff --git a/Telegram/SourceFiles/boxes/about_sponsored_box.cpp b/Telegram/SourceFiles/boxes/about_sponsored_box.cpp index e7751ac67b..f377c34782 100644 --- a/Telegram/SourceFiles/boxes/about_sponsored_box.cpp +++ b/Telegram/SourceFiles/boxes/about_sponsored_box.cpp @@ -61,9 +61,9 @@ void AboutSponsoredBox(not_null box) { tr::lng_sponsored_info_description1_link(), tr::lng_sponsored_info_description1_url() ) | rpl::map([](const QString &text, const QString &url) { - return Ui::Text::Link(text, url); + return tr::link(text, url); }), - Ui::Text::RichLangValue); + tr::rich); box->addRow(object_ptr(box, std::move(text1), stLabel)); box->addSkip(st::sponsoredUrlButtonSkip); diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 514d7bc43a..af5a5b088a 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -160,7 +160,7 @@ void MustBePublicFailed( TextWithEntities PeerFloodErrorText( not_null session, PeerFloodType type) { - const auto link = Ui::Text::Link( + const auto link = tr::link( tr::lng_cant_more_info(tr::now), session->createInternalLinkFull(u"spambot"_q)); return ((type == PeerFloodType::InviteGroup) @@ -169,7 +169,7 @@ TextWithEntities PeerFloodErrorText( tr::now, lt_more_info, link, - Ui::Text::WithEntities); + tr::marked); } void ShowAddParticipantsError( diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.cpp b/Telegram/SourceFiles/boxes/choose_filter_box.cpp index fbefdce76d..b6925504a7 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/choose_filter_box.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/filter_icons.h" #include "ui/painter.h" #include "ui/rect.h" -#include "ui/text/text_utilities.h" // Ui::Text::Bold +#include "ui/text/text_utilities.h" // tr::bold #include "ui/toast/toast.h" #include "ui/widgets/buttons.h" #include "ui/widgets/menu/menu_action.h" @@ -179,10 +179,10 @@ void ChangeFilterById( : tr::lng_filters_toast_remove)( tr::now, lt_chat, - Ui::Text::Bold(chat), + tr::bold(chat), lt_folder, Ui::Text::Wrapped(name.text, EntityType::Bold), - Ui::Text::WithEntities), + tr::marked), .textContext = Core::TextContext({ .session = &history->session(), .customEmojiLoopLimit = isStatic ? -1 : 0, diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 5a954eb0f5..c26d572b48 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -485,7 +485,7 @@ void ProxyRow::updateFields(View &&view) { TextWithEntities() .append(_view.type) .append(' ') - .append(Ui::Text::Link(endpoint, QString())), + .append(tr::link(endpoint, QString())), Ui::ItemTextDefaultOptions()); const auto state = _view.state; diff --git a/Telegram/SourceFiles/boxes/delete_messages_box.cpp b/Telegram/SourceFiles/boxes/delete_messages_box.cpp index c4bd9751ef..f256dd34dd 100644 --- a/Telegram/SourceFiles/boxes/delete_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/delete_messages_box.cpp @@ -99,7 +99,7 @@ void DeleteMessagesBox::prepare() { lt_date, TextWithEntities{ langDayOfMonthFull(_wipeHistoryFirstToDelete) }, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_sure_delete_by_date_many( tr::now, lt_days, @@ -108,8 +108,8 @@ void DeleteMessagesBox::prepare() { lt_count, _wipeHistoryFirstToDelete.daysTo( _wipeHistoryLastToDelete) + 1, - Ui::Text::WithEntities), - Ui::Text::RichLangValue); + tr::marked), + tr::rich); deleteStyle = &st::attentionBoxButton; } else if (_wipeHistoryJustClear) { const auto isChannel = peer->isChannel() && !peer->isMegagroup(); @@ -130,7 +130,7 @@ void DeleteMessagesBox::prepare() { tr::now, lt_group, peer->name()); - details = Ui::Text::RichLangValue(details.text); + details = tr::rich(details.text); deleteStyle = &st::attentionBoxButton; } else { details.text = peer->isSelf() @@ -148,7 +148,7 @@ void DeleteMessagesBox::prepare() { : peer->isMegagroup() ? tr::lng_sure_leave_group(tr::now) : tr::lng_sure_leave_channel(tr::now); - details = Ui::Text::RichLangValue(details.text); + details = tr::rich(details.text); if (!peer->isUser()) { *deleteText = tr::lng_box_leave(); } @@ -201,8 +201,8 @@ void DeleteMessagesBox::prepare() { tr::lng_delete_all_from_user( tr::now, lt_user, - Ui::Text::Bold(_moderateFrom->name()), - Ui::Text::WithEntities), + tr::bold(_moderateFrom->name()), + tr::marked), false, st::defaultBoxCheckbox); @@ -396,7 +396,7 @@ auto DeleteMessagesBox::revokeText(not_null peer) const tr::now, lt_user, { user->firstName }, - Ui::Text::RichLangValue); + tr::rich); } else { result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now); } @@ -429,7 +429,7 @@ auto DeleteMessagesBox::revokeText(not_null peer) const tr::now, lt_user, { user->firstName }, - Ui::Text::RichLangValue); + tr::rich); } else { result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now); } @@ -441,27 +441,27 @@ auto DeleteMessagesBox::revokeText(not_null peer) const result.description = tr::lng_selected_unsend_about_user_one( tr::now, lt_user, - Ui::Text::Bold(user->shortName()), - Ui::Text::WithEntities); + tr::bold(user->shortName()), + tr::marked); } else { result.description = tr::lng_selected_unsend_about_user( tr::now, lt_count, canRevokeOutgoingCount, lt_user, - Ui::Text::Bold(user->shortName()), - Ui::Text::WithEntities); + tr::bold(user->shortName()), + tr::marked); } } else if (canRevokeOutgoingCount == 1) { result.description = tr::lng_selected_unsend_about_group_one( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.description = tr::lng_selected_unsend_about_group( tr::now, lt_count, canRevokeOutgoingCount, - Ui::Text::WithEntities); + tr::marked); } return result; } @@ -557,7 +557,7 @@ void DeleteMessagesBox::deleteAndClear() { ? tr::lng_suggest_warn_text_ton : tr::lng_suggest_warn_text_stars)( tr::now, - Ui::Text::RichLangValue), + tr::rich), .confirmed = callback, .confirmText = tr::lng_suggest_warn_delete_anyway(tr::now), .confirmStyle = &st::attentionBoxButton, diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index 0d88dae9dc..0c1c8264b1 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -907,7 +907,7 @@ void EditPrivacyBox::setupContent() { const auto never = addExceptionLink(Exception::Never); addLabel( content, - _controller->exceptionsDescription() | Ui::Text::ToWithEntities(), + _controller->exceptionsDescription() | rpl::map(tr::marked), st::defaultVerticalListSkip); auto below = _controller->setupBelowWidget( @@ -1092,15 +1092,15 @@ void EditMessagesPrivacyBox( using WeakToast = base::weak_ptr; const auto toast = std::make_shared(); const auto showToast = [=] { - auto link = Ui::Text::Link( - Ui::Text::Semibold( + auto link = tr::link( + tr::semibold( tr::lng_messages_privacy_premium_link(tr::now))); (*toast) = controller->showToast({ .text = tr::lng_messages_privacy_premium( tr::now, lt_link, link, - Ui::Text::WithEntities), + tr::marked), .filter = crl::guard(&controller->session(), [=]( const ClickHandlerPtr &, Qt::MouseButton button) { @@ -1277,7 +1277,7 @@ void EditDirectMessagesPriceBox( .lottieMargins = st::settingsFilterIconPadding, .showFinished = box->showFinishes(), .about = tr::lng_manage_monoforum_about( - Ui::Text::RichLangValue + tr::rich ), .aboutMargins = st::settingsFilterDividerLabelPadding, }); diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp index 6a583d8b8c..54093dc853 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp @@ -541,13 +541,13 @@ void LinkController::addHeader(not_null container) { object_ptr( verticalLayout, (_data.url.isEmpty() - ? tr::lng_filters_link_no_about(Ui::Text::WithEntities) + ? tr::lng_filters_link_no_about(tr::marked) : tr::lng_filters_link_share_about( lt_folder, rpl::single(Ui::Text::Wrapped( _filterTitle.text, EntityType::Bold)), - Ui::Text::WithEntities)), + tr::marked)), st::settingsFilterDividerLabel, st::defaultPopupMenu, Core::TextContext({ diff --git a/Telegram/SourceFiles/boxes/gift_credits_box.cpp b/Telegram/SourceFiles/boxes/gift_credits_box.cpp index da7aef097f..279c77e3ac 100644 --- a/Telegram/SourceFiles/boxes/gift_credits_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_credits_box.cpp @@ -69,9 +69,9 @@ void GiftCreditsBox( auto link = tr::lng_credits_box_history_entry_gift_about_link( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link( + return tr::link( std::move(text), u"internal:stars_examples"_q); }); @@ -83,7 +83,7 @@ void GiftCreditsBox( rpl::single(TextWithEntities{ peer->shortName() }), lt_link, std::move(link), - Ui::Text::RichLangValue), + tr::rich), st::creditsBoxAbout), st::boxRowPadding, style::al_top); diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index a64ad0c55f..4bb5c88100 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -235,10 +235,10 @@ using SpinnerState = Data::GiftUpgradeSpinner::State; tr::lng_gift_value_minimum_price_tooltip( tr::now, lt_amount, - Ui::Text::Bold(text.text), + tr::bold(text.text), lt_gift, - Ui::Text::Bold(unique->title), - Ui::Text::WithEntities)); + tr::bold(unique->title), + tr::marked)); } [[nodiscard]] object_ptr MakeAveragePriceValue( @@ -254,10 +254,10 @@ using SpinnerState = Data::GiftUpgradeSpinner::State; tr::lng_gift_value_average_price_tooltip( tr::now, lt_amount, - Ui::Text::Bold(text.text), + tr::bold(text.text), lt_gift, - Ui::Text::Bold(unique->title), - Ui::Text::WithEntities)); + tr::bold(unique->title), + tr::marked)); } [[nodiscard]] object_ptr MakeAttributeValue( @@ -466,7 +466,7 @@ void AddUniqueGiftPropertyRows( showTooltip(widget, tr::lng_gift_unique_rarity( lt_percent, rpl::single(TextWithEntities{ percent }), - Ui::Text::WithEntities)); + tr::marked)); }; const auto empty = std::vector(); const auto extract = [&](const auto &list) { @@ -646,15 +646,15 @@ void AddTable( AddTableRow( table, tr::lng_gift_link_label_to(), - tr::lng_gift_link_label_to_unclaimed(Ui::Text::WithEntities)); + tr::lng_gift_link_label_to_unclaimed(tr::marked)); } AddTableRow( table, tr::lng_gift_link_label_gift(), tr::lng_gift_link_gift_premium( lt_duration, - GiftDurationValue(current.days) | Ui::Text::ToWithEntities(), - Ui::Text::WithEntities)); + GiftDurationValue(current.days) | rpl::map(tr::marked), + tr::marked)); if (!skipReason && current.from) { const auto reason = AddTableRow( table, @@ -662,15 +662,14 @@ void AddTable( (current.giveawayId ? ((current.to ? tr::lng_gift_link_reason_giveaway - : tr::lng_gift_link_reason_unclaimed)( - ) | Ui::Text::ToLink()) + : tr::lng_gift_link_reason_unclaimed)(tr::link)) : current.giveaway ? ((current.to ? tr::lng_gift_link_reason_giveaway : tr::lng_gift_link_reason_unclaimed)( - Ui::Text::WithEntities + tr::marked ) | rpl::type_erased) - : tr::lng_gift_link_reason_chosen(Ui::Text::WithEntities))); + : tr::lng_gift_link_reason_chosen(tr::marked))); reason->setClickHandlerFilter([=](const auto &...) { if (const auto window = show->resolveWindow()) { window->showPeerHistory( @@ -685,7 +684,7 @@ void AddTable( AddTableRow( table, tr::lng_gift_link_label_date(), - rpl::single(Ui::Text::WithEntities( + rpl::single(tr::marked( langDateTime(base::unixtime::parse(current.date))))); } } @@ -726,11 +725,11 @@ void ShowAlreadyPremiumToast( .text = tr::lng_gift_link_already_about( tr::now, lt_date, - Ui::Text::Bold(langDateTime(base::unixtime::parse(date))), + tr::bold(langDateTime(base::unixtime::parse(date))), lt_link, - Ui::Text::Link( - Ui::Text::Bold(tr::lng_gift_link_already_link(tr::now))), - Ui::Text::WithEntities), + tr::link( + tr::bold(tr::lng_gift_link_already_link(tr::now))), + tr::marked), .filter = crl::guard(navigation, shareLink), .duration = 6 * crl::time(1000), }); @@ -789,8 +788,8 @@ void GiftCodeBox( tr::lng_gift_link_title()), .about = rpl::conditional( state->used.value(), - tr::lng_gift_link_used_about(Ui::Text::RichLangValue), - tr::lng_gift_link_about(Ui::Text::RichLangValue)), + tr::lng_gift_link_used_about(tr::rich), + tr::lng_gift_link_about(tr::rich)), .light = true, })); @@ -815,7 +814,7 @@ void GiftCodeBox( auto shareLink = tr::lng_gift_link_also_send_link( ) | rpl::map([](const QString &text) { - return Ui::Text::Link(text); + return tr::link(text); }); auto richDate = [](const Api::GiftCode &data) { return TextWithEntities{ @@ -830,11 +829,11 @@ void GiftCodeBox( tr::lng_gift_link_used_footer( lt_date, state->data.value() | rpl::map(richDate), - Ui::Text::WithEntities), + tr::marked), tr::lng_gift_link_also_send( lt_link, std::move(shareLink), - Ui::Text::WithEntities)), + tr::marked)), st::giveawayGiftCodeFooter), st::giveawayGiftCodeFooterMargin, style::al_top); @@ -916,8 +915,8 @@ void GiftCodePendingBox( .title = tr::lng_gift_link_title(), .about = tr::lng_gift_link_pending_about( lt_user, - rpl::single(Ui::Text::Link(resultToName)), - Ui::Text::RichLangValue), + rpl::single(tr::link(resultToName)), + tr::rich), .light = true, })); @@ -1040,20 +1039,20 @@ void GiveawayInfoBox( lt_cup, rpl::single( TextWithEntities{ QString::fromUtf8("\xf0\x9f\x8f\x86") }), - Ui::Text::WithEntities) + tr::marked) : (info.credits) ? tr::lng_prizes_you_won_credits( lt_amount, tr::lng_prizes_you_won_credits_amount( lt_count, rpl::single(float64(info.credits)), - Ui::Text::Bold), + tr::bold), lt_cup, rpl::single( TextWithEntities{ QString::fromUtf8("\xf0\x9f\x8f\x86") }), - Ui::Text::WithEntities) + tr::marked) : (info.state == State::Finished) - ? tr::lng_prizes_you_didnt(Ui::Text::WithEntities) + ? tr::lng_prizes_you_didnt(tr::marked) : (rpl::producer)(nullptr); if (resultText) { @@ -1105,14 +1104,14 @@ void GiveawayInfoBox( : tr::lng_prizes_credits_admins)( tr::now, lt_channel, - Ui::Text::Bold(first), + tr::bold(first), lt_amount, tr::lng_prizes_credits_admins_amount( tr::now, lt_count_decimal, float64(credits), - Ui::Text::Bold), - Ui::Text::RichLangValue) + tr::bold), + tr::rich) : (group ? tr::lng_prizes_admins_group : tr::lng_prizes_admins)( @@ -1120,11 +1119,11 @@ void GiveawayInfoBox( lt_count, quantity, lt_channel, - Ui::Text::Bold(first), + tr::bold(first), lt_duration, TextWithEntities{ GiftDuration(months * 30) }, - Ui::Text::RichLangValue), - Ui::Text::RichLangValue)); + tr::rich), + tr::rich)); const auto many = start ? (start->channels.size() > 1) : (results->additionalPeersCount > 0); @@ -1144,8 +1143,8 @@ void GiveawayInfoBox( lt_count, count, lt_channel, - Ui::Text::Bold(first), - Ui::Text::RichLangValue) + tr::bold(first), + tr::rich) : (many ? tr::lng_prizes_winners_new_of_many : tr::lng_prizes_winners_new_of_one)( @@ -1153,11 +1152,11 @@ void GiveawayInfoBox( lt_count, count, lt_channel, - Ui::Text::Bold(first), + tr::bold(first), lt_start_date, - Ui::Text::Bold( + tr::bold( langDateTime(base::unixtime::parse(info.startDate))), - Ui::Text::RichLangValue); + tr::rich); const auto additionalPrize = results ? results->additionalPrize : start->additionalPrize; @@ -1169,10 +1168,10 @@ void GiveawayInfoBox( lt_count, count, lt_channel, - Ui::Text::Bold(first), + tr::bold(first), lt_prize, TextWithEntities{ additionalPrize }, - Ui::Text::RichLangValue)); + tr::rich)); } const auto untilDate = start ? start->untilDate @@ -1182,17 +1181,17 @@ void GiveawayInfoBox( : tr::lng_prizes_how_when_finish)( tr::now, lt_date, - Ui::Text::Bold(langDayOfMonthFull( + tr::bold(langDayOfMonthFull( base::unixtime::parse(untilDate).date())), lt_winners, winners, - Ui::Text::RichLangValue)); + tr::rich)); if (info.activatedCount > 0) { text.append(' ').append(tr::lng_prizes_end_activated( tr::now, lt_count, info.activatedCount, - Ui::Text::RichLangValue)); + tr::rich)); } if (!info.giftCode.isEmpty() || info.state == State::Finished @@ -1206,8 +1205,8 @@ void GiveawayInfoBox( : tr::lng_prizes_how_no_admin)( tr::now, lt_channel, - Ui::Text::Bold(channel->name()), - Ui::Text::RichLangValue)); + tr::bold(channel->name()), + tr::rich)); } else if (info.tooEarlyDate) { const auto channel = controller->session().data().channel( info.adminChannelId); @@ -1216,33 +1215,33 @@ void GiveawayInfoBox( : tr::lng_prizes_how_no_joined)( tr::now, lt_date, - Ui::Text::Bold( + tr::bold( langDateTime( base::unixtime::parse(info.tooEarlyDate))), - Ui::Text::RichLangValue)); + tr::rich)); } else if (!info.disallowedCountry.isEmpty()) { text.append("\n\n").append(tr::lng_prizes_how_no_country( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); } else if (info.participating) { text.append("\n\n").append((many ? tr::lng_prizes_how_yes_joined_many : tr::lng_prizes_how_yes_joined_one)( tr::now, lt_channel, - Ui::Text::Bold(first), - Ui::Text::RichLangValue)); + tr::bold(first), + tr::rich)); } else { text.append("\n\n").append((many ? tr::lng_prizes_how_participate_many : tr::lng_prizes_how_participate_one)( tr::now, lt_channel, - Ui::Text::Bold(first), + tr::bold(first), lt_date, - Ui::Text::Bold(langDayOfMonthFull( + tr::bold(langDayOfMonthFull( base::unixtime::parse(untilDate).date())), - Ui::Text::RichLangValue)); + tr::rich)); } } const auto padding = st::boxPadding; @@ -1380,7 +1379,7 @@ struct AddedUniqueDetails { rpl::single( Ui::Text::IconEmoji(&st::starIconEmoji).append( Lang::FormatCountDecimal(removeCost))), - Ui::Text::RichLangValue), + tr::rich), .title = tr::lng_gift_unique_info_remove_title(), }); box->addRow( @@ -1460,8 +1459,8 @@ void AddStarGiftTable( const auto show = [&](const auto &phrase) { showTooltip(badge, phrase( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*unique))), - Ui::Text::WithEntities)); + rpl::single(tr::bold(UniqueGiftName(*unique))), + tr::marked)); }; if (!*was || *was == id) { *was = id; @@ -1510,8 +1509,8 @@ void AddStarGiftTable( const auto show = [&](const auto &phrase) { showTooltip(badge, phrase( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*unique))), - Ui::Text::WithEntities)); + rpl::single(tr::bold(UniqueGiftName(*unique))), + tr::marked)); }; if (!*was || *was == id) { *was = id; @@ -1582,21 +1581,21 @@ void AddStarGiftTable( AddTableRow( table, tr::lng_gift_link_label_first_sale(), - rpl::single(Ui::Text::WithEntities( + rpl::single(tr::marked( langDateTime(entry.firstSaleDate)))); } if (!unique && !entry.lastSaleDate.isNull()) { AddTableRow( table, tr::lng_gift_link_label_last_sale(), - rpl::single(Ui::Text::WithEntities( + rpl::single(tr::marked( langDateTime(entry.lastSaleDate)))); } if (!unique && !entry.date.isNull()) { AddTableRow( table, tr::lng_gift_link_label_date(), - rpl::single(Ui::Text::WithEntities(langDateTime(entry.date)))); + rpl::single(tr::marked(langDateTime(entry.date)))); } if (unique) { AddUniqueGiftPropertyRows(container, table, unique, spinner); @@ -1626,7 +1625,7 @@ void AddStarGiftTable( ? tr::lng_gift_availability_none( lt_amount, std::move(amount), - Ui::Text::WithEntities) + tr::marked) : (unique ? tr::lng_gift_unique_availability : tr::lng_gift_availability_left)( @@ -1634,13 +1633,13 @@ void AddStarGiftTable( rpl::single(count * 1.), lt_amount, std::move(amount), - Ui::Text::WithEntities))); + tr::marked))); } if (!unique && !entry.soldOutInfo && canStartUpgrade) { AddTableRow( table, tr::lng_gift_unique_status(), - tr::lng_gift_unique_status_non(Ui::Text::WithEntities)); + tr::lng_gift_unique_status_non(tr::marked)); } if (unique) { if (unique->value) { @@ -1662,37 +1661,37 @@ void AddStarGiftTable( ? (original.message.empty() ? tr::lng_gift_unique_info_sender( lt_from, - rpl::single(Ui::Text::Link(from->name(), 2)), + rpl::single(tr::link(from->name(), 2)), lt_recipient, - rpl::single(Ui::Text::Link(to->name(), 1)), + rpl::single(tr::link(to->name(), 1)), lt_date, rpl::single(dateText), - Ui::Text::WithEntities) + tr::marked) : tr::lng_gift_unique_info_sender_comment( lt_from, - rpl::single(Ui::Text::Link(from->name(), 2)), + rpl::single(tr::link(from->name(), 2)), lt_recipient, - rpl::single(Ui::Text::Link(to->name(), 1)), + rpl::single(tr::link(to->name(), 1)), lt_date, rpl::single(dateText), lt_text, rpl::single(original.message), - Ui::Text::WithEntities)) + tr::marked)) : (original.message.empty() ? tr::lng_gift_unique_info_reciever( lt_recipient, - rpl::single(Ui::Text::Link(to->name(), 1)), + rpl::single(tr::link(to->name(), 1)), lt_date, rpl::single(dateText), - Ui::Text::WithEntities) + tr::marked) : tr::lng_gift_unique_info_reciever_comment( lt_recipient, - rpl::single(Ui::Text::Link(to->name(), 1)), + rpl::single(tr::link(to->name(), 1)), lt_date, rpl::single(dateText), lt_text, rpl::single(original.message), - Ui::Text::WithEntities)); + tr::marked)); const auto tmp = std::make_shared(nullptr); auto made = MakeUniqueDetails( show, @@ -1795,7 +1794,7 @@ void AddCreditsHistoryEntryTable( table, tr::lng_gift_link_label_reason(), tr::lng_credits_box_history_entry_reason_star_ref( - Ui::Text::WithEntities)); + tr::marked)); } } if (starrefRecipientId && entry.starrefAmount && !entry.giftResale) { @@ -1861,7 +1860,7 @@ void AddCreditsHistoryEntryTable( entry.bareMsgId); auto label = object_ptr( table, - rpl::single(Ui::Text::Link(link)), + rpl::single(tr::link(link)), table->st().defaultValue); label->setClickHandlerFilter([=](const auto &...) { if (const auto window = show->resolveWindow()) { @@ -1883,13 +1882,13 @@ void AddCreditsHistoryEntryTable( table, tr::lng_credits_box_history_entry_via(), tr::lng_credits_box_history_entry_app_store( - Ui::Text::RichLangValue)); + tr::rich)); } else if (entry.peerType == Type::PlayMarket) { AddTableRow( table, tr::lng_credits_box_history_entry_via(), tr::lng_credits_box_history_entry_play_market( - Ui::Text::RichLangValue)); + tr::rich)); } else if (entry.peerType == Type::Fragment) { AddTableRow( table, @@ -1899,18 +1898,18 @@ void AddCreditsHistoryEntryTable( ((entry.gift && entry.credits.stars()) ? tr::lng_credits_box_history_entry_anonymous : tr::lng_credits_box_history_entry_fragment)( - Ui::Text::RichLangValue)); + tr::rich)); } else if (entry.peerType == Type::Ads) { AddTableRow( table, tr::lng_credits_box_history_entry_via(), - tr::lng_credits_box_history_entry_ads(Ui::Text::RichLangValue)); + tr::lng_credits_box_history_entry_ads(tr::rich)); } else if (entry.peerType == Type::PremiumBot) { AddTableRow( table, tr::lng_credits_box_history_entry_via(), tr::lng_credits_box_history_entry_via_premium_bot( - Ui::Text::RichLangValue)); + tr::rich)); } if (entry.bareGiveawayMsgId) { AddTableRow( @@ -1926,7 +1925,7 @@ void AddCreditsHistoryEntryTable( tr::lng_gift_stars_title( lt_count, rpl::single(entry.credits.value()), - Ui::Text::RichLangValue)); + tr::rich)); } { const auto link = CreateMessageLink( @@ -1939,7 +1938,7 @@ void AddCreditsHistoryEntryTable( tr::lng_gift_link_label_reason(), tr::lng_gift_link_reason_giveaway( ) | rpl::map([link](const QString &text) { - return Ui::Text::Link(text, link); + return tr::link(text, link); })); } } @@ -1948,7 +1947,7 @@ void AddCreditsHistoryEntryTable( table, tr::lng_gift_link_label_reason(), tr::lng_credits_box_history_entry_subscription( - Ui::Text::WithEntities)); + tr::marked)); } if (entry.paidMessagesAmount) { auto value = Ui::Text::IconEmoji(&st::starIconEmojiColored); @@ -1967,7 +1966,7 @@ void AddCreditsHistoryEntryTable( tr::lng_months( lt_count, rpl::single(1. * months), - Ui::Text::WithEntities)); + tr::marked)); } if (!entry.id.isEmpty()) { auto label = MakeMaybeMultilineTokenValue(table, entry.id, st); @@ -1988,27 +1987,27 @@ void AddCreditsHistoryEntryTable( table, tr::lng_credits_box_history_entry_floodskip_row(), rpl::single( - Ui::Text::WithEntities( + tr::marked( Lang::FormatCountDecimal(entry.floodSkip)))); } if (!entry.date.isNull()) { AddTableRow( table, tr::lng_gift_link_label_date(), - rpl::single(Ui::Text::WithEntities(langDateTime(entry.date)))); + rpl::single(tr::marked(langDateTime(entry.date)))); } if (!entry.successDate.isNull()) { AddTableRow( table, tr::lng_credits_box_history_entry_success_date(), - rpl::single(Ui::Text::WithEntities(langDateTime(entry.date)))); + rpl::single(tr::marked(langDateTime(entry.date)))); } if (!entry.successLink.isEmpty()) { AddTableRow( table, tr::lng_credits_box_history_entry_success_url(), rpl::single( - Ui::Text::Link(entry.successLink, entry.successLink))); + tr::link(entry.successLink, entry.successLink))); } if (entry.limitedCount > 0 && entry.limitedLeft >= 0) { AddTableRow( @@ -2021,7 +2020,7 @@ void AddCreditsHistoryEntryTable( rpl::single(TextWithEntities{ Lang::FormatCountDecimal(entry.limitedCount) }), - Ui::Text::WithEntities)); + tr::marked)); } } @@ -2055,7 +2054,7 @@ void AddSubscriptionEntryTable( AddTableRow( table, tr::lng_credits_subscription_row_to(), - rpl::single(Ui::Text::WithEntities(s.title))); + rpl::single(tr::marked(s.title))); } if (!s.until.isNull()) { if (s.subscription.period > 0) { @@ -2065,7 +2064,7 @@ void AddSubscriptionEntryTable( table, tr::lng_group_invite_joined_row_date(), rpl::single( - Ui::Text::WithEntities(langDateTime(subscribed)))); + tr::marked(langDateTime(subscribed)))); } } AddTableRow( @@ -2075,7 +2074,7 @@ void AddSubscriptionEntryTable( : s.cancelled ? tr::lng_credits_subscription_row_next_off() : tr::lng_credits_subscription_row_next_on(), - rpl::single(Ui::Text::WithEntities(langDateTime(s.until)))); + rpl::single(tr::marked(langDateTime(s.until)))); } } @@ -2099,7 +2098,7 @@ void AddSubscriberEntryTable( AddTableRow( table, tr::lng_group_invite_joined_row_date(), - rpl::single(Ui::Text::WithEntities(langDateTime(d)))); + rpl::single(tr::marked(langDateTime(d)))); } } @@ -2130,7 +2129,7 @@ void AddCreditsBoostTable( tr::lng_gift_stars_title( lt_count, rpl::single(float64(b.credits)), - Ui::Text::RichLangValue)); + tr::rich)); } { const auto link = CreateMessageLink( @@ -2143,7 +2142,7 @@ void AddCreditsBoostTable( tr::lng_gift_link_label_reason(), tr::lng_gift_link_reason_giveaway( ) | rpl::map([link](const QString &text) { - return Ui::Text::Link(text, link); + return tr::link(text, link); })); } } @@ -2151,13 +2150,13 @@ void AddCreditsBoostTable( AddTableRow( table, tr::lng_gift_link_label_date(), - rpl::single(Ui::Text::WithEntities(langDateTime(b.date)))); + rpl::single(tr::marked(langDateTime(b.date)))); } if (!b.expiresAt.isNull()) { AddTableRow( table, tr::lng_gift_until(), - rpl::single(Ui::Text::WithEntities(langDateTime(b.expiresAt)))); + rpl::single(tr::marked(langDateTime(b.expiresAt)))); } } @@ -2219,7 +2218,7 @@ void AddUniqueGiftValueTable( value->initialSalePrice, value->currency, true)), - Ui::Text::WithEntities), + tr::marked), helper.context()); if (value->lastSaleDate) { AddTableRow( diff --git a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp index 75086cad2b..14227728c4 100644 --- a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp @@ -297,12 +297,12 @@ void CreateModerateMessagesBox( !(isSingle) ? tr::lng_delete_all_from_users( tr::now, - Ui::Text::WithEntities) + tr::marked) : tr::lng_delete_all_from_user( tr::now, lt_user, - Ui::Text::Bold(firstItem->from()->name()), - Ui::Text::WithEntities), + tr::bold(firstItem->from()->name()), + tr::marked), false, st::defaultBoxCheckbox), st::boxRowPadding + buttonPadding); @@ -456,10 +456,10 @@ void CreateModerateMessagesBox( : tr::lng_restrict_users_full)( lt_emoji, rpl::single(toggled ? emojiUp : emojiDown), - Ui::Text::WithEntities); + tr::marked); }) | rpl::flatten_latest( ) | rpl::on_next([=](const TextWithEntities &text) { - raw->setMarkedText(Ui::Text::Link(text, u"internal:"_q)); + raw->setMarkedText(tr::link(text, u"internal:"_q)); }, label->lifetime()); Ui::AddSkip(inner); @@ -622,12 +622,12 @@ void DeleteChatBox(not_null box, not_null peer) { Ui::CreateChild( container, peer->isSelf() - ? tr::lng_saved_messages() | Ui::Text::ToBold() + ? tr::lng_saved_messages(tr::bold) : maybeUser - ? tr::lng_profile_delete_conversation() | Ui::Text::ToBold() + ? tr::lng_profile_delete_conversation(tr::bold) : rpl::single( - userpicPeer->name() - ) | Ui::Text::ToBold() | rpl::type_erased, + tr::bold(userpicPeer->name()) + ) | rpl::type_erased, box->getDelegate()->style().title)); Ui::AddSkip(container); @@ -661,10 +661,10 @@ void DeleteChatBox(not_null box, not_null peer) { tr::now, lt_user, TextWithEntities{ maybeUser->firstName }, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_delete_for_everyone_check( tr::now, - Ui::Text::WithEntities), + tr::marked), false, st::defaultBoxCheckbox)); }(); @@ -678,7 +678,7 @@ void DeleteChatBox(not_null box, not_null peer) { return box->addRow( object_ptr( container, - tr::lng_profile_block_bot(tr::now, Ui::Text::WithEntities), + tr::lng_profile_block_bot(tr::now, tr::marked), false, st::defaultBoxCheckbox)); }(); @@ -712,7 +712,7 @@ void DeleteChatBox(not_null box, not_null peer) { ? tr::lng_filters_checkbox_remove_channel : tr::lng_filters_checkbox_remove_group)( tr::now, - Ui::Text::WithEntities), + tr::marked), false, st::defaultBoxCheckbox)); }(); @@ -794,7 +794,7 @@ void DeleteSublistBox( userpic, Ui::CreateChild( container, - tr::lng_profile_delete_conversation() | Ui::Text::ToBold(), + tr::lng_profile_delete_conversation(tr::bold), box->getDelegate()->style().title)); Ui::AddSkip(container); diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index 6f7a202e1c..20bbb9f565 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -73,17 +73,17 @@ void TransferPasswordError( auto text = std::move(about).append('\n').append('\n').append( tr::lng_rights_transfer_check_password( tr::now, - Ui::Text::RichLangValue) + tr::rich) ).append('\n').append('\n').append( tr::lng_rights_transfer_check_session( tr::now, - Ui::Text::RichLangValue) + tr::rich) ); if (error == PasswordErrorType::Later) { text.append('\n').append('\n').append( tr::lng_rights_transfer_check_later( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); } box->addRow(object_ptr( box, @@ -1152,7 +1152,7 @@ RecoverBox::RecoverBox( tr::lng_signin_recover_hint( lt_recover_email, rpl::single(Ui::Text::WrapEmailPattern(pattern)), - Ui::Text::WithEntities), + tr::marked), st::termsContent, st::defaultPopupMenu) , _closeParent(std::move(closeParent)) { diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index ad9e2becca..503524ee99 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -788,11 +788,11 @@ RecipientMoneyRestrictionError WriteMoneyRestrictionError( lt_user, TextWithEntities{ user->shortName() }, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_send_non_premium_message_toast_link( tr::now))), - Ui::Text::RichLangValue), + tr::rich), }; } diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index a2c635810d..974a90b532 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/boxes/confirm_box.h" #include "ui/boxes/show_or_premium_box.h" #include "ui/effects/premium_graphics.h" -#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue +#include "ui/text/text_utilities.h" // tr::rich #include "ui/toast/toast.h" #include "ui/widgets/buttons.h" #include "ui/widgets/checkbox.h" @@ -191,17 +191,17 @@ void FillUpgradeToPremiumCover( for (auto i = 0; i != names; ++i) { const auto name = userpicUsers[i]->shortName(); if (text.empty()) { - text = Ui::Text::Bold(name); + text = tr::bold(name); } else if (i == names - 1 && !remaining) { text = tr::lng_invite_upgrade_users_few( tr::now, lt_users, text, lt_last, - Ui::Text::Bold(name), - Ui::Text::RichLangValue); + tr::bold(name), + tr::rich); } else { - text.append(", ").append(Ui::Text::Bold(name)); + text.append(", ").append(tr::bold(name)); } } if (remaining > 0) { @@ -211,7 +211,7 @@ void FillUpgradeToPremiumCover( remaining, lt_users, text, - Ui::Text::RichLangValue); + tr::rich); } const auto inviteOnly = !forbidden.premiumAllowsInvite.empty() && (forbidden.premiumAllowsWrite.size() != forbidden.users.size()); @@ -227,7 +227,7 @@ void FillUpgradeToPremiumCover( int(userpicUsers.size()), lt_users, text, - Ui::Text::RichLangValue); + tr::rich); container->add( object_ptr( container, @@ -474,11 +474,11 @@ void InviteForbiddenController::setSimpleCover() { ? phraseCounted( lt_count, rpl::single(count), - Ui::Text::RichLangValue) + tr::rich) : phraseNamed( lt_user, rpl::single(TextWithEntities{ _users.front()->name() }), - Ui::Text::RichLangValue); + tr::rich); delegate()->peerListSetAboveWidget(object_ptr>( (QWidget*)nullptr, object_ptr( @@ -530,18 +530,18 @@ void InviteForbiddenController::setComplexCover() { ? tr::lng_invite_upgrade_via_channel_about : tr::lng_invite_upgrade_via_group_about)( tr::now, - Ui::Text::WithEntities) + tr::marked) : (_forbidden.users.size() == 1 ? tr::lng_via_link_cant_one( tr::now, lt_user, TextWithEntities{ _forbidden.users.front()->shortName() }, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_via_link_cant_many( tr::now, lt_count, int(_forbidden.users.size()), - Ui::Text::RichLangValue)); + tr::rich)); container->add( object_ptr( container, @@ -721,12 +721,12 @@ void InviteForbiddenController::send( tr::now, lt_user, TextWithEntities{ list.front()->name() }, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_via_link_shared_many( tr::now, lt_count, int(list.size()), - Ui::Text::RichLangValue); + tr::rich); close(); show->showToast(std::move(text)); return true; @@ -989,14 +989,14 @@ void AddParticipantsBoxController::inviteSelectedUsers( { users.front()->name()}, lt_group, { _peer->name()}, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_participant_invite_sure_many( tr::now, lt_count, int(users.size()), lt_group, { _peer->name() }, - Ui::Text::RichLangValue); + tr::rich); Ui::ConfirmBox(box, { .text = std::move(text), .confirmed = crl::guard(weak, [=](Fn &&close) { diff --git a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp index bf831f0282..3f5815771f 100644 --- a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp @@ -202,10 +202,10 @@ object_ptr MakeConfirmBox( auto text = tr::lng_request_peer_confirm( tr::now, lt_chat, - Ui::Text::Bold(name), + tr::bold(name), lt_bot, - Ui::Text::Bold(botName), - Ui::Text::WithEntities); + tr::bold(botName), + tr::marked); if (!peer->isUser()) { const auto rights = peer->isBroadcast() ? BroadcastRightsText(query.botRights) @@ -215,12 +215,12 @@ object_ptr MakeConfirmBox( tr::lng_request_peer_confirm_rights( tr::now, lt_bot, - Ui::Text::Bold(botName), + tr::bold(botName), lt_chat, - Ui::Text::Bold(name), + tr::bold(name), lt_rights, TextWithEntities{ rights }, - Ui::Text::WithEntities)); + tr::marked)); } else if (!peer->isBroadcast() && query.isBotParticipant) { const auto common = bot->session().api().botCommonGroups(bot); if (!common || !ranges::contains(*common, peer)) { @@ -228,10 +228,10 @@ object_ptr MakeConfirmBox( tr::lng_request_peer_confirm_add( tr::now, lt_bot, - Ui::Text::Bold(botName), + tr::bold(botName), lt_chat, - Ui::Text::Bold(name), - Ui::Text::WithEntities)); + tr::bold(name), + tr::marked)); } } } diff --git a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp index a435c5ffc9..d98131fc16 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp @@ -751,13 +751,13 @@ void Controller::showPhotoMenu(bool suggest) { ? tr::lng_profile_suggest_sure( tr::now, lt_user, - Ui::Text::Bold(_user->shortName()), - Ui::Text::WithEntities) + tr::bold(_user->shortName()), + tr::marked) : tr::lng_profile_set_personal_sure( tr::now, lt_user, - Ui::Text::Bold(_user->shortName()), - Ui::Text::WithEntities)), + tr::bold(_user->shortName()), + tr::marked)), .confirm = (suggest ? tr::lng_profile_suggest_button(tr::now) : tr::lng_profile_set_photo_button(tr::now)), @@ -798,13 +798,13 @@ void Controller::choosePhotoFile(bool suggest) { ? tr::lng_profile_suggest_sure( tr::now, lt_user, - Ui::Text::Bold(_user->shortName()), - Ui::Text::WithEntities) + tr::bold(_user->shortName()), + tr::marked) : tr::lng_profile_set_personal_sure( tr::now, lt_user, - Ui::Text::Bold(_user->shortName()), - Ui::Text::WithEntities)), + tr::bold(_user->shortName()), + tr::marked)), .confirm = (suggest ? tr::lng_profile_suggest_button(tr::now) : tr::lng_profile_set_photo_button(tr::now)), diff --git a/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp index 9a2896d52e..8f5154c955 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/vertical_list.h" #include "ui/widgets/buttons.h" #include "ui/wrap/vertical_layout.h" -#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue +#include "ui/text/text_utilities.h" // tr::rich #include "boxes/peer_list_box.h" #include "ui/boxes/confirm_box.h" #include "boxes/add_contact_box.h" @@ -146,10 +146,10 @@ void Controller::choose(not_null chat) { auto text = tr::lng_manage_discussion_group_sure( tr::now, lt_group, - Ui::Text::Bold(chat->name()), + tr::bold(chat->name()), lt_channel, - Ui::Text::Bold(_channel->name()), - Ui::Text::WithEntities); + tr::bold(_channel->name()), + tr::marked); if (!_channel->isPublic()) { text.append( "\n\n" + tr::lng_manage_linked_channel_private(tr::now)); @@ -161,7 +161,7 @@ void Controller::choose(not_null chat) { text.append("\n\n"); text.append(tr::lng_manage_discussion_group_warning( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); } } const auto sure = [=](Fn &&close) { @@ -180,10 +180,10 @@ void Controller::choose(not_null chat) { auto text = tr::lng_manage_discussion_group_sure( tr::now, lt_group, - Ui::Text::Bold(chat->name()), + tr::bold(chat->name()), lt_channel, - Ui::Text::Bold(_channel->name()), - Ui::Text::WithEntities); + tr::bold(_channel->name()), + tr::marked); if (!_channel->isPublic()) { text.append("\n\n" + tr::lng_manage_linked_channel_private(tr::now)); } @@ -191,7 +191,7 @@ void Controller::choose(not_null chat) { text.append("\n\n"); text.append(tr::lng_manage_discussion_group_warning( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); const auto sure = [=](Fn &&close) { close(); const auto done = [=](not_null chat) { @@ -213,15 +213,15 @@ void Controller::choose(not_null chat) { if (!channel->isBroadcast()) { return tr::lng_manage_linked_channel_about( lt_channel, - rpl::single(Ui::Text::Bold(chat->name())), - Ui::Text::WithEntities); + rpl::single(tr::bold(chat->name())), + tr::marked); } else if (chat != nullptr) { return tr::lng_manage_discussion_group_about_chosen( lt_group, - rpl::single(Ui::Text::Bold(chat->name())), - Ui::Text::WithEntities); + rpl::single(tr::bold(chat->name())), + tr::marked); } - return tr::lng_manage_discussion_group_about(Ui::Text::WithEntities); + return tr::lng_manage_discussion_group_about(tr::marked); } [[nodiscard]] object_ptr EditDiscussionLinkBox( @@ -361,5 +361,5 @@ void ShowForumForDiscussionError( navigation->showToast( tr::lng_forum_topics_no_discussion( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index b00ec51539..494cf4af2a 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -301,11 +301,11 @@ void EditAdminBox::prepare() { tr::lng_rights_about_by( lt_user, rpl::single(_by - ? Ui::Text::Link(_by->name(), 1) + ? tr::link(_by->name(), 1) : TextWithEntities{ QString::fromUtf8("\U0001F47B") }), lt_date, rpl::single(TextWithEntities{ langDateTimeFull(parsed) }), - Ui::Text::WithEntities)); + tr::marked)); if (_by) { label->setLink(1, _by->createOpenLink()); } @@ -465,8 +465,8 @@ void EditAdminBox::prepare() { phrase( tr::now, lt_group, - Ui::Text::Bold(peer()->name()), - Ui::Text::WithEntities), + tr::bold(peer()->name()), + tr::marked), crl::guard(this, [=] { finishAddAdmin(); }) })); } else { @@ -611,10 +611,10 @@ void EditAdminBox::transferOwnership() { .text = tr::lng_rights_transfer_about( tr::now, lt_group, - Ui::Text::Bold(peer()->name()), + tr::bold(peer()->name()), lt_user, - Ui::Text::Bold(user()->shortName()), - Ui::Text::RichLangValue), + tr::bold(user()->shortName()), + tr::rich), .confirmed = callback, .confirmText = tr::lng_rights_transfer_sure(), })); @@ -627,8 +627,8 @@ bool EditAdminBox::handleTransferPasswordError(const QString &error) { auto about = tr::lng_rights_transfer_check_about( tr::now, lt_user, - Ui::Text::Bold(user()->shortName()), - Ui::Text::WithEntities); + tr::bold(user()->shortName()), + tr::marked); if (auto box = PrePasswordErrorBox(error, session, std::move(about))) { getDelegate()->show(std::move(box)); return true; @@ -837,11 +837,11 @@ void EditRestrictedBox::prepare() { : tr::lng_rights_chat_restricted_by)( lt_user, rpl::single(_by - ? Ui::Text::Link(_by->name(), 1) + ? tr::link(_by->name(), 1) : TextWithEntities{ QString::fromUtf8("\U0001F47B") }), lt_date, rpl::single(TextWithEntities{ langDateTimeFull(parsed) }), - Ui::Text::WithEntities)); + tr::marked)); if (_by) { label->setLink(1, _by->createOpenLink()); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 626c3baf8e..a06a09df4c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1686,11 +1686,11 @@ base::unique_qptr ParticipantsBoxController::rowContextMenu( auto text = phrase( tr::now, lt_user, - Ui::Text::Bold(by->name()), + tr::bold(by->name()), lt_date, - Ui::Text::Bold( + tr::bold( langDateTimeFull(base::unixtime::parse(since))), - Ui::Text::WithEntities); + tr::marked); auto button = base::make_unique_q( result->menu(), result->st().menu, diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp index 825430e4af..0bcf11c3c4 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp @@ -436,7 +436,7 @@ void LevelBadge::updateText() { tr::now, lt_count, _level, - Ui::Text::WithEntities)); + tr::marked)); } else { text.append(QString::number(_level)); } @@ -1126,7 +1126,7 @@ Fn AddColorGiftTabs( auto tabs = std::vector(); tabs.push_back({ .id = u"my"_q, - .text = tr::lng_gift_stars_tabs_my(tr::now, Ui::Text::WithEntities), + .text = tr::lng_gift_stars_tabs_my(tr::now, tr::marked), }); for (const auto &gift : list) { auto text = TextWithEntities(); @@ -1668,7 +1668,7 @@ void CreateBoostLevelContainer( using namespace Ui::Text; return Link(std::move(t), u"internal:"_q); }), - Ui::Text::RichLangValue), + tr::rich), style); state->label->show(); boostLevelContainer->sizeValue( @@ -2150,13 +2150,13 @@ void EditPeerColorSection( tr::lng_gift_buy_resale_button( lt_cost, rpl::single(Data::FormatGiftResaleTon(*buy)), - Ui::Text::WithEntities), + tr::marked), tr::lng_gift_buy_resale_equals( lt_cost, rpl::single(Ui::Text::IconEmoji( &st::starIconEmojiSmall ).append(Lang::FormatCountDecimal(buy->starsForResale))), - Ui::Text::WithEntities), + tr::marked), st::resaleButtonTitle, st::resaleButtonSubtitle); } else { @@ -2164,7 +2164,7 @@ void EditPeerColorSection( lt_cost, rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append( Lang::FormatCountDecimal(buy->starsForResale))), - Ui::Text::WithEntities)); + tr::marked)); } }, button->lifetime()); } @@ -2282,11 +2282,11 @@ void EditPeerProfileColorSection( tr::lng_settings_color_profile_about_link( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([=](TextWithEntities t) { - return Ui::Text::Link(std::move(t), u"internal:"_q); + return tr::link(std::move(t), u"internal:"_q); }), - Ui::Text::RichLangValue)); + tr::rich)); Ui::AddSkip(container, st::settingsColorSampleSkip); about->setClickHandlerFilter([=](auto...) { aboutCallback(); @@ -2412,13 +2412,13 @@ void EditPeerProfileColorSection( tr::lng_gift_buy_resale_button( lt_cost, rpl::single(Data::FormatGiftResaleTon(*buy)), - Ui::Text::WithEntities), + tr::marked), tr::lng_gift_buy_resale_equals( lt_cost, rpl::single(Ui::Text::IconEmoji( &st::starIconEmojiSmall ).append(Lang::FormatCountDecimal(buy->starsForResale))), - Ui::Text::WithEntities), + tr::marked), st::resaleButtonTitle, st::resaleButtonSubtitle); } else { @@ -2426,7 +2426,7 @@ void EditPeerProfileColorSection( lt_cost, rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append( Lang::FormatCountDecimal(buy->starsForResale))), - Ui::Text::WithEntities)); + tr::marked)); } }, button->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 4b48cee3c8..480a7f53a2 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -155,7 +155,7 @@ not_null AddButtonWithText( return AddButtonWithText( parent, std::move(text), - std::move(label) | Ui::Text::ToWithEntities(), + std::move(label) | rpl::map(tr::marked), std::move(callback), std::move(descriptor)); } @@ -1098,9 +1098,9 @@ void Controller::fillDirectMessagesButton() { auto label = _starsPerDirectMessageSavedValue->value( ) | rpl::map([](int starsPerMessage) { return (starsPerMessage < 0) - ? tr::lng_manage_monoforum_off(Ui::Text::WithEntities) + ? tr::lng_manage_monoforum_off(tr::marked) : !starsPerMessage - ? tr::lng_manage_monoforum_free(Ui::Text::WithEntities) + ? tr::lng_manage_monoforum_free(tr::marked) : rpl::single(Ui::Text::IconEmoji( &st::starIconEmojiColored ).append(' ').append( @@ -1164,7 +1164,7 @@ void Controller::fillForumButton() { tr::now, lt_count, EnableForumMinMembers(_peer), - Ui::Text::RichLangValue)); + tr::rich)); } } else { _navigation->uiShow()->show(Box( @@ -1323,8 +1323,8 @@ void Controller::fillSignaturesButton() { _controls.buttonsLayout, rpl::conditional( signs->toggledValue(), - tr::lng_edit_sign_profiles_about(Ui::Text::WithEntities), - tr::lng_edit_sign_messages_about(Ui::Text::WithEntities))); + tr::lng_edit_sign_profiles_about(tr::marked), + tr::lng_edit_sign_messages_about(tr::marked))); Ui::AddSkip(_controls.buttonsLayout); } @@ -1412,11 +1412,11 @@ void Controller::fillManageSection() { container, tr::lng_manage_peer_bot_about( lt_bot, - rpl::single(Ui::Text::Link( + rpl::single(tr::link( '@' + kBotManagerUsername.utf16(), _peer->session().createInternalLinkFull( kBotManagerUsername.utf16()))), - Ui::Text::RichLangValue), + tr::rich), st::boxDividerLabel), st::defaultBoxDividerLabelPadding)); fillBotVerifyAccounts(); @@ -2895,7 +2895,7 @@ object_ptr EditPeerInfoBox::CreateButton( return CreateButton( parent, std::move(text), - std::move(count) | Ui::Text::ToWithEntities(), + std::move(count) | rpl::map(tr::marked), std::move(callback), st, std::move(descriptor)); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 67184f0688..10d8f03e1b 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -739,14 +739,14 @@ void Controller::setupAboveJoinedWidget() { TextWithEntities{ .text = QString(QChar(0x00D7)) }, lt_total, { QString::number(current.usage) }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_group_invite_subscription_info_title_none( tr::now, lt_emoji, _creditsEmoji, lt_price, { QString::number(current.subscription.credits) }, - Ui::Text::WithEntities), + tr::marked), kMarkupTextOptions, _emojiHelper.context([=] { widget->update(); })); auto &lifetime = widget->lifetime(); @@ -997,7 +997,7 @@ void Controller::rowClicked(not_null row) { _creditsEmoji, lt_cost, { QString::number(data.subscription.credits) }, - Ui::Text::WithEntities), + tr::marked), _emojiHelper.context()); const auto subtitle2 = box->addRow( object_ptr( @@ -1030,10 +1030,9 @@ void Controller::rowClicked(not_null row) { box, tr::lng_credits_box_out_about( lt_link, - tr::lng_payments_terms_link( - ) | Ui::Text::ToLink( - tr::lng_credits_box_out_about_link(tr::now)), - Ui::Text::WithEntities), + tr::lng_payments_terms_link(tr::url( + tr::lng_credits_box_out_about_link(tr::now))), + tr::marked), st::creditsBoxAboutDivider), style::al_top); @@ -1103,8 +1102,8 @@ void Controller::processRequest( : tr::lng_group_requests_was_added)( tr::now, lt_user, - Ui::Text::Bold(user->name()), - Ui::Text::WithEntities)); + tr::bold(user->name()), + tr::marked)); } }); const auto fail = crl::guard(this, [=] { diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index 5a2df335e5..a5a44adce8 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -459,7 +459,7 @@ not_null AddInnerToggle( rpl::empty_value() ) | rpl::map(countChecked) ) | rpl::map([=](const QString &t, int checked) { - auto count = Ui::Text::Bold(" " + auto count = tr::bold(" " + QString::number(checked) + '/' + QString::number(totalInnerChecks)); @@ -1295,7 +1295,7 @@ Fn AboutGigagroupCallback( object_ptr( box, tr::lng_gigagroup_warning( - ) | Ui::Text::ToRichLangValue(), + ) | rpl::map(tr::rich), st::infoAboutGigagroup)); box->addButton(tr::lng_gigagroup_convert_sure(), convertSure); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp index cde9c1bc6a..7b710c0155 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp @@ -592,9 +592,8 @@ void AddReactionsText( inner, tr::lng_manage_peer_reactions_own( lt_link, - tr::lng_manage_peer_reactions_own_link( - ) | Ui::Text::ToLink(), - Ui::Text::WithEntities), + tr::lng_manage_peer_reactions_own_link(tr::link), + tr::marked), st::boxDividerLabel)); const auto weak = base::make_weak(navigation); label->setClickHandlerFilter([=](const auto &...) { @@ -615,11 +614,11 @@ void AddReactionsText( count->value() | tr::to_count(), lt_same_count, std::move(countString), - Ui::Text::RichLangValue), + tr::rich), tr::lng_manage_peer_reactions_boost( lt_link, - tr::lng_manage_peer_reactions_boost_link() | Ui::Text::ToLink(), - Ui::Text::RichLangValue) + tr::lng_manage_peer_reactions_boost_link(tr::link), + tr::rich) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { a.append(' ').append(std::move(b)); return std::move(a); @@ -936,11 +935,11 @@ void EditAllowedReactionsBox( tr::lng_manage_peer_reactions_paid_about( lt_link, tr::lng_manage_peer_reactions_paid_link([=](QString text) { - return Ui::Text::Link( + return tr::link( text, u"https://telegram.org/tos/stars"_q); }), - Ui::Text::WithEntities)); + tr::marked)); } const auto collect = [=] { auto result = AllowedReactions(); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp index 26310db43f..2b9436c14f 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp @@ -436,8 +436,8 @@ void RequestsBoxController::processRequest( : tr::lng_group_requests_was_added)( tr::now, lt_user, - Ui::Text::Bold(user->name()), - Ui::Text::WithEntities)); + tr::bold(user->name()), + tr::marked)); } }); const auto fail = crl::guard(this, remove); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp index af4682511c..1674f80e2a 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/boxes/confirm_box.h" #include "ui/layers/show.h" #include "ui/painter.h" -#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue. +#include "ui/text/text_utilities.h" // tr::rich. #include "ui/toast/toast.h" #include "ui/ui_utility.h" #include "ui/vertical_list.h" @@ -335,7 +335,7 @@ void UsernamesList::rebuild(const Data::Usernames &usernames) { tr::lng_usernames_activate_error( lt_count, rpl::single(kMaxUsernames), - Ui::Text::RichLangValue))); + tr::rich))); } if (error == Api::Usernames::Error::Flood) { _show->showToast( diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp index b76358e454..36b7563257 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp @@ -751,7 +751,7 @@ void PeerShortInfoBox::prepareRows() { const style::FlatLabel &textSt) { auto line = CreateTextWithLabel( _rows, - rpl::duplicate(label) | Ui::Text::ToWithEntities(), + rpl::duplicate(label) | rpl::map(tr::marked), rpl::duplicate(text), _st.label, textSt, @@ -801,7 +801,7 @@ void PeerShortInfoBox::prepareRows() { tr::lng_context_copy_link(tr::now)); addInfoOneLine( tr::lng_info_mobile_label(), - phoneValue() | Ui::Text::ToWithEntities(), + phoneValue() | rpl::map(tr::marked), tr::lng_profile_copy_phone(tr::now)); auto label = _fields.current().isBio ? tr::lng_info_bio_label() @@ -809,11 +809,11 @@ void PeerShortInfoBox::prepareRows() { addInfoLine(std::move(label), aboutValue(), _st.labeled); addInfoOneLine( tr::lng_info_username_label(), - usernameValue() | Ui::Text::ToWithEntities(), + usernameValue() | rpl::map(tr::marked), tr::lng_context_copy_mention(tr::now)); addInfoOneLine( birthdayLabel(), - birthdayValue() | Ui::Text::ToWithEntities(), + birthdayValue() | rpl::map(tr::marked), tr::lng_mediaview_copy(tr::now)); addInfoLine( tr::lng_info_notes_label(), @@ -881,14 +881,14 @@ rpl::producer PeerShortInfoBox::nameValue() const { rpl::producer PeerShortInfoBox::channelValue() const { return _fields.value( ) | rpl::map([](const PeerShortInfoFields &fields) { - return Ui::Text::Link(fields.channelName, fields.channelLink); + return tr::link(fields.channelName, fields.channelLink); }) | rpl::distinct_until_changed(); } rpl::producer PeerShortInfoBox::linkValue() const { return _fields.value( ) | rpl::map([](const PeerShortInfoFields &fields) { - return Ui::Text::Link(fields.link, fields.link); + return tr::link(fields.link, fields.link); }) | rpl::distinct_until_changed(); } diff --git a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp index dd2d8d24dd..592e225f83 100644 --- a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp @@ -217,13 +217,13 @@ void Controller::prepare() { above.data(), tr::lng_boost_reassign_text( lt_channel, - rpl::single(Ui::Text::Bold(_to->name())), + rpl::single(tr::bold(_to->name())), lt_gift, tr::lng_boost_reassign_gift( lt_count, rpl::single(1. * BoostsForGift(session)), - Ui::Text::RichLangValue), - Ui::Text::RichLangValue), + tr::rich), + tr::rich), st::boostReassignText), st::boxRowPadding, style::al_top); @@ -278,7 +278,7 @@ void Controller::rowClicked(not_null row) { tr::now, lt_count, BoostsForGift(&session()), - Ui::Text::RichLangValue), + tr::rich), .adaptive = true, }); return; @@ -331,14 +331,14 @@ object_ptr ReassignBoostFloodBox(int seconds, bool group) { ? tr::lng_boost_error_flood_text_group : tr::lng_boost_error_flood_text)( lt_left, - rpl::single(Ui::Text::Bold((days > 1) + rpl::single(tr::bold((days > 1) ? tr::lng_days(tr::now, lt_count, days) : (hours > 1) ? tr::lng_hours(tr::now, lt_count, hours) : (minutes > 1) ? tr::lng_minutes(tr::now, lt_count, minutes) : tr::lng_seconds(tr::now, lt_count, seconds))), - Ui::Text::RichLangValue), + tr::rich), .title = tr::lng_boost_error_flood_title(), }); } @@ -362,10 +362,10 @@ object_ptr ReassignBoostSingleBox( Ui::ConfirmBox(box, { .text = tr::lng_boost_now_instead( lt_channel, - rpl::single(Ui::Text::Bold(peer->name())), + rpl::single(tr::bold(peer->name())), lt_other, - rpl::single(Ui::Text::Bold(to->name())), - Ui::Text::WithEntities), + rpl::single(tr::bold(to->name())), + tr::marked), .confirmed = confirmed, .confirmText = tr::lng_boost_now_replace(), .labelPadding = st::boxRowPadding, diff --git a/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp b/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp index 721d1e191c..18602c886b 100644 --- a/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp @@ -154,7 +154,7 @@ void ToggleTopicsBox( .lottieMargins = st::settingsFilterIconPadding, .showFinished = box->showFinishes(), .about = tr::lng_edit_topics_about( - Ui::Text::RichLangValue + tr::rich ), .aboutMargins = st::settingsFilterDividerLabelPadding, }); @@ -205,7 +205,7 @@ void ToggleTopicsBox( Ui::AddDividerText( layout, - tr::lng_edit_topics_layout_about(Ui::Text::RichLangValue)); + tr::lng_edit_topics_layout_about(tr::rich)); layoutWrap->toggle(enabled, anim::type::instant); toggle->toggledChanges( diff --git a/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp b/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp index a3f77c3749..6023bde0c6 100644 --- a/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp @@ -138,8 +138,8 @@ void Controller::confirmAdd(not_null peer) { .text = PeerVerifyPhrases(peer).sent( tr::now, lt_name, - Ui::Text::Bold(peer->shortName()), - Ui::Text::WithEntities), + tr::bold(peer->shortName()), + tr::marked), .duration = kSetupVerificationToastDuration, }); } else { @@ -153,8 +153,8 @@ void Controller::confirmAdd(not_null peer) { Ui::ConfirmBox(box, { .text = phrases.text( lt_name, - rpl::single(Ui::Text::Bold(peer->shortName())), - Ui::Text::WithEntities), + rpl::single(tr::bold(peer->shortName())), + tr::marked), .confirmed = send, .confirmText = phrases.submit(), .title = phrases.title(), diff --git a/Telegram/SourceFiles/boxes/premium_limits_box.cpp b/Telegram/SourceFiles/boxes/premium_limits_box.cpp index 88611c63f6..897690bea6 100644 --- a/Telegram/SourceFiles/boxes/premium_limits_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_limits_box.cpp @@ -517,13 +517,13 @@ void SimplePinsLimitBox( tr::lng_filter_pin_limit1( lt_count, rpl::single(premium ? premiumLimit : defaultLimit), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) ? rpl::single(TextWithEntities()) : tr::lng_filter_pin_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a @@ -556,13 +556,13 @@ void ChannelsLimitBox( tr::lng_channels_limit1( lt_count, rpl::single(current), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) - ? tr::lng_channels_limit2_final(Ui::Text::RichLangValue) + ? tr::lng_channels_limit2_final(tr::rich) : tr::lng_channels_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return a.append(QChar(' ')).append(std::move(b)); }); @@ -646,13 +646,13 @@ void PublicLinksLimitBox( tr::lng_links_limit1( lt_count, rpl::single(current), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) - ? tr::lng_links_limit2_final(Ui::Text::RichLangValue) + ? tr::lng_links_limit2_final(tr::rich) : tr::lng_links_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return a.append(QChar(' ')).append(std::move(b)); }); @@ -714,13 +714,13 @@ void FilterChatsLimitBox( : tr::lng_filter_chats_exlude_limit1)( lt_count, rpl::single(premium ? premiumLimit : defaultLimit), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) ? rpl::single(TextWithEntities()) : tr::lng_filter_chats_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a @@ -752,13 +752,13 @@ void FilterLinksLimitBox( tr::lng_filter_links_limit1( lt_count, rpl::single(premium ? premiumLimit : defaultLimit), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) ? rpl::single(TextWithEntities()) : tr::lng_filter_links_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a @@ -801,13 +801,13 @@ void FiltersLimitBox( tr::lng_filters_limit1( lt_count, rpl::single(premium ? premiumLimit : defaultLimit), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) ? rpl::single(TextWithEntities()) : tr::lng_filters_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a @@ -840,13 +840,13 @@ void ShareableFiltersLimitBox( tr::lng_filter_shared_limit1( lt_count, rpl::single(premium ? premiumLimit : defaultLimit), - Ui::Text::RichLangValue), + tr::rich), ((premium || !premiumPossible) ? rpl::single(TextWithEntities()) : tr::lng_filter_shared_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a @@ -929,7 +929,7 @@ void ForumPinsLimitBox( auto text = tr::lng_forum_pin_limit( lt_count, rpl::single(current), - Ui::Text::RichLangValue); + tr::rich); SimpleLimitBox( box, nullptr, @@ -962,13 +962,13 @@ void CaptionLimitBox( tr::lng_caption_limit1( lt_count, rpl::single(currentLimit), - Ui::Text::RichLangValue), + tr::rich), (!premiumPossible ? rpl::single(TextWithEntities()) : tr::lng_caption_limit2( lt_count, rpl::single(premiumLimit), - Ui::Text::RichLangValue)) + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a @@ -1035,14 +1035,14 @@ void FileSizeLimitBox( auto text = rpl::combine( tr::lng_file_size_limit1( lt_size, - rpl::single(Ui::Text::Bold(gb(showLimit))), - Ui::Text::RichLangValue), + rpl::single(tr::bold(gb(showLimit))), + tr::rich), (!premiumPossible ? rpl::single(TextWithEntities()) : tr::lng_file_size_limit2( lt_size, - rpl::single(Ui::Text::Bold(gb(premiumGb))), - Ui::Text::RichLangValue)) + rpl::single(tr::bold(gb(premiumGb))), + tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return a.append(QChar(' ')).append(std::move(b)); }); @@ -1090,10 +1090,10 @@ void AccountsLimitBox( tr::lng_accounts_limit1( lt_count, rpl::single(current), - Ui::Text::RichLangValue), + tr::rich), ((!premiumPossible || current > premiumLimit) ? rpl::single(TextWithEntities()) - : tr::lng_accounts_limit2(Ui::Text::RichLangValue)) + : tr::lng_accounts_limit2(tr::rich)) ) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) { return b.text.isEmpty() ? a diff --git a/Telegram/SourceFiles/boxes/premium_preview_box.cpp b/Telegram/SourceFiles/boxes/premium_preview_box.cpp index b5fc60ce6e..0ba8e7e91a 100644 --- a/Telegram/SourceFiles/boxes/premium_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_preview_box.cpp @@ -913,7 +913,7 @@ void AddGiftsInfoRows(not_null container) { raw->add( object_ptr( raw, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), st::defaultFlatLabel), st::settingsPremiumRowTitlePadding); raw->add( @@ -1473,7 +1473,7 @@ void PremiumUnavailableBox(not_null box) { Ui::ConfirmBox(box, { .text = tr::lng_premium_unavailable( tr::now, - Ui::Text::RichLangValue), + tr::rich), .inform = true, }); } @@ -1492,7 +1492,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_channels( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.channelsDefault(), premium, }); @@ -1504,7 +1504,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_pins( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.dialogsPinnedDefault(), premium, }); @@ -1516,7 +1516,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_links( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.channelsPublicDefault(), premium, }); @@ -1528,7 +1528,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_gifs( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.gifsDefault(), premium, }); @@ -1540,7 +1540,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_stickers( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.stickersFavedDefault(), premium, }); @@ -1550,7 +1550,7 @@ void DoubledLimitsPreviewBox( entries.push_back({ tr::lng_premium_double_limits_subtitle_bio(), tr::lng_premium_double_limits_about_bio( - Ui::Text::RichLangValue), + tr::rich), limits.aboutLengthDefault(), premium, }); @@ -1560,7 +1560,7 @@ void DoubledLimitsPreviewBox( entries.push_back({ tr::lng_premium_double_limits_subtitle_captions(), tr::lng_premium_double_limits_about_captions( - Ui::Text::RichLangValue), + tr::rich), limits.captionLengthDefault(), premium, }); @@ -1572,7 +1572,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_folders( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.dialogFiltersDefault(), premium, }); @@ -1584,7 +1584,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_folder_chats( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.dialogFiltersChatsDefault(), premium, }); @@ -1598,7 +1598,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_accounts( lt_count, rpl::single(float64(Main::Domain::kPremiumMaxAccounts)), - Ui::Text::RichLangValue), + tr::rich), Main::Domain::kMaxAccounts, Main::Domain::kPremiumMaxAccounts, till, @@ -1610,7 +1610,7 @@ void DoubledLimitsPreviewBox( tr::lng_premium_double_limits_about_similar_channels( lt_count, rpl::single(float64(premium)), - Ui::Text::RichLangValue), + tr::rich), limits.similarChannelsDefault(), premium, }); diff --git a/Telegram/SourceFiles/boxes/self_destruction_box.cpp b/Telegram/SourceFiles/boxes/self_destruction_box.cpp index d8eb129717..5d96befeb7 100644 --- a/Telegram/SourceFiles/boxes/self_destruction_box.cpp +++ b/Telegram/SourceFiles/boxes/self_destruction_box.cpp @@ -53,7 +53,7 @@ void AddDeleteAccount( fields.customTitle = tr::lng_settings_destroy_title(); fields.customDescription = tr::lng_context_mark_read_all_sure_2( tr::now, - Ui::Text::RichLangValue).text; + tr::rich).text; fields.customSubmitButton = tr::lng_theme_delete(); fields.customCheckCallback = [=]( const Core::CloudPasswordResult &result, diff --git a/Telegram/SourceFiles/boxes/send_credits_box.cpp b/Telegram/SourceFiles/boxes/send_credits_box.cpp index b108ef1aa2..b4c9e5f450 100644 --- a/Telegram/SourceFiles/boxes/send_credits_box.cpp +++ b/Telegram/SourceFiles/boxes/send_credits_box.cpp @@ -109,9 +109,9 @@ void AddTerms( tr::lng_paid_react_agree_link(), tr::lng_group_invite_subscription_about_url() ) | rpl::map([](const QString &text, const QString &url) { - return Ui::Text::Link(text, url); + return tr::link(text, url); }), - Ui::Text::RichLangValue), + tr::rich), st::inviteLinkSubscribeBoxTerms); const auto &buttonPadding = stBox.buttonPadding; const auto style = box->lifetime().make_state(style::Box{ @@ -153,25 +153,25 @@ void AddTerms( auto photosBold = tr::lng_credits_box_out_photos( lt_count, rpl::single(photos) | tr::to_count(), - Ui::Text::Bold); + tr::bold); auto videosBold = tr::lng_credits_box_out_videos( lt_count, rpl::single(videos) | tr::to_count(), - Ui::Text::Bold); + tr::bold); auto media = (!videos) ? ((photos > 1) ? std::move(photosBold) - : tr::lng_credits_box_out_photo(Ui::Text::WithEntities)) + : tr::lng_credits_box_out_photo(tr::marked)) : (!photos) ? ((videos > 1) ? std::move(videosBold) - : tr::lng_credits_box_out_video(Ui::Text::WithEntities)) + : tr::lng_credits_box_out_video(tr::marked)) : tr::lng_credits_box_out_both( lt_photo, std::move(photosBold), lt_video, std::move(videosBold), - Ui::Text::WithEntities); + tr::marked); if (const auto user = data.peer->asUser()) { return tr::lng_credits_box_out_media_user( lt_count, @@ -179,8 +179,8 @@ void AddTerms( lt_media, std::move(media), lt_user, - rpl::single(Ui::Text::Bold(user->shortName())), - Ui::Text::RichLangValue); + rpl::single(tr::bold(user->shortName())), + tr::rich); } return tr::lng_credits_box_out_media( lt_count, @@ -188,8 +188,8 @@ void AddTerms( lt_media, std::move(media), lt_chat, - rpl::single(Ui::Text::Bold(data.peer->name())), - Ui::Text::RichLangValue); + rpl::single(tr::bold(data.peer->name())), + tr::rich); } const auto bot = session->data().user(form->botId); @@ -203,7 +203,7 @@ void AddTerms( rpl::single(TextWithEntities{ form->title }), lt_recipient, rpl::single(TextWithEntities{ bot->name() }), - Ui::Text::RichLangValue); + tr::rich); } return tr::lng_credits_box_out_sure( lt_count, @@ -212,7 +212,7 @@ void AddTerms( rpl::single(TextWithEntities{ form->title }), lt_bot, rpl::single(TextWithEntities{ bot->name() }), - Ui::Text::RichLangValue); + tr::rich); } [[nodiscard]] object_ptr SendCreditsThumbnail( @@ -455,7 +455,7 @@ void SendCreditsBox( rpl::single(form->invoice.amount) | tr::to_count(), lt_emoji, rpl::single(CreditsEmojiSmall()), - Ui::Text::RichLangValue), + tr::rich), state->confirmButtonBusy.value() ) | rpl::map([](TextWithEntities &&text, bool busy) { return busy ? TextWithEntities() : std::move(text); diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 63042cb800..769cfb4031 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -158,8 +158,8 @@ void EditPriceBox( box, tr::lng_paid_about( lt_link, - tr::lng_paid_about_link() | Ui::Text::ToLink(), - Ui::Text::WithEntities), + tr::lng_paid_about_link(tr::link), + tr::marked), st::paidAmountAbout), st::boxRowPadding + QMargins(0, st::sendMediaRowSkip, 0, 0)); about->setClickHandlerFilter([=](const auto &...) { @@ -853,7 +853,7 @@ void SendFilesBox::refreshPriceTag() { auto text = tr::lng_paid_price( lt_price, std::move(price), - Ui::Text::WithEntities); + tr::marked); const auto label = Ui::CreateChild( raw, QString(), diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index 9b16636cba..24ea1da597 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -551,8 +551,8 @@ auto GenerateGiftMedia( tr::lng_gift_released_by( tr::now, lt_name, - Ui::Text::Link('@' + by->username()), - Ui::Text::WithEntities), + tr::link('@' + by->username()), + tr::marked), st::giftBoxReleasedByMargin, st::uniqueGiftReleasedBy.style)); } @@ -620,20 +620,20 @@ void ShowSentToast( auto text = v::match(descriptor, [&](const GiftTypePremium &gift) { return tr::lng_action_gift_premium_about( tr::now, - Text::RichLangValue); + tr::rich); }, [&](const GiftTypeStars &gift) { if (gift.info.perUserTotal && gift.info.perUserRemains < 2) { return tr::lng_gift_sent_finished( tr::now, lt_count, gift.info.perUserTotal, - Text::RichLangValue); + tr::rich); } else if (gift.info.perUserTotal) { return tr::lng_gift_sent_remains( tr::now, lt_count, gift.info.perUserRemains - 1, - Text::RichLangValue); + tr::rich); } const auto amount = gift.info.stars + (details.upgraded ? gift.info.starsToUpgrade : 0); @@ -641,7 +641,7 @@ void ShowSentToast( tr::now, lt_count, amount, - Text::RichLangValue); + tr::rich); }); const auto strong = window->showToast({ .title = tr::lng_gift_sent_title(tr::now), @@ -1344,8 +1344,8 @@ void ShowGiftUpgradedToast( .text = tr::lng_gift_upgraded_about( tr::now, lt_name, - Text::Bold(Data::UniqueGiftName(*gift)), - Ui::Text::WithEntities), + tr::bold(Data::UniqueGiftName(*gift)), + tr::marked), .duration = kUpgradeDoneToastDuration, }); } @@ -1520,7 +1520,7 @@ void AddUpgradeButton( rpl::single(star.append(' ' + Lang::FormatCreditsAmountDecimal( CreditsAmount{ cost }))), - Text::WithEntities), + tr::marked), st::boxLabel, st::defaultPopupMenu, helper.context()); @@ -1547,14 +1547,14 @@ void AddUpgradeButton( lt_name, rpl::single(TextWithEntities{ peer->name() }), lt_link, - tr::lng_gift_send_unique_link() | Text::ToLink(), - Text::WithEntities) + tr::lng_gift_send_unique_link(tr::link), + tr::marked) : tr::lng_gift_send_unique_about( lt_user, rpl::single(TextWithEntities{ peer->shortName() }), lt_link, - tr::lng_gift_send_unique_link() | Text::ToLink(), - Text::WithEntities))); + tr::lng_gift_send_unique_link(tr::link), + tr::marked))); about->setClickHandlerFilter([=](const auto &...) { preview(); return false; @@ -1875,7 +1875,7 @@ void CheckMaybeGiftLocked( tr::now, lt_count, star->info.perUserTotal, - Ui::Text::RichLangValue), + tr::rich), }); } else { send(); @@ -2188,10 +2188,10 @@ void GiftBox( .subtitle = tr::lng_gift_premium_subtitle(), .about = tr::lng_gift_premium_about( lt_name, - rpl::single(Text::Bold(peer->shortName())), + rpl::single(tr::bold(peer->shortName())), lt_features, - tr::lng_gift_premium_features() | Text::ToLink(), - Text::WithEntities), + tr::lng_gift_premium_features(tr::link), + tr::marked), .aboutFilter = premiumClickHandlerFilter, .content = MakePremiumGifts(window, peer), }); @@ -2212,24 +2212,24 @@ void GiftBox( ? tr::lng_gift_channel_title() : tr::lng_gift_stars_subtitle()), .about = (peer->isSelf() - ? tr::lng_gift_self_about(Text::WithEntities) + ? tr::lng_gift_self_about(tr::marked) : peer->isBroadcast() ? tr::lng_gift_channel_about( lt_name, - rpl::single(Text::Bold(peer->name())), - Text::WithEntities) + rpl::single(tr::bold(peer->name())), + tr::marked) : rpl::conditional( collectibles->value(), tr::lng_gift_stars_about_collectibles( lt_link, - tr::lng_gift_stars_link() | Text::ToLink(), - Text::WithEntities), + tr::lng_gift_stars_link(tr::link), + tr::marked), tr::lng_gift_stars_about( lt_name, - rpl::single(Text::Bold(peer->shortName())), + rpl::single(tr::bold(peer->shortName())), lt_link, - tr::lng_gift_stars_link() | Text::ToLink(), - Text::WithEntities))), + tr::lng_gift_stars_link(tr::link), + tr::marked))), .aboutFilter = starsClickHandlerFilter, .content = MakeStarsGifts( window, @@ -3941,7 +3941,7 @@ void ShowUniqueGiftWearBox( raw->add( object_ptr( raw, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), st.infoTitle ? *st.infoTitle : st::defaultFlatLabel), st::settingsPremiumRowTitlePadding); raw->add( @@ -4023,15 +4023,15 @@ void ShowUniqueGiftWearBox( box->closeBox(); emojiStatuses->set(peer, id); } else { - const auto link = Ui::Text::Bold( + const auto link = tr::bold( tr::lng_send_as_premium_required_link(tr::now)); Settings::ShowPremiumPromoToast( show, tr::lng_gift_wear_subscribe( tr::now, lt_link, - Ui::Text::Link(link), - Ui::Text::WithEntities), + tr::link(link), + tr::marked), u"wear_collectibles"_q); } }); @@ -4249,29 +4249,29 @@ void UniqueGiftSellBox( tr::now, lt_count, nanoTonMin / float64(Ui::kNanosInOne), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_gift_sell_min_price( tr::now, lt_count, starsMin, - Ui::Text::RichLangValue)) + tr::rich)) : enough ? (value->ton() ? tr::lng_gift_sell_amount_ton( tr::now, lt_count, receive, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_gift_sell_amount( tr::now, lt_count, receive, - Ui::Text::RichLangValue)) + tr::rich)) : tr::lng_gift_sell_about( tr::now, lt_percent, TextWithEntities{ u"%1%"_q.arg(thousandths / 10.) }, - Ui::Text::RichLangValue); + tr::rich); }); const auto details = box->addRow(object_ptr( box, @@ -4298,7 +4298,7 @@ void UniqueGiftSellBox( box->addRow( object_ptr( container, - tr::lng_gift_sell_only_ton_about(Ui::Text::RichLangValue), + tr::lng_gift_sell_only_ton_about(tr::rich), st::boxDividerLabel)); Ui::AddSkip(container); @@ -5085,7 +5085,7 @@ void UpgradeBox( raw->add( object_ptr( raw, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), st::defaultFlatLabel), st::settingsPremiumRowTitlePadding); raw->add( @@ -5314,7 +5314,7 @@ void UpgradeBox( ) | rpl::map([](int cost) { if (!cost) { return tr::lng_gift_upgrade_confirm( - Ui::Text::WithEntities); + tr::marked); } return tr::lng_gift_upgrade_button( lt_price, @@ -5322,7 +5322,7 @@ void UpgradeBox( &st::starIconEmoji ).append(Lang::FormatCreditsAmountDecimal( CreditsAmount{ cost }))), - Ui::Text::WithEntities); + tr::marked); }) | rpl::flatten_latest(); }; auto subtext = state->cost->tillNextValue( @@ -5363,7 +5363,7 @@ void UpgradeBox( tr::lng_gift_upgrade_see_table( lt_arrow, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - [](QString text) { return Ui::Text::Link(text); }), + [](QString text) { return tr::link(text); }), st::resalePriceTableLink); link->setTryMakeSimilarLines(true); button->geometryValue() | rpl::on_next([=](QRect geometry) { @@ -5630,10 +5630,10 @@ void ShowGiftTransferredToast( .text = tr::lng_gift_transferred_about( tr::now, lt_name, - Text::Bold(Data::UniqueGiftName(gift)), + tr::bold(Data::UniqueGiftName(gift)), lt_recipient, - Text::Bold(to->shortName()), - Ui::Text::WithEntities), + tr::bold(to->shortName()), + tr::marked), .duration = kUpgradeDoneToastDuration, }); } @@ -5875,7 +5875,7 @@ void SendGiftBox( tr::lng_gift_send_pay_with_stars( lt_amount, rpl::single(base::duplicate(star).append(Lang::FormatCountDecimal(byStars))), - Ui::Text::WithEntities), + tr::marked), st::settingsButtonNoIcon) )->toggleOn(rpl::single(false))->toggledValue( ) | rpl::on_next([=](bool toggled) { @@ -5895,9 +5895,8 @@ void SendGiftBox( Lang::FormatCreditsAmountDecimal(amount)); }), lt_link, - tr::lng_gift_send_stars_balance_link( - ) | Ui::Text::ToLink(), - Ui::Text::WithEntities)); + tr::lng_gift_send_stars_balance_link(tr::link), + tr::marked)); struct State { Settings::BuyStarsHandler buyStars; rpl::variable loading; @@ -6027,7 +6026,7 @@ void SendGiftBox( : tr::lng_gift_send_button)( lt_cost, std::move(cost), - Text::WithEntities), + tr::marked), session, st::creditsBoxButtonLabel, &st::giftBox.button.textFg); diff --git a/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp b/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp index 49bceb8186..25ce424929 100644 --- a/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp @@ -265,7 +265,7 @@ struct ResaleTabs { const auto id = IdFor(entry.model); const auto text = TextWithEntities{ entry.model.name - }.append(' ').append(Ui::Text::Bold( + }.append(' ').append(tr::bold( Lang::FormatCountDecimal(entry.count) )); actionWithDocument(text, [=] { @@ -277,7 +277,7 @@ struct ResaleTabs { const auto id = IdFor(entry.backdrop); const auto text = TextWithEntities{ entry.backdrop.name - }.append(' ').append(Ui::Text::Bold( + }.append(' ').append(tr::bold( Lang::FormatCountDecimal(entry.count) )); actionWithColor(text, [=] { @@ -289,7 +289,7 @@ struct ResaleTabs { const auto id = IdFor(entry.pattern); const auto text = TextWithEntities{ entry.pattern.name - }.append(' ').append(Ui::Text::Bold( + }.append(' ').append(tr::bold( Lang::FormatCountDecimal(entry.count) )); actionWithDocument(text, [=] { diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 5c8c267871..7e99726a64 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -2087,9 +2087,9 @@ bool StickerSetBox::Inner::official() const { rpl::producer StickerSetBox::Inner::title() const { if (!_loaded) { - return tr::lng_contacts_loading() | Ui::Text::ToWithEntities(); + return tr::lng_contacts_loading(tr::marked); } else if (_pack.isEmpty()) { - return tr::lng_attach_failed() | Ui::Text::ToWithEntities(); + return tr::lng_attach_failed(tr::marked); } auto text = TextWithEntities{ _setTitle }; TextUtilities::ParseEntities(text, TextParseMentions); diff --git a/Telegram/SourceFiles/boxes/transfer_gift_box.cpp b/Telegram/SourceFiles/boxes/transfer_gift_box.cpp index ec5adf5727..c39809dc84 100644 --- a/Telegram/SourceFiles/boxes/transfer_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/transfer_gift_box.cpp @@ -99,8 +99,8 @@ void ConfirmExportBox( box, tr::lng_gift_transfer_confirm_text( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))), - Ui::Text::WithEntities), + rpl::single(tr::bold(UniqueGiftName(*gift))), + tr::marked), st::boxLabel)); box->addButton(tr::lng_gift_transfer_confirm_button(), [=] { confirmed([weak = base::make_weak(box)] { @@ -584,13 +584,13 @@ void BuyResaleGift( tr::now, lt_price, Ui::Text::Wrapped(cost, EntityType::Bold), - Ui::Text::WithEntities), + tr::marked), .confirmed = [=](Fn close) { close(); submit(); }, .cancelled = cancelled, .confirmText = tr::lng_gift_buy_resale_button( lt_cost, rpl::single(cost), - Ui::Text::WithEntities), + tr::marked), .title = tr::lng_gift_buy_price_change_title(), })); } else { @@ -617,8 +617,8 @@ void ShowTransferToBox( ).append(Lang::FormatCreditsAmountDecimal( CreditsAmount(stars) ))), - Ui::Text::WithEntities) - : tr::lng_gift_transfer_button(Ui::Text::WithEntities); + tr::marked) + : tr::lng_gift_transfer_button(tr::marked); struct State { bool sent = false; @@ -659,21 +659,21 @@ void ShowTransferToBox( .text = (stars > 0) ? tr::lng_gift_transfer_sure_for( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))), + rpl::single(tr::bold(UniqueGiftName(*gift))), lt_recipient, - rpl::single(Ui::Text::Bold(peer->shortName())), + rpl::single(tr::bold(peer->shortName())), lt_price, tr::lng_action_gift_for_stars( lt_count, rpl::single(stars * 1.), - Ui::Text::Bold), - Ui::Text::WithEntities) + tr::bold), + tr::marked) : tr::lng_gift_transfer_sure( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))), + rpl::single(tr::bold(UniqueGiftName(*gift))), lt_recipient, - rpl::single(Ui::Text::Bold(peer->shortName())), - Ui::Text::WithEntities), + rpl::single(tr::bold(peer->shortName())), + tr::marked), .confirmed = std::move(callback), .confirmText = std::move(transfer), }); @@ -990,7 +990,7 @@ void ShowBuyResaleGiftBox( object_ptr( box, tr::lng_gift_buy_resale_only_ton( - Ui::Text::RichLangValue), + tr::rich), st::resaleConfirmTonOnly), st::boxRowPadding + st::resaleConfirmTonOnlyMargin); } else { @@ -1009,13 +1009,13 @@ void ShowBuyResaleGiftBox( u"stars"_q, tr::lng_gift_buy_resale_pay_stars( tr::now, - Ui::Text::WithEntities), + tr::marked), }, { u"ton"_q, tr::lng_gift_buy_resale_pay_ton( tr::now, - Ui::Text::WithEntities), + tr::marked), }, }), st::boxRowPadding + st::resaleConfirmTonOnlyMargin); @@ -1031,7 +1031,7 @@ void ShowBuyResaleGiftBox( rpl::single(ton ? Data::FormatGiftResaleTon(*gift) : Data::FormatGiftResaleStars(*gift)), - Ui::Text::WithEntities); + tr::marked); }) | rpl::flatten_latest(); auto callback = [=](Fn close) { @@ -1063,28 +1063,28 @@ void ShowBuyResaleGiftBox( lt_count_decimal, rpl::single(gift->nanoTonForResale / float64(Ui::kNanosInOne)), - Ui::Text::Bold) + tr::bold) : tr::lng_action_gift_for_stars( lt_count_decimal, rpl::single(gift->starsForResale * 1.), - Ui::Text::Bold); + tr::bold); }) | rpl::flatten_latest(); Ui::ConfirmBox(box, { .text = to->isSelf() ? tr::lng_gift_buy_resale_confirm_self( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))), + rpl::single(tr::bold(UniqueGiftName(*gift))), lt_price, std::move(price), - Ui::Text::WithEntities) + tr::marked) : tr::lng_gift_buy_resale_confirm( lt_name, - rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))), + rpl::single(tr::bold(UniqueGiftName(*gift))), lt_price, std::move(price), lt_user, - rpl::single(Ui::Text::Bold(to->shortName())), - Ui::Text::WithEntities), + rpl::single(tr::bold(to->shortName())), + tr::marked), .confirmed = std::move(callback), .confirmText = std::move(transfer), }); diff --git a/Telegram/SourceFiles/boxes/translate_box.cpp b/Telegram/SourceFiles/boxes/translate_box.cpp index 09c3b4636f..853cc50579 100644 --- a/Telegram/SourceFiles/boxes/translate_box.cpp +++ b/Telegram/SourceFiles/boxes/translate_box.cpp @@ -246,7 +246,7 @@ void TranslateBox( const auto &list = data.vresult().v; if (list.isEmpty()) { showText( - Ui::Text::Italic(tr::lng_translate_box_error(tr::now))); + tr::italic(tr::lng_translate_box_error(tr::now))); } else { showText(Api::ParseTextWithEntities( &peer->session(), @@ -254,7 +254,7 @@ void TranslateBox( } }).fail([=](const MTP::Error &error) { showText( - Ui::Text::Italic(tr::lng_translate_box_error(tr::now))); + tr::italic(tr::lng_translate_box_error(tr::now))); }).send(); }; state->to.value() | rpl::on_next(send, box->lifetime()); diff --git a/Telegram/SourceFiles/boxes/url_auth_box.cpp b/Telegram/SourceFiles/boxes/url_auth_box.cpp index 8316b248ed..409a6dd0ad 100644 --- a/Telegram/SourceFiles/boxes/url_auth_box.cpp +++ b/Telegram/SourceFiles/boxes/url_auth_box.cpp @@ -276,16 +276,16 @@ not_null UrlAuthBox::setupContent( tr::lng_url_auth_login_option( tr::now, lt_domain, - Ui::Text::Bold(domain), + tr::bold(domain), lt_user, - Ui::Text::Bold(session->user()->name()), - Ui::Text::WithEntities)); + tr::bold(session->user()->name()), + tr::marked)); const auto allow = bot ? addCheckbox(tr::lng_url_auth_allow_messages( tr::now, lt_bot, - Ui::Text::Bold(bot->firstName), - Ui::Text::WithEntities)) + tr::bold(bot->firstName), + tr::marked)) : nullptr; if (allow) { rpl::single( diff --git a/Telegram/SourceFiles/boxes/username_box.cpp b/Telegram/SourceFiles/boxes/username_box.cpp index 4f1fd483d8..1134ff9905 100644 --- a/Telegram/SourceFiles/boxes/username_box.cpp +++ b/Telegram/SourceFiles/boxes/username_box.cpp @@ -333,20 +333,20 @@ void UsernamesBox( auto description = [&]() -> rpl::producer { if (!isBot) { return rpl::combine( - tr::lng_username_description1(Ui::Text::RichLangValue), - tr::lng_username_description2(Ui::Text::RichLangValue) + tr::lng_username_description1(tr::rich), + tr::lng_username_description2(tr::rich) ) | rpl::map([](TextWithEntities d1, TextWithEntities d2) { return d1.append("\n\n").append(std::move(d2)); }); } if (const auto url = AppConfig::FragmentLink(&peer->session())) { - const auto link = Ui::Text::Link( + const auto link = tr::link( tr::lng_bot_username_description1_link(tr::now), *url); return tr::lng_bot_username_description1( lt_link, rpl::single(link), - Ui::Text::RichLangValue); + tr::rich); } return rpl::single({}); }(); @@ -433,10 +433,10 @@ UsernameCheckInfo UsernameCheckInfo::PurchaseAvailable( .text = tr::lng_username_purchase_available( tr::now, lt_link, - Ui::Text::Link( + tr::link( tr::lng_username_purchase_available_link(tr::now), (*fragmentLink) + u"/username/"_q + username), - Ui::Text::RichLangValue), + tr::rich), }; } else { return { diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp index 167dda11ae..db9a550624 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.cpp +++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp @@ -783,7 +783,7 @@ void ClearCallsBox( lt_count, rpl::single(controller->session().appConfig().confcallSizeLimit() * 1.), - Ui::Text::WithEntities)); + tr::marked)); const auto icon = Ui::CreateChild( result, diff --git a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp index 6cdc5f4ae4..0418370481 100644 --- a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp +++ b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp @@ -592,7 +592,7 @@ void SetupFingerprintTooltip(not_null widget) { } const auto text = tr::lng_confcall_e2e_about( tr::now, - Ui::Text::WithEntities); + tr::marked); if (text.empty()) { return; } diff --git a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp index a71b00bc84..ad76a5e096 100644 --- a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp +++ b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp @@ -237,7 +237,7 @@ void ChooseJoinAsBox( if ((context == Context::Create) && (peer->isChannel() && peer->asChannel()->hasAdminRights())) { const auto makeLink = [](const QString &text) { - return Ui::Text::Link(text); + return tr::link(text); }; const auto label = box->addRow(object_ptr( box, @@ -246,7 +246,7 @@ void ChooseJoinAsBox( (livestream ? tr::lng_group_call_schedule_channel : tr::lng_group_call_schedule)(makeLink), - Ui::Text::WithEntities), + tr::marked), labelSt)); label->overrideLinkClickHandler([=] { auto withJoinAs = info; @@ -294,8 +294,8 @@ void ChooseJoinAsBox( : tr::lng_group_call_join_confirm)( tr::now, lt_chat, - Ui::Text::Bold(name), - Ui::Text::WithEntities); + tr::bold(name), + tr::marked); } } // namespace @@ -451,10 +451,10 @@ void ChooseJoinAsProcess::processList( .append(tr::lng_group_call_or_schedule( tr::now, lt_link, - Ui::Text::Link((livestream + tr::link((livestream ? tr::lng_group_call_schedule_channel : tr::lng_group_call_schedule)(tr::now)), - Ui::Text::WithEntities)); + tr::marked)); } const auto guard = base::make_weak(&_request->guard); const auto safeFinish = crl::guard(guard, [=] { finish(info); }); diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index e2a5be2ab7..117b7fb677 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -4290,66 +4290,66 @@ TextWithEntities ComposeInviteResultToast( append(tr::lng_confcall_invite_done_user( tr::now, lt_user, - Ui::Text::Bold(result.invited.front()->shortName()), - Ui::Text::RichLangValue)); + tr::bold(result.invited.front()->shortName()), + tr::rich)); } else if (invited > 1) { append(tr::lng_confcall_invite_done_many( tr::now, lt_count, invited, - Ui::Text::RichLangValue)); + tr::rich)); } if (already == 1) { append(tr::lng_confcall_invite_already_user( tr::now, lt_user, - Ui::Text::Bold(result.alreadyIn.front()->shortName()), - Ui::Text::RichLangValue)); + tr::bold(result.alreadyIn.front()->shortName()), + tr::rich)); } else if (already > 1) { append(tr::lng_confcall_invite_already_many( tr::now, lt_count, already, - Ui::Text::RichLangValue)); + tr::rich)); } if (restricted == 1) { append(tr::lng_confcall_invite_fail_user( tr::now, lt_user, - Ui::Text::Bold(result.privacyRestricted.front()->shortName()), - Ui::Text::RichLangValue)); + tr::bold(result.privacyRestricted.front()->shortName()), + tr::rich)); } else if (restricted > 1) { append(tr::lng_confcall_invite_fail_many( tr::now, lt_count, restricted, - Ui::Text::RichLangValue)); + tr::rich)); } if (kicked == 1) { append(tr::lng_confcall_invite_kicked_user( tr::now, lt_user, - Ui::Text::Bold(result.kicked.front()->shortName()), - Ui::Text::RichLangValue)); + tr::bold(result.kicked.front()->shortName()), + tr::rich)); } else if (kicked > 1) { append(tr::lng_confcall_invite_kicked_many( tr::now, lt_count, kicked, - Ui::Text::RichLangValue)); + tr::rich)); } if (failed == 1) { append(tr::lng_confcall_invite_fail_user( tr::now, lt_user, - Ui::Text::Bold(result.failed.front()->shortName()), - Ui::Text::RichLangValue)); + tr::bold(result.failed.front()->shortName()), + tr::rich)); } else if (failed > 1) { append(tr::lng_confcall_invite_fail_many( tr::now, lt_count, failed, - Ui::Text::RichLangValue)); + tr::rich)); } return text; } diff --git a/Telegram/SourceFiles/calls/group/calls_group_common.cpp b/Telegram/SourceFiles/calls/group/calls_group_common.cpp index 1a44fff548..69c028cdce 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_common.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_common.cpp @@ -57,8 +57,8 @@ object_ptr ScreenSharingPrivacyRequestBox() { tr::lng_group_call_mac_screencast_access(), tr::lng_group_call_mac_recording() ) | rpl::map([](QString a, QString b) { - auto result = Ui::Text::RichLangValue(a); - result.append("\n\n").append(Ui::Text::RichLangValue(b)); + auto result = tr::rich(a); + result.append("\n\n").append(tr::rich(b)); return result; }), st::groupCallBoxLabel), @@ -133,7 +133,7 @@ void ConferenceCallJoinConfirm( st::boxRowPadding + st::confcallLinkTitlePadding, style::al_top); const auto wrapName = [&](not_null peer) { - return rpl::single(Ui::Text::Bold(peer->shortName())); + return rpl::single(tr::bold(peer->shortName())); }; box->addRow( object_ptr( @@ -142,8 +142,8 @@ void ConferenceCallJoinConfirm( ? tr::lng_confcall_join_text_inviter( lt_user, wrapName(maybeInviter), - Ui::Text::RichLangValue) - : tr::lng_confcall_join_text(Ui::Text::RichLangValue)), + tr::rich) + : tr::lng_confcall_join_text(tr::rich)), st::confcallLinkCenteredText), st::boxRowPadding, style::al_top @@ -189,14 +189,14 @@ void ConferenceCallJoinConfirm( ? tr::lng_confcall_already_joined_one( lt_user, wrapByIndex(0), - Ui::Text::RichLangValue) + tr::rich) : (known == 2) ? tr::lng_confcall_already_joined_two( lt_user, wrapByIndex(0), lt_other, wrapByIndex(1), - Ui::Text::RichLangValue) + tr::rich) : (known == 3) ? tr::lng_confcall_already_joined_three( lt_user, @@ -205,7 +205,7 @@ void ConferenceCallJoinConfirm( wrapByIndex(1), lt_third, wrapByIndex(2), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_confcall_already_joined_many( lt_count, rpl::single(1. * (std::max(known, call->fullCount()) - 2)), @@ -213,7 +213,7 @@ void ConferenceCallJoinConfirm( wrapByIndex(0), lt_other, wrapByIndex(1), - Ui::Text::RichLangValue); + tr::rich); box->addRow( object_ptr( box, @@ -418,8 +418,8 @@ void ShowConferenceCallLinkBox( tr::lng_confcall_link_join_link( lt_arrow, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - [](QString v) { return Ui::Text::Link(v); }), - Ui::Text::WithEntities), + [](QString v) { return tr::link(v); }), + tr::marked), (st.centerLabel ? *st.centerLabel : st::confcallLinkCenteredText)); diff --git a/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp b/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp index bc4645e069..4b1c8b2fdf 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp @@ -899,14 +899,14 @@ object_ptr PrepareInviteBox( showToast(tr::lng_group_call_invite_done_user( tr::now, lt_user, - Ui::Text::Bold(result.invited.front()->firstName), - Ui::Text::WithEntities)); + tr::bold(result.invited.front()->firstName), + tr::marked)); } else if (result.invited.size() > 1) { showToast(tr::lng_group_call_invite_done_many( tr::now, lt_count, result.invited.size(), - Ui::Text::RichLangValue)); + tr::rich)); } }); }; diff --git a/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp b/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp index 2821870e2a..00eae1040f 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp @@ -643,7 +643,7 @@ void MessagesUi::setContentFailed(MessageView &entry) { TextWithEntities().append( QString::fromUtf8("\xe2\x9d\x97\xef\xb8\x8f") ).append(' ').append( - Ui::Text::Italic(u"Failed to send the message."_q)), + tr::italic(u"Failed to send the message."_q)), kMarkupTextOptions, st::groupCallWidth / 8); entry.price = Ui::Text::String(); @@ -673,7 +673,7 @@ void MessagesUi::setContent(MessageView &entry) { } auto composed = entry.admin ? entry.original - : Ui::Text::Link(name, 1).append(' ').append(entry.original); + : tr::link(name, 1).append(' ').append(entry.original); if (!entry.admin) { composed.text.replace(QChar('\n'), QChar(' ')); } @@ -960,7 +960,7 @@ TextWithEntities MessagesUi::nameText( } result.append(Ui::Text::SingleCustomEmoji(i->second)).append(' '); } - result.append(Ui::Text::Bold(peer->shortName())); + result.append(tr::bold(peer->shortName())); return result; } diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index 6a26012a5d..1c4f8f86a2 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -1360,7 +1360,7 @@ void Panel::subscribeToChanges(not_null real) { ? tr::lng_group_call_recording_stopped_channel : tr::lng_group_call_recording_stopped))( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); }, lifetime()); validateRecordingMark(real->recordStartDate() != 0); diff --git a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp index a6ad667d06..8a5c8994c1 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp @@ -335,7 +335,7 @@ void StartRtmpProcess::FillRtmpRows( if (button == Qt::LeftButton) { show->showBox(Ui::MakeConfirmBox({ .text = tr::lng_group_call_rtmp_key_warning( - Ui::Text::RichLangValue), + tr::rich), .confirmed = [=](Fn &&close) { handler->onClick({}); close(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp index aca8a90798..e49484cd20 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp @@ -457,8 +457,8 @@ void SettingsBox( ? tr::lng_group_call_mac_input() : tr::lng_group_call_mac_accessibility()) ) | rpl::map([](QString a, QString b) { - auto result = Ui::Text::RichLangValue(a); - result.append("\n\n").append(Ui::Text::RichLangValue(b)); + auto result = tr::rich(a); + result.append("\n\n").append(tr::rich(b)); return result; }), st::groupCallBoxLabel), diff --git a/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp b/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp index 7c9222ef94..b3a8604c97 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp @@ -56,8 +56,8 @@ void Toasts::setupJoinAsChanged() { : tr::lng_group_call_join_as_changed)( tr::now, lt_name, - Ui::Text::Bold(_call->joinAs()->name()), - Ui::Text::WithEntities)); + tr::bold(_call->joinAs()->name()), + tr::marked)); }, _lifetime); } @@ -76,8 +76,8 @@ void Toasts::setupTitleChanged() { : tr::lng_group_call_title_changed)( tr::now, lt_title, - Ui::Text::Bold(title), - Ui::Text::WithEntities)); + tr::bold(title), + tr::marked)); }, _lifetime); } @@ -96,8 +96,8 @@ void Toasts::setupAllowedToSpeak() { .text = tr::lng_group_call_can_speak( tr::now, lt_chat, - Ui::Text::Bold(name), - Ui::Text::WithEntities), + tr::bold(name), + tr::marked), }); } }, _lifetime); diff --git a/Telegram/SourceFiles/calls/group/ui/calls_group_stars_coloring.cpp b/Telegram/SourceFiles/calls/group/ui/calls_group_stars_coloring.cpp index 948c90ef33..9deb7a79fb 100644 --- a/Telegram/SourceFiles/calls/group/ui/calls_group_stars_coloring.cpp +++ b/Telegram/SourceFiles/calls/group/ui/calls_group_stars_coloring.cpp @@ -105,15 +105,15 @@ object_ptr VideoStreamStarsLevel( }); return MakeStarSelectInfoBlocks(box, { { - .title = std::move(pinTitle) | Text::ToWithEntities(), + .title = std::move(pinTitle) | rpl::map(tr::marked), .subtext = tr::lng_paid_comment_pin_about(), }, { - .title = std::move(limitTitle) | Text::ToWithEntities(), + .title = std::move(limitTitle) | rpl::map(tr::marked), .subtext = std::move(limitSubtext), }, { - .title = std::move(emojiTitle) | Text::ToWithEntities(), + .title = std::move(emojiTitle) | rpl::map(tr::marked), .subtext = std::move(emojiSubtext), }, }, {}, true); diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 2f36bd5e17..7f43678797 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -496,7 +496,7 @@ void InitMessageFieldHandlers(MessageFieldHandlersArgs &&args) { return url.startsWith(start) ? url : (start + url); } show->showToast( - tr::lng_factcheck_links(tr::now, Ui::Text::RichLangValue)); + tr::lng_factcheck_links(tr::now, tr::rich)); return QString(); }; if (action == EditLinkAction::Check) { @@ -1308,8 +1308,8 @@ std::unique_ptr FrozenWriteRestriction( ? tr::lng_frozen_bar_text( lt_arrow, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::WithEntities) - : tr::lng_frozen_restrict_text(Ui::Text::WithEntities)), + tr::marked) + : tr::lng_frozen_restrict_text(tr::marked)), bar ? st::frozenBarSubtitle : st::frozenRestrictionSubtitle); subtitle->setAttribute(Qt::WA_TransparentForMouseEvents); subtitle->show(); @@ -1445,7 +1445,7 @@ void FrozenInfoBox( raw->add( object_ptr( raw, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), st.infoTitle ? *st.infoTitle : st::defaultFlatLabel), st::settingsPremiumRowTitlePadding); raw->add( @@ -1472,23 +1472,23 @@ void FrozenInfoBox( infoRow( tr::lng_frozen_subtitle1(), - tr::lng_frozen_text1(Ui::Text::WithEntities), + tr::lng_frozen_text1(tr::marked), st.violationIcon ? st.violationIcon : &st::menuIconBlock); infoRow( tr::lng_frozen_subtitle2(), - tr::lng_frozen_text2(Ui::Text::WithEntities), + tr::lng_frozen_text2(tr::marked), st.readOnlyIcon ? st.readOnlyIcon : &st::menuIconLock); infoRow( tr::lng_frozen_subtitle3(), tr::lng_frozen_text3( lt_link, - rpl::single(Ui::Text::Link(u"@SpamBot"_q, info.appealUrl)), + rpl::single(tr::link(u"@SpamBot"_q, info.appealUrl)), lt_date, rpl::single(TextWithEntities{ langDayOfMonthFull( base::unixtime::parse(info.until).date()), }), - Ui::Text::WithEntities), + tr::marked), st.appealIcon ? st.appealIcon : &st::menuIconHourglass); const auto button = box->addButton( diff --git a/Telegram/SourceFiles/chat_helpers/share_message_phrase_factory.cpp b/Telegram/SourceFiles/chat_helpers/share_message_phrase_factory.cpp index 26912176e2..608823a3c5 100644 --- a/Telegram/SourceFiles/chat_helpers/share_message_phrase_factory.cpp +++ b/Telegram/SourceFiles/chat_helpers/share_message_phrase_factory.cpp @@ -25,14 +25,14 @@ rpl::producer ForwardedMessagePhrase( return (args.singleMessage ? tr::lng_share_message_to_saved_messages : tr::lng_share_messages_to_saved_messages)( - Ui::Text::RichLangValue); + tr::rich); } else { return (args.singleMessage ? tr::lng_share_message_to_chat : tr::lng_share_messages_to_chat)( lt_chat, rpl::single(TextWithEntities{ args.to1->name() }), - Ui::Text::RichLangValue); + tr::rich); } } else if ((args.toCount == 2) && (args.to1 && args.to2)) { return (args.singleMessage @@ -42,14 +42,14 @@ rpl::producer ForwardedMessagePhrase( rpl::single(TextWithEntities{ args.to1->name() }), lt_chat, rpl::single(TextWithEntities{ args.to2->name() }), - Ui::Text::RichLangValue); + tr::rich); } else { return (args.singleMessage ? tr::lng_share_message_to_many_chats : tr::lng_share_messages_to_many_chats)( lt_count, rpl::single(args.toCount) | tr::to_count(), - Ui::Text::RichLangValue); + tr::rich); } } diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index fe56330372..f0b62e8025 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -1117,7 +1117,7 @@ void TabbedSelector::checkRestrictedPeer() { _restrictedLabel.create( this, rpl::single(error.boostsToLift - ? Ui::Text::Link(error.text) + ? tr::link(error.text) : TextWithEntities{ error.text }), st::stickersRestrictedLabel); const auto lifting = error.boostsToLift; diff --git a/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp b/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp index 6130741d30..76b10d412e 100644 --- a/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp @@ -226,11 +226,11 @@ PreviewWrap::PreviewWrap( lt_user, rpl::single( item->history()->peer->shortName() - ) | Ui::Text::ToRichLangValue(), - Ui::Text::RichLangValue) + ) | rpl::map(tr::rich), + tr::rich) : (isRound ? tr::lng_ttl_round_tooltip_in - : tr::lng_ttl_voice_tooltip_in)(Ui::Text::RichLangValue); + : tr::lng_ttl_voice_tooltip_in)(tr::rich); const auto tooltip = Ui::CreateChild( this, object_ptr>( diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index afc03da744..bf18b41a9b 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -154,10 +154,10 @@ void PersonalChannelController::prepare() { } if (!delegate()->peerListFullRowsCount()) { auto none = rpl::combine( - tr::lng_settings_channel_no_yet(Ui::Text::WithEntities), + tr::lng_settings_channel_no_yet(tr::marked), tr::lng_settings_channel_start() ) | rpl::map([](TextWithEntities &&text, const QString &link) { - return text.append('\n').append(Ui::Text::Link(link)); + return text.append('\n').append(tr::link(link)); }); auto label = object_ptr( nullptr, @@ -1085,14 +1085,12 @@ bool ShowEditBirthday( std::move(isExactlyContacts), tr::lng_settings_birthday_contacts( lt_link, - tr::lng_settings_birthday_contacts_link( - ) | Ui::Text::ToLink(link), - Ui::Text::WithEntities), + tr::lng_settings_birthday_contacts_link(tr::url(link)), + tr::marked), tr::lng_settings_birthday_about( lt_link, - tr::lng_settings_birthday_about_link( - ) | Ui::Text::ToLink(link), - Ui::Text::WithEntities))); + tr::lng_settings_birthday_about_link(tr::url(link)), + tr::marked))); })); } @@ -1597,10 +1595,10 @@ bool ResolveTopUp( .text = tr::lng_credits_enough( tr::now, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_credits_enough_link(tr::now))), - Ui::Text::RichLangValue), + tr::rich), .filter = filter, .duration = 4 * crl::time(1000), }); diff --git a/Telegram/SourceFiles/data/components/recent_shared_media_gifts.cpp b/Telegram/SourceFiles/data/components/recent_shared_media_gifts.cpp index 731f41bb3b..c8e6cd6fc3 100644 --- a/Telegram/SourceFiles/data/components/recent_shared_media_gifts.cpp +++ b/Telegram/SourceFiles/data/components/recent_shared_media_gifts.cpp @@ -199,10 +199,10 @@ void RecentSharedMediaGifts::togglePinned( TextWithEntities{ Data::UniqueGiftName(*replacingData), }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_gift_pinned_done( tr::now, - Ui::Text::WithEntities)), + tr::marked)), .duration = Ui::Toast::kDefaultDuration * 2, }); } diff --git a/Telegram/SourceFiles/data/components/sponsored_messages.cpp b/Telegram/SourceFiles/data/components/sponsored_messages.cpp index fb27db98d5..85dfa4e124 100644 --- a/Telegram/SourceFiles/data/components/sponsored_messages.cpp +++ b/Telegram/SourceFiles/data/components/sponsored_messages.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "main/main_session.h" #include "ui/chat/sponsored_message_bar.h" -#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue. +#include "ui/text/text_utilities.h" // tr::rich. namespace Data { namespace { @@ -554,7 +554,7 @@ void SponsoredMessages::append( tr::now, lt_text, { .text = qs(*data.vsponsor_info()) }, - Ui::Text::RichLangValue) + tr::rich) : TextWithEntities(); auto additionalInfo = TextWithEntities::Simple( data.vadditional_info() ? qs(*data.vadditional_info()) : QString()); diff --git a/Telegram/SourceFiles/data/data_chat_participant_status.cpp b/Telegram/SourceFiles/data/data_chat_participant_status.cpp index 33315b63e4..6390f55947 100644 --- a/Telegram/SourceFiles/data/data_chat_participant_status.cpp +++ b/Telegram/SourceFiles/data/data_chat_participant_status.cpp @@ -527,7 +527,7 @@ void ShowSendErrorToast( window->resolveBoostState(peer->asChannel(), error.boostsToLift); }; show->showToast({ - .text = Ui::Text::Link(*error), + .text = tr::link(*error), .filter = [=](const auto &...) { boost(); return false; }, }); } diff --git a/Telegram/SourceFiles/data/data_document_resolver.cpp b/Telegram/SourceFiles/data/data_document_resolver.cpp index 248daec9a9..fc83ca8e39 100644 --- a/Telegram/SourceFiles/data/data_document_resolver.cpp +++ b/Telegram/SourceFiles/data/data_document_resolver.cpp @@ -130,13 +130,13 @@ void LaunchWithWarning( File::Launch(name); }; auto text = isIpReveal - ? tr::lng_launch_svg_warning(Ui::Text::WithEntities) + ? tr::lng_launch_svg_warning(tr::marked) : ((nameType == Core::NameType::Executable) ? tr::lng_launch_exe_warning : tr::lng_launch_other_warning)( lt_extension, - rpl::single(Ui::Text::Bold('.' + extension)), - Ui::Text::WithEntities); + rpl::single(tr::bold('.' + extension)), + tr::marked); auto check = (isIpReveal ? tr::lng_launch_exe_dont_ask : tr::lng_launch_dont_ask)(); diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index 6724923f1c..f032785f3f 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -93,7 +93,7 @@ constexpr auto kShowChatNamesCount = 8; result, lt_chat, wrapName(*i), - Ui::Text::WithEntities); + tr::marked); } return result; }(); @@ -104,7 +104,7 @@ constexpr auto kShowChatNamesCount = 8; (count - shown), lt_chats, accumulated, - Ui::Text::WithEntities) + tr::marked) : accumulated; } diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 7546d047aa..4b5ae3ec78 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -116,10 +116,10 @@ struct AlbumCounts { tr::now, lt_media, Ui::Text::Colorized(attachType), - Ui::Text::WithEntities), + tr::marked), lt_caption, wrapped, - Ui::Text::WithEntities); + tr::marked); } [[nodiscard]] QImage PreparePreviewImage( @@ -2510,7 +2510,7 @@ ClickHandlerPtr MediaDice::MakeHandler( .duration = Ui::Toast::kDefaultDuration * 2, }; if (CanSend(history->peer, ChatRestriction::SendOther)) { - auto link = Ui::Text::Link(tr::lng_about_random_send(tr::now)); + auto link = tr::link(tr::lng_about_random_send(tr::now)); link.entities.push_back( EntityInText(EntityType::Semibold, 0, link.text.size())); config.text.append(' ').append(std::move(link)); diff --git a/Telegram/SourceFiles/data/data_stories.cpp b/Telegram/SourceFiles/data/data_stories.cpp index dfa73b25ad..e41964db9a 100644 --- a/Telegram/SourceFiles/data/data_stories.cpp +++ b/Telegram/SourceFiles/data/data_stories.cpp @@ -1334,8 +1334,8 @@ void Stories::toggleHidden( show->showToast(phrase( tr::now, lt_user, - Ui::Text::Bold(name), - Ui::Text::RichLangValue)); + tr::bold(name), + tr::rich)); } }); diff --git a/Telegram/SourceFiles/data/data_story.cpp b/Telegram/SourceFiles/data/data_story.cpp index a290131f6c..deb5afa27a 100644 --- a/Telegram/SourceFiles/data/data_story.cpp +++ b/Telegram/SourceFiles/data/data_story.cpp @@ -363,10 +363,10 @@ TextWithEntities Story::inReplyText() const { tr::now, lt_media, Ui::Text::Colorized(type), - Ui::Text::WithEntities), + tr::marked), lt_caption, _caption, - Ui::Text::WithEntities); + tr::marked); } void Story::setPinnedToTop(bool pinned) { diff --git a/Telegram/SourceFiles/data/stickers/data_stickers.cpp b/Telegram/SourceFiles/data/stickers/data_stickers.cpp index 19c8e9640f..ea44c12e9a 100644 --- a/Telegram/SourceFiles/data/stickers/data_stickers.cpp +++ b/Telegram/SourceFiles/data/stickers/data_stickers.cpp @@ -48,7 +48,7 @@ using SetFlag = StickersSetFlag; const Data::PremiumLimits &limits) { const auto defaultLimit = limits.gifsDefault(); const auto premiumLimit = limits.gifsPremium(); - return Ui::Text::Bold( + return tr::bold( tr::lng_saved_gif_limit_title(tr::now, lt_count, defaultLimit) ).append('\n').append( tr::lng_saved_gif_limit_more( @@ -56,15 +56,15 @@ using SetFlag = StickersSetFlag; lt_count, premiumLimit, lt_link, - Ui::Text::Link(tr::lng_saved_gif_limit_link(tr::now)), - Ui::Text::WithEntities)); + tr::link(tr::lng_saved_gif_limit_link(tr::now)), + tr::marked)); } [[nodiscard]] TextWithEntities FaveStickersToast( const Data::PremiumLimits &limits) { const auto defaultLimit = limits.stickersFavedDefault(); const auto premiumLimit = limits.stickersFavedPremium(); - return Ui::Text::Bold( + return tr::bold( tr::lng_fave_sticker_limit_title(tr::now, lt_count, defaultLimit) ).append('\n').append( tr::lng_fave_sticker_limit_more( @@ -72,8 +72,8 @@ using SetFlag = StickersSetFlag; lt_count, premiumLimit, lt_link, - Ui::Text::Link(tr::lng_fave_sticker_limit_link(tr::now)), - Ui::Text::WithEntities)); + tr::link(tr::lng_fave_sticker_limit_link(tr::now)), + tr::marked)); } void MaybeShowPremiumToast( diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 5d3d0edc31..1112141cae 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -181,7 +181,7 @@ constexpr auto kPreviewPostsLimit = 3; } else { text.append(tr::lng_search_tab_no_results( tr::now, - Ui::Text::Bold)); + tr::bold)); if (!trimmed.isEmpty()) { const auto preview = (trimmed.size() > kQueryPreviewLimit + 3) ? (trimmed.mid(0, kQueryPreviewLimit) + Ui::kQEllipsis) @@ -193,7 +193,7 @@ constexpr auto kPreviewPostsLimit = 3; trimmed.mid(0, kQueryPreviewLimit))); if (suggestAllChats) { text.append("\n\n").append( - Ui::Text::Link(tr::lng_search_tab_try_in_all(tr::now))); + tr::link(tr::lng_search_tab_try_in_all(tr::now))); } else if (hashtag) { text.append("\n").append( tr::lng_search_tab_no_results_retry(tr::now)); @@ -1184,7 +1184,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { result->sponsored->button, tr::lng_search_sponsored_button( tr::now, - Ui::Text::WithEntities), + tr::marked), st::dialogsSponsoredButton); } @@ -1400,7 +1400,7 @@ void InnerWidget::fillRightButton( rightButton, tr::lng_profile_open_app_short( tr::now, - Ui::Text::WithEntities), + tr::marked), st::dialogRowOpenBot); return &(_rightButtons.emplace( user->id, @@ -4155,9 +4155,9 @@ void InnerWidget::refreshEmpty() { std::move(phrase), std::move(link) ) | rpl::map([](const QString &phrase, const QString &link) { - auto result = Ui::Text::WithEntities(phrase); + auto result = tr::marked(phrase); if (!link.isEmpty()) { - result.append("\n\n").append(Ui::Text::Link(link)); + result.append("\n\n").append(tr::link(link)); } return result; }); diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp index d9cff28865..7cf7598fad 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp @@ -58,7 +58,7 @@ namespace { const auto attempt = [&](const auto &phrase) { result.setMarkedText( st::dialogsSearchTagPromo, - phrase(tr::now, lt_arrow, emoji, Ui::Text::WithEntities), + phrase(tr::now, lt_arrow, emoji, tr::marked), kMarkupTextOptions); return result.maxWidth() < width; }; diff --git a/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp b/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp index 51d034522a..83292cec59 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp @@ -90,8 +90,8 @@ void ShowAuthToast( auto text = tr::lng_unconfirmed_auth_confirmed_message( tr::now, lt_link, - Ui::Text::Link(tr::lng_settings_sessions_title(tr::now)), - Ui::Text::RichLangValue); + tr::link(tr::lng_settings_sessions_title(tr::now)), + tr::rich); auto filter = [=]( ClickHandlerPtr handler, Qt::MouseButton button) { @@ -141,7 +141,7 @@ void ShowAuthToast( .append( tr::lng_unconfirmed_auth_denied_warning( tr::now, - Ui::Text::Bold)), + tr::bold)), .confirmText = tr::lng_archive_hint_button(tr::now), }); })); @@ -365,7 +365,7 @@ rpl::producer*> TopBarSuggestionValue( content->setContent( tr::lng_dialogs_suggestions_premium_grace_title( tr::now, - Ui::Text::Bold), + tr::bold), tr::lng_dialogs_suggestions_premium_grace_about( tr::now, TextWithEntities::Simple)); @@ -413,7 +413,7 @@ rpl::producer*> TopBarSuggestionValue( Ui::MakeCreditsIconEntity(), lt_channels, { peers }, - Ui::Text::Bold), + tr::bold), tr::lng_dialogs_suggestions_credits_sub_low_about( tr::now, TextWithEntities::Simple), @@ -483,12 +483,12 @@ rpl::producer*> TopBarSuggestionValue( tr::now, lt_text, { first->shortName() }, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_dialogs_suggestions_birthday_contacts_title( tr::now, lt_count, users.size(), - Ui::Text::RichLangValue); + tr::rich); auto text = isSingle ? tr::lng_dialogs_suggestions_birthday_contact_about( tr::now, @@ -616,7 +616,7 @@ rpl::producer*> TopBarSuggestionValue( content->setContent( tr::lng_dialogs_suggestions_birthday_title( tr::now, - Ui::Text::Bold), + tr::bold), tr::lng_dialogs_suggestions_birthday_about( tr::now, TextWithEntities::Simple)); @@ -648,7 +648,7 @@ rpl::producer*> TopBarSuggestionValue( tr::now, lt_text, { discount.replace(kMinus, QChar()) }, - Ui::Text::Bold), + tr::bold), description(tr::now, TextWithEntities::Simple)); content->setClickedCallback([=] { const auto controller = FindSessionController(parent); @@ -742,7 +742,7 @@ rpl::producer*> TopBarSuggestionValue( content->setContent( tr::lng_dialogs_suggestions_userpics_title( tr::now, - Ui::Text::Bold), + tr::bold), tr::lng_dialogs_suggestions_userpics_about( tr::now, TextWithEntities::Simple)); diff --git a/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp b/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp index 8744f30861..834e3f2f71 100644 --- a/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp +++ b/Telegram/SourceFiles/dialogs/ui/chat_search_in.cpp @@ -285,13 +285,13 @@ void ChatSearchIn::apply( updateSection( &_in, i->icon->clone(), - Ui::Text::Semibold(TabLabel(active, peerTabType))); + tr::semibold(TabLabel(active, peerTabType))); auto text = tr::lng_dlg_search_from( tr::now, lt_user, - Ui::Text::Semibold(fromName), - Ui::Text::WithEntities); + tr::semibold(fromName), + tr::marked); updateSection(&_from, std::move(fromUserpic), std::move(text)); resizeToWidth(width()); diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index f7939d7286..0d82994e2a 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -588,7 +588,7 @@ void PaintRow( .entities = ConvertTextTagsToEntities( draft->textWithTags.tags), }), - Text::WithEntities); + tr::marked); if (draft && draft->reply) { draftText = Ui::Text::Colorized( Ui::Text::IconEmoji(&st::dialogsMiniReplyIcon) diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_stories_list.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_stories_list.cpp index 993fa877a4..24d924e5f6 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_stories_list.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_stories_list.cpp @@ -926,7 +926,7 @@ TextWithEntities List::computeTooltipText() const { break; } } - auto sequence = Ui::Text::Bold(names.front()); + auto sequence = tr::bold(names.front()); if (names.size() > 1) { for (auto i = 1; i + 1 != names.size(); ++i) { sequence = tr::lng_stories_click_to_view_and_one( @@ -934,22 +934,22 @@ TextWithEntities List::computeTooltipText() const { lt_accumulated, sequence, lt_user, - Ui::Text::Bold(names[i]), - Ui::Text::WithEntities); + tr::bold(names[i]), + tr::marked); } sequence = tr::lng_stories_click_to_view_and_last( tr::now, lt_accumulated, sequence, lt_user, - Ui::Text::Bold(names.back()), - Ui::Text::WithEntities); + tr::bold(names.back()), + tr::marked); } return tr::lng_stories_click_to_view( tr::now, lt_users, sequence, - Ui::Text::WithEntities); + tr::marked); } void List::setShowTooltip( diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_suggestions.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_suggestions.cpp index 89bf9d918f..a72c03ad84 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_suggestions.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_suggestions.cpp @@ -1336,8 +1336,8 @@ void PopularAppsController::fill() { tr::lng_bot_apps_which( lt_link, tr::lng_bot_apps_which_link( - ) | Ui::Text::ToLink(u"internal:about_popular_apps"_q), - Ui::Text::WithEntities), + tr::url(u"internal:about_popular_apps"_q)), + tr::marked), st::dialogsPopularAppsAbout), st::dialogsPopularAppsPadding)); } @@ -2046,7 +2046,7 @@ void Suggestions::setupPostsIntro(const PostsSearchIntroState &intro) { tr::now, lt_count, spent, - Ui::Text::RichLangValue), + tr::rich), .attach = RectPart::Top, .duration = Ui::Toast::kDefaultDuration * 2, }); @@ -2736,7 +2736,7 @@ object_ptr> Suggestions::setupEmpty( auto content = object_ptr( parent, icon, - std::move(text) | Ui::Text::ToWithEntities()); + std::move(text) | rpl::map(tr::marked)); const auto raw = content.data(); rpl::combine( @@ -2958,13 +2958,13 @@ object_ptr PopularAppsAboutBox( return Ui::MakeInformBox({ .text = tr::lng_popular_apps_info_text( lt_bot, - rpl::single(Ui::Text::Link( + rpl::single(tr::link( u"@botfather"_q, u"https://t.me/botfather"_q)), lt_link, tr::lng_popular_apps_info_here( - ) | Ui::Text::ToLink(tr::lng_popular_apps_info_url(tr::now)), - Ui::Text::RichLangValue), + tr::url(tr::lng_popular_apps_info_url(tr::now))), + tr::rich), .confirmText = tr::lng_popular_apps_info_confirm(), .title = tr::lng_popular_apps_info_title(), }); diff --git a/Telegram/SourceFiles/dialogs/ui/posts_search_intro.cpp b/Telegram/SourceFiles/dialogs/ui/posts_search_intro.cpp index a4ceb0f8a8..83d4ce40de 100644 --- a/Telegram/SourceFiles/dialogs/ui/posts_search_intro.cpp +++ b/Telegram/SourceFiles/dialogs/ui/posts_search_intro.cpp @@ -217,7 +217,7 @@ void PostsSearchIntro::setup() { SetSearchButtonLabel(_button, tr::lng_posts_search_button( lt_query, rpl::single(Ui::Text::Colorized(state.query.trimmed())), - Ui::Text::WithEntities)); + tr::marked)); } else { _button->setText(rpl::single(QString())); @@ -229,13 +229,13 @@ void PostsSearchIntro::setup() { &st::starIconEmoji ).append( Lang::FormatCountDecimal(state.starsPerPaidSearch))), - Ui::Text::WithEntities), + tr::marked), tr::lng_posts_limit_unlocks( lt_duration, FormatCountdownTill( state.nextFreeSearchTime - ) | Ui::Text::ToWithEntities(), - Ui::Text::WithEntities), + ) | rpl::map(tr::marked), + tr::marked), st::resaleButtonTitle, st::resaleButtonSubtitle); } diff --git a/Telegram/SourceFiles/export/view/export_view_settings.cpp b/Telegram/SourceFiles/export/view/export_view_settings.cpp index b31d87c7de..b5b0e8bd6b 100644 --- a/Telegram/SourceFiles/export/view/export_view_settings.cpp +++ b/Telegram/SourceFiles/export/view/export_view_settings.cpp @@ -306,7 +306,7 @@ void SettingsWidget::addLocationLabel( ? u"Downloads/"_q + File::DefaultDownloadPathFolder(_session) : tr::lng_download_path_temp(tr::now) : path; - return Ui::Text::Link( + return tr::link( QDir::toNativeSeparators(text), QString("internal:edit_export_path")); }); @@ -316,7 +316,7 @@ void SettingsWidget::addLocationLabel( tr::lng_export_option_location( lt_path, std::move(pathLink), - Ui::Text::WithEntities), + tr::marked), st::exportLocationLabel), st::exportLocationPadding); label->overrideLinkClickHandler([=] { @@ -355,7 +355,7 @@ void SettingsWidget::addFormatAndLocationLabel( ? u"Downloads/"_q + File::DefaultDownloadPathFolder(_session) : tr::lng_download_path_temp(tr::now) : path; - return Ui::Text::Link( + return tr::link( QDir::toNativeSeparators(text), u"internal:edit_export_path"_q); }); @@ -368,7 +368,7 @@ void SettingsWidget::addFormatAndLocationLabel( : (format == Format::Json) ? "JSON" : tr::lng_export_option_html_and_json(tr::now); - return Ui::Text::Link(text, u"internal:edit_format"_q); + return tr::link(text, u"internal:edit_format"_q); }); const auto label = container->add( object_ptr( @@ -378,7 +378,7 @@ void SettingsWidget::addFormatAndLocationLabel( std::move(formatLink), lt_path, std::move(pathLink), - Ui::Text::WithEntities), + tr::marked), st::exportLocationLabel), st::exportLocationPadding); label->overrideLinkClickHandler([=](const QString &url) { @@ -403,7 +403,7 @@ void SettingsWidget::addLimitsLabel( ? rpl::single(langDayOfMonthFull( base::unixtime::parse(from).date())) : tr::lng_export_beginning() - ) | Ui::Text::ToLink(u"internal:edit_from"_q); + ) | rpl::map(tr::url(u"internal:edit_from"_q)); }) | rpl::flatten_latest(); const auto mapToTime = [](TimeId id, const QString &link) { @@ -412,7 +412,7 @@ void SettingsWidget::addLimitsLabel( base::unixtime::parse(id).time(), QLocale::ShortFormat) : QString() - ) | Ui::Text::ToLink(link); + ) | rpl::map(tr::url(link)); }; const auto concat = [](TextWithEntities date, TextWithEntities link) { @@ -441,7 +441,7 @@ void SettingsWidget::addLimitsLabel( ? rpl::single(langDayOfMonthFull( base::unixtime::parse(till).date())) : tr::lng_export_end() - ) | Ui::Text::ToLink(u"internal:edit_till"_q); + ) | rpl::map(tr::url(u"internal:edit_till"_q)); }) | rpl::flatten_latest(); auto tillTimeLink = value() | rpl::map([](const Settings &data) { @@ -461,7 +461,7 @@ void SettingsWidget::addLimitsLabel( std::move(fromLink), lt_till, std::move(tillLink), - Ui::Text::WithEntities + tr::marked ) | rpl::after_next([=] { container->resizeToWidth(container->width()); }); diff --git a/Telegram/SourceFiles/export/view/export_view_top_bar.cpp b/Telegram/SourceFiles/export/view/export_view_top_bar.cpp index add25397c3..abc03eb10a 100644 --- a/Telegram/SourceFiles/export/view/export_view_top_bar.cpp +++ b/Telegram/SourceFiles/export/view/export_view_top_bar.cpp @@ -77,7 +77,7 @@ void TopBar::updateData(Content &&content) { } const auto &row = content.rows[0]; _infoLeft->setMarkedText( - tr::lng_export_progress_title(tr::now, Ui::Text::Bold) + tr::lng_export_progress_title(tr::now, tr::bold) .append(' ') .append(QChar(0x2013))); _infoMiddle->setText(row.label); diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index 91dff7e1ad..e3475b269e 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -549,7 +549,7 @@ void InnerWidget::showFilter(Fn callback) { box->verticalLayout(), tr::lng_admin_log_filter_actions_admins_section( tr::now, - Ui::Text::WithEntities), + tr::marked), checkedPeerId.size() == admins.size(), st::defaultBoxCheckbox)); using Controller = Ui::ExpandablePeerListController; @@ -602,7 +602,7 @@ void InnerWidget::clearAndRequestLog() { void InnerWidget::updateEmptyText() { auto hasSearch = !_searchQuery.isEmpty(); auto hasFilter = _filter.flags || _filter.admins; - auto text = Ui::Text::Semibold((hasSearch || hasFilter) + auto text = tr::semibold((hasSearch || hasFilter) ? tr::lng_admin_log_no_results_title(tr::now) : tr::lng_admin_log_no_events_title(tr::now)); auto description = hasSearch diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 9188a325cd..cc054c1693 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -269,7 +269,7 @@ TextWithEntities GenerateAdminChangeText( tr::now, lt_user, user, - Ui::Text::WithEntities); + tr::marked); const auto useInviteLinkPhrase = channel->isMegagroup() && channel->anyoneCanAddMembers(); @@ -356,7 +356,7 @@ TextWithEntities GeneratePermissionsChangeText( tr::now, lt_user, user, - Ui::Text::WithEntities); + tr::marked); } else if (newFlags == 0 && (prevFlags & Flag::ViewMessages) && !peerIsUser(participantId)) { @@ -364,7 +364,7 @@ TextWithEntities GeneratePermissionsChangeText( tr::now, lt_user, user, - Ui::Text::WithEntities); + tr::marked); } const auto untilText = indefinitely ? tr::lng_admin_log_restricted_forever(tr::now) @@ -378,7 +378,7 @@ TextWithEntities GeneratePermissionsChangeText( user, lt_until, TextWithEntities { untilText }, - Ui::Text::WithEntities); + tr::marked); const auto changes = GeneratePermissionsChangeText(newRights, prevRights); if (!changes.isEmpty()) { result.text.append('\n' + changes); @@ -426,7 +426,7 @@ TextWithEntities GenerateInviteLinkLink(const MTPExportedChatInvite &data) { const auto text = GenerateInviteLinkText(data); return text.endsWith(Ui::kQEllipsis) ? TextWithEntities{ .text = text } - : Ui::Text::Link(text, InternalInviteLinkUrl(data)); + : tr::link(text, InternalInviteLinkUrl(data)); } TextWithEntities GenerateInviteLinkChangeText( @@ -444,7 +444,7 @@ TextWithEntities GenerateInviteLinkChangeText( tr::now, lt_link, link, - Ui::Text::WithEntities); + tr::marked); result.text.append('\n'); const auto label = [](const MTPExportedChatInvite &link) { @@ -566,7 +566,7 @@ auto GenerateParticipantString( name, lt_mention, mention, - Ui::Text::WithEntities); + tr::marked); } auto GenerateParticipantChangeText( @@ -611,7 +611,7 @@ auto GenerateParticipantChangeText( tr::now, lt_user, user, - Ui::Text::WithEntities); + tr::marked); }; auto result = [&] { @@ -633,7 +633,7 @@ auto GenerateParticipantChangeText( tr::now, lt_user, user, - Ui::Text::WithEntities); + tr::marked); } case Api::ChatParticipant::Type::Admin: { const auto user = GenerateParticipantString( @@ -718,7 +718,7 @@ TextWithEntities GenerateDefaultBannedRightsChangeText( not_null channel, const MTPForumTopic &topic) { return topic.match([&](const MTPDforumTopic &data) { - return Ui::Text::Link( + return tr::link( Data::ForumTopicIconWithTitle( data.vid().v, data.vicon_emoji_id().value_or_empty(), @@ -851,7 +851,7 @@ void GenerateItems( const auto fromName = from->name(); const auto fromLink = from->createOpenLink(); - const auto fromLinkText = Ui::Text::Link(fromName, QString()); + const auto fromLinkText = tr::link(fromName, QString()); const auto addSimpleServiceMessage = [&]( const TextWithEntities &text, @@ -879,7 +879,7 @@ void GenerateItems( fromLinkText, lt_title, { .text = qs(action.vnew_value()) }, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(std::move(text)); }; @@ -906,7 +906,7 @@ void GenerateItems( : (newValue.isEmpty() ? tr::lng_admin_log_removed_description_channel : tr::lng_admin_log_changed_description_channel) - )(tr::now, lt_from, fromLinkText, Ui::Text::WithEntities); + )(tr::now, lt_from, fromLinkText, tr::marked); addSimpleServiceMessage(text); const auto body = makeSimpleTextMessage( @@ -931,7 +931,7 @@ void GenerateItems( : (newValue.isEmpty() ? tr::lng_admin_log_removed_link_channel : tr::lng_admin_log_changed_link_channel) - )(tr::now, lt_from, fromLinkText, Ui::Text::WithEntities); + )(tr::now, lt_from, fromLinkText, tr::marked); addSimpleServiceMessage(text); const auto body = makeSimpleTextMessage(newValue.isEmpty() @@ -960,7 +960,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text, MsgId(), photo); }, [&](const MTPDphotoEmpty &data) { const auto text = (channel->isMegagroup() @@ -969,7 +969,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }); }; @@ -982,7 +982,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -994,7 +994,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1008,7 +1008,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text, realId); addPart( @@ -1023,7 +1023,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }); }; @@ -1061,7 +1061,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text, realId); const auto body = history->createItem( @@ -1089,7 +1089,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text, realId); addPart( @@ -1108,7 +1108,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1119,7 +1119,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1159,7 +1159,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } else { const auto text = tr::lng_admin_log_changed_stickers_group( @@ -1167,10 +1167,10 @@ void GenerateItems( lt_from, fromLinkText, lt_sticker_set, - Ui::Text::Link( + tr::link( tr::lng_admin_log_changed_stickers_set(tr::now), QString()), - Ui::Text::WithEntities); + tr::marked); const auto setLink = std::make_shared([=]( ClickContext context) { const auto my = context.other.value(); @@ -1203,7 +1203,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } else { const auto text = tr::lng_admin_log_changed_emoji_group( @@ -1211,10 +1211,10 @@ void GenerateItems( lt_from, fromLinkText, lt_sticker_set, - Ui::Text::Link( + tr::link( tr::lng_admin_log_changed_emoji_set(tr::now), QString()), - Ui::Text::WithEntities); + tr::marked); const auto setLink = std::make_shared([=]( ClickContext context) { const auto my = context.other.value(); @@ -1248,7 +1248,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1267,7 +1267,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text, realId); addPart( @@ -1289,7 +1289,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } else { const auto text = (broadcast @@ -1299,8 +1299,8 @@ void GenerateItems( lt_from, fromLinkText, lt_chat, - Ui::Text::Link(now->name(), QString()), - Ui::Text::WithEntities); + tr::link(now->name(), QString()), + tr::marked); const auto chatLink = std::make_shared([=] { if (const auto window = now->session().tryResolveWindow()) { window->showPeerHistory(now); @@ -1323,7 +1323,7 @@ void GenerateItems( const auto address = qs(data.vaddress()); const auto link = data.vgeo_point().match([&]( const MTPDgeoPoint &data) { - return Ui::Text::Link( + return tr::link( address, LocationClickHandler::Url(Data::LocationPoint(data))); }, [&](const MTPDgeoPointEmpty &) { @@ -1335,14 +1335,14 @@ void GenerateItems( fromLinkText, lt_address, link, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }, [&](const MTPDchannelLocationEmpty &) { const auto text = tr::lng_admin_log_removed_location_chat( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }); }; @@ -1358,14 +1358,14 @@ void GenerateItems( fromLinkText, lt_duration, { .text = duration }, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } else { const auto text = tr::lng_admin_log_removed_slow_mode( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } }; @@ -1377,7 +1377,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1388,7 +1388,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1417,7 +1417,7 @@ void GenerateItems( const auto participantPeer = groupCallParticipantPeer( data.vparticipant()); const auto participantPeerLink = participantPeer->createOpenLink(); - const auto participantPeerLinkText = Ui::Text::Link( + const auto participantPeerLinkText = tr::link( participantPeer->name(), QString()); const auto text = (broadcast @@ -1428,7 +1428,7 @@ void GenerateItems( fromLinkText, lt_user, participantPeerLinkText, - Ui::Text::WithEntities); + tr::marked); addServiceMessageWithLink(text, participantPeerLink); }; @@ -1436,7 +1436,7 @@ void GenerateItems( const auto participantPeer = groupCallParticipantPeer( data.vparticipant()); const auto participantPeerLink = participantPeer->createOpenLink(); - const auto participantPeerLinkText = Ui::Text::Link( + const auto participantPeerLinkText = tr::link( participantPeer->name(), QString()); const auto text = (broadcast @@ -1447,7 +1447,7 @@ void GenerateItems( fromLinkText, lt_user, participantPeerLinkText, - Ui::Text::WithEntities); + tr::marked); addServiceMessageWithLink(text, participantPeerLink); }; @@ -1463,7 +1463,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1504,7 +1504,7 @@ void GenerateItems( fromLinkText, lt_link, GenerateInviteLinkLink(data.vinvite()), - Ui::Text::WithEntities), + tr::marked), data.vinvite()); }; @@ -1516,7 +1516,7 @@ void GenerateItems( fromLinkText, lt_link, GenerateInviteLinkLink(data.vinvite()), - Ui::Text::WithEntities), + tr::marked), data.vinvite()); }; @@ -1528,7 +1528,7 @@ void GenerateItems( fromLinkText, lt_link, GenerateInviteLinkLink(data.vinvite()), - Ui::Text::WithEntities), + tr::marked), data.vinvite()); }; @@ -1543,7 +1543,7 @@ void GenerateItems( const auto participantPeer = groupCallParticipantPeer( data.vparticipant()); const auto participantPeerLink = participantPeer->createOpenLink(); - const auto participantPeerLinkText = Ui::Text::Link( + const auto participantPeerLinkText = tr::link( participantPeer->name(), QString()); const auto volume = data.vparticipant().match([&]( @@ -1561,7 +1561,7 @@ void GenerateItems( participantPeerLinkText, lt_percent, { .text = volumeText }, - Ui::Text::WithEntities); + tr::marked); addServiceMessageWithLink(text, participantPeerLink); }; @@ -1581,7 +1581,7 @@ void GenerateItems( fromLinkText, lt_duration, wrap(now), - Ui::Text::WithEntities) + tr::marked) : !now ? tr::lng_admin_log_messages_ttl_removed( tr::now, @@ -1589,7 +1589,7 @@ void GenerateItems( fromLinkText, lt_duration, wrap(was), - Ui::Text::WithEntities) + tr::marked) : tr::lng_admin_log_messages_ttl_changed( tr::now, lt_from, @@ -1598,7 +1598,7 @@ void GenerateItems( wrap(was), lt_duration, wrap(now), - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1614,8 +1614,8 @@ void GenerateItems( lt_from, fromLinkText, lt_user, - Ui::Text::Link(user->name(), QString()), - Ui::Text::WithEntities) + tr::link(user->name(), QString()), + tr::marked) : (channel->isMegagroup() ? tr::lng_admin_log_participant_approved_by_link : tr::lng_admin_log_participant_approved_by_link_channel)( @@ -1625,8 +1625,8 @@ void GenerateItems( lt_link, linkText, lt_user, - Ui::Text::Link(user->name(), QString()), - Ui::Text::WithEntities); + tr::link(user->name(), QString()), + tr::marked); addInviteLinkServiceMessage( text, data.vinvite(), @@ -1641,7 +1641,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1651,7 +1651,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text, realId); addPart( @@ -1671,7 +1671,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); }, [&](const MTPDchatReactionsSome &data) { using namespace Window::Notifications; auto list = TextWithEntities(); @@ -1689,7 +1689,7 @@ void GenerateItems( fromLinkText, lt_emoji, list, - Ui::Text::WithEntities); + tr::marked); }, [&](const MTPDchatReactionsAll &data) { return (data.is_allow_custom() ? tr::lng_admin_log_reactions_allowed_all @@ -1697,7 +1697,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); }); addSimpleServiceMessage(text); }; @@ -1743,7 +1743,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities)); + tr::marked)); const auto body = makeSimpleTextMessage(list(newValue)); body->addLogEntryOriginal( id, @@ -1772,7 +1772,7 @@ void GenerateItems( fromLinkText, lt_link, { changed }, - Ui::Text::WithEntities)); + tr::marked)); return; } // Probably will never happen. @@ -1798,7 +1798,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1810,7 +1810,7 @@ void GenerateItems( fromLinkText, lt_topic, topicLink, - Ui::Text::WithEntities)); + tr::marked)); }; const auto createEditTopic = [&](const LogEditTopic &data) { @@ -1825,7 +1825,7 @@ void GenerateItems( prevLink, lt_new_topic, nowLink, - Ui::Text::WithEntities)); + tr::marked)); } const auto wasClosed = IsTopicClosed(data.vprev_topic()); const auto nowClosed = IsTopicClosed(data.vnew_topic()); @@ -1838,7 +1838,7 @@ void GenerateItems( fromLinkText, lt_topic, nowLink, - Ui::Text::WithEntities)); + tr::marked)); } const auto wasHidden = IsTopicHidden(data.vprev_topic()); const auto nowHidden = IsTopicHidden(data.vnew_topic()); @@ -1851,7 +1851,7 @@ void GenerateItems( fromLinkText, lt_topic, nowLink, - Ui::Text::WithEntities)); + tr::marked)); } }; @@ -1866,7 +1866,7 @@ void GenerateItems( fromLinkText, lt_topic, topicLink, - Ui::Text::WithEntities)); + tr::marked)); }; const auto createPinTopic = [&](const LogPinTopic &data) { @@ -1878,7 +1878,7 @@ void GenerateItems( fromLinkText, lt_topic, topicLink, - Ui::Text::WithEntities)); + tr::marked)); } else if (const auto &previous = data.vprev_topic()) { auto topicLink = GenerateTopicLink(channel, *previous); addSimpleServiceMessage(tr::lng_admin_log_topics_unpinned( @@ -1887,7 +1887,7 @@ void GenerateItems( fromLinkText, lt_topic, topicLink, - Ui::Text::WithEntities)); + tr::marked)); } }; @@ -1899,7 +1899,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -1930,7 +1930,7 @@ void GenerateItems( { '#' + QString::number(wrap(prevColor) + 1) }, lt_color, { '#' + QString::number(wrap(nextColor) + 1) }, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } const auto prevEmoji = (was.type() == mtpc_peerColor) @@ -1948,7 +1948,7 @@ void GenerateItems( lt_emoji, Ui::Text::SingleCustomEmoji( Data::SerializeCustomEmojiId(nextEmoji)), - Ui::Text::WithEntities) + tr::marked) : !nextEmoji ? removeEmoji( tr::now, @@ -1957,7 +1957,7 @@ void GenerateItems( lt_emoji, Ui::Text::SingleCustomEmoji( Data::SerializeCustomEmojiId(prevEmoji)), - Ui::Text::WithEntities) + tr::marked) : changeEmoji( tr::now, lt_from, @@ -1968,7 +1968,7 @@ void GenerateItems( lt_emoji, Ui::Text::SingleCustomEmoji( Data::SerializeCustomEmojiId(nextEmoji)), - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); } }; @@ -2007,7 +2007,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities)); + tr::marked)); }; const auto createChangeEmojiStatus = [&](const LogChangeEmojiStatus &data) { @@ -2042,7 +2042,7 @@ void GenerateItems( lt_date, TextWithEntities{ langDateTime(base::unixtime::parse(nextUntil)) }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_admin_log_set_status( tr::now, lt_from, @@ -2050,7 +2050,7 @@ void GenerateItems( lt_emoji, Ui::Text::SingleCustomEmoji( Data::SerializeCustomEmojiId(nextEmoji)), - Ui::Text::WithEntities)) + tr::marked)) : !nextEmoji ? tr::lng_admin_log_removed_status( tr::now, @@ -2059,7 +2059,7 @@ void GenerateItems( lt_emoji, Ui::Text::SingleCustomEmoji( Data::SerializeCustomEmojiId(prevEmoji)), - Ui::Text::WithEntities) + tr::marked) : (nextUntil ? tr::lng_admin_log_change_status_until( tr::now, @@ -2074,7 +2074,7 @@ void GenerateItems( lt_date, TextWithEntities{ langDateTime(base::unixtime::parse(nextUntil)) }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_admin_log_change_status( tr::now, lt_from, @@ -2085,7 +2085,7 @@ void GenerateItems( lt_emoji, Ui::Text::SingleCustomEmoji( Data::SerializeCustomEmojiId(nextEmoji)), - Ui::Text::WithEntities)); + tr::marked)); addSimpleServiceMessage(text); }; @@ -2097,7 +2097,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; @@ -2110,7 +2110,7 @@ void GenerateItems( } const auto participantPeer = channel->owner().peer(participant.id()); const auto participantPeerLink = participantPeer->createOpenLink(); - const auto participantPeerLinkText = Ui::Text::Link( + const auto participantPeerLinkText = tr::link( participantPeer->name(), QString()); const auto parsed = base::unixtime::parse( @@ -2122,7 +2122,7 @@ void GenerateItems( participantPeerLinkText, lt_date, { langDateTimeFull(parsed) }, - Ui::Text::WithEntities), + tr::marked), participantPeerLink); }; @@ -2134,7 +2134,7 @@ void GenerateItems( tr::now, lt_from, fromLinkText, - Ui::Text::WithEntities); + tr::marked); addSimpleServiceMessage(text); }; diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index ac55d18102..08c7706d6a 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1297,8 +1297,8 @@ void History::applyServiceChanges( payment->amount, EntityType::Bold), lt_title, - Ui::Text::Bold(paid->title), - Ui::Text::WithEntities), + tr::bold(paid->title), + tr::marked), .textContext = Core::TextContext({ .session = &session(), }), diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index f260ce77a4..3b7344ae80 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -427,7 +427,7 @@ HistoryItem::HistoryItem( } else if (checked == MediaCheckResult::Empty) { AddComponents(HistoryServiceData::Bit()); setServiceText({ - tr::lng_message_empty(tr::now, Ui::Text::WithEntities) + tr::lng_message_empty(tr::now, tr::marked) }); } else if ((checked == MediaCheckResult::HasUnsupportedTimeToLive) || (checked == MediaCheckResult::HasExpiredMediaTimeToLive)) { @@ -514,7 +514,7 @@ HistoryItem::HistoryItem( { .id = id, .flags = localFlags }, PreparedServiceText{ tr::lng_message_empty( tr::now, - Ui::Text::WithEntities) }) { + tr::marked) }) { } HistoryItem::HistoryItem( @@ -2342,13 +2342,13 @@ void HistoryItem::clearMediaAsExpired() { ? tr::lng_ttl_voice_expired : document->isVideoMessage() ? tr::lng_ttl_round_expired - : tr::lng_message_empty)(tr::now, Ui::Text::WithEntities); + : tr::lng_message_empty)(tr::now, tr::marked); updateServiceText({ std::move(text) }); _flags |= MessageFlag::ReactionsAllowed; } else if (media->photo()) { applyEditionToHistoryCleared(); updateServiceText({ - tr::lng_ttl_photo_expired(tr::now, Ui::Text::WithEntities) + tr::lng_ttl_photo_expired(tr::now, tr::marked) }); _flags |= MessageFlag::ReactionsAllowed; } @@ -4570,7 +4570,7 @@ PreparedServiceText HistoryItem::prepareServiceTextForMessage( if (out()) { return { - tr::lng_ttl_photo_sent(tr::now, Ui::Text::WithEntities) + tr::lng_ttl_photo_sent(tr::now, tr::marked) }; } else { auto result = PreparedServiceText(); @@ -4579,12 +4579,12 @@ PreparedServiceText HistoryItem::prepareServiceTextForMessage( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); return result; } } else { return { - tr::lng_ttl_photo_expired(tr::now, Ui::Text::WithEntities) + tr::lng_ttl_photo_expired(tr::now, tr::marked) }; } }, [&](const MTPDmessageMediaDocument &data) -> PreparedServiceText { @@ -4597,7 +4597,7 @@ PreparedServiceText HistoryItem::prepareServiceTextForMessage( return { tr::lng_ttl_video_sent( tr::now, - Ui::Text::WithEntities) + tr::marked) }; } else { auto result = PreparedServiceText(); @@ -4606,7 +4606,7 @@ PreparedServiceText HistoryItem::prepareServiceTextForMessage( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); return result; } } else if (out()) { @@ -4614,7 +4614,7 @@ PreparedServiceText HistoryItem::prepareServiceTextForMessage( ? tr::lng_ttl_voice_sent : data.is_round() ? tr::lng_ttl_round_sent - : tr::lng_message_empty)(tr::now, Ui::Text::WithEntities); + : tr::lng_message_empty)(tr::now, tr::marked); return { std::move(text) }; } return {}; @@ -4625,7 +4625,7 @@ PreparedServiceText HistoryItem::prepareServiceTextForMessage( ? tr::lng_ttl_voice_expired : data.is_round() ? tr::lng_ttl_round_expired - : tr::lng_message_empty)(tr::now, Ui::Text::WithEntities); + : tr::lng_message_empty)(tr::now, tr::marked); return { std::move(text) }; } }, [](const auto &) { @@ -4975,7 +4975,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.links.push_back(u->createOpenLink()); @@ -4984,8 +4984,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_from, fromLinkText(), // Link 1. lt_user, - Ui::Text::Link(u->name(), 2), // Link 2. - Ui::Text::WithEntities); + tr::link(u->name(), 2), // Link 2. + tr::marked); } } else if (users.isEmpty()) { result.links.push_back(fromLink()); @@ -4995,14 +4995,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_user, { .text = u"somebody"_q }, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); for (auto i = 0, l = int(users.size()); i != l; ++i) { auto user = _history->owner().user(users[i].v); result.links.push_back(user->createOpenLink()); - auto linkText = Ui::Text::Link(user->name(), 2 + i); + auto linkText = tr::link(user->name(), 2 + i); if (i == 0) { result.text = linkText; } else if (i + 1 == l) { @@ -5012,7 +5012,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text, lt_user, linkText, - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_add_users_and_one( tr::now, @@ -5020,7 +5020,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text, lt_user, linkText, - Ui::Text::WithEntities); + tr::marked); } } result.text = tr::lng_action_add_users_many( @@ -5029,7 +5029,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_users, result.text, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5041,7 +5041,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5050,7 +5050,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { if (_history->peer->isMonoforum()) { result.text = tr::lng_action_created_monoforum( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_created_chat( @@ -5059,7 +5059,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_title, { .text = qs(action.vtitle()) }, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5069,11 +5069,11 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { if (_history->peer->isMonoforum()) { result.text = tr::lng_action_created_monoforum( tr::now, - Ui::Text::WithEntities); + tr::marked); } else if (isPost()) { result.text = tr::lng_action_created_channel( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_created_chat( @@ -5082,7 +5082,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_title, { .text = qs(action.vtitle()) }, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5092,14 +5092,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { if (isPost()) { result.text = tr::lng_action_removed_photo_channel( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_removed_photo( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5112,7 +5112,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } else { auto user = _history->owner().user(action.vuser_id().v); result.links.push_back(fromLink()); @@ -5122,8 +5122,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_from, fromLinkText(), // Link 1. lt_user, - Ui::Text::Link(user->name(), 2), // Link 2. - Ui::Text::WithEntities); + tr::link(user->name(), 2), // Link 2. + tr::marked); } return result; }; @@ -5133,14 +5133,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { if (isPost()) { result.text = tr::lng_action_changed_photo_channel( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_changed_photo( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5152,7 +5152,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_title, { .text = (qs(action.vtitle())) }, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_changed_title( @@ -5161,7 +5161,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_title, { .text = qs(action.vtitle()) }, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5190,7 +5190,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_amount, AmountAndStarCurrency(data.vtotal_amount().v, qs(data.vcurrency())), - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5199,14 +5199,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { if (out()) { result.text = tr::lng_action_you_took_screenshot( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_took_screenshot( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5240,15 +5240,15 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_app, (url.isEmpty() ? TextWithEntities{ u"App"_q } - : Ui::Text::Link(info->title, url)), - Ui::Text::WithEntities); + : tr::link(info->title, url)), + tr::marked); } else { const auto domain = qs(action.vdomain().value_or_empty()); result.text = tr::lng_action_bot_allowed_from_domain( tr::now, lt_domain, - Ui::Text::Link(domain, u"http://"_q + domain), - Ui::Text::WithEntities); + tr::link(domain, u"http://"_q + domain), + tr::marked); } return result; }; @@ -5286,10 +5286,10 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text = tr::lng_action_secure_values_sent( tr::now, lt_user, - Ui::Text::Link(_history->peer->name(), QString()), // Link 1. + tr::link(_history->peer->name(), QString()), // Link 1. lt_documents, { .text = documents.join(", ") }, - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5300,7 +5300,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5334,29 +5334,29 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_distance, { .text = distance }, lt_user, - Ui::Text::Link(toPeer->name(), QString()), // Link 1. - Ui::Text::WithEntities); + tr::link(toPeer->name(), QString()), // Link 1. + tr::marked); } else if (toId == selfId) { result.links.push_back(fromPeer->createOpenLink()); return tr::lng_action_proximity_reached_you( tr::now, lt_from, - Ui::Text::Link(fromPeer->name(), QString()), // Link 1. + tr::link(fromPeer->name(), QString()), // Link 1. lt_distance, { .text = distance }, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromPeer->createOpenLink()); result.links.push_back(toPeer->createOpenLink()); return tr::lng_action_proximity_reached( tr::now, lt_from, - Ui::Text::Link(fromPeer->name(), 1), // Link 1. + tr::link(fromPeer->name(), 1), // Link 1. lt_distance, { .text = distance }, lt_user, - Ui::Text::Link(toPeer->name(), 2), // Link 2. - Ui::Text::WithEntities); + tr::link(toPeer->name(), 2), // Link 2. + tr::marked); } }(); return result; @@ -5381,7 +5381,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_duration, { .text = text }, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_group_call_finished_group( @@ -5390,21 +5390,21 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_duration, { .text = text }, - Ui::Text::WithEntities); + tr::marked); } return result; } if (_history->peer->isBroadcast()) { result.text = tr::lng_action_group_call_started_channel( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_group_call_started_group( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5440,14 +5440,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_duration, { .text = duration }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_ttl_global( tr::now, lt_from, - Ui::Text::Link(peer->name(), 1), // Link 1. + tr::link(peer->name(), 1), // Link 1. lt_duration, { .text = duration }, - Ui::Text::WithEntities); + tr::marked); return result; } } @@ -5455,25 +5455,25 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { if (!period) { result.text = tr::lng_action_ttl_removed_channel( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_ttl_changed_channel( tr::now, lt_duration, { .text = duration }, - Ui::Text::WithEntities); + tr::marked); } } else if (_from->isSelf()) { if (!period) { result.text = tr::lng_action_ttl_removed_you( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_ttl_changed_you( tr::now, lt_duration, { .text = duration }, - Ui::Text::WithEntities); + tr::marked); } } else { result.links.push_back(fromLink()); @@ -5482,7 +5482,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_ttl_changed( tr::now, @@ -5490,7 +5490,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_duration, { .text = duration }, - Ui::Text::WithEntities); + tr::marked); } } return result; @@ -5510,7 +5510,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_emoji, { .text = text }, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_theme_changed( @@ -5519,25 +5519,25 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_emoji, { .text = text }, - Ui::Text::WithEntities); + tr::marked); } } else { if (_from->isSelf()) { result.text = tr::lng_action_you_theme_disabled( tr::now, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_theme_disabled( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } } }, [&](const MTPDchatThemeUniqueGift &data) { data.vgift().match([&](const MTPDstarGiftUnique &data) { - const auto giftName = Ui::Text::Bold(qs(data.vtitle()) + const auto giftName = tr::bold(qs(data.vtitle()) + u" #"_q + QString::number(data.vnum().v)); if (_from->isSelf()) { @@ -5545,7 +5545,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_name, giftName, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_gift_theme_changed( @@ -5554,7 +5554,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), lt_name, giftName, - Ui::Text::WithEntities); + tr::marked); } }, [](const MTPDstarGift &) { }); @@ -5569,7 +5569,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5579,7 +5579,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_text, { .text = qs(action.vtext()) }, - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5599,21 +5599,21 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(peer->createOpenLink()); result.text = isSelf ? tr::lng_action_gift_sent(tr::now, lt_cost, cost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5626,13 +5626,13 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text = tr::lng_action_topic_created( tr::now, lt_topic, - Ui::Text::Link( + tr::link( Data::ForumTopicIconWithTitle( id, action.vicon_emoji_id().value_or_empty(), qs(action.vtitle())), topicUrl), - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5661,7 +5661,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { { linkText }, lt_emoji, Data::SingleCustomEmoji(iconId), - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_topic_icon_removed( @@ -5670,7 +5670,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { fromLinkText(), // Link 1. lt_link, { linkText }, - Ui::Text::WithEntities); + tr::marked); } } } else { @@ -5686,7 +5686,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { topicRootId(), action.vicon_emoji_id().value_or_empty(), qs(*action.vtitle())), - Ui::Text::WithEntities); + tr::marked); } if (result.text.empty()) { result.text = { tr::lng_message_empty(tr::now) }; @@ -5718,8 +5718,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { : tr::lng_action_suggested_photo))( tr::now, lt_user, - Ui::Text::Link(name, 1), // Link 1. - Ui::Text::WithEntities); + tr::link(name, 1), // Link 1. + tr::marked); return result; }; @@ -5735,7 +5735,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { auto user = _history->owner().peer(id); result.links.push_back(user->createOpenLink()); - auto linkText = Ui::Text::Link(user->name(), 2 + i); + auto linkText = tr::link(user->name(), 2 + i); if (i == 0) { result.text = linkText; } else if (i + 1 == count) { @@ -5745,7 +5745,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text, lt_user, linkText, - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_add_users_and_one( tr::now, @@ -5753,7 +5753,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text, lt_user, linkText, - Ui::Text::WithEntities); + tr::marked); } } @@ -5762,8 +5762,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_chat, result.text, lt_bot, - Ui::Text::Link(history()->peer->name(), 1), - Ui::Text::WithEntities); + tr::link(history()->peer->name(), 1), + tr::marked); return result; }; @@ -5786,20 +5786,20 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { ? tr::lng_action_set_wallpaper_both_me( tr::now, lt_user, - Ui::Text::Link(Ui::Text::Bold(name), 1), - Ui::Text::WithEntities) + tr::link(tr::bold(name), 1), + tr::marked) : (same ? tr::lng_action_set_same_wallpaper_me : tr::lng_action_set_wallpaper_me)( tr::now, - Ui::Text::WithEntities)) + tr::marked)) : (same ? tr::lng_action_set_same_wallpaper : tr::lng_action_set_wallpaper)( tr::now, lt_user, - Ui::Text::Link(Ui::Text::Bold(name), 1), - Ui::Text::WithEntities); + tr::link(tr::bold(name), 1), + tr::marked); return result; }; @@ -5829,14 +5829,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { ? tr::lng_action_gift_sent(tr::now, lt_cost, cost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } return result; @@ -5858,15 +5858,15 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_count_decimal, float64(credits), - Ui::Text::Bold), - Ui::Text::WithEntities) + tr::bold), + tr::marked) : (_history->peer->isMegagroup() ? tr::lng_action_giveaway_started_group : tr::lng_action_giveaway_started)( tr::now, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5898,14 +5898,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { const auto isSelf = (_from->id == _from->session().userPeerId()); result.links.push_back(fromLink()); result.text = isSelf - ? tr::lng_action_boost_apply_me(tr::now, Ui::Text::WithEntities) + ? tr::lng_action_boost_apply_me(tr::now, tr::marked) : tr::lng_action_boost_apply( tr::now, lt_count, boosts, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); const auto channel = _history->peer->asChannel(); setCustomServiceLink(std::make_shared([=]( ClickContext context) { @@ -5929,10 +5929,10 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text = tr::lng_action_payment_refunded( tr::now, lt_peer, - Ui::Text::Link(refund->peer->name(), 1), // Link 1. + tr::link(refund->peer->name(), 1), // Link 1. lt_amount, AmountAndStarCurrency(amount, currency), - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -5951,21 +5951,21 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(peer->createOpenLink()); result.text = isSelf ? tr::lng_action_gift_sent(tr::now, lt_cost, cost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -5985,21 +5985,21 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(peer->createOpenLink()); result.text = isSelf ? tr::lng_action_gift_sent(tr::now, lt_cost, cost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -6045,12 +6045,12 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text = isSelf ? tr::lng_action_gift_unique_sent( tr::now, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_unique_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. - Ui::Text::WithEntities); + tr::link(peer->shortName(), 1), // Link 1. + tr::marked); return result; } const auto cost = TextWithEntities{ @@ -6079,16 +6079,16 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_cost, cost, lt_name, - Ui::Text::Link(channel->name(), 1), - Ui::Text::WithEntities); + tr::link(channel->name(), 1), + tr::marked); } else { result.text = tr::lng_action_gift_sent_self_channel( tr::now, lt_name, - Ui::Text::Link(channel->name(), 1), + tr::link(channel->name(), 1), lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } } else { result.links.push_back(from->createOpenLink()); @@ -6099,20 +6099,20 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_cost, cost, lt_name, - Ui::Text::Link(channel->name(), 2), + tr::link(channel->name(), 2), lt_user, - Ui::Text::Link(from->shortName(), 1), - Ui::Text::WithEntities); + tr::link(from->shortName(), 1), + tr::marked); } else { result.text = tr::lng_action_gift_sent_channel( tr::now, lt_user, - Ui::Text::Link(from->shortName(), 1), + tr::link(from->shortName(), 1), lt_name, - Ui::Text::Link(channel->name(), 2), + tr::link(channel->name(), 2), lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } } } else if (anonymous || _history->peer->isSelf()) { @@ -6140,7 +6140,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(from->createOpenLink()); result.text = tr::lng_action_gift_sent_upgrade_self_other( @@ -6148,10 +6148,10 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_cost, cost, lt_name, - Ui::Text::Link(peer->shortName(), 1), + tr::link(peer->shortName(), 1), lt_user, - Ui::Text::Link(from->shortName(), 2), - Ui::Text::WithEntities); + tr::link(from->shortName(), 2), + tr::marked); } } else { result.links.push_back(peer->createOpenLink()); @@ -6160,20 +6160,20 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text = tr::lng_action_gift_sent_upgrade_other( tr::now, lt_from, - Ui::Text::Link(peer->shortName(), 1), + tr::link(peer->shortName(), 1), lt_cost, cost, lt_user, - Ui::Text::Link(from->shortName(), 2), - Ui::Text::WithEntities); + tr::link(from->shortName(), 2), + tr::marked); } else { result.text = tr::lng_action_gift_sent_upgrade( tr::now, lt_from, - Ui::Text::Link(peer->shortName(), 1), + tr::link(peer->shortName(), 1), lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } } } else { @@ -6185,14 +6185,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_cost, cost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, cost, - Ui::Text::WithEntities); + tr::marked); } return result; }; @@ -6229,30 +6229,30 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { ? tr::lng_action_gift_sent_channel( tr::now, lt_user, - Ui::Text::Link(from->shortName(), 1), + tr::link(from->shortName(), 1), lt_name, - Ui::Text::Link(channel->name(), 2), + tr::link(channel->name(), 2), lt_cost, resaleCost, - Ui::Text::WithEntities) + tr::marked) : (action.is_upgrade() ? tr::lng_action_gift_upgraded_channel : tr::lng_action_gift_transferred_channel)( tr::now, lt_user, - Ui::Text::Link(from->shortName(), 1), + tr::link(from->shortName(), 1), lt_channel, - Ui::Text::Link(channel->name(), 2), - Ui::Text::WithEntities); + tr::link(channel->name(), 2), + tr::marked); } else { result.text = resale ? tr::lng_action_gift_sent_self_channel( tr::now, lt_name, - Ui::Text::Link(channel->name(), 1), + tr::link(channel->name(), 1), lt_cost, resaleCost, - Ui::Text::WithEntities) + tr::marked) : (from->isServiceUser() ? tr::lng_action_gift_transferred_unknown_channel : action.is_upgrade() @@ -6260,8 +6260,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { : tr::lng_action_gift_transferred_self_channel)( tr::now, lt_channel, - Ui::Text::Link(channel->name(), 1), - Ui::Text::WithEntities); + tr::link(channel->name(), 1), + tr::marked); } result.links.push_back(channel->createOpenLink()); } else { @@ -6271,14 +6271,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { result.text = tr::lng_action_gift_upgraded_helped_self( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), - Ui::Text::WithEntities); + tr::link(peer->shortName(), 1), + tr::marked); } else { result.text = tr::lng_action_gift_upgraded_helped( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), - Ui::Text::WithEntities); + tr::link(peer->shortName(), 1), + tr::marked); } } else if (!from->isServiceUser() && !_history->peer->isSelf()) { if (!resale || !isSelf) { @@ -6290,28 +6290,28 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_cost, resaleCost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received_sold( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, resaleCost, - Ui::Text::WithEntities)) + tr::marked)) : resale ? (isSelf ? tr::lng_action_gift_sent( tr::now, lt_cost, resaleCost, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_gift_received( tr::now, lt_user, - Ui::Text::Link(peer->shortName(), 1), // Link 1. + tr::link(peer->shortName(), 1), // Link 1. lt_cost, resaleCost, - Ui::Text::WithEntities)) + tr::marked)) : (action.is_upgrade() ? (isSelf ? tr::lng_action_gift_upgraded_mine @@ -6321,8 +6321,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { : tr::lng_action_gift_transferred))( tr::now, lt_user, - Ui::Text::Link(from->shortName(), 1), - Ui::Text::WithEntities); + tr::link(from->shortName(), 1), + tr::marked); } else if (action.is_assigned()) { const auto gift = Api::FromTL( &history()->session(), @@ -6334,21 +6334,21 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { ? Data::UniqueGiftName(*gift->unique) : QString(), }, - Ui::Text::WithEntities); + tr::marked); } else { result.text = resale ? tr::lng_action_gift_self_bought( tr::now, lt_cost, resaleCost, - Ui::Text::WithEntities) + tr::marked) : (from->isServiceUser() ? tr::lng_action_gift_transferred_unknown : action.is_upgrade() ? tr::lng_action_gift_upgraded_self : tr::lng_action_gift_transferred_self)( tr::now, - Ui::Text::WithEntities); + tr::marked); } } return result; @@ -6363,8 +6363,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_count, action.vstars().v, lt_name, - Ui::Text::Link(_history->peer->shortName(), 1), - Ui::Text::WithEntities); + tr::link(_history->peer->shortName(), 1), + tr::marked); } else { result.links.push_back(_from->createOpenLink()); result.text = tr::lng_action_paid_message_refund( @@ -6372,8 +6372,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_count, action.vstars().v, lt_from, - Ui::Text::Link(_from->shortName(), 1), - Ui::Text::WithEntities); + tr::link(_from->shortName(), 1), + tr::marked); } return result; }; @@ -6388,23 +6388,23 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { tr::now, lt_count, stars, - Ui::Text::WithEntities) + tr::marked) : broadcastAllowed ? tr::lng_action_direct_messages_enabled( tr::now, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_direct_messages_disabled( tr::now, - Ui::Text::WithEntities)) + tr::marked)) : stars ? tr::lng_action_message_price_paid( tr::now, lt_count, stars, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_message_price_free( tr::now, - Ui::Text::WithEntities); + tr::marked); return result; }; @@ -6435,8 +6435,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { lt_count_decimal, price.value(), lt_from, - Ui::Text::Link(_from->shortName(), 1), - Ui::Text::WithEntities); + tr::link(_from->shortName(), 1), + tr::marked); return result; }; @@ -6465,8 +6465,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { : tr::lng_action_suggested_birthday)( tr::now, lt_user, - Ui::Text::Link(name, 1), // Link 1. - Ui::Text::WithEntities); + tr::link(name, 1), // Link 1. + tr::marked); return result; }; @@ -6508,7 +6508,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { action.vgift().match([&](const MTPDstarGiftUnique &data) { const auto amount = CreditsAmountFromTL(action.vprice()); const auto cost = tr::marked(PrepareCreditsAmountText(amount)); - const auto giftName = Ui::Text::Bold(qs(data.vtitle()) + const auto giftName = tr::bold(qs(data.vtitle()) + u" #"_q + QString::number(data.vnum().v)); const auto expired = action.is_expired(); @@ -6928,14 +6928,14 @@ PreparedServiceText HistoryItem::prepareInvitedToCallText( CallId linkCallId) { auto chatText = tr::lng_action_invite_user_chat( tr::now, - Ui::Text::WithEntities); + tr::marked); auto result = PreparedServiceText(); result.links.push_back(fromLink()); auto linkIndex = 1; if (linkCallId) { const auto peer = _history->peer; result.links.push_back(GroupCallClickHandler(peer, linkCallId)); - chatText = Ui::Text::Link(chatText.text, ++linkIndex); + chatText = tr::link(chatText.text, ++linkIndex); } if (users.size() == 1) { auto user = users[0]; @@ -6945,10 +6945,10 @@ PreparedServiceText HistoryItem::prepareInvitedToCallText( lt_from, fromLinkText(), // Link 1. lt_user, - Ui::Text::Link(user->name(), ++linkIndex), // Link N. + tr::link(user->name(), ++linkIndex), // Link N. lt_chat, chatText, - Ui::Text::WithEntities); + tr::marked); } else if (users.empty()) { result.text = tr::lng_action_invite_user( tr::now, @@ -6958,13 +6958,13 @@ PreparedServiceText HistoryItem::prepareInvitedToCallText( { .text = u"somebody"_q }, lt_chat, chatText, - Ui::Text::WithEntities); + tr::marked); } else { for (auto i = 0, l = int(users.size()); i != l; ++i) { const auto user = users[i]; result.links.push_back(user->createOpenLink()); - auto linkText = Ui::Text::Link(user->name(), ++linkIndex); + auto linkText = tr::link(user->name(), ++linkIndex); if (i == 0) { result.text = linkText; } else if (i + 1 == l) { @@ -6974,7 +6974,7 @@ PreparedServiceText HistoryItem::prepareInvitedToCallText( result.text, lt_user, linkText, - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_invite_users_and_one( tr::now, @@ -6982,7 +6982,7 @@ PreparedServiceText HistoryItem::prepareInvitedToCallText( result.text, lt_user, linkText, - Ui::Text::WithEntities); + tr::marked); } } result.text = tr::lng_action_invite_users_many( @@ -6993,7 +6993,7 @@ PreparedServiceText HistoryItem::prepareInvitedToCallText( result.text, lt_chat, chatText, - Ui::Text::WithEntities); + tr::marked); } return result; } @@ -7037,7 +7037,7 @@ PreparedServiceText HistoryItem::preparePinnedText() { original = Ui::Text::Mid(original, 0, cutAt).append( Ui::kQEllipsis); } - original = Ui::Text::Link( + original = tr::link( Ui::Text::Filtered( std::move(original), { @@ -7053,15 +7053,15 @@ PreparedServiceText HistoryItem::preparePinnedText() { fromLinkText(), // Link 1. lt_text, st::wrap_rtl(original), // Link 2. - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_pinned_media( tr::now, lt_from, fromLinkText(), // Link 1. lt_media, - Ui::Text::Link(mediaText, 2), // Link 2. - Ui::Text::WithEntities); + tr::link(mediaText, 2), // Link 2. + tr::marked); } } else if (pinned && pinned->msgId) { result.links.push_back(fromLink()); @@ -7071,8 +7071,8 @@ PreparedServiceText HistoryItem::preparePinnedText() { lt_from, fromLinkText(), // Link 1. lt_media, - Ui::Text::Link(tr::lng_contacts_loading(tr::now), 2), // Link 2. - Ui::Text::WithEntities); + tr::link(tr::lng_contacts_loading(tr::now), 2), // Link 2. + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_pinned_media( @@ -7081,7 +7081,7 @@ PreparedServiceText HistoryItem::preparePinnedText() { fromLinkText(), // Link 1. lt_media, { .text = tr::lng_deleted_message(tr::now) }, - Ui::Text::WithEntities); + tr::marked); } return result; } @@ -7103,12 +7103,12 @@ PreparedServiceText HistoryItem::prepareGameScoreText() { column, gamescore->msg->fullId())); auto titleText = game->title; - return Ui::Text::Link(titleText, QString()); + return tr::link(titleText, QString()); } } - return tr::lng_deleted_message(tr::now, Ui::Text::WithEntities); + return tr::lng_deleted_message(tr::now, tr::marked); } else if (gamescore && gamescore->msgId) { - return tr::lng_contacts_loading(tr::now, Ui::Text::WithEntities); + return tr::lng_contacts_loading(tr::now, tr::marked); } return {}; }; @@ -7121,7 +7121,7 @@ PreparedServiceText HistoryItem::prepareGameScoreText() { tr::now, lt_count, scoreNumber, - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_game_you_scored( tr::now, @@ -7129,7 +7129,7 @@ PreparedServiceText HistoryItem::prepareGameScoreText() { scoreNumber, lt_game, gameTitle, - Ui::Text::WithEntities); + tr::marked); } } else { result.links.push_back(fromLink()); @@ -7141,7 +7141,7 @@ PreparedServiceText HistoryItem::prepareGameScoreText() { scoreNumber, lt_from, fromLinkText(), // Link 1. - Ui::Text::WithEntities); + tr::marked); } else { result.text = tr::lng_action_game_score( tr::now, @@ -7151,7 +7151,7 @@ PreparedServiceText HistoryItem::prepareGameScoreText() { fromLinkText(), // Link 1. lt_game, gameTitle, - Ui::Text::WithEntities); + tr::marked); } } return result; @@ -7166,7 +7166,7 @@ PreparedServiceText HistoryItem::preparePaymentSentText() { if (payment->msg) { if (const auto media = payment->msg->media()) { if (const auto invoice = media->invoice()) { - return Ui::Text::Link(invoice->title, QString()); + return tr::link(invoice->title, QString()); } } } @@ -7179,7 +7179,7 @@ PreparedServiceText HistoryItem::preparePaymentSentText() { tr::now, lt_amount, payment->amount, - Ui::Text::WithEntities); + tr::marked); } else { result.text = (payment->recurringInit ? tr::lng_action_payment_init_recurring @@ -7189,7 +7189,7 @@ PreparedServiceText HistoryItem::preparePaymentSentText() { payment->amount, lt_user, { .text = _history->peer->name() }, - Ui::Text::WithEntities); + tr::marked); } } else { result.text = (payment->recurringInit @@ -7202,7 +7202,7 @@ PreparedServiceText HistoryItem::preparePaymentSentText() { { .text = _history->peer->name() }, lt_invoice, invoiceTitle, - Ui::Text::WithEntities); + tr::marked); if (payment->msg) { result.links.push_back(payment->lnk); } @@ -7225,10 +7225,10 @@ PreparedServiceText HistoryItem::prepareStoryMentionText() { tr::now, lt_user, Ui::Text::Wrapped( - Ui::Text::Bold(peer->shortName()), + tr::bold(peer->shortName()), EntityType::CustomUrl, u"internal:index"_q + QChar(1)), - Ui::Text::WithEntities); + tr::marked); return result; } @@ -7250,7 +7250,7 @@ PreparedServiceText HistoryItem::prepareCallScheduledText( tr::now, lt_date, { .text = date }, - Ui::Text::WithEntities); + tr::marked); } else { result.links.push_back(fromLink()); result.text = tr::lng_action_group_call_scheduled_group( @@ -7259,7 +7259,7 @@ PreparedServiceText HistoryItem::prepareCallScheduledText( fromLinkText(), // Link 1. lt_date, { .text = date }, - Ui::Text::WithEntities); + tr::marked); } }; const auto time = QLocale().toString( @@ -7307,7 +7307,7 @@ PreparedServiceText HistoryItem::composeTodoIncompleted( tr::now, lt_tasks, tasks, - Ui::Text::WithEntities), + tr::marked), }; } return { @@ -7317,7 +7317,7 @@ PreparedServiceText HistoryItem::composeTodoIncompleted( fromLinkText(), lt_tasks, tasks, - Ui::Text::WithEntities), + tr::marked), .links = { fromLink() }, }; } @@ -7331,7 +7331,7 @@ PreparedServiceText HistoryItem::composeTodoCompleted( tr::now, lt_tasks, tasks, - Ui::Text::WithEntities), + tr::marked), }; } return { @@ -7341,7 +7341,7 @@ PreparedServiceText HistoryItem::composeTodoCompleted( fromLinkText(), lt_tasks, tasks, - Ui::Text::WithEntities), + tr::marked), .links = { fromLink() }, }; } @@ -7368,7 +7368,7 @@ PreparedServiceText HistoryItem::prepareTodoAppendTasksText() { tr::now, lt_tasks, tasks, - Ui::Text::WithEntities), + tr::marked), }; } return { @@ -7378,14 +7378,14 @@ PreparedServiceText HistoryItem::prepareTodoAppendTasksText() { fromLinkText(), lt_tasks, tasks, - Ui::Text::WithEntities), + tr::marked), .links = { fromLink() }, }; return result; } TextWithEntities HistoryItem::fromLinkText() const { - return Ui::Text::Link(st::wrap_rtl(_from->name()), 1); + return tr::link(st::wrap_rtl(_from->name()), 1); } ClickHandlerPtr HistoryItem::fromLink() const { diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index 048a69871e..3b64956a26 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -81,7 +81,7 @@ base::options::toggle FastButtonsModeOption({ tr::now, lt_count, fullCount, - Ui::Text::WithEntities); + tr::marked); } else if (count == 1) { return names.front(); } @@ -93,7 +93,7 @@ base::options::toggle FastButtonsModeOption({ full, lt_task, names[i], - Ui::Text::WithEntities); + tr::marked); } return tr::lng_action_todo_tasks_and_last( tr::now, @@ -101,7 +101,7 @@ base::options::toggle FastButtonsModeOption({ full, lt_task, names.back(), - Ui::Text::WithEntities); + tr::marked); } } // namespace @@ -272,7 +272,7 @@ void HistoryMessageForwarded::create( name, lt_user, { .text = originalPostAuthor }, - Ui::Text::WithEntities)); + tr::marked)); } else { phrase.append(name); } @@ -281,9 +281,9 @@ void HistoryMessageForwarded::create( tr::now, lt_user, Ui::Text::Wrapped(phrase, EntityType::CustomUrl, QString()), // Link 1. - Ui::Text::WithEntities); + tr::marked); } else if (via && psaType.isEmpty()) { - const auto linkData = Ui::Text::Link( + const auto linkData = tr::link( QString(), 1).entities.front().data(); // Link 1. if (fromChannel) { @@ -292,16 +292,16 @@ void HistoryMessageForwarded::create( lt_channel, Ui::Text::Wrapped(phrase, EntityType::CustomUrl, linkData), // Link 1. lt_inline_bot, - Ui::Text::Link('@' + via->bot->username(), 2), // Link 2. - Ui::Text::WithEntities); + tr::link('@' + via->bot->username(), 2), // Link 2. + tr::marked); } else { phrase = tr::lng_forwarded_via( tr::now, lt_user, Ui::Text::Wrapped(phrase, EntityType::CustomUrl, linkData), // Link 1. lt_inline_bot, - Ui::Text::Link('@' + via->bot->username(), 2), // Link 2. - Ui::Text::WithEntities); + tr::link('@' + via->bot->username(), 2), // Link 2. + tr::marked); } } else { if (fromChannel || !psaType.isEmpty()) { @@ -327,14 +327,14 @@ void HistoryMessageForwarded::create( phrase, EntityType::CustomUrl, QString()), // Link 1. - Ui::Text::WithEntities); + tr::marked); } } else { phrase = tr::lng_forwarded( tr::now, lt_user, Ui::Text::Wrapped(phrase, EntityType::CustomUrl, QString()), // Link 1. - Ui::Text::WithEntities); + tr::marked); } } text.setMarkedText(st::fwdTextStyle, phrase, kMarkupTextOptions, context); diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index aabdc56ef5..b9f213a0b9 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -244,11 +244,11 @@ object_ptr MakeSendErrorBox( auto text = TextWithEntities(); if (withTitle) { text.append( - Ui::Text::Bold(error.thread->chatListName()) + tr::bold(error.thread->chatListName()) ).append("\n\n"); } if (error.error.boostsToLift) { - text.append(Ui::Text::Link(error.error.text)); + text.append(tr::link(error.error.text)); } else { text.append(error.error.text); } @@ -374,15 +374,15 @@ void ShowSendPaidConfirm( lt_count, stars / messages, lt_name, - Ui::Text::Bold(singlePeer->shortName()), - Ui::Text::RichLangValue) + tr::bold(singlePeer->shortName()), + tr::rich) : (usersOnly ? tr::lng_payment_confirm_users : tr::lng_payment_confirm_chats)( tr::now, lt_count, int(peers.size()), - Ui::Text::RichLangValue)).append(' ').append( + tr::rich)).append(' ').append( tr::lng_payment_confirm_sure( tr::now, lt_count, @@ -392,8 +392,8 @@ void ShowSendPaidConfirm( tr::now, lt_count, stars, - Ui::Text::RichLangValue), - Ui::Text::RichLangValue)), + tr::rich), + tr::rich)), .confirmed = proceed, .confirmText = tr::lng_payment_confirm_button( lt_count, @@ -1032,14 +1032,14 @@ PreparedServiceText GenerateJoinedText( : tr::lng_action_add_you)( tr::now, lt_from, - Ui::Text::Link(inviter->name(), QString()), - Ui::Text::WithEntities); + tr::link(inviter->name(), QString()), + tr::marked); return result; } else if (history->peer->isMegagroup()) { if (viaRequest) { return { tr::lng_action_you_joined_by_request( tr::now, - Ui::Text::WithEntities) }; + tr::marked) }; } auto self = history->session().user(); auto result = PreparedServiceText(); @@ -1047,15 +1047,15 @@ PreparedServiceText GenerateJoinedText( result.text = tr::lng_action_user_joined( tr::now, lt_from, - Ui::Text::Link(self->name(), QString()), - Ui::Text::WithEntities); + tr::link(self->name(), QString()), + tr::marked); return result; } return { viaRequest ? tr::lng_action_you_joined_by_request_channel( tr::now, - Ui::Text::WithEntities) - : tr::lng_action_you_joined(tr::now, Ui::Text::WithEntities) }; + tr::marked) + : tr::lng_action_you_joined(tr::now, tr::marked) }; } not_null GenerateJoinedMessage( @@ -1269,14 +1269,14 @@ void ShowTrialTranscribesToast(int left, TimeId until) { left, lt_date, { date }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_audio_transcribe_trials_over( tr::now, lt_date, - Ui::Text::Bold(date), + tr::bold(date), lt_link, - Ui::Text::Link(tr::lng_settings_privacy_premium_link(tr::now)), - Ui::Text::WithEntities); + tr::link(tr::lng_settings_privacy_premium_link(tr::now)), + tr::marked); window->uiShow()->showToast(Ui::Toast::Config{ .text = text, .filter = filter, diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 9aa8887af0..91ab95450b 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -41,7 +41,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/labels.h" #include "ui/effects/ripple_animation.h" #include "ui/effects/message_sending_animation_controller.h" -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "ui/text/format_values.h" #include "ui/chat/message_bar.h" #include "ui/chat/attach/attach_send_files_way.h" @@ -3686,10 +3685,10 @@ void HistoryWidget::showAboutTopPromotion() { ? QString() : Lang::GetNonDefaultValue(kPsaAboutPrefix + type.toUtf8()); const auto text = type.isEmpty() - ? tr::lng_proxy_sponsor_about(tr::now, Ui::Text::RichLangValue) + ? tr::lng_proxy_sponsor_about(tr::now, tr::rich) : custom.isEmpty() - ? tr::lng_about_psa_default(tr::now, Ui::Text::RichLangValue) - : Ui::Text::RichLangValue(custom); + ? tr::lng_about_psa_default(tr::now, tr::rich) + : tr::rich(custom); showInfoTooltip(text, nullptr); } @@ -5133,7 +5132,7 @@ void HistoryWidget::checkSuggestToGigagroup() { object_ptr( box, tr::lng_gigagroup_suggest_text( - ) | Ui::Text::ToRichLangValue(), + ) | rpl::map(tr::rich), st::infoAboutGigagroup)); box->addButton( tr::lng_gigagroup_suggest_more(), @@ -9287,12 +9286,13 @@ void HistoryWidget::updateTopBarSelection() { _reportMessages->setAttribute(transparent, false); _reportMessages->setColorOverride(std::nullopt); } - _reportMessages->setText(Ui::Text::Upper(selectedState.count + _reportMessages->setText(selectedState.count ? tr::lng_report_messages_count( tr::now, lt_count, - selectedState.count) - : tr::lng_report_messages_none(tr::now))); + selectedState.count, + tr::upper) + : tr::lng_report_messages_none(tr::now, tr::upper)); updateControlsVisibility(); updateHistoryGeometry(); if (!controller()->isLayerShown() diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 3a3abae803..69e86bd1b2 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -3083,11 +3083,11 @@ void SetupRestrictionView( lt_user, TextWithEntities{ peer->shortName() }, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_send_non_premium_message_toast_link( tr::now))), - Ui::Text::RichLangValue), + tr::rich), u"require_premium"_q); }); state->label = makeLabel(value.text, st->premiumRequired.label); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp index 752baa3c38..51147d5c3f 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_suggest_options.cpp @@ -747,12 +747,12 @@ void ChooseSuggestPriceBox( tr::now, lt_count, nanoTonMin / float64(Ui::kNanosInOne), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_gift_sell_min_price( tr::now, lt_count, starsMin, - Ui::Text::RichLangValue)); + tr::rich)); } return; } @@ -830,25 +830,25 @@ void ChooseSuggestPriceBox( if (args.mode == SuggestMode::Change) { return tr::lng_suggest_options_update( tr::now, - Ui::Text::WithEntities); + tr::marked); } else if (price.empty()) { return tr::lng_suggest_options_offer_free( tr::now, - Ui::Text::WithEntities); + tr::marked); } else if (price.ton()) { return tr::lng_suggest_options_offer( tr::now, lt_amount, Ui::Text::IconEmoji(&st::tonIconEmoji).append( Lang::FormatCreditsAmountDecimal(price)), - Ui::Text::WithEntities); + tr::marked); } return tr::lng_suggest_options_offer( tr::now, lt_amount, Ui::Text::IconEmoji(&st::starIconEmoji).append( Lang::FormatCreditsAmountDecimal(price)), - Ui::Text::WithEntities); + tr::marked); })); const auto buttonWidth = st::boxWidth - rect::m::sum::h(st::suggestPriceBox.buttonPadding); @@ -967,7 +967,7 @@ void InsufficientTonBox( const auto label = box->addRow( object_ptr( box, - tr::lng_suggest_low_ton_text(Ui::Text::RichLangValue), + tr::lng_suggest_low_ton_text(tr::rich), st::lowTonText), st::boxRowPadding + st::lowTonTextPadding, style::al_top); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index d470169f4a..5d362d0aa6 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -412,9 +412,9 @@ TTLButton::TTLButton( (recordingVideo ? tr::lng_record_once_active_video : tr::lng_record_once_active_tooltip)( - Ui::Text::RichLangValue), + tr::rich), tr::lng_record_once_first_tooltip( - Ui::Text::RichLangValue)); + tr::rich)); _tooltip.reset(Ui::CreateChild( parent.get(), object_ptr>( diff --git a/Telegram/SourceFiles/history/view/history_view_about_view.cpp b/Telegram/SourceFiles/history/view/history_view_about_view.cpp index d97927af6e..417218fbef 100644 --- a/Telegram/SourceFiles/history/view/history_view_about_view.cpp +++ b/Telegram/SourceFiles/history/view/history_view_about_view.cpp @@ -306,7 +306,7 @@ auto GenerateChatIntro( const auto description = data.customPhrases() ? data.description : tr::lng_chat_intro_default_message(tr::now); - pushText(Ui::Text::Bold(title), st::chatIntroTitleMargin); + pushText(tr::bold(title), st::chatIntroTitleMargin); pushText({ description }, title.isEmpty() ? st::chatIntroTitleMargin : st::chatIntroMargin); @@ -366,7 +366,7 @@ auto GenerateNewBotThread( const auto title = tr::lng_bot_new_thread_title(tr::now); const auto description = tr::lng_bot_new_thread_about(tr::now); push(std::make_unique(parent)); - pushText(Ui::Text::Bold(title), st::chatIntroTitleMargin); + pushText(tr::bold(title), st::chatIntroTitleMargin); pushText({ description }, st::chatIntroMargin); push(std::make_unique()); @@ -396,10 +396,10 @@ auto GenerateNewPeerInfo( return result; }; push(std::make_unique( - Ui::Text::Bold(user->name()), + tr::bold(user->name()), st::newPeerTitleMargin)); push(std::make_unique( - tr::lng_new_contact_not_contact(tr::now, Ui::Text::WithEntities), + tr::lng_new_contact_not_contact(tr::now, tr::marked), st::newPeerSubtitleMargin, fadedFg)); @@ -411,7 +411,7 @@ auto GenerateNewPeerInfo( const auto flag = countries.flagEmojiByISO2(country); entries.push_back({ tr::lng_new_contact_phone_number(tr::now), - Ui::Text::Bold(flag + QChar(0xA0) + name), + tr::bold(flag + QChar(0xA0) + name), }); } const auto month = user->registrationMonth(); @@ -419,7 +419,7 @@ auto GenerateNewPeerInfo( if (month && year) { entries.push_back({ tr::lng_new_contact_registration(tr::now), - Ui::Text::Bold(langMonthOfYearFull(month, year)), + tr::bold(langMonthOfYearFull(month, year)), }); } @@ -450,7 +450,7 @@ auto GenerateNewPeerInfo( Ui::Text::SingleCustomEmoji(userpicsData), lt_arrow, Ui::Text::IconEmoji(&st::textMoreIconEmoji), - Ui::Text::Bold), + tr::bold), EntityType::CustomUrl, url), }); @@ -901,7 +901,7 @@ AdminLog::OwnedItem AboutView::makeNewPeerInfo(not_null user) { AdminLog::OwnedItem AboutView::makeAboutVerifyCodes() { return makeAboutSimple( - tr::lng_verification_codes_about(tr::now, Ui::Text::RichLangValue)); + tr::lng_verification_codes_about(tr::now, tr::rich)); } AdminLog::OwnedItem AboutView::makeAboutBot(not_null info) { @@ -944,8 +944,8 @@ AdminLog::OwnedItem AboutView::makePremiumRequired() { }, PreparedServiceText{ tr::lng_send_non_premium_text( tr::now, lt_user, - Ui::Text::Bold(_history->peer->shortName()), - Ui::Text::RichLangValue), + tr::bold(_history->peer->shortName()), + tr::rich), }); auto result = AdminLog::OwnedItem(_delegate, item); result->overrideMedia(std::make_unique( @@ -957,10 +957,10 @@ AdminLog::OwnedItem AboutView::makePremiumRequired() { } AdminLog::OwnedItem AboutView::makeStarsPerMessage(int stars) { - auto name = Ui::Text::Bold(_history->peer->shortName()); + auto name = tr::bold(_history->peer->shortName()); auto cost = Ui::Text::IconEmoji( &st::starIconEmoji - ).append(Ui::Text::Bold(Lang::FormatCountDecimal(stars))); + ).append(tr::bold(Lang::FormatCountDecimal(stars))); const auto item = _history->makeMessage({ .id = _history->nextNonHistoryEntryId(), .flags = (MessageFlag::FakeAboutView @@ -974,7 +974,7 @@ AdminLog::OwnedItem AboutView::makeStarsPerMessage(int stars) { std::move(name), lt_amount, std::move(cost), - Ui::Text::RichLangValue) + tr::rich) : stars ? tr::lng_send_charges_stars_channel( tr::now, @@ -982,12 +982,12 @@ AdminLog::OwnedItem AboutView::makeStarsPerMessage(int stars) { std::move(name), lt_amount, std::move(cost), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_send_free_channel( tr::now, lt_channel, std::move(name), - Ui::Text::RichLangValue), + tr::rich), }); auto result = AdminLog::OwnedItem(_delegate, item); result->overrideMedia(std::make_unique( @@ -1021,7 +1021,7 @@ AdminLog::OwnedItem AboutView::makeNewBotThread() { | MessageFlag::Local), .from = _history->peer->id, }, PreparedServiceText{ - tr::lng_bot_new_thread_about(tr::now, Ui::Text::RichLangValue) + tr::lng_bot_new_thread_about(tr::now, tr::rich) }); auto result = AdminLog::OwnedItem(_delegate, item); result->overrideMedia(std::make_unique( diff --git a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp index 89e28b100f..9662278b53 100644 --- a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp @@ -105,7 +105,7 @@ rpl::producer RootViewContent( ) | rpl::map([=](Ui::MessageBarContent &&content) { const auto item = history->owner().message(history->peer, rootId); if (!item) { - content.text = Ui::Text::Link(tr::lng_deleted_message(tr::now)); + content.text = tr::link(tr::lng_deleted_message(tr::now)); } const auto sender = (item && item->discussionPostOriginalSender()) ? item->discussionPostOriginalSender() diff --git a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp index e87ca9798c..73a4487ea9 100644 --- a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp +++ b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp @@ -301,9 +301,9 @@ void ContactStatus::Bar::showState( lt_emoji, status, lt_link, - Ui::Text::Link( + tr::link( tr::lng_new_contact_about_status_link(tr::now)), - Ui::Text::WithEntities), + tr::marked), context); _emojiStatusInfo->entity()->overrideLinkClickHandler([=] { _emojiStatusClicks.fire({}); @@ -325,10 +325,10 @@ void ContactStatus::Bar::showState( : tr::lng_new_contact_from_request_group)( tr::now, lt_user, - Ui::Text::Bold(_name), + tr::bold(_name), lt_name, - Ui::Text::Bold(state.requestChatName), - Ui::Text::WithEntities)); + tr::bold(state.requestChatName), + tr::marked)); resizeToWidth(width()); } @@ -710,11 +710,11 @@ void ContactStatus::setupShareHandler(not_null user) { .text = tr::lng_new_contact_share_sure( tr::now, lt_phone, - Ui::Text::WithEntities( + tr::marked( Ui::FormatPhone(user->session().user()->phone())), lt_user, - Ui::Text::Bold(user->name()), - Ui::Text::WithEntities), + tr::bold(user->name()), + tr::marked), .confirmed = share, .confirmText = tr::lng_box_ok(), })); @@ -804,12 +804,12 @@ void ContactStatus::setupRequestInfoHandler(not_null peer) { box, tr::lng_from_request_body( lt_name, - rpl::single(Ui::Text::Bold(_state.requestChatName)), + rpl::single(tr::bold(_state.requestChatName)), lt_date, - rpl::single(langDateTimeFull( + rpl::single(tr::marked(langDateTimeFull( base::unixtime::parse(_state.requestDate) - )) | Ui::Text::ToWithEntities(), - Ui::Text::WithEntities), + ))), + tr::marked), st::boxLabel)); box->addButton(tr::lng_from_request_understand(), [=] { @@ -1167,7 +1167,7 @@ void PaysStatus::Bar::showState(State state) { TextWithEntities{ _peer->shortName() }, lt_cost, PaidSendButtonText(tr::now, state.perMessage), - Ui::Text::WithEntities)); + tr::marked)); resizeToWidth(width()); } diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index d4b2746334..79a2857157 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -1457,7 +1457,7 @@ void CopyPostLink( if (isPublicLink && !videoTimestamp) { show->showToast({ .text = tr::lng_channel_public_link_copied( - tr::now, Ui::Text::Bold + tr::now, tr::bold ).append('\n').append(Platform::IsMac() ? tr::lng_public_post_private_hint_cmd(tr::now) : tr::lng_public_post_private_hint_ctrl(tr::now)), @@ -1963,25 +1963,25 @@ void AddEmojiPacksAction( tr::now, lt_count, count, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_context_animated_emoji( tr::now, lt_name, TextWithEntities{ name }, - Ui::Text::RichLangValue); + tr::rich); case EmojiPacksSource::Tag: return tr::lng_context_animated_tag( tr::now, lt_name, TextWithEntities{ name }, - Ui::Text::RichLangValue); + tr::rich); case EmojiPacksSource::Reaction: if (!name.text.isEmpty()) { return tr::lng_context_animated_reaction( tr::now, lt_name, TextWithEntities{ name }, - Ui::Text::RichLangValue); + tr::rich); } [[fallthrough]]; case EmojiPacksSource::Reactions: @@ -1990,12 +1990,12 @@ void AddEmojiPacksAction( tr::now, lt_count, count, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_context_animated_reactions( tr::now, lt_name, TextWithEntities{ name }, - Ui::Text::RichLangValue); + tr::rich); } Unexpected("Source in AddEmojiPacksAction."); }(); @@ -2062,7 +2062,7 @@ void AddSelectRestrictionAction( ? tr::lng_context_noforwards_info_bot : tr::lng_context_noforwards_info_channel)( tr::now, - Ui::Text::RichLangValue), + tr::rich), addIcon ? &st::menuIconCopyright : nullptr); button->setAttribute(Qt::WA_TransparentForMouseEvents); menu->addAction(std::move(button)); diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index 742eab946d..d0bf8628f7 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -1512,18 +1512,18 @@ auto Element::contextDependentServiceText() -> TextWithLinks { .arg(peerToChannel(peerId).bare) .arg(topicRootId.bare); const auto fromLink = [&](int index) { - return Ui::Text::Link(from->name(), index); + return tr::link(from->name(), index); }; const auto placeholderLink = [&] { const auto linkText = history()->peer->isBot() ? tr::lng_action_topic_bot_thread(tr::now) : tr::lng_action_topic_placeholder(tr::now); - return Ui::Text::Link(linkText, topicUrl); + return tr::link(linkText, topicUrl); }; const auto wrapTopic = [&]( const QString &title, std::optional iconId) { - return Ui::Text::Link( + return tr::link( Data::ForumTopicIconWithTitle( topicRootId, iconId.value_or(0), @@ -1555,7 +1555,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { tr::now, lt_topic, wrapParentTopic(), - Ui::Text::WithEntities), + tr::marked), }; } else if (info->reopened) { return { @@ -1563,7 +1563,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { tr::now, lt_topic, wrapParentTopic(), - Ui::Text::WithEntities), + tr::marked), }; } else if (info->hidden) { return { @@ -1571,7 +1571,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { tr::now, lt_topic, wrapParentTopic(), - Ui::Text::WithEntities), + tr::marked), }; } else if (info->unhidden) { return { @@ -1579,7 +1579,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { tr::now, lt_topic, wrapParentTopic(), - Ui::Text::WithEntities), + tr::marked), }; } else if (info->renamed) { return { @@ -1595,7 +1595,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { (info->reiconed ? info->iconId : std::optional())), - Ui::Text::WithEntities), + tr::marked), { from->createOpenLink() }, }; } else if (info->reiconed) { @@ -1609,7 +1609,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { placeholderLink(), lt_emoji, Data::SingleCustomEmoji(iconId), - Ui::Text::WithEntities), + tr::marked), { from->createOpenLink() }, }; } else { @@ -1620,7 +1620,7 @@ auto Element::contextDependentServiceText() -> TextWithLinks { fromLink(1), lt_link, placeholderLink(), - Ui::Text::WithEntities), + tr::marked), { from->createOpenLink() }, }; } @@ -1640,7 +1640,7 @@ void Element::validateText() { _textItem = item; if (!storyMention) { if (_text.isEmpty()) { - setTextWithLinks(Ui::Text::Italic(storyUnsupported + setTextWithLinks(tr::italic(storyUnsupported ? tr::lng_stories_unsupported(tr::now) : tr::lng_forwarded_story_expired(tr::now))); } @@ -1689,7 +1689,7 @@ void Element::validateText() { } else { const auto unavailable = item->computeUnavailableReason(); if (!unavailable.isEmpty()) { - setTextWithLinks(Ui::Text::Italic(unavailable)); + setTextWithLinks(tr::italic(unavailable)); } else { setTextWithLinks(_textItem->translatedTextWithLocalEntities()); } diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index b80c164b4d..c0232c2b18 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -221,12 +221,12 @@ void Message::initPaidInformation() { return (info.messages == 1) ? tr::lng_action_paid_message_one( tr::now, - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_paid_message_some( tr::now, lt_count, info.messages, - Ui::Text::WithEntities); + tr::marked); }; auto text = PreparedServiceText{ .text = item->out() @@ -236,14 +236,14 @@ void Message::initPaidInformation() { info.stars, lt_action, action(), - Ui::Text::WithEntities) + tr::marked) : tr::lng_action_paid_message_got( tr::now, lt_count, info.stars, lt_name, - Ui::Text::Link(item->from()->shortName(), 1), - Ui::Text::WithEntities), + tr::link(item->from()->shortName(), 1), + tr::marked), }; if (!item->out()) { text.links.push_back(item ->from()->createOpenLink()); @@ -2730,7 +2730,7 @@ ClickHandlerPtr Message::psaTooltipLink() const { const auto custom = type.isEmpty() ? QString() : Lang::GetNonDefaultValue(kPsaTooltipPrefix + type.toUtf8()); - auto text = Ui::Text::RichLangValue( + auto text = tr::rich( (custom.isEmpty() ? tr::lng_tooltip_psa_default(tr::now) : custom)); diff --git a/Telegram/SourceFiles/history/view/history_view_paid_reaction_toast.cpp b/Telegram/SourceFiles/history/view/history_view_paid_reaction_toast.cpp index 7c35960b7f..adda745bd7 100644 --- a/Telegram/SourceFiles/history/view/history_view_paid_reaction_toast.cpp +++ b/Telegram/SourceFiles/history/view/history_view_paid_reaction_toast.cpp @@ -259,15 +259,15 @@ void PaidReactionToast::showFor( tr::lng_paid_react_toast_anonymous( lt_count, _count.value() | tr::to_count(), - Ui::Text::Bold), + tr::bold), tr::lng_paid_react_toast( lt_count, _count.value() | tr::to_count(), - Ui::Text::Bold)), + tr::bold)), tr::lng_paid_react_toast_text( lt_count_decimal, _count.value() | tr::to_count(), - Ui::Text::RichLangValue) + tr::rich) ) | rpl::map([](TextWithEntities &&title, TextWithEntities &&body) { title.append('\n').append(body); return std::move(title); diff --git a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp index 8dfb7a0adb..fd19a4daa7 100644 --- a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp +++ b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp @@ -102,7 +102,7 @@ bool ShowReactionPreview( tr::lng_context_animated_reaction( lt_name, rpl::single(Ui::Text::Colorized(packName)), - Ui::Text::RichLangValue)); + tr::rich)); state->label->setAttribute(Qt::WA_TransparentForMouseEvents); const auto backgroundRaw = state->background.get(); const auto labelRaw = state->label.get(); diff --git a/Telegram/SourceFiles/history/view/history_view_reply.cpp b/Telegram/SourceFiles/history/view/history_view_reply.cpp index 4b23f2b6f4..f7af04bdf8 100644 --- a/Telegram/SourceFiles/history/view/history_view_reply.cpp +++ b/Telegram/SourceFiles/history/view/history_view_reply.cpp @@ -1030,7 +1030,7 @@ TextWithEntities Reply::ComposePreviewName( tr::now, lt_title, todolist->title, - Ui::Text::WithEntities); + tr::marked); } } const auto toPeer = to->history()->peer; @@ -1057,7 +1057,7 @@ TextWithEntities Reply::ComposePreviewName( tr::now, lt_name, nameFull, - Ui::Text::WithEntities); + tr::marked); } diff --git a/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp b/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp index 60629cc7da..ed8b38125f 100644 --- a/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp +++ b/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp @@ -135,10 +135,10 @@ void ScheduleBox( tr::lng_schedule_repeat_promo( tr::now, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_schedule_repeat_promo_link(tr::now))), - Ui::Text::RichLangValue), + tr::rich), u"schedule_repeat"_q); return true; }; diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 474859e7d4..d6b169307d 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -242,7 +242,7 @@ ScheduledWidget::ScheduledWidget( _inner, controller->chatStyle(), st::msgServicePadding); - const auto emptyText = Ui::Text::Semibold( + const auto emptyText = tr::semibold( tr::lng_scheduled_messages_empty(tr::now)); emptyInfo->setText(emptyText); _inner->setEmptyInfoWidget(std::move(emptyInfo)); @@ -1337,7 +1337,7 @@ void ScheduledWidget::showProcessingVideoTooltip() { _inner.data(), Ui::MakeNiceTooltipLabel( _inner.data(), - tr::lng_scheduled_video_tip(Ui::Text::WithEntities), + tr::lng_scheduled_video_tip(tr::marked), st::processingVideoTipMaxWidth, st::defaultImportantTooltipLabel), st::defaultImportantTooltip); @@ -1729,7 +1729,7 @@ bool ShowScheduledVideoPublished( const auto text = tr::lng_scheduled_video_published( tr::now, - Ui::Text::Bold); + tr::bold); const auto &st = st::processingVideoToast; const auto skip = st::processingVideoPreviewSkip; const auto size = st.style.font->height * 2; diff --git a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp index c52dd290dc..80dae68c08 100644 --- a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp +++ b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp @@ -274,7 +274,7 @@ void SelfForwardsTagger::showTaggedToast(DocumentId reaction) { tr::now, lt_emoji, Data::SingleCustomEmoji(reaction), - Ui::Text::WithEntities); + tr::marked); hideToast(); const auto &st = st::selfForwardsTaggerToast; diff --git a/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp b/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp index 23b7c37df3..9db7105a71 100644 --- a/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp +++ b/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp @@ -145,14 +145,14 @@ void StickerToast::showWithTitle(const QString &title) { const auto toSaved = isEmoji && (_section == Section::Message) && !(++counter % 2); - const auto text = Ui::Text::Bold( + const auto text = tr::bold( title ).append('\n').append( (toSaved - ? tr::lng_animated_emoji_saved(tr::now, Ui::Text::RichLangValue) + ? tr::lng_animated_emoji_saved(tr::now, tr::rich) : isEmoji - ? tr::lng_animated_emoji_text(tr::now, Ui::Text::RichLangValue) - : tr::lng_sticker_premium_text(tr::now, Ui::Text::RichLangValue)) + ? tr::lng_animated_emoji_text(tr::now, tr::rich) + : tr::lng_sticker_premium_text(tr::now, tr::rich)) ); _st = st::historyPremiumToast; const auto skip = _st.padding.top(); diff --git a/Telegram/SourceFiles/history/view/history_view_translate_bar.cpp b/Telegram/SourceFiles/history/view/history_view_translate_bar.cpp index 3d97e5a8b8..48085dc18b 100644 --- a/Telegram/SourceFiles/history/view/history_view_translate_bar.cpp +++ b/Telegram/SourceFiles/history/view/history_view_translate_bar.cpp @@ -487,8 +487,8 @@ void TranslateBar::showSettingsToast( const auto text = tr::lng_translate_dont_added( tr::now, lt_name, - Ui::Text::Bold(Ui::LanguageName(ignored)), - Ui::Text::WithEntities); + tr::bold(Ui::LanguageName(ignored)), + tr::marked); showToast(text, tr::lng_translate_settings(tr::now), [=] { if (const auto strong = weak.get()) { const auto box = strong->show( @@ -513,7 +513,7 @@ void TranslateBar::showHiddenToast(not_null peer) { : peer->isBroadcast() ? tr::lng_translate_hidden_channel : tr::lng_translate_hidden_group; - const auto proj = Ui::Text::WithEntities; + const auto proj = tr::marked; showToast(phrase(tr::now, proj), tr::lng_translate_undo(tr::now), [=] { peer->saveTranslationDisabled(false); }); diff --git a/Telegram/SourceFiles/history/view/history_view_view_button.cpp b/Telegram/SourceFiles/history/view/history_view_view_button.cpp index 5f981bd186..48a7a1055c 100644 --- a/Telegram/SourceFiles/history/view/history_view_view_button.cpp +++ b/Telegram/SourceFiles/history/view/history_view_view_button.cpp @@ -17,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "ui/effects/ripple_animation.h" #include "ui/painter.h" -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "window/window_session_controller.h" #include "styles/style_chat.h" @@ -63,7 +62,7 @@ namespace { [[nodiscard]] QString MakeMediaButtonText(not_null media) { Expects(media->giveawayStart() || media->giveawayResults()); - return Ui::Text::Upper(tr::lng_prizes_how_works(tr::now)); + return tr::lng_prizes_how_works(tr::now, tr::upper); } } // namespace diff --git a/Telegram/SourceFiles/history/view/media/history_view_birthday_suggestion.cpp b/Telegram/SourceFiles/history/view/media/history_view_birthday_suggestion.cpp index 614549c717..c838896b51 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_birthday_suggestion.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_birthday_suggestion.cpp @@ -80,7 +80,7 @@ namespace HistoryView { tr::now, lt_user, TextWithEntities{ peer->shortName() }, - Ui::Text::WithEntities), + tr::marked), st::birthdaySuggestTextPadding)); push(std::make_unique( @@ -112,7 +112,7 @@ BirthdayTable::BirthdayTable(Data::Birthday birthday, QMargins margins) .label = Ui::Text::String(st::defaultTextStyle, label), .value = Ui::Text::String( st::defaultTextStyle, - Ui::Text::Bold(value)), + tr::bold(value)), }); }; push(tr::lng_date_input_day(tr::now), QString::number(birthday.day())); diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 0f9a554c24..0a8d36f132 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -454,9 +454,9 @@ QSize Document::countOptimalSize() { auto text = (entry.requestId || !entry.shown) ? TextWithEntities() : entry.toolong - ? Ui::Text::Italic(tr::lng_audio_transcribe_long(tr::now)) + ? tr::italic(tr::lng_audio_transcribe_long(tr::now)) : entry.failed - ? Ui::Text::Italic(tr::lng_attach_failed(tr::now)) + ? tr::italic(tr::lng_attach_failed(tr::now)) : TextWithEntities{ entry.result }.append( pending ? Ui::Text::LottieEmoji(descriptor) diff --git a/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp b/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp index 9e9b4a6f8a..2c0d63fcdc 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp @@ -82,7 +82,7 @@ auto GenerateGiveawayStart( links)); }; pushText( - Ui::Text::Bold( + tr::bold( tr::lng_prizes_title(tr::now, lt_count, quantity)), st::chatGiveawayPrizesTitleMargin); @@ -94,7 +94,7 @@ auto GenerateGiveawayStart( quantity, lt_prize, TextWithEntities{ data->additionalPrize }, - Ui::Text::RichLangValue), + tr::rich), st::chatGiveawayPrizesMargin); push(std::make_unique( tr::lng_prizes_additional_with(tr::now), @@ -109,8 +109,8 @@ auto GenerateGiveawayStart( tr::now, lt_count, data->credits, - Ui::Text::RichLangValue), - Ui::Text::RichLangValue) + tr::rich), + tr::rich) : (data->credits && (quantity > 1)) ? tr::lng_prizes_credits_about( tr::now, @@ -121,18 +121,18 @@ auto GenerateGiveawayStart( tr::now, lt_count, data->credits, - Ui::Text::RichLangValue), - Ui::Text::RichLangValue) + tr::rich), + tr::rich) : tr::lng_prizes_about( tr::now, lt_count, quantity, lt_duration, - Ui::Text::Bold(GiftDuration(months * 30)), - Ui::Text::RichLangValue), + tr::bold(GiftDuration(months * 30)), + tr::rich), st::chatGiveawayPrizesMargin); pushText( - Ui::Text::Bold(tr::lng_prizes_participants(tr::now)), + tr::bold(tr::lng_prizes_participants(tr::now)), st::chatGiveawayPrizesTitleMargin); const auto hasChannel = ranges::any_of( @@ -192,7 +192,7 @@ auto GenerateGiveawayStart( } pushText( - Ui::Text::Bold(tr::lng_prizes_date(tr::now)), + tr::bold(tr::lng_prizes_date(tr::now)), (countries.empty() ? st::chatGiveawayNoCountriesTitleMargin : st::chatGiveawayPrizesMargin)); @@ -259,7 +259,7 @@ auto GenerateGiveawayResults( pushText( (isSingleWinner ? tr::lng_prizes_results_title_one - : tr::lng_prizes_results_title)(tr::now, Ui::Text::Bold), + : tr::lng_prizes_results_title)(tr::now, tr::bold), st::chatGiveawayPrizesTitleMargin); const auto showGiveawayHandler = JumpToMessageClickHandler( data->channel, @@ -271,14 +271,14 @@ auto GenerateGiveawayResults( lt_count, quantity, lt_link, - Ui::Text::Link(tr::lng_prizes_results_link(tr::now)), - Ui::Text::RichLangValue), + tr::link(tr::lng_prizes_results_link(tr::now)), + tr::rich), st::chatGiveawayPrizesMargin, { { 1, showGiveawayHandler } }); pushText( (isSingleWinner ? tr::lng_prizes_results_winner - : tr::lng_prizes_results_winners)(tr::now, Ui::Text::Bold), + : tr::lng_prizes_results_winners)(tr::now, tr::bold), st::chatGiveawayPrizesTitleMargin); push(std::make_unique( @@ -286,7 +286,7 @@ auto GenerateGiveawayResults( data->winners)); if (data->winnersCount > data->winners.size()) { pushText( - Ui::Text::Bold(tr::lng_prizes_results_more( + tr::bold(tr::lng_prizes_results_more( tr::now, lt_count, data->winnersCount - data->winners.size())), diff --git a/Telegram/SourceFiles/history/view/media/history_view_media.cpp b/Telegram/SourceFiles/history/view/media/history_view_media.cpp index ae837b3dc1..2951078862 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media.cpp @@ -409,7 +409,7 @@ void Media::drawSpoilerTag( tr::now, lt_price, price, - Ui::Text::WithEntities), + tr::marked), kMarkupTextOptions); } const auto width = iconSkip + text.maxWidth(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_common.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_common.cpp index 7e1017a955..b46a9aa0a7 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_common.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_common.cpp @@ -81,7 +81,7 @@ rpl::producer AgeVerifyAbout( }; Assert(shift >= 0 && shift < postfixes.size()); const auto postfix = *(begin(postfixes) + shift); - return Ui::Text::RichLangValue(Lang::GetNonDefaultValue( + return tr::rich(Lang::GetNonDefaultValue( kVerifyAgeAboutPrefix + country.toUtf8() + postfix ).replace(u"{count}"_q, string)); }); @@ -284,22 +284,22 @@ void ShowPaidMediaUnlockedToast( : nullptr; auto text = tr::lng_credits_media_done_title( tr::now, - Ui::Text::Bold + tr::bold ).append('\n').append(user ? tr::lng_credits_media_done_text_user( tr::now, lt_count, invoice->amount, lt_user, - Ui::Text::Bold(user->shortName()), - Ui::Text::RichLangValue) + tr::bold(user->shortName()), + tr::rich) : tr::lng_credits_media_done_text( tr::now, lt_count, invoice->amount, lt_chat, - Ui::Text::Bold(broadcast->name()), - Ui::Text::RichLangValue)); + tr::bold(broadcast->name()), + tr::rich)); controller->showToast(std::move(text), kMediaUnlockedTooltipDuration); } @@ -366,7 +366,7 @@ void ShowAgeVerification( box->addRow( object_ptr( box, - tr::lng_age_verify_here(Ui::Text::RichLangValue), + tr::lng_age_verify_here(tr::rich), st::settingsAgeVerifyText), st::boxRowPadding + st::settingsAgeVerifyMargin, style::al_top); @@ -454,7 +454,7 @@ void ShowAgeVerificationMobile( box->addRow( object_ptr( box, - tr::lng_age_verify_mobile(Ui::Text::RichLangValue), + tr::lng_age_verify_mobile(tr::rich), st::settingsAgeVerifyText), st::boxRowPadding + st::settingsAgeVerifyMargin, style::al_top); @@ -545,7 +545,7 @@ void ShowSensitiveConfirm( show->showToast({ .text = tr::lng_sensitive_toast( tr::now, - Ui::Text::RichLangValue), + tr::rich), .adaptive = true, .duration = 5 * crl::time(1000), }); @@ -556,7 +556,7 @@ void ShowSensitiveConfirm( close(); }; Ui::ConfirmBox(box, { - .text = tr::lng_sensitive_text(Ui::Text::RichLangValue), + .text = tr::lng_sensitive_text(tr::rich), .confirmed = done, .confirmText = tr::lng_sensitive_view(), .title = tr::lng_sensitive_title(), diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index bc9386a1d9..4c0ec3a81f 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -863,8 +863,8 @@ void Poll::paintBottom( p.setFont(st::semiboldFont); p.setPen(link ? stm->msgFileThumbLinkFg : stm->msgDateFg); const auto string = showVotes() - ? tr::lng_polls_view_results(tr::now, Ui::Text::Upper) - : tr::lng_polls_submit_votes(tr::now, Ui::Text::Upper); + ? tr::lng_polls_view_results(tr::now, tr::upper) + : tr::lng_polls_submit_votes(tr::now, tr::upper); const auto stringw = st::semiboldFont->width(string); p.drawTextLeft( left + (paintw - stringw) / 2, diff --git a/Telegram/SourceFiles/history/view/media/history_view_similar_channels.cpp b/Telegram/SourceFiles/history/view/media/history_view_similar_channels.cpp index 93b99c4818..70bb4dc44f 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_similar_channels.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_similar_channels.cpp @@ -70,11 +70,11 @@ using Channels = Api::ChatParticipants::Peers; lt_count, upto, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_similar_channels_premium_all_link( tr::now))), - Ui::Text::RichLangValue), + tr::rich), u"similar_channels"_q); return; } diff --git a/Telegram/SourceFiles/history/view/media/history_view_suggest_decision.cpp b/Telegram/SourceFiles/history/view/media/history_view_suggest_decision.cpp index baf0825c9e..f0c565ec9a 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_suggest_decision.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_suggest_decision.cpp @@ -150,7 +150,7 @@ auto GenerateSuggestDecisionMedia( ? tr::lng_suggest_action_his_not_enough_ton : tr::lng_suggest_action_his_not_enough_stars))( tr::now, - Ui::Text::RichLangValue)), + tr::rich)), st::chatSuggestInfoFullMargin, style::al_top); } else if (decision->rejected) { @@ -163,8 +163,8 @@ auto GenerateSuggestDecisionMedia( : tr::lng_suggest_action_declined)( tr::now, lt_from, - Ui::Text::Bold(broadcast->name()), - Ui::Text::WithEntities)), + tr::bold(broadcast->name()), + tr::marked)), (withComment ? st::chatSuggestInfoTitleMargin : st::chatSuggestInfoFullMargin)); @@ -186,7 +186,7 @@ auto GenerateSuggestDecisionMedia( pushText( TextWithEntities( ).append(Emoji(kAgreement)).append(' ').append( - Ui::Text::Bold(tr::lng_suggest_action_agreement(tr::now)) + tr::bold(tr::lng_suggest_action_agreement(tr::now)) ), st::chatSuggestInfoTitleMargin, style::al_top); @@ -197,9 +197,9 @@ auto GenerateSuggestDecisionMedia( tr::lng_suggest_action_agree_date( tr::now, lt_channel, - Ui::Text::Bold(broadcast->name()), + tr::bold(broadcast->name()), lt_date, - Ui::Text::Bold(tr::lng_mediaview_date_time( + tr::bold(tr::lng_mediaview_date_time( tr::now, lt_date, QLocale().toString( @@ -209,7 +209,7 @@ auto GenerateSuggestDecisionMedia( QLocale().toString( date.time(), QLocale::ShortFormat))), - Ui::Text::WithEntities)), + tr::marked)), (price ? st::chatSuggestInfoMiddleMargin : st::chatSuggestInfoLastMargin)); @@ -224,7 +224,7 @@ auto GenerateSuggestDecisionMedia( tr::now, lt_count_decimal, price.value(), - Ui::Text::RichLangValue) + tr::rich) : (price.stars() ? tr::lng_suggest_action_his_charged_stars : tr::lng_suggest_action_his_charged_ton)( @@ -232,8 +232,8 @@ auto GenerateSuggestDecisionMedia( lt_count_decimal, price.value(), lt_from, - Ui::Text::Bold(sublistPeer->shortName()), - Ui::Text::RichLangValue))), + tr::bold(sublistPeer->shortName()), + tr::rich))), st::chatSuggestInfoMiddleMargin); pushText( @@ -244,8 +244,8 @@ auto GenerateSuggestDecisionMedia( : tr::lng_suggest_action_agree_receive_stars)( tr::now, lt_channel, - Ui::Text::Bold(broadcast->name()), - Ui::Text::WithEntities)), + tr::bold(broadcast->name()), + tr::marked)), st::chatSuggestInfoMiddleMargin); pushText( @@ -256,8 +256,8 @@ auto GenerateSuggestDecisionMedia( : tr::lng_suggest_action_agree_removed_stars)( tr::now, lt_channel, - Ui::Text::Bold(broadcast->name()), - Ui::Text::WithEntities)), + tr::bold(broadcast->name()), + tr::marked)), st::chatSuggestInfoLastMargin); } } @@ -307,7 +307,7 @@ auto GenerateSuggestRequestMedia( ((!changes && from->isSelf()) ? tr::lng_suggest_action_your( tr::now, - Ui::Text::WithEntities) + tr::marked) : (!changes ? tr::lng_suggest_action_his : changes->message @@ -319,8 +319,8 @@ auto GenerateSuggestRequestMedia( : tr::lng_suggest_change_time)( tr::now, lt_from, - Ui::Text::Bold(from->shortName()), - Ui::Text::WithEntities)), + tr::bold(from->shortName()), + tr::marked)), st::chatSuggestInfoTitleMargin, style::al_top); @@ -329,7 +329,7 @@ auto GenerateSuggestRequestMedia( ((changes && changes->price) ? tr::lng_suggest_change_price_label : tr::lng_suggest_action_price_label)(tr::now), - Ui::Text::Bold(!suggest->price + tr::bold(!suggest->price ? tr::lng_suggest_action_price_free(tr::now) : suggest->price.stars() ? tr::lng_suggest_stars_amount( @@ -345,7 +345,7 @@ auto GenerateSuggestRequestMedia( ((changes && changes->date) ? tr::lng_suggest_change_time_label : tr::lng_suggest_action_time_label)(tr::now), - Ui::Text::Bold(suggest->date + tr::bold(suggest->date ? Ui::FormatDateTime(base::unixtime::parse(suggest->date)) : tr::lng_suggest_action_time_any(tr::now)), }); @@ -360,7 +360,7 @@ auto GenerateSuggestRequestMedia( push(std::make_unique( tr::lng_suggest_change_text_label( tr::now, - Ui::Text::WithEntities), + tr::marked), st::chatSuggestInfoLastMargin, fadedFg)); } diff --git a/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp b/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp index 015f24e5d2..d849a1cc7d 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_todo_list.cpp @@ -362,7 +362,7 @@ void TodoList::toggleCompletion(int id) { return; } else if (_parent->data()->Has()) { _parent->delegate()->elementShowTooltip( - tr::lng_todo_mark_forwarded(tr::now, Ui::Text::RichLangValue), + tr::lng_todo_mark_forwarded(tr::now, tr::rich), [] {}); return; } else if (!canComplete()) { @@ -370,8 +370,8 @@ void TodoList::toggleCompletion(int id) { tr::lng_todo_mark_restricted( tr::now, lt_user, - Ui::Text::Bold(_parent->data()->from()->shortName()), - Ui::Text::RichLangValue), [] {}); + tr::bold(_parent->data()->from()->shortName()), + tr::rich), [] {}); return; } else if (!_parent->history()->session().premium()) { Window::PeerMenuTodoWantsPremium(Window::TodoWantsPremium::Mark); diff --git a/Telegram/SourceFiles/history/view/media/history_view_unique_gift.cpp b/Telegram/SourceFiles/history/view/media/history_view_unique_gift.cpp index 453e37591c..700d0481f7 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_unique_gift.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_unique_gift.cpp @@ -360,7 +360,7 @@ auto GenerateUniqueGiftMedia( st::chatUniqueStickerPadding)); const auto peer = parent->history()->peer; pushText( - Ui::Text::Bold(peer->isSelf() + tr::bold(peer->isSelf() ? tr::lng_action_gift_self_subtitle(tr::now) : peer->isServiceUser() ? tr::lng_gift_link_label_gift(tr::now) @@ -374,7 +374,7 @@ auto GenerateUniqueGiftMedia( white, st::chatUniqueTitlePadding); pushText( - Ui::Text::Bold(Data::UniqueGiftName(*gift)), + tr::bold(Data::UniqueGiftName(*gift)), st::chatUniqueTextStyle, gift->backdrop.textColor, st::chatUniqueTextPadding); @@ -387,15 +387,15 @@ auto GenerateUniqueGiftMedia( tr::lng_gift_released_by( tr::now, lt_name, - Ui::Text::Link('@' + by->username()), - Ui::Text::WithEntities), + tr::link('@' + by->username()), + tr::marked), st::giftBoxReleasedByMargin, gift->backdrop, handler)); } const auto name = [](const Data::UniqueGiftAttribute &value) { - return Ui::Text::Bold(value.name); + return tr::bold(value.name); }; auto attributes = std::vector{ { tr::lng_gift_unique_model(tr::now), name(gift->model) }, @@ -568,7 +568,7 @@ auto GenerateAuctionPreview( : gift->resellTitle; if (!name.isEmpty()) { push(std::make_unique( - Ui::Text::Bold(name), + tr::bold(name), QMargins(0, 0, 0, st::defaultVerticalListSkip), [c = backdrop.textColor](const auto&) { return c; }, st::chatUniqueTitle)); diff --git a/Telegram/SourceFiles/history/view/media/history_view_userpic_suggestion.cpp b/Telegram/SourceFiles/history/view/media/history_view_userpic_suggestion.cpp index 9b8a5d7c75..15a7558e80 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_userpic_suggestion.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_userpic_suggestion.cpp @@ -120,16 +120,16 @@ void ShowUserpicSuggestion( void ShowSetToast( not_null controller, const QImage &frame) { - const auto text = Ui::Text::Bold( + const auto text = tr::bold( tr::lng_profile_changed_photo_title(tr::now) ).append('\n').append( tr::lng_profile_changed_photo_about( tr::now, lt_link, - Ui::Text::Link( + tr::link( tr::lng_profile_changed_photo_link(tr::now), u"tg://settings/edit_profile"_q), - Ui::Text::WithEntities) + tr::marked) ); auto st = std::make_shared(st::historyPremiumToast); const auto skip = st->padding.top(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp index 7874557484..1cf85bf2f6 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp @@ -193,7 +193,7 @@ constexpr auto kSponsoredUserpicLines = 2; [[nodiscard]] TextWithEntities PageToPhrase(not_null page) { const auto type = page->type; - const auto text = Ui::Text::Upper(page->iv + const auto text = tr::upper(page->iv ? tr::lng_view_button_iv(tr::now) : page->uniqueGift ? tr::lng_view_button_collectible(tr::now) @@ -408,7 +408,7 @@ QSize WebPage::countOptimalSize() { } else if (sponsored && !sponsored->buttonText.isEmpty()) { _openButton.setText( st::semiboldTextStyle, - Ui::Text::Upper(sponsored->buttonText)); + tr::upper(sponsored->buttonText)); } const auto padding = inBubblePadding() + innerMargin(); @@ -597,14 +597,14 @@ QSize WebPage::countOptimalSize() { _siteNameLines = 1; _siteName.setMarkedText( st::webPageTitleStyle, - Ui::Text::Link(siteName, _data->url), + tr::link(siteName, _data->url), Ui::WebpageTextTitleOptions()); } if (_title.isEmpty() && !title.isEmpty()) { if (!_siteNameLines && !_data->url.isEmpty()) { _title.setMarkedText( st::webPageTitleStyle, - Ui::Text::Link(title, _data->url), + tr::link(title, _data->url), Ui::WebpageTextTitleOptions()); } else { diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp index cbe9e3e3cc..94442aa2e5 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp @@ -1491,10 +1491,10 @@ TextWithEntities ItemReactionsAbout(not_null item) { : tr::lng_subscribe_tag_about( tr::now, lt_link, - Ui::Text::Link( + tr::link( tr::lng_subscribe_tag_link(tr::now), u"internal:about_tags"_q), - Ui::Text::WithEntities); + tr::marked); } } // namespace HistoryView::Reactions diff --git a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_common.cpp b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_common.cpp index 7157c96d1b..935a3ff499 100644 --- a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_common.cpp +++ b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_common.cpp @@ -234,16 +234,16 @@ QString FormatProgramDuration(int durationMonths) { rpl::producer FormatForProgramDuration( int durationMonths) { return !durationMonths - ? tr::lng_star_ref_one_about_for_forever(Ui::Text::RichLangValue) + ? tr::lng_star_ref_one_about_for_forever(tr::rich) : (durationMonths < 12) ? tr::lng_star_ref_one_about_for_months( lt_count, rpl::single(durationMonths * 1.), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_star_ref_one_about_for_years( lt_count, rpl::single((durationMonths / 12) * 1.), - Ui::Text::RichLangValue); + tr::rich); } not_null AddViewListButton( @@ -264,7 +264,7 @@ not_null AddViewListButton( const auto label = parent->add( object_ptr( parent, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), stLabel), titlePadding); label->setAttribute(Qt::WA_TransparentForMouseEvents); @@ -457,13 +457,13 @@ object_ptr StarRefLinkBox( ? tr::lng_star_ref_link_about_user : tr::lng_star_ref_link_about_channel)( lt_amount, - rpl::single(Ui::Text::Bold( + rpl::single(tr::bold( FormatCommission(program.commission))), lt_app, - rpl::single(Ui::Text::Bold(bot->name())), + rpl::single(tr::bold(bot->name())), lt_duration, FormatForProgramDuration(program.durationMonths), - Ui::Text::WithEntities), + tr::marked), st::starrefCenteredText), style::al_top); @@ -509,11 +509,11 @@ object_ptr StarRefLinkBox( rpl::single(row.state.users * 1.), lt_app, rpl::single(name), - Ui::Text::WithEntities) + tr::marked) : tr::lng_star_ref_link_copy_none( lt_app, rpl::single(name), - Ui::Text::WithEntities))); + tr::marked))); }); } @@ -583,13 +583,13 @@ object_ptr JoinStarRefBox( box, tr::lng_star_ref_one_about( lt_app, - rpl::single(Ui::Text::Bold(bot->name())), + rpl::single(tr::bold(bot->name())), lt_amount, - rpl::single(Ui::Text::Bold( + rpl::single(tr::bold( FormatCommission(program.commission))), lt_duration, FormatForProgramDuration(program.durationMonths), - Ui::Text::WithEntities), + tr::marked), st::starrefCenteredText), style::al_top); @@ -605,7 +605,7 @@ object_ptr JoinStarRefBox( lt_amount, rpl::single( Ui::Text::Wrapped(text, EntityType::Bold)), - Ui::Text::WithEntities), + tr::marked), st::starrefRevenueText, st::defaultPopupMenu), st::boxRowPadding, @@ -722,8 +722,8 @@ object_ptr JoinStarRefBox( tr::lng_star_ref_one_join_text( lt_terms, tr::lng_star_ref_button_link( - ) | Ui::Text::ToLink(tr::lng_star_ref_tos_url(tr::now)), - Ui::Text::WithEntities)); + tr::url(tr::lng_star_ref_tos_url(tr::now))), + tr::marked)); }); } @@ -735,7 +735,7 @@ object_ptr ConfirmEndBox(Fn finish) { box->addRow( object_ptr( box, - tr::lng_star_ref_warning_if_end(Ui::Text::RichLangValue), + tr::lng_star_ref_warning_if_end(tr::rich), st::boxLabel), margins); const auto addPoint = [&](tr::phrase<> text) { @@ -744,7 +744,7 @@ object_ptr ConfirmEndBox(Fn finish) { box, object_ptr( box, - text(Ui::Text::RichLangValue), + text(tr::rich), st::blockUserConfirmation), QMargins(st::boxTextFont->height, 0, 0, 0)), margins); @@ -943,7 +943,7 @@ void ConfirmUpdate( Ui::ConfirmBox(box, { .text = (exists ? tr::lng_star_ref_warning_change - : tr::lng_star_ref_warning_text)(Ui::Text::RichLangValue), + : tr::lng_star_ref_warning_text)(tr::rich), .confirmed = [=](Fn close) { if (*sent) { return; diff --git a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp index fd2ec5f33e..db994f8afa 100644 --- a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp +++ b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp @@ -645,8 +645,8 @@ base::unique_qptr ListController::rowContextMenu( _controller->show(Ui::MakeConfirmBox({ .text = tr::lng_star_ref_revoke_text( lt_bot, - rpl::single(Ui::Text::Bold(bot->name())), - Ui::Text::RichLangValue), + rpl::single(tr::bold(bot->name())), + tr::rich), .confirmed = sure, .title = tr::lng_star_ref_revoke_title(), })); @@ -771,18 +771,16 @@ not_null InnerWidget::setupMy() { void InnerWidget::setupSort(not_null label) { constexpr auto phrase = [](SuggestedSort sort) { - return (sort == SuggestedSort::Profitability) - ? tr::lng_star_ref_sort_profitability(tr::now) + return ((sort == SuggestedSort::Profitability) + ? tr::lng_star_ref_sort_profitability : (sort == SuggestedSort::Revenue) - ? tr::lng_star_ref_sort_revenue(tr::now) - : tr::lng_star_ref_sort_date(tr::now); + ? tr::lng_star_ref_sort_revenue + : tr::lng_star_ref_sort_date)(tr::now, tr::link); }; const auto sort = Ui::CreateChild( label->parentWidget(), - tr::lng_star_ref_sort_text( - lt_sort, - _sort.value() | rpl::map(phrase) | Ui::Text::ToLink(), - Ui::Text::WithEntities), + tr::lng_star_ref_sort_text(lt_sort, _sort.value() | rpl::map(phrase), + tr::marked), st::defaultFlatLabel); rpl::combine( label->geometryValue(), @@ -806,7 +804,7 @@ void InnerWidget::setupSort(not_null label) { }; for (const auto order : orders) { const auto chosen = (order == _sort.current()); - menu->addAction(phrase(order), crl::guard(this, [=] { + menu->addAction(phrase(order).text, crl::guard(this, [=] { _sort = order; }), chosen ? &st::mediaPlayerMenuCheck : nullptr); } @@ -867,7 +865,7 @@ object_ptr InnerWidget::infoRow( raw->add( object_ptr( raw, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), st::defaultFlatLabel), st::settingsPremiumRowTitlePadding); raw->add( @@ -989,8 +987,7 @@ void Widget::restoreState(not_null memento) { std::unique_ptr Widget::setupTop() { auto title = tr::lng_star_ref_list_title(); - auto about = tr::lng_star_ref_list_about_channel() - | Ui::Text::ToWithEntities(); + auto about = tr::lng_star_ref_list_about_channel(tr::marked); const auto controller = this->controller(); const auto weak = base::make_weak(controller->parentController()); diff --git a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp index 77d63f69fa..ffff738e9c 100644 --- a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp +++ b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp @@ -757,7 +757,7 @@ void InnerWidget::setupEnd() { .title = tr::lng_star_ref_ended_title(tr::now), .text = tr::lng_star_ref_ended_text( tr::now, - Ui::Text::RichLangValue), + tr::rich), .duration = Ui::Toast::kDefaultDuration * 3, }); } @@ -778,7 +778,7 @@ object_ptr InnerWidget::infoRow( raw->add( object_ptr( raw, - std::move(title) | Ui::Text::ToBold(), + std::move(title) | rpl::map(tr::bold), st::defaultFlatLabel), st::settingsPremiumRowTitlePadding); raw->add( @@ -902,7 +902,7 @@ void Widget::restoreState(not_null memento) { std::unique_ptr Widget::setupTop() { auto title = tr::lng_star_ref_title(); - auto about = tr::lng_star_ref_about() | Ui::Text::ToWithEntities(); + auto about = tr::lng_star_ref_about(tr::marked); const auto controller = this->controller(); const auto weak = base::make_weak(controller->parentController()); @@ -1008,8 +1008,8 @@ std::unique_ptr Widget::setupBottom() { : tr::lng_star_ref_start_info)( lt_terms, tr::lng_star_ref_button_link( - ) | Ui::Text::ToLink(tr::lng_star_ref_tos_url(tr::now)), - Ui::Text::WithEntities), + tr::url(tr::lng_star_ref_tos_url(tr::now))), + tr::marked), st::boxDividerLabel), QMargins(margins.left(), 0, margins.right(), 0)); save->setClickedCallback([=] { @@ -1032,7 +1032,7 @@ std::unique_ptr Widget::setupBottom() { ? tr::lng_star_ref_updated_text : tr::lng_star_ref_created_text)( tr::now, - Ui::Text::RichLangValue), + tr::rich), .duration = Ui::Toast::kDefaultDuration * 3, }); }); diff --git a/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp b/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp index cf1a24e68d..a187928026 100644 --- a/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp @@ -332,7 +332,7 @@ void CreateGiveawayBox( (peer->isMegagroup() ? tr::lng_giveaway_new_about_group() : tr::lng_giveaway_new_about()) - ) | rpl::map(Ui::Text::RichLangValue)); + ) | rpl::map(tr::rich)); { const auto &padding = st::giveawayGiftCodeCoverDividerPadding; Ui::AddSkip(box->verticalLayout(), padding.bottom()); @@ -1023,9 +1023,9 @@ void CreateGiveawayBox( lt_link, tr::lng_premium_gift_terms_link( ) | rpl::map([](const QString &t) { - return Ui::Text::Link(t, 1); + return tr::link(t, 1); }), - Ui::Text::WithEntities), + tr::marked), st::boxDividerLabel); terms->setLink(1, std::make_shared([=] { box->closeBox(); @@ -1195,7 +1195,7 @@ void CreateGiveawayBox( users, lt_duration, TextWithEntities{ duration }, - Ui::Text::RichLangValue); + tr::rich); } return tr::lng_giveaway_prizes_additional( tr::now, @@ -1205,7 +1205,7 @@ void CreateGiveawayBox( TextWithEntities{ prize }, lt_duration, TextWithEntities{ duration }, - Ui::Text::RichLangValue); + tr::rich); }); auto creditsAdditionalAbout = rpl::combine( state->additionalPrize.value(), @@ -1218,7 +1218,7 @@ void CreateGiveawayBox( tr::now, lt_count, credits, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_giveaway_prizes_additional_credits( tr::now, lt_count, @@ -1230,8 +1230,8 @@ void CreateGiveawayBox( tr::now, lt_count, credits, - Ui::Text::RichLangValue), - Ui::Text::RichLangValue); + tr::rich), + tr::rich); }); auto creditsValueType = typeGroup->value( @@ -1247,9 +1247,8 @@ void CreateGiveawayBox( std::move(additionalAbout)), rpl::conditional( rpl::duplicate(creditsValueType), - tr::lng_giveaway_additional_credits_about(), - tr::lng_giveaway_additional_about() - ) | Ui::Text::ToWithEntities())); + tr::lng_giveaway_additional_credits_about(tr::marked), + tr::lng_giveaway_additional_about(tr::marked)))); Ui::AddSkip(additionalWrap); } @@ -1487,15 +1486,15 @@ void CreateGiveawayBox( ? tr::lng_giveaway_created_body_group : tr::lng_giveaway_created_body); show->showToast({ - .text = Ui::Text::Bold( + .text = tr::bold( title(tr::now)).append('\n').append( body( tr::now, lt_link, - Ui::Text::Link( + tr::link( tr::lng_giveaway_created_link( tr::now)), - Ui::Text::WithEntities)), + tr::marked)), .filter = filter, .adaptive = true, .duration = kDoneTooltipDuration, diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp index 786a5b1ef8..ca7c702b1b 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp @@ -357,7 +357,7 @@ void InnerWidget::fill() { const auto empty = container->add(object_ptr( container, Dialogs::SearchEmptyIcon::NoResults, - tr::lng_search_tab_no_results(Ui::Text::Bold))); + tr::lng_search_tab_no_results(tr::bold))); empty->setMinimalHeight(st::normalBoxLottieSize.height()); empty->animate(); return; @@ -419,11 +419,11 @@ void InnerWidget::fill() { tr::lng_channel_earn_about_link( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link(std::move(text), 1); + return tr::link(std::move(text), 1); }), - Ui::Text::RichLangValue), + tr::rich), st::boxDividerLabel); label->setLink(1, std::make_shared([=] { _show->showBox(Box([=](not_null box) { @@ -542,8 +542,8 @@ void InnerWidget::fill() { tr::lng_channel_earn_learn_coin_title( lt_emoji, rpl::single( - Ui::Text::Link(bigCurrencyIcon, 1)), - Ui::Text::RichLangValue), + tr::link(bigCurrencyIcon, 1)), + tr::rich), st::boxTitle, st::defaultPopupMenu, emojiHelper.context()), @@ -571,11 +571,11 @@ void InnerWidget::fill() { lt_emoji, rpl::single(Ui::Text::IconEmoji( &st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link(std::move(text), 1); + return tr::link(std::move(text), 1); }), - Ui::Text::RichLangValue), + tr::rich), st::channelEarnLearnDescription)); label->resizeToWidth(box->width() - rect::m::sum::h(st::boxRowPadding)); diff --git a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp index 5c1c56744a..0106bcb4da 100644 --- a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp +++ b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp @@ -222,7 +222,7 @@ void GiftButton::setDescriptor(const GiftDescriptor &descriptor, Mode mode) { _text = Ui::Text::String(st::giftBoxGiftHeight / 4); _text.setMarkedText( st::defaultTextStyle, - Ui::Text::Bold( + tr::bold( tr::lng_months(tr::now, lt_count, months) ).append('\n').append( tr::lng_gift_premium_label(tr::now) diff --git a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp index 2d0d54933a..8a59b4bb36 100644 --- a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp +++ b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp @@ -1257,8 +1257,8 @@ void InnerWidget::refreshAbout() { if (filteredEmpty) { auto text = tr::lng_peer_gifts_empty_search( tr::now, - Ui::Text::RichLangValue); - text.append("\n\n").append(Ui::Text::Link( + tr::rich); + text.append("\n\n").append(tr::link( tr::lng_peer_gifts_view_all(tr::now))); auto about = std::make_unique( this, @@ -1316,13 +1316,13 @@ void InnerWidget::refreshAbout() { _about = std::make_unique( this, ((maybeEmpty && !knownEmpty) - ? tr::lng_contacts_loading(Ui::Text::WithEntities) + ? tr::lng_contacts_loading(tr::marked) : _peer->isSelf() - ? tr::lng_peer_gifts_about_mine(Ui::Text::RichLangValue) + ? tr::lng_peer_gifts_about_mine(tr::rich) : tr::lng_peer_gifts_about( lt_user, - rpl::single(Ui::Text::Bold(_peer->shortName())), - Ui::Text::RichLangValue)), + rpl::single(tr::bold(_peer->shortName())), + tr::rich)), st::giftListAbout); _about->show(); resizeToWidth(width()); @@ -1469,7 +1469,7 @@ void InnerWidget::refreshCollectionsTabs() { auto tabs = std::vector(); tabs.push_back({ .id = u"all"_q, - .text = tr::lng_gift_collection_all(tr::now, Ui::Text::WithEntities), + .text = tr::lng_gift_collection_all(tr::now, tr::marked), }); for (const auto &collection : _collections) { auto &per = _perCollection[collection.id]; diff --git a/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp b/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp index c6e64dc428..29683dccdd 100644 --- a/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp +++ b/Telegram/SourceFiles/info/polls/info_polls_results_inner_widget.cpp @@ -524,7 +524,7 @@ ListController *CreateAnswerRows( tr::lng_polls_show_more( lt_count_decimal, controller->loadMoreCount() | rpl::map(_1 + 0.), - Ui::Text::Upper), + tr::upper), st::pollResultsShowMore))); more->entity()->setClickedCallback([=] { controller->allowLoadMore(); diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 5090dd7f2a..6f97132eba 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -80,7 +80,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rect.h" #include "ui/ui_utility.h" #include "ui/text/format_values.h" -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "ui/text/text_variant.h" #include "ui/toast/toast.h" #include "ui/vertical_list.h" @@ -144,7 +143,7 @@ base::options::toggle ShowChannelJoinedBelowAbout({ end(usernames)); for (auto &username : std::move(subrange)) { const auto isLast = (usernames.back() == username); - result.append(Ui::Text::Link( + result.append(tr::link( '@' + base::take(username.text), username.entities.front().data())); if (!isLast) { @@ -162,8 +161,8 @@ base::options::toggle ShowChannelJoinedBelowAbout({ UsernamesValue(peer) | rpl::map([](std::vector v) { return !v.empty(); }), - tr::lng_filters_link_subtitle(Ui::Text::WithEntities), - tr::lng_info_link_topic_label(Ui::Text::WithEntities)); + tr::lng_filters_link_subtitle(tr::marked), + tr::lng_info_link_topic_label(tr::marked)); } [[nodiscard]] Fn UsernamesLinkCallback( @@ -238,7 +237,7 @@ base::options::toggle ShowChannelJoinedBelowAbout({ ? tr::lng_you_joined_group : tr::lng_action_you_joined)( tr::now, - Ui::Text::Italic)); + tr::italic)); value.append(Italic(": ")); const auto raw = channel->inviteDate; value.append(Link( @@ -874,7 +873,7 @@ void DeleteContactNote( auto label = BirthdayLabelText(rpl::duplicate(birthday)); auto text = BirthdayValueText( rpl::duplicate(birthday) - ) | Ui::Text::ToWithEntities(); + ) | rpl::map(tr::marked); const auto giftIcon = Ui::CreateChild(layout); giftIcon->resize(st::birthdayTodayIcon.size()); @@ -983,7 +982,7 @@ template const style::SettingsButton &st = st::infoMainButton) { const auto button = AddActionButton( parent, - std::move(text) | Ui::Text::ToUpper(), + std::move(text) | rpl::map(tr::upper), std::move(toggleOn), std::move(callback), nullptr, @@ -1635,7 +1634,7 @@ object_ptr DetailsFiller::setupInfo() { UsernameValue(user, true) | rpl::map([=](TextWithEntities u) { return u.text.isEmpty() ? TextWithEntities() - : Ui::Text::Link(u, UsernameUrl(user, u.text.mid(1))); + : tr::link(u, UsernameUrl(user, u.text.mid(1))); }), QString(), st::infoProfileLabeledUsernamePadding); @@ -1683,7 +1682,7 @@ object_ptr DetailsFiller::setupInfo() { } else if (!details.location.point) { return TextWithEntities{ details.location.address }; } - return Ui::Text::Link( + return tr::link( TextUtilities::SingleLine(details.location.address), LocationClickHandler::Url(*details.location.point)); }); @@ -1706,7 +1705,7 @@ object_ptr DetailsFiller::setupInfo() { const auto text = link.text; return text.isEmpty() ? TextWithEntities() - : Ui::Text::Link( + : tr::link( (text.startsWith(u"https://"_q) ? text.mid(u"https://"_q.size()) : text) + addToLink, @@ -1749,7 +1748,7 @@ object_ptr DetailsFiller::setupInfo() { channel ) | rpl::map([](const ChannelLocation *location) { return location - ? Ui::Text::Link( + ? tr::link( TextUtilities::SingleLine(location->address), LocationClickHandler::Url(location->point)) : TextWithEntities(); @@ -1794,7 +1793,7 @@ object_ptr DetailsFiller::setupPersonalChannel( const auto channelLabelFactory = [=](rpl::producer c) { return rpl::combine( - tr::lng_info_personal_channel_label(Ui::Text::WithEntities), + tr::lng_info_personal_channel_label(tr::marked), std::move(c) ) | rpl::map([](TextWithEntities &&text, ChannelData *channel) { const auto count = channel ? channel->membersCount() : 0; @@ -1850,7 +1849,7 @@ object_ptr DetailsFiller::setupPersonalChannel( ) | rpl::map([=](ChannelData *channel) { return channel ? NameValue(channel) : rpl::single(QString()); }) | rpl::flatten_latest() | rpl::map([](const QString &name) { - return name.isEmpty() ? TextWithEntities() : Ui::Text::Link(name); + return name.isEmpty() ? TextWithEntities() : tr::link(name); }); auto line = CreateTextWithLabel( result, @@ -2111,8 +2110,8 @@ void DetailsFiller::setupMainApp() { rpl::combine( tr::lng_profile_open_app_about( lt_terms, - tr::lng_profile_open_app_terms() | Ui::Text::ToLink(url), - Ui::Text::WithEntities), + tr::lng_profile_open_app_terms(tr::url(url)), + tr::marked), user->session().changes().peerFlagsValue( user, Data::PeerUpdate::Flag::VerifyInfo) @@ -2389,8 +2388,8 @@ void ActionsFiller::addAffiliateProgram(not_null user) { lt_bot, rpl::single(TextWithEntities{ user->name() }), lt_amount, - rpl::duplicate(commission) | Ui::Text::ToWithEntities(), - Ui::Text::RichLangValue)); + rpl::duplicate(commission) | rpl::map(tr::marked), + tr::rich)); Ui::AddSkip(inner); wrap->toggleOn(std::move( diff --git a/Telegram/SourceFiles/info/profile/info_profile_members.cpp b/Telegram/SourceFiles/info/profile/info_profile_members.cpp index 729b1a365d..25900c1ec4 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members.cpp @@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/fields/input_field.h" #include "ui/widgets/scroll_area.h" #include "ui/wrap/padding_wrap.h" -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "ui/search_field_controller.h" #include "lang/lang_keys.h" #include "ui/boxes/confirm_box.h" @@ -177,8 +176,8 @@ object_ptr Members::setupTitle() { tr::lng_chat_status_members( lt_count_decimal, MembersCountValue(_peer) | tr::to_count(), - Ui::Text::Upper), - tr::lng_channel_admins(Ui::Text::Upper)), + tr::upper), + tr::lng_channel_admins(tr::upper)), st::infoBlockHeaderLabel); result->setAttribute(Qt::WA_TransparentForMouseEvents); return result; diff --git a/Telegram/SourceFiles/info/profile/info_profile_phone_menu.cpp b/Telegram/SourceFiles/info/profile/info_profile_phone_menu.cpp index 0457cb1d33..a6506b646b 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_phone_menu.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_phone_menu.cpp @@ -129,7 +129,7 @@ void AddPhoneMenu(not_null menu, not_null user) { return; } else if (const auto url = AppConfig::FragmentLink(&user->session())) { menu->addSeparator(&st::expandedMenuSeparator); - const auto link = Ui::Text::Link( + const auto link = tr::link( tr::lng_info_mobile_context_menu_fragment_about_link(tr::now), *url); menu->addAction(base::make_unique_q( @@ -138,7 +138,7 @@ void AddPhoneMenu(not_null menu, not_null user) { tr::lng_info_mobile_context_menu_fragment_about( lt_link, rpl::single(link), - Ui::Text::RichLangValue))); + tr::rich))); } } diff --git a/Telegram/SourceFiles/info/profile/info_profile_status_label.cpp b/Telegram/SourceFiles/info/profile/info_profile_status_label.cpp index 830dfc4c5b..a44fb98fed 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_status_label.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_status_label.cpp @@ -134,7 +134,7 @@ void StatusLabel::refresh() { if (!channel->membersCountKnown()) { auto result = ChannelTypeText(channel); return hasMembersLink - ? Ui::Text::Link(result) + ? tr::link(result) : TextWithEntities{ .text = result }; } const auto onlineCount = _onlineCount; @@ -144,7 +144,7 @@ void StatusLabel::refresh() { onlineCount, channel->isMegagroup()); return hasMembersLink - ? Ui::Text::Link(result) + ? tr::link(result) : TextWithEntities{ .text = result }; } return tr::lng_chat_status_unaccessible(tr::now, WithEntities); diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index 24d50b54bb..4eac975c9e 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -1115,8 +1115,8 @@ void TopBar::setupUserpicButton( .about = (*phrase)( tr::now, lt_user, - Ui::Text::Bold(name), - Ui::Text::WithEntities), + tr::bold(name), + tr::marked), .confirm = ((type == ChosenType::Suggest) ? tr::lng_profile_suggest_button(tr::now) : tr::lng_profile_set_photo_button(tr::now)), @@ -1262,8 +1262,8 @@ void TopBar::setupUserpicButton( const auto text = tr::lng_profile_topic_toast( tr::now, lt_name, - Ui::Text::Link(packName, u"internal:"_q), - Ui::Text::WithEntities); + tr::link(packName, u"internal:"_q), + tr::marked); const auto weak = base::make_weak(controller); controller->showToast(Ui::Toast::Config{ .text = text, diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index 0a21f12a91..a303b418c2 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -130,8 +130,8 @@ rpl::producer PhoneValue(not_null user) { user, UpdateFlag::PhoneNumber) | rpl::to_empty ) | rpl::map([=] { - return Ui::FormatPhone(user->phone()); - }) | Ui::Text::ToWithEntities(); + return tr::marked(Ui::FormatPhone(user->phone())); + }); } rpl::producer PhoneOrHiddenValue(not_null user) { @@ -146,9 +146,9 @@ rpl::producer PhoneOrHiddenValue(not_null user) { const QString &about, const QString &hidden) { if (phone.text.isEmpty() && username.isEmpty() && about.isEmpty()) { - return Ui::Text::WithEntities(hidden); + return tr::marked(hidden); } else if (IsCollectiblePhone(user)) { - return Ui::Text::Link(phone, u"internal:collectible_phone/"_q + return tr::link(phone, u"internal:collectible_phone/"_q + user->phone() + '@' + QString::number(user->id.value)); } else { return phone; @@ -164,9 +164,9 @@ rpl::producer UsernameValue( : (PlainUsernameValue(peer) | rpl::type_erased) ) | rpl::map([](QString &&username) { return username.isEmpty() - ? QString() - : ('@' + username); - }) | Ui::Text::ToWithEntities(); + ? tr::marked() + : tr::marked('@' + username); + }); } QString UsernameUrl( @@ -192,7 +192,7 @@ rpl::producer> UsernamesValue( return ranges::views::all( usernames ) | ranges::views::transform([&](const QString &u) { - return Ui::Text::Link(u, UsernameUrl(peer, u)); + return tr::link(u, UsernameUrl(peer, u)); }) | ranges::to_vector; }; auto value = rpl::merge( diff --git a/Telegram/SourceFiles/info/saved/info_saved_music_widget.cpp b/Telegram/SourceFiles/info/saved/info_saved_music_widget.cpp index eb672f599f..e1bc6d4a1e 100644 --- a/Telegram/SourceFiles/info/saved/info_saved_music_widget.cpp +++ b/Telegram/SourceFiles/info/saved/info_saved_music_widget.cpp @@ -176,9 +176,9 @@ void MusicInner::refreshEmpty() { _empty = object_ptr( this, (!knownEmpty - ? tr::lng_contacts_loading(Ui::Text::WithEntities) + ? tr::lng_contacts_loading(tr::marked) : rpl::single( - tr::lng_media_song_empty(tr::now, Ui::Text::WithEntities))), + tr::lng_media_song_empty(tr::now, tr::marked))), st::giftListAbout); _empty->show(); _emptyLoading = !knownEmpty; diff --git a/Telegram/SourceFiles/info/similar_peers/info_similar_peers_widget.cpp b/Telegram/SourceFiles/info/similar_peers/info_similar_peers_widget.cpp index 77b6045dec..88d1972c32 100644 --- a/Telegram/SourceFiles/info/similar_peers/info_similar_peers_widget.cpp +++ b/Telegram/SourceFiles/info/similar_peers/info_similar_peers_widget.cpp @@ -173,8 +173,9 @@ void ListController::setupUnlock() { rpl::single(upto * 1.), lt_link, tr::lng_similar_channels_premium_all_link( - ) | Ui::Text::ToBold() | Ui::Text::ToLink(), - Ui::Text::RichLangValue), + tr::bold + ) | rpl::map(tr::link), + tr::rich), st::similarChannelsLockAbout); about->setClickHandlerFilter([=](const auto &...) { const auto window = _controller->parentController(); diff --git a/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp b/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp index 6a88274fe4..819733cd71 100644 --- a/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp +++ b/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp @@ -718,10 +718,10 @@ void InnerWidget::refreshEmpty() { _empty = object_ptr( this, (!knownEmpty - ? tr::lng_contacts_loading(Ui::Text::WithEntities) + ? tr::lng_contacts_loading(tr::marked) : _peer->isSelf() - ? tr::lng_stories_empty(Ui::Text::RichLangValue) - : tr::lng_stories_empty_channel(Ui::Text::RichLangValue)), + ? tr::lng_stories_empty(tr::rich) + : tr::lng_stories_empty_channel(tr::rich)), st::giftListAbout); _empty->show(); } @@ -750,7 +750,7 @@ void InnerWidget::refreshAlbumsTabs() { .id = u"all"_q, .text = tr::lng_stories_album_all( tr::now, - Ui::Text::WithEntities), + tr::marked), }); for (const auto &album : _albums) { auto title = TextWithEntities(); diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp index e050a45ba5..d3d5cbab02 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp @@ -286,7 +286,7 @@ void FillDisclaimerBox( Ui::ConfirmBox(box, { .text = tr::lng_mini_apps_disclaimer_text( tr::now, - Ui::Text::RichLangValue), + tr::rich), .confirmed = callback, .cancelled = [=](Fn close) { done(false); close(); }, .confirmText = tr::lng_box_ok(), @@ -304,10 +304,10 @@ void FillDisclaimerBox( box.get(), tr::lng_mini_apps_disclaimer_button( lt_link, - rpl::single(Ui::Text::Link( + rpl::single(tr::link( tr::lng_mini_apps_disclaimer_link(tr::now), tr::lng_mini_apps_tos_url(tr::now))), - Ui::Text::WithEntities), + tr::marked), st::urlAuthCheckbox, std::move(checkView)), { @@ -387,9 +387,9 @@ void FillBotUsepic( tr::lng_allow_bot_webview_details( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link(std::move(text), u"internal:"_q); + return tr::link(std::move(text), u"internal:"_q); }), st::defaultFlatLabel); const auto userpic = Ui::CreateChild( @@ -509,7 +509,7 @@ void ConfirmEmojiStatusAccessBox( AddSkip(box->verticalLayout(), 2 * st::defaultVerticalListSkip); - auto name = Ui::Text::Bold(bot->name()); + auto name = tr::bold(bot->name()); box->addRow( object_ptr( box, @@ -518,7 +518,7 @@ void ConfirmEmojiStatusAccessBox( rpl::single(name), lt_name, rpl::single(name), - Ui::Text::RichLangValue), + tr::rich), st::botEmojiStatusText), style::al_top); @@ -571,8 +571,8 @@ void ConfirmEmojiStatusBox( box, tr::lng_bot_emoji_status_text( lt_bot, - rpl::single(Ui::Text::Bold(bot->name())), - Ui::Text::RichLangValue), + rpl::single(tr::bold(bot->name())), + tr::rich), st::botEmojiStatusText), style::al_top); @@ -1058,10 +1058,10 @@ void WebViewInstance::confirmOpen(Fn done) { .text = tr::lng_profile_open_app_about( tr::now, lt_terms, - Ui::Text::Link( + tr::link( tr::lng_profile_open_app_terms(tr::now), tr::lng_mini_apps_tos_url(tr::now)), - Ui::Text::RichLangValue), + tr::rich), .confirmed = crl::guard(this, callback), .cancelled = crl::guard(this, cancel), .confirmText = tr::lng_view_button_bot_app(), @@ -1095,10 +1095,10 @@ void WebViewInstance::confirmAppOpen( tr::lng_profile_open_app_about( tr::now, lt_terms, - Ui::Text::Link( + tr::link( tr::lng_profile_open_app_terms(tr::now), tr::lng_mini_apps_tos_url(tr::now)), - Ui::Text::RichLangValue), + tr::rich), crl::guard(this, callback), crl::guard(this, cancelled), tr::lng_view_button_bot_app(), @@ -1110,8 +1110,8 @@ void WebViewInstance::confirmAppOpen( tr::lng_url_auth_allow_messages( tr::now, lt_bot, - Ui::Text::Bold(_bot->name()), - Ui::Text::WithEntities), + tr::bold(_bot->name()), + tr::marked), true, st::urlAuthCheckbox), style::margins( @@ -1624,8 +1624,8 @@ void WebViewInstance::botHandleMenuButton( : tr::lng_bot_remove_from_menu_sure)( tr::now, lt_bot, - Ui::Text::Bold(name), - Ui::Text::WithEntities), + tr::bold(name), + tr::marked), done, })); } break; @@ -2498,8 +2498,8 @@ void AttachWebView::confirmAddToMenu( box, tr::lng_bot_will_be_added( lt_bot, - rpl::single(Ui::Text::Bold(bot.name)), - Ui::Text::WithEntities), + rpl::single(tr::bold(bot.name)), + tr::marked), st::boxLabel)); } else { Ui::ConfirmBox(box, { @@ -2508,8 +2508,8 @@ void AttachWebView::confirmAddToMenu( : tr::lng_bot_add_to_menu)( tr::now, lt_bot, - Ui::Text::Bold(bot.name), - Ui::Text::WithEntities), + tr::bold(bot.name), + tr::marked), done, (callback ? [=](Fn close) { callback(false); close(); } @@ -2522,8 +2522,8 @@ void AttachWebView::confirmAddToMenu( tr::lng_url_auth_allow_messages( tr::now, lt_bot, - Ui::Text::Bold(bot.name), - Ui::Text::WithEntities), + tr::bold(bot.name), + tr::marked), true, st::urlAuthCheckbox), style::margins( diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_downloads.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_downloads.cpp index 901c61a4c6..25bce297f4 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_downloads.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_downloads.cpp @@ -385,8 +385,8 @@ void DownloadFileBox(not_null box, DownloadBoxArgs args) { box, tr::lng_bot_download_file_sure( lt_bot, - rpl::single(Ui::Text::Bold(args.bot)), - Ui::Text::RichLangValue), + rpl::single(tr::bold(args.bot)), + tr::rich), st::botDownloadLabel)); //box->addRow(MakeFilePreview(box, args)); const auto done = std::move(args.done); diff --git a/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp b/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp index 0125a7d778..3a2d170df2 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp @@ -125,7 +125,7 @@ void Inner::checkRestrictedPeer() { _restrictedLabel.create( this, rpl::single(error.boostsToLift - ? Ui::Text::Link(error.text) + ? tr::link(error.text) : TextWithEntities{ error.text }), st::stickersRestrictedLabel); const auto lifting = error.boostsToLift; diff --git a/Telegram/SourceFiles/intro/intro_code.cpp b/Telegram/SourceFiles/intro/intro_code.cpp index c1058a180f..5521275862 100644 --- a/Telegram/SourceFiles/intro/intro_code.cpp +++ b/Telegram/SourceFiles/intro/intro_code.cpp @@ -91,15 +91,15 @@ void CodeWidget::updateDescText() { ? tr::lng_intro_email_confirm_subtitle( lt_email, rpl::single(Ui::Text::WrapEmailPattern(emailPattern)), - Ui::Text::WithEntities) + tr::marked) : isFragment ? tr::lng_intro_fragment_about( lt_phone_number, rpl::single( TextWithEntities::Simple(Ui::FormatPhone(getData()->phone))), - Ui::Text::RichLangValue) + tr::rich) : (byTelegram ? tr::lng_code_from_telegram : tr::lng_code_desc)( - Ui::Text::RichLangValue)); + tr::rich)); if (getData()->codeByTelegram) { _noTelegramCode->show(); _callTimer.cancel(); diff --git a/Telegram/SourceFiles/intro/intro_password_check.cpp b/Telegram/SourceFiles/intro/intro_password_check.cpp index 55caa72c8c..47bc74b5ba 100644 --- a/Telegram/SourceFiles/intro/intro_password_check.cpp +++ b/Telegram/SourceFiles/intro/intro_password_check.cpp @@ -354,8 +354,8 @@ void PasswordCheckWidget::updateDescriptionText() { ? tr::lng_signin_recover_desc( lt_email, rpl::single(Ui::Text::WrapEmailPattern(emailPattern)), - Ui::Text::WithEntities) - : tr::lng_signin_desc(Ui::Text::WithEntities)); + tr::marked) + : tr::lng_signin_desc(tr::marked)); } void PasswordCheckWidget::submit() { diff --git a/Telegram/SourceFiles/intro/intro_qr.cpp b/Telegram/SourceFiles/intro/intro_qr.cpp index 22e64a7981..fa5aacf254 100644 --- a/Telegram/SourceFiles/intro/intro_qr.cpp +++ b/Telegram/SourceFiles/intro/intro_qr.cpp @@ -312,12 +312,12 @@ void QrWidget::setupControls() { const auto label = steps->add( object_ptr( steps, - text(Ui::Text::RichLangValue), + text(tr::rich), st::introQrStep), st::introQrStepMargins); const auto number = Ui::CreateChild( steps, - rpl::single(Ui::Text::Semibold(QString::number(++index) + ".")), + rpl::single(tr::semibold(QString::number(++index) + ".")), st::defaultFlatLabel); rpl::combine( number->widthValue(), diff --git a/Telegram/SourceFiles/intro/intro_widget.cpp b/Telegram/SourceFiles/intro/intro_widget.cpp index 1b5444a608..096d61ce0f 100644 --- a/Telegram/SourceFiles/intro/intro_widget.cpp +++ b/Telegram/SourceFiles/intro/intro_widget.cpp @@ -512,8 +512,8 @@ void Widget::showTerms() { this, tr::lng_terms_signup( lt_link, - tr::lng_terms_signup_link() | Ui::Text::ToLink(), - Ui::Text::WithEntities), + tr::lng_terms_signup_link(tr::link), + tr::marked), st::introTermsLabel); _terms.create(this, std::move(entity)); _terms->entity()->overrideLinkClickHandler([=] { diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index 90bcfac412..39679934c1 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -79,12 +79,12 @@ void ConfirmSwitchBox::prepare() { ? tr::lng_language_switch_about_official : tr::lng_language_switch_about_unofficial)( lt_lang_name, - rpl::single(Ui::Text::Bold(_name)), + rpl::single(tr::bold(_name)), lt_percent, - rpl::single(Ui::Text::Bold(QString::number(_percent))), + rpl::single(tr::bold(QString::number(_percent))), lt_link, - tr::lng_language_switch_link() | Ui::Text::ToLink(_editLink), - Ui::Text::WithEntities); + tr::lng_language_switch_link(tr::url(_editLink)), + tr::marked); const auto content = Ui::CreateChild>( this, object_ptr( @@ -120,10 +120,10 @@ void NotReadyBox::prepare() { auto text = tr::lng_language_not_ready_about( lt_lang_name, - rpl::single(_name) | Ui::Text::ToWithEntities(), + rpl::single(tr::marked(_name)), lt_link, - tr::lng_language_not_ready_link() | Ui::Text::ToLink(_editLink), - Ui::Text::WithEntities); + tr::lng_language_not_ready_link(tr::url(_editLink)), + tr::marked); const auto content = Ui::CreateChild>( this, object_ptr( diff --git a/Telegram/SourceFiles/lang/lang_text_entity.h b/Telegram/SourceFiles/lang/lang_text_entity.h index 8a0a14e462..6c69645f7c 100644 --- a/Telegram/SourceFiles/lang/lang_text_entity.h +++ b/Telegram/SourceFiles/lang/lang_text_entity.h @@ -37,6 +37,25 @@ struct ReplaceTag { namespace tr { namespace details { +struct UpperProjection { + [[nodiscard]] QString operator()(const QString &value) const { + return value.toUpper(); + } + [[nodiscard]] QString operator()(QString &&value) const { + return std::move(value).toUpper(); + } + [[nodiscard]] TextWithEntities operator()( + const TextWithEntities &value) const { + return { value.text.toUpper(), value.entities }; + } + [[nodiscard]] TextWithEntities operator()( + TextWithEntities &&value) const { + return { + std::move(value.text).toUpper(), + std::move(value.entities) }; + } +}; + struct MarkedProjection { [[nodiscard]] TextWithEntities operator()() const { return {}; @@ -177,8 +196,22 @@ struct LinkProjection { } }; +struct UrlProjection { + [[nodiscard]] auto operator()(const QString &url) const { + return [url](auto &&text) { + return Ui::Text::Link(std::forward(text), url); + }; + } + [[nodiscard]] auto operator()(int index) const { + return [index](auto &&text) { + return Ui::Text::Link(std::forward(text), index); + }; + } +}; + } // namespace details +inline constexpr details::UpperProjection upper{}; inline constexpr details::MarkedProjection marked{}; inline constexpr details::RichProjection rich{}; inline constexpr details::BoldProjection bold{}; @@ -187,5 +220,6 @@ inline constexpr details::ItalicProjection italic{}; inline constexpr details::UnderlineProjection underline{}; inline constexpr details::StrikeOutProjection strikeout{}; inline constexpr details::LinkProjection link{}; +inline constexpr details::UrlProjection url{}; } // namespace tr diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 6f12aff903..62de0ebaa4 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1994,23 +1994,23 @@ void MainWidget::showNonPremiumLimitToast(bool download) { tr::now, lt_percent, TextWithEntities{ QString::number(percent - 100) }, - Ui::Text::RichLangValue) + tr::rich) : (download ? tr::lng_limit_download_increase_times : tr::lng_limit_upload_increase_times)( tr::now, lt_count, percent / 100, - Ui::Text::RichLangValue); + tr::rich); auto text = (download ? tr::lng_limit_download_subscribe : tr::lng_limit_upload_subscribe)( tr::now, lt_link, - Ui::Text::Link(Ui::Text::Bold(link)), + tr::link(tr::bold(link)), lt_increase, TextWithEntities{ increase }, - Ui::Text::RichLangValue); + tr::rich); auto filter = [=](ClickHandlerPtr handler, Qt::MouseButton button) { Settings::ShowPremium( controller(), diff --git a/Telegram/SourceFiles/media/stories/media_stories_controller.cpp b/Telegram/SourceFiles/media/stories/media_stories_controller.cpp index 9ca1aa79f7..583b9fc898 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_controller.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_controller.cpp @@ -1986,14 +1986,14 @@ Ui::Toast::Config PrepareToggleInProfileToast( ? tr::lng_stories_channel_save_done : tr::lng_stories_save_done)( tr::now, - Ui::Text::Bold) + tr::bold) : (channel ? tr::lng_stories_channel_save_done_many : tr::lng_stories_save_done_many)( tr::now, lt_count, count, - Ui::Text::Bold)).append( + tr::bold)).append( '\n').append((channel ? tr::lng_stories_channel_save_done_about : tr::lng_stories_save_done_about)(tr::now)) @@ -2002,14 +2002,14 @@ Ui::Toast::Config PrepareToggleInProfileToast( ? tr::lng_stories_channel_archive_done : tr::lng_stories_archive_done)( tr::now, - Ui::Text::WithEntities) + tr::marked) : (channel ? tr::lng_stories_channel_archive_done_many : tr::lng_stories_archive_done_many)( tr::now, lt_count, count, - Ui::Text::WithEntities))), + tr::marked))), .st = &st::storiesActionToast, .duration = (inProfile ? Data::Stories::kInProfileToastDuration diff --git a/Telegram/SourceFiles/media/stories/media_stories_header.cpp b/Telegram/SourceFiles/media/stories/media_stories_header.cpp index 5ee7f49255..c9d2062923 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_header.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_header.cpp @@ -272,7 +272,7 @@ struct MadePrivacyBadge { from, st::storiesRepostUserpicPadding)); result.append(from->name()); - return Ui::Text::Link(result); + return tr::link(result); } [[nodiscard]] TextWithEntities RepostNameValue( @@ -287,7 +287,7 @@ struct MadePrivacyBadge { st::storiesRepostUserpicPadding))); } result.append(name); - return Ui::Text::Link(result); + return tr::link(result); } } // namespace @@ -403,7 +403,7 @@ void Header::show(HeaderData data, rpl::producer videoStreamViewers) { data.repostFrom); const auto prefix = data.fromPeer ? data.fromPeer : data.repostPeer; _repost->setMarkedText( - (prefix ? Ui::Text::Link(prefixName) : prefixName), + (prefix ? tr::link(prefixName) : prefixName), Core::TextContext({ .session = &data.peer->session() })); if (prefix) { _repost->setClickHandlerFilter([=](const auto &...) { @@ -727,7 +727,7 @@ void Header::toggleTooltip(Tooltip type, bool show) { } const auto text = [&]() -> TextWithEntities { using Privacy = Data::StoryPrivacy; - const auto boldName = Ui::Text::Bold(_data->peer->shortName()); + const auto boldName = tr::bold(_data->peer->shortName()); const auto self = _data->peer->isSelf(); switch (type) { case Tooltip::SilentVideo: @@ -737,32 +737,32 @@ void Header::toggleTooltip(Tooltip type, bool show) { return self ? tr::lng_stories_about_close_friends_my( tr::now, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_stories_about_close_friends( tr::now, lt_user, boldName, - Ui::Text::RichLangValue); + tr::rich); case Privacy::Contacts: return self ? tr::lng_stories_about_contacts_my( tr::now, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_stories_about_contacts( tr::now, lt_user, boldName, - Ui::Text::RichLangValue); + tr::rich); case Privacy::SelectedContacts: return self ? tr::lng_stories_about_selected_contacts_my( tr::now, - Ui::Text::RichLangValue) + tr::rich) : tr::lng_stories_about_selected_contacts( tr::now, lt_user, boldName, - Ui::Text::RichLangValue); + tr::rich); } } return {}; diff --git a/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp b/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp index 9d3785ac59..d0ead0ccf7 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp @@ -53,7 +53,7 @@ struct State { tr::now, lt_left, TextWithEntities{ TimeLeftText(left) }, - Ui::Text::RichLangValue), + tr::rich), .st = &st::storiesStealthToast, .adaptive = true, .duration = kAlreadyToastDuration, @@ -65,7 +65,7 @@ struct State { .title = tr::lng_stealth_mode_enabled_tip_title(tr::now), .text = tr::lng_stealth_mode_enabled_tip( tr::now, - Ui::Text::RichLangValue), + tr::rich), .st = &st::storiesStealthToast, .adaptive = true, .duration = kAlreadyToastDuration, @@ -76,7 +76,7 @@ struct State { return { .text = tr::lng_stealth_mode_cooldown_tip( tr::now, - Ui::Text::RichLangValue), + tr::rich), .st = &st::storiesStealthToast, .adaptive = true, .duration = kAlreadyToastDuration, diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 438bff9e5d..7c1f88ebfd 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -809,10 +809,10 @@ void OverlayWidget::showSaveMsgToast(const QString &path, auto phrase) { phrase( tr::now, lt_downloads, - Ui::Text::Link( + tr::link( tr::lng_mediaview_downloads(tr::now), "internal:show_saved_message"), - Ui::Text::WithEntities), + tr::marked), st::mediaviewSaveMsgShown); } @@ -1375,10 +1375,10 @@ void OverlayWidget::showPremiumDownloadPromo() { .text = tr::lng_stories_save_promo( tr::now, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_send_as_premium_required_link(tr::now))), - Ui::Text::WithEntities), + tr::marked), .filter = filter, .adaptive = true, .duration = kStorySavePromoDuration, @@ -3432,7 +3432,7 @@ void OverlayWidget::refreshCaption() { if (media->webpage()) { if (_message->isSponsored()) { return TextWithEntities() - .append(Ui::Text::Bold(media->webpage()->title)) + .append(tr::bold(media->webpage()->title)) .append('\n') .append(media->webpage()->description); } diff --git a/Telegram/SourceFiles/menu/menu_antispam_validator.cpp b/Telegram/SourceFiles/menu/menu_antispam_validator.cpp index ab9e12e7ab..8f6323096b 100644 --- a/Telegram/SourceFiles/menu/menu_antispam_validator.cpp +++ b/Telegram/SourceFiles/menu/menu_antispam_validator.cpp @@ -103,7 +103,7 @@ object_ptr AntiSpamValidator::createButton() const { tr::now, lt_count, EnableAntiSpamMinMembers(channel), - Ui::Text::RichLangValue)); + tr::rich)); } else { channel->session().api().request(MTPchannels_ToggleAntiSpam( channel->inputChannel, @@ -157,11 +157,11 @@ void AntiSpamValidator::addAction( const auto text = tr::lng_admin_log_antispam_menu_report_toast( tr::now, lt_link, - Ui::Text::Link( + tr::link( tr::lng_admin_log_antispam_menu_report_toast_link( tr::now), "internal:show"), - Ui::Text::RichLangValue); + tr::rich); const auto showToast = [=, window = _controller, channel = _channel] { diff --git a/Telegram/SourceFiles/menu/menu_item_download_files.cpp b/Telegram/SourceFiles/menu/menu_item_download_files.cpp index a4f3c21bf4..be5e060d87 100644 --- a/Telegram/SourceFiles/menu/menu_item_download_files.cpp +++ b/Telegram/SourceFiles/menu/menu_item_download_files.cpp @@ -102,10 +102,10 @@ void AddAction( : tr::lng_mediaview_saved_to)( tr::now, lt_downloads, - Ui::Text::Link( + tr::link( tr::lng_mediaview_downloads(tr::now), "internal:show_saved_message"), - Ui::Text::WithEntities), + tr::marked), .filter = filter, .st = &st::defaultToast, }); diff --git a/Telegram/SourceFiles/menu/menu_send.cpp b/Telegram/SourceFiles/menu/menu_send.cpp index 8b40d5ebea..504fdfc4c2 100644 --- a/Telegram/SourceFiles/menu/menu_send.cpp +++ b/Telegram/SourceFiles/menu/menu_send.cpp @@ -278,8 +278,8 @@ EffectPreview::EffectPreview( this, tr::lng_effect_premium( lt_link, - tr::lng_effect_premium_link() | Ui::Text::ToLink(), - Ui::Text::WithEntities), + tr::lng_effect_premium_link(tr::link), + tr::marked), st::effectPreviewPromoLabel), st::effectPreviewPromoPadding)) , _bottom(_send ? ((Ui::RpWidget*)_send.get()) : _premiumPromoLabel.get()) diff --git a/Telegram/SourceFiles/menu/menu_sponsored.cpp b/Telegram/SourceFiles/menu/menu_sponsored.cpp index d747ecdbf1..aa6994d590 100644 --- a/Telegram/SourceFiles/menu/menu_sponsored.cpp +++ b/Telegram/SourceFiles/menu/menu_sponsored.cpp @@ -149,7 +149,7 @@ void AboutBox( : isSearch ? tr::lng_sponsored_revenued_info1_search_description : tr::lng_sponsored_revenued_info1_bot_description)( - Ui::Text::RichLangValue), + tr::rich), st::sponsoredAboutPrivacyIcon); if (!isSearch) { Ui::AddSkip(content); @@ -161,14 +161,14 @@ void AboutBox( (isChannel ? tr::lng_sponsored_revenued_info2_description : tr::lng_sponsored_revenued_info2_bot_description)( - Ui::Text::RichLangValue), + tr::rich), st::sponsoredAboutSplitIcon); } Ui::AddSkip(content); Ui::AddSkip(content); auto link = tr::lng_settings_privacy_premium_link( ) | rpl::map([](QString t) { - return Ui::Text::Link(std::move(t), u"internal:"_q); + return tr::link(std::move(t), u"internal:"_q); }); addEntry( tr::lng_sponsored_revenued_info3_title(), @@ -178,7 +178,7 @@ void AboutBox( rpl::single(float64(levels)), lt_link, std::move(link), - Ui::Text::RichLangValue) + tr::rich) : isSearch ? tr::lng_sponsored_revenued_info3_search_description( lt_link, @@ -186,18 +186,18 @@ void AboutBox( lt_arrow, rpl::single( Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::WithEntities + tr::marked ) | rpl::map([](TextWithEntities &&link) { return Ui::Text::Wrapped( std::move(link), EntityType::CustomUrl, u"internal:"_q); }), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_sponsored_revenued_info3_bot_description( lt_link, std::move(link), - Ui::Text::RichLangValue)), + tr::rich)), st::sponsoredAboutRemoveIcon)->setClickHandlerFilter([=]( const auto &...) { ShowPremiumPreviewBox(show, PremiumFeature::NoAds); @@ -233,11 +233,11 @@ void AboutBox( tr::lng_channel_earn_about_link( lt_emoji, rpl::single(arrow), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([=](TextWithEntities t) { - return Ui::Text::Link(std::move(t), kUrl.utf16()); + return tr::link(std::move(t), kUrl.utf16()); }), - Ui::Text::RichLangValue), + tr::rich), st::channelEarnLearnDescription))->resizeToWidth(available); } Ui::AddSkip(content); @@ -305,7 +305,7 @@ void AboutBox( void ShowReportSponsoredBox( std::shared_ptr show, Data::SponsoredReportAction report) { - const auto guideLink = Ui::Text::Link( + const auto guideLink = tr::link( tr::lng_report_sponsored_reported_link(tr::now), u"https://promote.telegram.org/guidelines"_q); @@ -343,7 +343,7 @@ void ShowReportSponsoredBox( tr::lng_report_sponsored_reported_learn( lt_link, rpl::single(guideLink), - Ui::Text::WithEntities), + tr::marked), st::boxDividerLabel), st::defaultBoxDividerLabelPadding)); } @@ -364,7 +364,7 @@ void ShowReportSponsoredBox( tr::now, lt_link, guideLink, - Ui::Text::WithEntities); + tr::marked); show->showToast({ .text = std::move(text), .duration = kToastDuration, diff --git a/Telegram/SourceFiles/menu/menu_ttl_validator.cpp b/Telegram/SourceFiles/menu/menu_ttl_validator.cpp index ba5ad14ee9..efc8bc9267 100644 --- a/Telegram/SourceFiles/menu/menu_ttl_validator.cpp +++ b/Telegram/SourceFiles/menu/menu_ttl_validator.cpp @@ -96,9 +96,9 @@ Args TTLValidator::createArgs() const { lt_link, tr::lng_ttl_edit_about2_link( ) | rpl::map([=](const QString &s) { - return Ui::Text::Link(s, "tg://settings/auto_delete"); + return tr::link(s, "tg://settings/auto_delete"); }), - Ui::Text::WithEntities); + tr::marked); auto about = rpl::combine( std::move(about1), std::move(about2) diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp index 7f73fddbc9..2a83822262 100644 --- a/Telegram/SourceFiles/overview/overview_layout.cpp +++ b/Telegram/SourceFiles/overview/overview_layout.cpp @@ -802,7 +802,7 @@ Voice::Voice( _data->loadThumbnail(parent->fullId()); updateName(); - const auto dateText = Ui::Text::Link( + const auto dateText = tr::link( langDateTime(base::unixtime::parse(parent->date()))); // Link 1. _details.setMarkedText( st::defaultTextStyle, @@ -812,7 +812,7 @@ Voice::Voice( dateText, lt_duration, { .text = Ui::FormatDurationText(_data->duration() / 1000) }, - Ui::Text::WithEntities)); + tr::marked)); _details.setLink(1, JumpToMessageClickHandler(parent)); } diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp index f79b4d8379..4f1251c9b3 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp @@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/slide_wrap.h" #include "ui/wrap/fade_wrap.h" #include "ui/text/format_values.h" // Ui::FormatPhone -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "ui/widgets/fields/special_fields.h" #include "boxes/abstract_box.h" #include "data/data_user.h" @@ -344,7 +343,7 @@ void PanelEditContact::setupControls( _content->add( object_ptr( _content, - std::move(*text) | Ui::Text::ToUpper(), + std::move(*text) | rpl::map(tr::upper), st::passportDeleteButton), st::passportUploadButtonPadding )->addClickHandler([=] { diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp index 8f1fb3567d..e8da525cb8 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp @@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "countries/countries_instance.h" #include "data/data_user.h" // ->bot()->session() #include "main/main_session.h" // ->session().user() -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "boxes/abstract_box.h" #include "ui/boxes/confirm_box.h" #include "lang/lang_keys.h" @@ -496,7 +495,7 @@ not_null PanelEditDocument::setupContent( inner->add( object_ptr( inner, - std::move(*text) | Ui::Text::ToUpper(), + std::move(*text) | rpl::map(tr::upper), st::passportDeleteButton), st::passportUploadButtonPadding )->addClickHandler([=] { diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp index 1cf274d437..fcc631ce66 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp @@ -16,7 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" #include "ui/chat/attach/attach_prepare.h" -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "ui/text/text_options.h" #include "ui/image/image_prepare.h" #include "ui/painter.h" @@ -225,7 +224,7 @@ Ui::SlideWrap *EditScans::List::nonDeletedErrorRow() const { rpl::producer EditScans::List::uploadButtonText() const { return (files.empty() ? tr::lng_passport_upload_scans - : tr::lng_passport_upload_more)() | Ui::Text::ToUpper(); + : tr::lng_passport_upload_more)(tr::upper); } void EditScans::List::hideError() { @@ -684,9 +683,8 @@ void EditScans::setupSpecialScans( } auto label = scan.rowCreated.value( ) | rpl::map([=, type = type](bool created) { - return uploadText(type, created)(); - }) | rpl::flatten_latest( - ) | Ui::Text::ToUpper(); + return uploadText(type, created)(tr::upper); + }) | rpl::flatten_latest(); scan.upload = inner->add( object_ptr( inner, diff --git a/Telegram/SourceFiles/passport/passport_panel_form.cpp b/Telegram/SourceFiles/passport/passport_panel_form.cpp index bd5735e036..4710c4a1ba 100644 --- a/Telegram/SourceFiles/passport/passport_panel_form.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_form.cpp @@ -138,22 +138,22 @@ not_null PanelForm::setupContent() { auto policyLink = tr::lng_passport_policy( lt_bot, rpl::single(bot->name()) - ) | Ui::Text::ToLink( - policyUrl + ) | rpl::map( + tr::url(policyUrl) ) | rpl::map([=](TextWithEntities &&text) { return Ui::Text::Wrapped(std::move(text), EntityType::Bold); }); auto text = policyUrl.isEmpty() ? tr::lng_passport_allow( lt_bot, - rpl::single('@' + bot->username()) - ) | Ui::Text::ToWithEntities() + rpl::single(tr::marked('@' + bot->username())), + tr::marked) : tr::lng_passport_accept_allow( lt_policy, std::move(policyLink), lt_bot, - rpl::single('@' + bot->username()) | Ui::Text::ToWithEntities(), - Ui::Text::WithEntities); + rpl::single(tr::marked('@' + bot->username())), + tr::marked); const auto policy = inner->add( object_ptr( inner, diff --git a/Telegram/SourceFiles/payments/payments_non_panel_process.cpp b/Telegram/SourceFiles/payments/payments_non_panel_process.cpp index c6a4523525..e704bd3389 100644 --- a/Telegram/SourceFiles/payments/payments_non_panel_process.cpp +++ b/Telegram/SourceFiles/payments/payments_non_panel_process.cpp @@ -71,7 +71,7 @@ void ProcessCreditsPayment( tr::now, lt_count_decimal, form->starGiftLimitedCount, - Ui::Text::RichLangValue), + tr::rich), }); } else { show->showToast( @@ -83,7 +83,7 @@ void ProcessCreditsPayment( tr::now, lt_count, std::max(form->starGiftPerUserLimit, 1), - Ui::Text::RichLangValue), + tr::rich), }); } else { show->showToast(*error); diff --git a/Telegram/SourceFiles/payments/payments_reaction_process.cpp b/Telegram/SourceFiles/payments/payments_reaction_process.cpp index c16dd290e8..d9a2cd5408 100644 --- a/Telegram/SourceFiles/payments/payments_reaction_process.cpp +++ b/Telegram/SourceFiles/payments/payments_reaction_process.cpp @@ -220,7 +220,7 @@ void ShowPaidReactionDetails( return tr::lng_paid_react_send( lt_price, std::move(nice), - Ui::Text::RichLangValue); + tr::rich); }; auto top = std::vector(); const auto add = [&](const Data::MessageReactionsTopPaid &entry) { diff --git a/Telegram/SourceFiles/payments/ui/payments_form_summary.cpp b/Telegram/SourceFiles/payments/ui/payments_form_summary.cpp index 10dfbebad1..00e5ec49eb 100644 --- a/Telegram/SourceFiles/payments/ui/payments_form_summary.cpp +++ b/Telegram/SourceFiles/payments/ui/payments_form_summary.cpp @@ -362,7 +362,7 @@ void FormSummary::setupPrices(not_null layout) { const auto text = formatAmount(_invoice.tipsSelected); const auto label = addRow( tr::lng_payments_tips_label(tr::now), - Ui::Text::Link(text)); + tr::link(text)); label->overrideLinkClickHandler([=] { _delegate->panelChooseTips(); }); diff --git a/Telegram/SourceFiles/payments/ui/payments_panel.cpp b/Telegram/SourceFiles/payments/ui/payments_panel.cpp index 6ca93cb3db..eac1cf9b58 100644 --- a/Telegram/SourceFiles/payments/ui/payments_panel.cpp +++ b/Telegram/SourceFiles/payments/ui/payments_panel.cpp @@ -742,8 +742,8 @@ void Panel::requestTermsAcceptance( ? tr::lng_payments_terms_text : tr::lng_payments_terms_text_once)( lt_bot, - rpl::single(Ui::Text::Bold('@' + username)), - Ui::Text::WithEntities), + rpl::single(tr::bold('@' + username)), + tr::marked), st::boxLabel)); const auto update = std::make_shared>(); auto checkView = std::make_unique( @@ -756,10 +756,10 @@ void Panel::requestTermsAcceptance( box.get(), tr::lng_payments_terms_agree( lt_link, - rpl::single(Ui::Text::Link( + rpl::single(tr::link( tr::lng_payments_terms_link(tr::now), url)), - Ui::Text::WithEntities), + tr::marked), st::defaultBoxCheckbox, std::move(checkView)), { diff --git a/Telegram/SourceFiles/settings/business/settings_away_message.cpp b/Telegram/SourceFiles/settings/business/settings_away_message.cpp index 27c89ac41c..60ffa0bb19 100644 --- a/Telegram/SourceFiles/settings/business/settings_away_message.cpp +++ b/Telegram/SourceFiles/settings/business/settings_away_message.cpp @@ -238,7 +238,7 @@ void AwayMessage::setupContent( .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes(), - .about = tr::lng_away_about(Ui::Text::WithEntities), + .about = tr::lng_away_about(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); diff --git a/Telegram/SourceFiles/settings/business/settings_chat_links.cpp b/Telegram/SourceFiles/settings/business/settings_chat_links.cpp index 444059ecd0..8df87f2dec 100644 --- a/Telegram/SourceFiles/settings/business/settings_chat_links.cpp +++ b/Telegram/SourceFiles/settings/business/settings_chat_links.cpp @@ -720,7 +720,7 @@ void ChatLinks::setupContent( .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes() | rpl::take(1), - .about = tr::lng_chat_links_about(Ui::Text::WithEntities), + .about = tr::lng_chat_links_about(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); @@ -783,11 +783,11 @@ void ChatLinks::setupContent( ? tr::lng_chat_links_footer_both( tr::now, lt_username, - Ui::Text::Link(links[0], "https://" + links[0]), + tr::link(links[0], "https://" + links[0]), lt_link, - Ui::Text::Link(links[1], "https://" + links[1]), - Ui::Text::WithEntities) - : Ui::Text::Link(links[0], "https://" + links[0]); + tr::link(links[1], "https://" + links[1]), + tr::marked) + : tr::link(links[0], "https://" + links[0]); }; auto links = !username.isEmpty() ? make({ username, '+' + self->phone() }) @@ -797,7 +797,7 @@ void ChatLinks::setupContent( tr::lng_chat_links_footer( lt_links, rpl::single(std::move(links)), - Ui::Text::WithEntities), + tr::marked), st::boxDividerLabel); label->setClickHandlerFilter([=](ClickHandlerPtr handler, auto) { QGuiApplication::clipboard()->setText(handler->url()); diff --git a/Telegram/SourceFiles/settings/business/settings_chatbots.cpp b/Telegram/SourceFiles/settings/business/settings_chatbots.cpp index 76df1953bd..c5c93f670b 100644 --- a/Telegram/SourceFiles/settings/business/settings_chatbots.cpp +++ b/Telegram/SourceFiles/settings/business/settings_chatbots.cpp @@ -429,8 +429,8 @@ void Chatbots::setupContent() { .about = tr::lng_chatbots_about( lt_link, tr::lng_chatbots_about_link( - ) | Ui::Text::ToLink(tr::lng_chatbots_info_url(tr::now)), - Ui::Text::WithEntities), + tr::url(tr::lng_chatbots_info_url(tr::now))), + tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); @@ -524,7 +524,7 @@ void Chatbots::refreshDetails() { ) | rpl::on_next([=](Data::ChatbotsPermissions now) { const auto warn = [&](tr::phrase text) { controller()->show(Ui::MakeInformBox({ - .text = text(tr::now, lt_bot, Ui::Text::Bold(bot->name()), Ui::Text::RichLangValue), + .text = text(tr::now, lt_bot, tr::bold(bot->name()), tr::rich), .title = tr::lng_chatbots_warning_title(), })); }; diff --git a/Telegram/SourceFiles/settings/business/settings_greeting.cpp b/Telegram/SourceFiles/settings/business/settings_greeting.cpp index 3879126534..7f6f575172 100644 --- a/Telegram/SourceFiles/settings/business/settings_greeting.cpp +++ b/Telegram/SourceFiles/settings/business/settings_greeting.cpp @@ -135,7 +135,7 @@ void Greeting::setupContent( .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes(), - .about = tr::lng_greeting_about(Ui::Text::WithEntities), + .about = tr::lng_greeting_about(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); diff --git a/Telegram/SourceFiles/settings/business/settings_location.cpp b/Telegram/SourceFiles/settings/business/settings_location.cpp index da6b668835..e3b332163d 100644 --- a/Telegram/SourceFiles/settings/business/settings_location.cpp +++ b/Telegram/SourceFiles/settings/business/settings_location.cpp @@ -123,7 +123,7 @@ void Location::setupPicker(not_null content) { .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes(), - .about = tr::lng_location_about(Ui::Text::WithEntities), + .about = tr::lng_location_about(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); @@ -273,7 +273,7 @@ void Location::setupUnsupported(not_null content) { .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes(), - .about = tr::lng_location_fallback(Ui::Text::WithEntities), + .about = tr::lng_location_fallback(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, .parts = RectPart::Top, }); diff --git a/Telegram/SourceFiles/settings/business/settings_quick_replies.cpp b/Telegram/SourceFiles/settings/business/settings_quick_replies.cpp index 7850f71998..562b8f6700 100644 --- a/Telegram/SourceFiles/settings/business/settings_quick_replies.cpp +++ b/Telegram/SourceFiles/settings/business/settings_quick_replies.cpp @@ -73,7 +73,7 @@ void QuickReplies::setupContent( .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes(), - .about = tr::lng_replies_about(Ui::Text::WithEntities), + .about = tr::lng_replies_about(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); Ui::AddSkip(content); diff --git a/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp b/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp index bf8f4bf51c..412d025cc6 100644 --- a/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp +++ b/Telegram/SourceFiles/settings/business/settings_shortcut_messages.cpp @@ -420,21 +420,21 @@ void ShortcutMessages::refreshEmptyText() { auto text = away ? tr::lng_away_empty_title( tr::now, - Ui::Text::Bold + tr::bold ).append("\n\n").append(tr::lng_away_empty_about(tr::now)) : greeting ? tr::lng_greeting_empty_title( tr::now, - Ui::Text::Bold + tr::bold ).append("\n\n").append(tr::lng_greeting_empty_about(tr::now)) : tr::lng_replies_empty_title( tr::now, - Ui::Text::Bold + tr::bold ).append("\n\n").append(tr::lng_replies_empty_about( tr::now, lt_shortcut, - Ui::Text::Bold('/' + shortcut), - Ui::Text::WithEntities)); + tr::bold('/' + shortcut), + tr::marked)); _emptyIcon = away ? &st::awayEmptyIcon : greeting diff --git a/Telegram/SourceFiles/settings/business/settings_working_hours.cpp b/Telegram/SourceFiles/settings/business/settings_working_hours.cpp index 03812b6fc1..58c9d47864 100644 --- a/Telegram/SourceFiles/settings/business/settings_working_hours.cpp +++ b/Telegram/SourceFiles/settings/business/settings_working_hours.cpp @@ -614,7 +614,7 @@ void WorkingHours::setupContent( .lottieSize = st::settingsCloudPasswordIconSize, .lottieMargins = st::peerAppearanceIconPadding, .showFinished = showFinishes(), - .about = tr::lng_hours_about(Ui::Text::WithEntities), + .about = tr::lng_hours_about(tr::marked), .aboutMargins = st::peerAppearanceCoverLabelMargin, }); diff --git a/Telegram/SourceFiles/settings/settings_business.cpp b/Telegram/SourceFiles/settings/settings_business.cpp index 0abc66a754..9311914048 100644 --- a/Telegram/SourceFiles/settings/settings_business.cpp +++ b/Telegram/SourceFiles/settings/settings_business.cpp @@ -195,7 +195,7 @@ void AddBusinessSummary( const auto label = content->add( object_ptr( content, - std::move(entry.title) | Ui::Text::ToBold(), + std::move(entry.title) | rpl::map(tr::bold), stLabel), titlePadding); label->setAttribute(Qt::WA_TransparentForMouseEvents); @@ -578,12 +578,12 @@ void Business::setupContent() { lt_emoji, rpl::single(Ui::Text::IconEmoji( &st::textMoreIconEmoji)), - Ui::Text::RichLangValue), + tr::rich), tr::lng_business_about_sponsored_url() ) | rpl::map([](TextWithEntities text, QString url) { - return Ui::Text::Link(text, url); + return tr::link(text, url); }), - Ui::Text::RichLangValue), + tr::rich), st::boxDividerLabel), st::defaultBoxDividerLabelPadding)); } @@ -629,9 +629,8 @@ base::weak_qptr Business::createPinnedToTop( auto about = [&]() -> rpl::producer { return rpl::conditional( Data::AmPremiumValue(&_controller->session()), - tr::lng_business_unlocked(), - tr::lng_business_about() - ) | Ui::Text::ToWithEntities(); + tr::lng_business_unlocked(tr::marked), + tr::lng_business_about(tr::marked)); }(); const auto content = [&]() -> Ui::Premium::TopBarAbstract* { diff --git a/Telegram/SourceFiles/settings/settings_credits.cpp b/Telegram/SourceFiles/settings/settings_credits.cpp index 7f7ed33af6..a7c49c2cd4 100644 --- a/Telegram/SourceFiles/settings/settings_credits.cpp +++ b/Telegram/SourceFiles/settings/settings_credits.cpp @@ -505,11 +505,11 @@ void Credits::setupContent() { rpl::single(TextWithEntities()), isCurrency ? tr::lng_credits_currency_summary_in_button( - Ui::Text::WithEntities) + tr::marked) : tr::lng_credits_topup_button( lt_emoji, rpl::single(Ui::Text::SingleCustomEmoji(u"+"_q)), - Ui::Text::WithEntities))); + tr::marked))); button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); const auto show = _controller->uiShow(); if (isCurrency) { @@ -562,8 +562,8 @@ void Credits::setupContent() { : _controller->session().credits().balanceValue() ) | rpl::map( Lang::FormatCreditsAmountDecimal - ) | rpl::map(Ui::Text::Bold), - Ui::Text::WithEntities), + ) | rpl::map(tr::bold), + tr::marked), textSt, st::defaultPopupMenu, std::move(context)), diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index b21d8cdb8d..c97b6cb065 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -139,8 +139,8 @@ const auto kTopUpPrefix = "cloud_lng_topup_purpose_"; const auto phrase = Lang::GetNonDefaultValue( kTopUpPrefix + purpose.toUtf8()); return phrase.isEmpty() - ? tr::lng_credits_small_balance_fallback(Ui::Text::RichLangValue) - : rpl::single(Ui::Text::RichLangValue(phrase)); + ? tr::lng_credits_small_balance_fallback(tr::rich) + : rpl::single(tr::rich(phrase)); } class Balance final @@ -229,8 +229,8 @@ void ConfirmConvertStarGift( tr::lng_gift_convert_sure_limit( lt_count, rpl::single(daysLeft * 1.), - Ui::Text::RichLangValue), - tr::lng_gift_convert_sure_caution(Ui::Text::RichLangValue) + tr::rich), + tr::lng_gift_convert_sure_caution(tr::rich) ) | rpl::map([]( TextWithEntities &&a, TextWithEntities &&b, @@ -267,7 +267,7 @@ void ConvertStarGift( tr::now, lt_count, stars, - Ui::Text::RichLangValue)); + tr::rich)); done(true); }).fail([=](const MTP::Error &error) { show->showToast(error.type()); @@ -677,9 +677,9 @@ void FillCreditOptions( tr::lng_credits_summary_options_about_link(), tr::lng_credits_summary_options_about_url() ) | rpl::map([](const QString &text, const QString &url) { - return Ui::Text::Link(text, url); + return tr::link(text, url); }), - Ui::Text::RichLangValue); + tr::rich); Ui::AddSkip(content); Ui::AddDividerText( content, @@ -729,9 +729,8 @@ void FillCreditOptions( tr::lng_credits_box_out_about( lt_link, tr::lng_payments_terms_link( - ) | Ui::Text::ToLink( - tr::lng_credits_box_out_about_link(tr::now)), - Ui::Text::WithEntities), + tr::url(tr::lng_credits_box_out_about_link(tr::now))), + tr::marked), st::creditsBoxAboutDivider); } @@ -1260,8 +1259,8 @@ Fn removed)> UniqueGiftRemoveDetailsHandler( show->showToast(tr::lng_gift_unique_info_removed( tr::now, lt_name, - Ui::Text::Bold(name), - Ui::Text::WithEntities)); + tr::bold(name), + tr::marked)); unique->originalDetails = Data::UniqueGiftOriginalDetails(); } }; @@ -1619,8 +1618,8 @@ void GenericCreditsEntryBody( content, tr::lng_credits_box_history_entry_gift_released( lt_name, - rpl::single(Ui::Text::Link('@' + peer->username())), - Ui::Text::WithEntities), + rpl::single(tr::link('@' + peer->username())), + tr::marked), st::creditsReleasedByLabel), style::al_top); released->setClickHandlerFilter([=](const auto &...) { @@ -1665,7 +1664,7 @@ void GenericCreditsEntryBody( starEmoji, lt_cost, { QString::number(s.subscription.credits) }, - Ui::Text::WithEntities), + tr::marked), kMarkupTextOptions, helper.context([=] { amount->update(); })); } else if (e.credits.stars()) { @@ -1796,20 +1795,20 @@ void GenericCreditsEntryBody( box, (e.giftRefunded ? tr::lng_action_gift_refunded( - Ui::Text::RichLangValue) + tr::rich) : e.starsUpgradedBySender ? tr::lng_action_gift_got_upgradable_text( - Ui::Text::RichLangValue) + tr::rich) : (e.starsToUpgrade && giftToSelf && !e.giftTransferred) ? tr::lng_action_gift_self_about_unique( - Ui::Text::WithEntities) + tr::marked) : (e.starsToUpgrade && giftToChannelCanManage && !e.giftTransferred) ? tr::lng_action_gift_channel_about_unique( - Ui::Text::WithEntities) + tr::marked) : ((canConvert || e.converted) ? rpl::combine( (canConvert @@ -1823,13 +1822,13 @@ void GenericCreditsEntryBody( : tr::lng_gift_got_stars))( lt_count, rpl::single(e.starsConverted * 1.), - Ui::Text::RichLangValue), + tr::rich), tr::lng_paid_about_link() ) | rpl::map([]( TextWithEntities text, QString link) { return text.append(' ').append( - Ui::Text::Link(link)); + tr::link(link)); }) : (e.savedToProfile ? (giftToChannel @@ -1838,7 +1837,7 @@ void GenericCreditsEntryBody( : (giftToChannel ? tr::lng_action_gift_got_gift_channel : tr::lng_action_gift_got_gift_text))( - Ui::Text::WithEntities))), + tr::marked))), st::creditsBoxAbout), style::al_top); about->setClickHandlerFilter([=](const auto &...) { @@ -1856,9 +1855,9 @@ void GenericCreditsEntryBody( auto link = tr::lng_credits_box_history_entry_gift_about_link( lt_emoji, rpl::single(arrow), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link( + return tr::link( std::move(text), u"internal:stars_examples"_q); }); @@ -1871,11 +1870,11 @@ void GenericCreditsEntryBody( rpl::single(TextWithEntities{ peer->shortName() }), lt_link, std::move(link), - Ui::Text::RichLangValue) + tr::rich) : tr::lng_credits_box_history_entry_gift_in_about( lt_link, std::move(link), - Ui::Text::RichLangValue), + tr::rich), st::creditsBoxAbout), style::al_top); } else if (e.paidMessagesCommission && e.barePeerId) { @@ -1883,9 +1882,9 @@ void GenericCreditsEntryBody( auto link = tr::lng_credits_paid_messages_fee_about_link( lt_emoji, rpl::single(arrow), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([id = e.barePeerId](TextWithEntities text) { - return Ui::Text::Link( + return tr::link( std::move(text), u"internal:edit_paid_messages_fee/"_q + QString::number(id)); }); @@ -1896,10 +1895,10 @@ void GenericCreditsEntryBody( tr::lng_credits_paid_messages_fee_about( lt_percent, rpl::single( - Ui::Text::Bold(QString::number(percent) + '%')), + tr::bold(QString::number(percent) + '%')), lt_link, std::move(link), - Ui::Text::RichLangValue), + tr::rich), st::creditsBoxAbout), style::al_top); } @@ -1924,9 +1923,8 @@ void GenericCreditsEntryBody( tr::lng_gift_in_blockchain_link_arrow( lt_arrow, rpl::single(arrow), - Ui::Text::WithEntities - ) | Ui::Text::ToLink(), - Ui::Text::WithEntities), + tr::link), + tr::marked), st::creditsBoxAboutDivider), style::al_top); label->setClickHandlerFilter([=](const auto &...) { @@ -2031,14 +2029,14 @@ void GenericCreditsEntryBody( lt_count, rpl::single(stars * 1.), lt_channel, - rpl::single(Ui::Text::Bold(giftChannel->name())), - Ui::Text::RichLangValue) + rpl::single(tr::bold(giftChannel->name())), + tr::rich) : tr::lng_gift_convert_sure_confirm( lt_count, rpl::single(stars * 1.), lt_user, - rpl::single(Ui::Text::Bold(starGiftSender->shortName())), - Ui::Text::RichLangValue); + rpl::single(tr::bold(starGiftSender->shortName())), + tr::rich); ConfirmConvertStarGift(show, std::move(text), stars, days, [=] { if (state->convertButtonBusy.current() || state->confirmButtonBusy.current()) { @@ -2102,30 +2100,30 @@ void GenericCreditsEntryBody( tr::lng_gift_visible_show_arrow( lt_arrow, rpl::single(arrow), - Ui::Text::WithEntities) + tr::marked) ) | rpl::map([=](QString &&hint, const TextWithEntities &hide) { return TextWithEntities{ std::move(hint) }.append(' ').append( - Ui::Text::Link(hide)); + tr::link(hide)); }); auto withHide = rpl::combine( visiblePhrase(), tr::lng_gift_visible_hide_arrow( lt_arrow, rpl::single(arrow), - Ui::Text::WithEntities) + tr::marked) ) | rpl::map([](QString &&hint, const TextWithEntities &hide) { return TextWithEntities{ std::move(hint) }.append(' ').append( - Ui::Text::Link(hide)); + tr::link(hide)); }); auto text = (!e.savedToProfile && canToggle && (canUpgrade || showNextToUpgrade)) ? std::move(withShow) : !e.savedToProfile - ? hiddenPhrase(Ui::Text::WithEntities) + ? hiddenPhrase(tr::marked) : canToggle ? std::move(withHide) - : visiblePhrase(Ui::Text::WithEntities); + : visiblePhrase(tr::marked); if (e.anonymous && e.barePeerId && !uniqueGift) { text = rpl::combine( std::move(text), @@ -2190,7 +2188,7 @@ void GenericCreditsEntryBody( return true; }); label->setMarkedText( - Ui::Text::Link( + tr::link( tr::lng_credits_subscription_on_button(tr::now), u"internal:"_q)); } else if (s.cancelled || s.cancelledByBot) { @@ -2326,14 +2324,14 @@ void GenericCreditsEntryBody( tr::lng_gift_buy_resale_button( lt_cost, rpl::single(Data::FormatGiftResaleTon(*uniqueGift)), - Ui::Text::WithEntities), + tr::marked), tr::lng_gift_buy_resale_equals( lt_cost, rpl::single(Ui::Text::IconEmoji( &st::starIconEmojiSmall ).append(Lang::FormatCountDecimal( uniqueGift->starsForResale))), - Ui::Text::WithEntities), + tr::marked), st::resaleButtonTitle, st::resaleButtonSubtitle); } else { @@ -2341,7 +2339,7 @@ void GenericCreditsEntryBody( lt_cost, rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append( Lang::FormatCountDecimal(uniqueGift->starsForResale))), - Ui::Text::WithEntities)); + tr::marked)); } } else if (showNextToUpgrade) { const auto session = &show->session(); @@ -2502,18 +2500,18 @@ void UniqueGiftValueBox( (showLastPrice ? tr::lng_gift_value_about_last( lt_gift, - rpl::single(Ui::Text::Bold( + rpl::single(tr::bold( Data::UniqueGiftName(*unique))), lt_platform, (value->lastSaleFragment ? tr::lng_gift_value_fragment : tr::lng_gift_value_telegram)( - Ui::Text::WithEntities), - Ui::Text::RichLangValue) + tr::marked), + tr::rich) : tr::lng_gift_value_about_average( lt_gift, - rpl::single(Ui::Text::Bold(unique->title)), - Ui::Text::RichLangValue)), + rpl::single(tr::bold(unique->title)), + tr::rich)), st::uniqueGiftValueAbout) )->setTryMakeSimilarLines(true); @@ -2534,7 +2532,7 @@ void UniqueGiftValueBox( lt_emoji, rpl::single(Data::SingleCustomEmoji(document)), lt_platform, - platform(Ui::Text::WithEntities), + platform(tr::marked), lt_arrow, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), tr::link), @@ -3051,51 +3049,51 @@ void SmallBalanceBox( .about = (v::is(source) ? tr::lng_credits_small_balance_subscribe( lt_channel, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::RichLangValue) + rpl::single(tr::bold(name)), + tr::rich) : v::is(source) ? tr::lng_credits_small_balance_reaction( lt_channel, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::RichLangValue) + rpl::single(tr::bold(name)), + tr::rich) : v::is(source) ? tr::lng_credits_small_balance_video_stream( lt_name, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::RichLangValue) + rpl::single(tr::bold(name)), + tr::rich) : v::is(source) ? DeepLinkBalanceAbout( v::get(source).purpose) : v::is(source) ? tr::lng_credits_small_balance_star_gift( lt_user, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::RichLangValue) + rpl::single(tr::bold(name)), + tr::rich) : v::is(source) ? (name.isEmpty() ? tr::lng_credits_small_balance_for_messages( - Ui::Text::RichLangValue) + tr::rich) : tr::lng_credits_small_balance_for_message( lt_user, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::RichLangValue)) + rpl::single(tr::bold(name)), + tr::rich)) : v::is(source) ? tr::lng_credits_small_balance_for_suggest( lt_channel, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::RichLangValue) + rpl::single(tr::bold(name)), + tr::rich) : v::is(source) ? tr::lng_credits_small_balance_for_offer(tr::rich) : v::is(source) ? tr::lng_credits_small_balance_for_search( - Ui::Text::RichLangValue) + tr::rich) : name.isEmpty() ? tr::lng_credits_small_balance_fallback( - Ui::Text::RichLangValue) + tr::rich) : tr::lng_credits_small_balance_about( lt_bot, rpl::single(TextWithEntities{ name }), - Ui::Text::RichLangValue)), + tr::rich)), .light = true, .gradientStops = Ui::Premium::CreditsIconGradientStops(), })); @@ -3345,7 +3343,7 @@ void AddWithdrawalWidget( amount, lt_emoji, Ui::Text::IconEmoji(&st::starIconEmojiLarge), - Ui::Text::RichLangValue)); + tr::rich)); } }; QObject::connect(input, &Ui::MaskedInputField::changed, process); @@ -3461,13 +3459,13 @@ void AddWithdrawalWidget( auto text = tr::lng_bot_earn_credits_out_minimal( tr::now, lt_link, - Ui::Text::Link( + tr::link( tr::lng_bot_earn_credits_out_minimal_link( tr::now, lt_count, min), u"internal:"_q), - Ui::Text::RichLangValue); + tr::rich); show->showToast(Ui::Toast::Config{ .text = std::move(text), .filter = [=](const auto ...) { @@ -3497,13 +3495,13 @@ void AddWithdrawalWidget( tr::lng_channel_earn_about_link( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link( + return tr::link( std::move(text), tr::lng_bot_earn_balance_about_url(tr::now)); }), - Ui::Text::RichLangValue), + tr::rich), st::boxDividerLabel); Ui::AddSkip(container); container->add(object_ptr( diff --git a/Telegram/SourceFiles/settings/settings_folders.cpp b/Telegram/SourceFiles/settings/settings_folders.cpp index dd3e63611f..42dab086fe 100644 --- a/Telegram/SourceFiles/settings/settings_folders.cpp +++ b/Telegram/SourceFiles/settings/settings_folders.cpp @@ -954,13 +954,13 @@ void SetupTagContent( content, rpl::conditional( rpl::duplicate(premium), - tr::lng_filters_enable_tags_about(Ui::Text::RichLangValue), + tr::lng_filters_enable_tags_about(tr::rich), tr::lng_filters_enable_tags_about_premium( lt_link, tr::lng_effect_premium_link() | rpl::map([](QString t) { - return Ui::Text::Link(std::move(t), u"internal:"_q); + return tr::link(std::move(t), u"internal:"_q); }), - Ui::Text::RichLangValue))); + tr::rich))); about->setClickHandlerFilter([=](const auto &...) { Settings::ShowPremium(controller, u"folder_tags"_q); return true; diff --git a/Telegram/SourceFiles/settings/settings_global_ttl.cpp b/Telegram/SourceFiles/settings/settings_global_ttl.cpp index f51662c9cc..4c3686b001 100644 --- a/Telegram/SourceFiles/settings/settings_global_ttl.cpp +++ b/Telegram/SourceFiles/settings/settings_global_ttl.cpp @@ -247,7 +247,7 @@ void GlobalTTL::showSure(TimeId ttl, bool rebuild) const { tr::now, lt_after_duration, { .text = ttlText }, - Ui::Text::WithEntities)); + tr::marked)); _show->hideLayer(); // Don't use close(). }); request(ttl); @@ -371,8 +371,8 @@ void GlobalTTL::setupContent() { tr::lng_settings_ttl_after_about( lt_link, tr::lng_settings_ttl_after_about_link( - ) | rpl::map([](QString s) { return Ui::Text::Link(s, 1); }), - Ui::Text::WithEntities), + ) | rpl::map([](QString s) { return tr::link(s, 1); }), + tr::marked), st::boxDividerLabel); footer->setLink(1, std::make_shared([=] { const auto session = &_controller->session(); @@ -401,12 +401,12 @@ void GlobalTTL::setupContent() { peers.size(), lt_duration, { .text = Ui::FormatTTL(ttl) }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_settings_ttl_select_chats_disabled_toast( tr::now, lt_count, peers.size(), - Ui::Text::WithEntities)); + tr::marked)); box->closeBox(); })); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); diff --git a/Telegram/SourceFiles/settings/settings_information.cpp b/Telegram/SourceFiles/settings/settings_information.cpp index 85e39cb60f..4ae2e718d6 100644 --- a/Telegram/SourceFiles/settings/settings_information.cpp +++ b/Telegram/SourceFiles/settings/settings_information.cpp @@ -225,8 +225,8 @@ private: const auto push = [=] { const auto now = base::unixtime::now(); consumer.put_next(Data::OnlineTextActive(user, now) - ? Ui::Text::Link(Data::OnlineText(user, now)) - : Ui::Text::WithEntities(Data::OnlineText(user, now))); + ? tr::link(Data::OnlineText(user, now)) + : tr::marked(Data::OnlineText(user, now))); timer->callOnce(Data::OnlineChangeTimeout(user, now)); }; timer->setCallback(push); @@ -406,13 +406,13 @@ void SetupBirthday( tr::lng_settings_birthday_contacts( lt_link, tr::lng_settings_birthday_contacts_link( - ) | Ui::Text::ToLink(u"internal:edit_privacy_birthday"_q), - Ui::Text::WithEntities), + tr::url(u"internal:edit_privacy_birthday"_q)), + tr::marked), tr::lng_settings_birthday_about( lt_link, tr::lng_settings_birthday_about_link( - ) | Ui::Text::ToLink(u"internal:edit_privacy_birthday"_q), - Ui::Text::WithEntities))); + tr::url(u"internal:edit_privacy_birthday"_q)), + tr::marked))); } void SetupPersonalChannel( @@ -469,7 +469,7 @@ void SetupRows( AddRow( container, tr::lng_settings_name_label(), - Info::Profile::NameValue(self) | Ui::Text::ToWithEntities(), + Info::Profile::NameValue(self) | rpl::map(tr::marked), tr::lng_profile_copy_fullname(tr::now), showEditName, { &st::menuIconProfile }); diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 18a355ac0c..5f24dcf3d1 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -232,7 +232,7 @@ void Cover::initViewers() { Info::Profile::UsernameValue( _user ) | rpl::on_next([=](const TextWithEntities &value) { - _username->setMarkedText(Ui::Text::Link(value.text.isEmpty() + _username->setMarkedText(tr::link(value.text.isEmpty() ? tr::lng_settings_username_add(tr::now) : value.text)); refreshUsernameGeometry(width()); @@ -437,11 +437,10 @@ void SetupValidatePhoneNumberSuggestion( content, tr::lng_settings_suggestion_phone_number_about( lt_link, - tr::lng_collectible_learn_more( - ) | Ui::Text::ToLink( + tr::lng_collectible_learn_more(tr::url( tr::lng_settings_suggestion_phone_number_about_link( - tr::now)), - Ui::Text::WithEntities), + tr::now))), + tr::marked), st::boxLabel), st::boxRowPadding); label->setClickHandlerFilter([=, weak = base::make_weak(controller)]( @@ -502,7 +501,7 @@ void SetupValidatePhoneNumberSuggestion( tr::lng_settings_suggestion_phone_number_change( lt_emoji, rpl::single(Ui::Text::SingleCustomEmoji(u"@"_q)), - Ui::Text::WithEntities), + tr::marked), st::boxLabel, st::defaultPopupMenu, Ui::Text::MarkedContext{ diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index 2291ed4347..e65aa3f23a 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -282,7 +282,7 @@ void AddTypeButton( .text = phrase( lt_count, rpl::single(float64(count)), - Ui::Text::RichLangValue), + tr::rich), .confirmed = [=](auto close) { toggle(); close(); }, .confirmText = tr::lng_box_ok(), .title = tr::lng_notification_exceptions_title(), diff --git a/Telegram/SourceFiles/settings/settings_passkeys.cpp b/Telegram/SourceFiles/settings/settings_passkeys.cpp index 118888bcf7..4033e3ebfe 100644 --- a/Telegram/SourceFiles/settings/settings_passkeys.cpp +++ b/Telegram/SourceFiles/settings/settings_passkeys.cpp @@ -395,11 +395,11 @@ void Passkeys::setupContent( tr::lng_channel_earn_about_link( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link(std::move(text), u"internal"_q); + return tr::link(std::move(text), u"internal"_q); }), - Ui::Text::RichLangValue + tr::rich )); label->setClickHandlerFilter([=](const auto &...) { controller->show(Box(PasskeysNoneBox, session)); diff --git a/Telegram/SourceFiles/settings/settings_premium.cpp b/Telegram/SourceFiles/settings/settings_premium.cpp index aca73cd1a9..91104ddaf8 100644 --- a/Telegram/SourceFiles/settings/settings_premium.cpp +++ b/Telegram/SourceFiles/settings/settings_premium.cpp @@ -863,7 +863,7 @@ void TopBarWithSticker::updateTitle( tr::now, lt_user, std::move(name), - Ui::Text::WithEntities)); + tr::marked)); } const auto stickerInfo = document->sticker(); if (!stickerInfo) { @@ -886,21 +886,21 @@ void TopBarWithSticker::updateTitle( set->thumbnailDocumentId); const auto entities = EntitiesInText{ { EntityType::CustomEmoji, 0, 1, entityEmojiData }, - Ui::Text::Link(text, linkIndex).entities.front(), + tr::link(text, linkIndex).entities.front(), }; auto title = (setId == coloredId) ? tr::lng_premium_emoji_status_title_colored( tr::now, lt_user, std::move(name), - Ui::Text::WithEntities) + tr::marked) : tr::lng_premium_emoji_status_title( tr::now, lt_user, std::move(name), lt_link, { .text = text, .entities = entities, }, - Ui::Text::WithEntities); + tr::marked); _title->setMarkedText( std::move(title), Core::TextContext({ .session = &controller->session() })); @@ -929,7 +929,7 @@ void TopBarWithSticker::updateAbout( ? tr::lng_premium_emoji_status_about : tr::lng_premium_summary_user_about)( tr::now, - Ui::Text::RichLangValue)); + tr::rich)); } void TopBarWithSticker::setPaused(bool paused) { @@ -1154,14 +1154,13 @@ void Premium::setupContent() { content->add( object_ptr( content, - tr::lng_premium_summary_bottom_subtitle( - ) | Ui::Text::ToBold(), + tr::lng_premium_summary_bottom_subtitle(tr::bold), stLabel), st::defaultSubsectionTitlePadding); content->add( object_ptr( content, - tr::lng_premium_summary_bottom_about(Ui::Text::RichLangValue), + tr::lng_premium_summary_bottom_about(tr::rich), st::aboutLabel), st::boxRowPadding); Ui::AddSkip( @@ -1197,14 +1196,14 @@ base::weak_qptr Premium::createPinnedToTop( lt_count, rpl::single(float64(months ? months : gift.days)), lt_user, - rpl::single(Ui::Text::Bold(peer->name())), - Ui::Text::RichLangValue); + rpl::single(tr::bold(peer->name())), + tr::rich); } } return rpl::conditional( Data::AmPremiumValue(&_controller->session()), _controller->session().api().premium().statusTextValue(), - tr::lng_premium_summary_top_about(Ui::Text::RichLangValue)); + tr::lng_premium_summary_top_about(tr::rich)); }(); const auto emojiStatusData = Ref::EmojiStatus::Parse(_ref); @@ -1246,7 +1245,7 @@ base::weak_qptr Premium::createPinnedToTop( .aboutValue = tr::lng_gift_premium_text( lt_count, rpl::single(premiumGiftData.perUserTotal * 1.), - Ui::Text::RichLangValue), + tr::rich), .type = TopBarWithStickerType::PremiumGift, }, _showFinished.events()); @@ -1841,7 +1840,7 @@ void AddSummaryPremium( const auto label = content->add( object_ptr( content, - std::move(entry.title) | Ui::Text::ToBold(), + std::move(entry.title) | rpl::map(tr::bold), stLabel), titlePadding); label->setAttribute(Qt::WA_TransparentForMouseEvents); diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index ca203ae862..f17dc58334 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -509,7 +509,7 @@ auto PhoneNumberPrivacyController::warning() const ) | rpl::map([=](bool onlyContactsSee) { return onlyContactsSee ? tr::lng_edit_privacy_phone_number_contacts( - Ui::Text::WithEntities) + tr::marked) : rpl::combine( tr::lng_edit_privacy_phone_number_warning(), tr::lng_username_link() @@ -518,7 +518,7 @@ auto PhoneNumberPrivacyController::warning() const warning + "\n\n" + added + "\n", }; const auto link = PublicLinkByPhone(self); - return base.append(Ui::Text::Link(link, link)); + return base.append(tr::link(link, link)); }); }) | rpl::flatten_latest(); } @@ -642,7 +642,7 @@ rpl::producer LastSeenPrivacyController::optionsTitleKey() const { auto LastSeenPrivacyController::warning() const -> rpl::producer { - return tr::lng_edit_privacy_lastseen_warning(Ui::Text::WithEntities); + return tr::lng_edit_privacy_lastseen_warning(tr::marked); } rpl::producer LastSeenPrivacyController::exceptionButtonTextKey( @@ -909,7 +909,7 @@ QString CallsPeer2PeerPrivacyController::optionLabel( auto CallsPeer2PeerPrivacyController::warning() const -> rpl::producer { - return tr::lng_settings_peer_to_peer_about(Ui::Text::WithEntities); + return tr::lng_settings_peer_to_peer_about(tr::marked); } auto CallsPeer2PeerPrivacyController::exceptionButtonTextKey( @@ -968,7 +968,7 @@ rpl::producer ForwardsPrivacyController::optionsTitleKey() const { auto ForwardsPrivacyController::warning() const -> rpl::producer { - return tr::lng_edit_privacy_forwards_warning(Ui::Text::WithEntities); + return tr::lng_edit_privacy_forwards_warning(tr::marked); } rpl::producer ForwardsPrivacyController::exceptionButtonTextKey( @@ -1446,15 +1446,15 @@ Fn VoicesPrivacyController::premiumClickedCallback( return nullptr; } const auto showToast = [=] { - auto link = Ui::Text::Link( - Ui::Text::Semibold( + auto link = tr::link( + tr::semibold( tr::lng_settings_privacy_premium_link(tr::now))); _toastInstance = controller->showToast({ .text = tr::lng_settings_privacy_premium( tr::now, lt_link, link, - Ui::Text::WithEntities), + tr::marked), .filter = crl::guard(&controller->session(), [=]( const ClickHandlerPtr &, Qt::MouseButton button) { @@ -1569,8 +1569,8 @@ object_ptr BirthdayPrivacyController::setupAboveWidget( tr::lng_edit_privacy_birthday_yet( lt_link, tr::lng_edit_privacy_birthday_yet_link( - ) | Ui::Text::ToLink("internal:edit_birthday"), - Ui::Text::WithEntities), + tr::url(u"internal:edit_birthday"_q)), + tr::marked), st::boxDividerLabel), st::defaultBoxDividerLabelPadding)); result->toggleOn(session->changes().peerFlagsValue( @@ -1648,15 +1648,15 @@ void GiftsAutoSavePrivacyController::ensureAdditionalState( _state->disallowed = globalPrivacy->disallowedGiftTypesCurrent(); _state->promo = [=] { _state->disables.fire({}); - const auto link = Ui::Text::Bold( + const auto link = tr::bold( tr::lng_settings_generic_subscribe_link(tr::now)); Settings::ShowPremiumPromoToast( controller->uiShow(), tr::lng_settings_generic_subscribe( tr::now, lt_link, - Ui::Text::Link(link), - Ui::Text::WithEntities), + tr::link(link), + tr::marked), u"gifts_privacy"_q); }; _state->save = [=] { @@ -1713,7 +1713,7 @@ object_ptr GiftsAutoSavePrivacyController::setupAboveWidget( tr::lng_edit_privacy_gifts_show_icon_about( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::settingsGiftIconEmoji)), - Ui::Text::WithEntities)); + tr::marked)); return result; } diff --git a/Telegram/SourceFiles/settings/settings_privacy_security.cpp b/Telegram/SourceFiles/settings/settings_privacy_security.cpp index 0885c32c4a..5d27670877 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_security.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_security.cpp @@ -311,15 +311,15 @@ void AddPremiumPrivacyButton( } const auto showToast = [=] { - auto link = Ui::Text::Link( - Ui::Text::Semibold( + auto link = tr::link( + tr::semibold( tr::lng_settings_privacy_premium_link(tr::now))); (*toast) = controller->showToast({ .text = tr::lng_settings_privacy_premium( tr::now, lt_link, link, - Ui::Text::WithEntities), + tr::marked), .duration = Ui::Toast::kDefaultDuration * 2, .filter = crl::guard(&controller->session(), [=]( const ClickHandlerPtr &, diff --git a/Telegram/SourceFiles/settings/settings_shortcuts.cpp b/Telegram/SourceFiles/settings/settings_shortcuts.cpp index 4849ec2b9f..88c7c2c095 100644 --- a/Telegram/SourceFiles/settings/settings_shortcuts.cpp +++ b/Telegram/SourceFiles/settings/settings_shortcuts.cpp @@ -244,7 +244,7 @@ struct Labeled { - st.style.font->width(button) - st::settingsButtonRightSkip; keys->setMarkedText((recording == raw) - ? Ui::Text::Italic( + ? tr::italic( tr::lng_shortcuts_recording(tr::now)) : key.isEmpty() ? TextWithEntities() diff --git a/Telegram/SourceFiles/ui/boxes/boost_box.cpp b/Telegram/SourceFiles/ui/boxes/boost_box.cpp index ac17a091f8..243cfaf4d7 100644 --- a/Telegram/SourceFiles/ui/boxes/boost_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/boost_box.cpp @@ -141,7 +141,6 @@ void AddFeaturesList( st, st::boostFeatureIconPosition); }; - const auto proj = &Ui::Text::RichLangValue; const auto lowMax = std::max({ features.linkLogoLevel, features.profileIconLevel, @@ -206,13 +205,15 @@ void AddFeaturesList( }, line->lifetime()); } if (i >= features.sponsoredLevel) { - add(tr::lng_channel_earn_off(proj), st::boostFeatureOffSponsored); + add( + tr::lng_channel_earn_off(tr::rich), + st::boostFeatureOffSponsored); } if (i >= features.customWallpaperLevel) { add( (group ? tr::lng_feature_custom_background_group - : tr::lng_feature_custom_background_channel)(proj), + : tr::lng_feature_custom_background_channel)(tr::rich), st::boostFeatureCustomBackground); } if (i >= features.wallpaperLevel) { @@ -222,12 +223,12 @@ void AddFeaturesList( : tr::lng_feature_backgrounds_channel)( lt_count, rpl::single(float64(features.wallpapersCount)), - proj), + tr::rich), st::boostFeatureBackground); } if (i >= features.emojiStatusLevel) { add( - tr::lng_feature_emoji_status(proj), + tr::lng_feature_emoji_status(tr::rich), st::boostFeatureEmojiStatus); } if (const auto j = features.profileColorsByLevel.find(i) @@ -238,7 +239,7 @@ void AddFeaturesList( add( (group ? tr::lng_feature_profile_icon_group - : tr::lng_feature_profile_icon_channel)(proj), + : tr::lng_feature_profile_icon_channel)(tr::rich), st::boostFeatureProfileIcon); } if (profileColors > 0) { @@ -247,7 +248,7 @@ void AddFeaturesList( : tr::lng_feature_profile_color_channel)( lt_count, rpl::single(float64(profileColors)), - proj + tr::rich ), st::boostFeatureProfileColor); } if (!group) { @@ -257,14 +258,14 @@ void AddFeaturesList( } if (i >= features.linkLogoLevel) { add( - tr::lng_feature_link_emoji(proj), + tr::lng_feature_link_emoji(tr::rich), st::boostFeatureCustomLink); } if (linkStyles > 0) { add(tr::lng_feature_link_style_channel( lt_count, rpl::single(float64(linkStyles)), - proj + tr::rich ), st::boostFeatureLink); } if (const auto j = features.nameColorsByLevel.find(i) @@ -275,31 +276,31 @@ void AddFeaturesList( add(tr::lng_feature_name_color_channel( lt_count, rpl::single(float64(nameColors)), - proj + tr::rich ), st::boostFeatureName); } add(tr::lng_feature_reactions( lt_count, rpl::single(float64(i)), - proj + tr::rich ), st::boostFeatureCustomReactions); } add( - tr::lng_feature_stories(lt_count, rpl::single(float64(i)), proj), + tr::lng_feature_stories(lt_count, rpl::single(1. * i), tr::rich), st::boostFeatureStories); if (!group && i >= features.autotranslateLevel) { add( - tr::lng_feature_autotranslate(proj), + tr::lng_feature_autotranslate(tr::rich), st::boostFeatureAutoTranslate); } if (group && i >= features.transcribeLevel) { add( - tr::lng_feature_transcribe(proj), + tr::lng_feature_transcribe(tr::rich), st::boostFeatureTranscribe); } if (group && i >= features.emojiPackLevel) { add( - tr::lng_feature_custom_emoji_pack(proj), + tr::lng_feature_custom_emoji_pack(tr::rich), st::boostFeatureCustomEmoji); } } @@ -391,7 +392,7 @@ void BoostBox( ? (wasLifting - std::clamp(counters.mine - wasMine, 0, wasLifting - 1)) : 0; - const auto bold = Ui::Text::Bold(name); + const auto bold = tr::bold(name); const auto now = counters.boosts; const auto full = !counters.nextLevelBoosts; const auto left = (counters.nextLevelBoosts > now) @@ -400,14 +401,14 @@ void BoostBox( auto post = tr::lng_boost_channel_post_stories( lt_count, rpl::single(float64(counters.level + (left ? 1 : 0))), - Ui::Text::RichLangValue); + tr::rich); return (lifting > 1) ? tr::lng_boost_group_lift_restrictions_many( lt_count, rpl::single(float64(lifting)), - Ui::Text::RichLangValue) + tr::rich) : lifting - ? tr::lng_boost_group_lift_restrictions(Ui::Text::RichLangValue) + ? tr::lng_boost_group_lift_restrictions(tr::rich) : (counters.mine || full) ? (left ? tr::lng_boost_channel_needs_unlock( @@ -415,12 +416,12 @@ void BoostBox( rpl::single(float64(left)), lt_channel, rpl::single(bold), - Ui::Text::RichLangValue) + tr::rich) : (!counters.level ? (data.group ? tr::lng_boost_channel_reached_first_group : tr::lng_boost_channel_reached_first)( - Ui::Text::RichLangValue) + tr::rich) : (data.group ? tr::lng_boost_channel_reached_more_group : tr::lng_boost_channel_reached_more)( @@ -428,13 +429,13 @@ void BoostBox( rpl::single(float64(counters.level)), lt_post, std::move(post), - Ui::Text::RichLangValue))) + tr::rich))) : tr::lng_boost_channel_needs_unlock( lt_count, rpl::single(float64(left)), lt_channel, rpl::single(bold), - Ui::Text::RichLangValue); + tr::rich); }) | rpl::flatten_latest(); if (wasLifting) { state->data.value( @@ -657,7 +658,7 @@ void BoostBoxAlready(not_null box, bool group) { ConfirmBox(box, { .text = (group ? tr::lng_boost_error_already_text_group - : tr::lng_boost_error_already_text)(Text::RichLangValue), + : tr::lng_boost_error_already_text)(tr::rich), .title = tr::lng_boost_error_already_title(), .inform = true, }); @@ -676,7 +677,7 @@ void GiftForBoostsBox( rpl::single(receive) | tr::to_count(), lt_channel, rpl::single(TextWithEntities{ channel }), - Text::RichLangValue), + tr::rich), .title = tr::lng_boost_need_more(), .inform = true, }); @@ -686,7 +687,7 @@ void GiftedNoBoostsBox(not_null box, bool group) { InformBox(box, { .text = (group ? tr::lng_boost_error_gifted_text_group - : tr::lng_boost_error_gifted_text)(Text::RichLangValue), + : tr::lng_boost_error_gifted_text)(tr::rich), .title = tr::lng_boost_error_gifted_title(), }); } @@ -698,7 +699,7 @@ void PremiumForBoostsBox( ConfirmBox(box, { .text = (group ? tr::lng_boost_error_premium_text_group - : tr::lng_boost_error_premium_text)(Text::RichLangValue), + : tr::lng_boost_error_premium_text)(tr::rich), .confirmed = buyPremium, .confirmText = tr::lng_boost_error_premium_yes(), .title = tr::lng_boost_error_premium_title(), @@ -746,12 +747,12 @@ void AskBoostBox( return tr::lng_boost_channel_needs_level_color( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostAutotranslate data) { return tr::lng_boost_channel_needs_level_autotranslate( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostWallpaper data) { isGroup = data.group; return (data.group @@ -759,7 +760,7 @@ void AskBoostBox( : tr::lng_boost_channel_needs_level_wallpaper)( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostEmojiStatus data) { isGroup = data.group; return (data.group @@ -767,35 +768,35 @@ void AskBoostBox( : tr::lng_boost_channel_needs_level_status)( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostEmojiPack data) { isGroup = true; return tr::lng_boost_group_needs_level_emoji( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostCustomReactions data) { return tr::lng_boost_channel_needs_level_reactions( lt_count, rpl::single(float64(data.count)), lt_same_count, rpl::single(TextWithEntities{ QString::number(data.count) }), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostCpm data) { return tr::lng_boost_channel_needs_level_cpm( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }, [&](AskBoostWearCollectible data) { return tr::lng_boost_channel_needs_level_wear( lt_count, rpl::single(float64(data.requiredLevel)), - Ui::Text::RichLangValue); + tr::rich); }); auto text = rpl::combine( std::move(reasonText), (isGroup ? tr::lng_boost_group_ask : tr::lng_boost_channel_ask)( - Ui::Text::RichLangValue) + tr::rich) ) | rpl::map([](TextWithEntities &&text, TextWithEntities &&ask) { return text.append(u"\n\n"_q).append(std::move(ask)); }); diff --git a/Telegram/SourceFiles/ui/boxes/choose_date_time.cpp b/Telegram/SourceFiles/ui/boxes/choose_date_time.cpp index c508060105..19731b6f8b 100644 --- a/Telegram/SourceFiles/ui/boxes/choose_date_time.cpp +++ b/Telegram/SourceFiles/ui/boxes/choose_date_time.cpp @@ -290,7 +290,7 @@ object_ptr ChooseRepeatPeriod( ) | rpl::on_next([=](TimeId value, bool locked) { auto result = tr::lng_schedule_repeat_label( tr::now, - Ui::Text::WithEntities); + tr::marked); const auto text = [&] { const auto i = ranges::lower_bound( @@ -301,8 +301,8 @@ object_ptr ChooseRepeatPeriod( return (i != end(map)) ? i->text : map.back().text; }(); - label->setMarkedText(result.append(' ').append(Ui::Text::Link( - Ui::Text::Bold(text).append( + label->setMarkedText(result.append(' ').append(tr::link( + tr::bold(text).append( Ui::Text::IconEmoji(locked ? &st::scheduleRepeatDropdownLock : &st::scheduleRepeatDropdownArrow)) diff --git a/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp b/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp index abc74a1ebf..22ab7e05db 100644 --- a/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp @@ -178,13 +178,13 @@ void CollectibleInfoBox( ? tr::lng_collectible_phone_title( tr::now, lt_phone, - Ui::Text::Link(formatted), - Ui::Text::WithEntities) + tr::link(formatted), + tr::marked) : tr::lng_collectible_username_title( tr::now, lt_username, - Ui::Text::Link(formatted), - Ui::Text::WithEntities); + tr::link(formatted), + tr::marked); const auto copyCallback = [box, type, formatted, text = info.copyText]( bool copyLink) { QGuiApplication::clipboard()->setText((text.isEmpty() || !copyLink) @@ -218,7 +218,7 @@ void CollectibleInfoBox( TextWithEntities{ FormatDate(info.date) }, lt_price, FormatPrice(info), - Ui::Text::RichLangValue); + tr::rich); const auto label = box->addRow( object_ptr(box, st::collectibleInfo), st::collectibleInfoPadding, diff --git a/Telegram/SourceFiles/ui/boxes/confirm_phone_box.cpp b/Telegram/SourceFiles/ui/boxes/confirm_phone_box.cpp index 4f1407580b..ec309d5ea6 100644 --- a/Telegram/SourceFiles/ui/boxes/confirm_phone_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/confirm_phone_box.cpp @@ -51,8 +51,8 @@ void ConfirmPhoneBox::prepare() { this, tr::lng_confirm_phone_about( lt_phone, - rpl::single(Ui::Text::Bold(Ui::FormatPhone(_phone))), - Ui::Text::WithEntities), + rpl::single(tr::bold(Ui::FormatPhone(_phone))), + tr::marked), st::confirmPhoneAboutLabel); _code.create(this, st::confirmPhoneCodeField, tr::lng_code_ph()); diff --git a/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp b/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp index 37105b056e..e1ae66cc32 100644 --- a/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp +++ b/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp @@ -135,13 +135,13 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( tr::lng_group_invite_subscription_about_link( lt_emoji, rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)), - Ui::Text::RichLangValue + tr::rich ) | rpl::map([](TextWithEntities text) { - return Ui::Text::Link( + return tr::link( std::move(text), tr::lng_group_invite_subscription_about_url(tr::now)); }), - Ui::Text::RichLangValue), + tr::rich), st::boxDividerLabel); Ui::AddSkip(wrap->entity()); Ui::AddSkip(wrap->entity()); diff --git a/Telegram/SourceFiles/ui/boxes/show_or_premium_box.cpp b/Telegram/SourceFiles/ui/boxes/show_or_premium_box.cpp index 3757517c4e..86803457b2 100644 --- a/Telegram/SourceFiles/ui/boxes/show_or_premium_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/show_or_premium_box.cpp @@ -83,14 +83,14 @@ void ShowOrPremiumBox( tr::lng_lastseen_show_about( lt_user, rpl::single(TextWithEntities{ shortName }), - Text::RichLangValue), + tr::rich), tr::lng_lastseen_show_button(), tr::lng_lastseen_or(), tr::lng_lastseen_premium_title(), tr::lng_lastseen_premium_about( lt_user, rpl::single(TextWithEntities{ shortName }), - Text::RichLangValue), + tr::rich), tr::lng_lastseen_premium_button(), tr::lng_lastseen_shown_toast(tr::now), u"show_or_premium_lastseen"_q, @@ -100,14 +100,14 @@ void ShowOrPremiumBox( tr::lng_readtime_show_about( lt_user, rpl::single(TextWithEntities{ shortName }), - Text::RichLangValue), + tr::rich), tr::lng_readtime_show_button(), tr::lng_readtime_or(), tr::lng_readtime_premium_title(), tr::lng_readtime_premium_about( lt_user, rpl::single(TextWithEntities{ shortName }), - Text::RichLangValue), + tr::rich), tr::lng_readtime_premium_button(), tr::lng_readtime_shown_toast(tr::now), u"show_or_premium_readtime"_q, diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_downloads.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_downloads.cpp index 05b2e1d033..7a4d8fb00c 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_downloads.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_downloads.cpp @@ -197,12 +197,12 @@ void Action::refresh(const DownloadsEntry &entry) { ? TextWithEntities{ FormatProgressText(entry.ready, entry.total), } - : tr::lng_bot_download_starting(tr::now, Text::WithEntities)) + : tr::lng_bot_download_starting(tr::now, tr::marked)) : tr::lng_bot_download_failed( tr::now, lt_retry, Text::Link(tr::lng_bot_download_retry(tr::now)), - Text::WithEntities); + tr::marked); _progress.setMarkedText(progressText); const auto enabled = isEnabled(); diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index b644d12a74..be1a3e7401 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -2121,7 +2121,7 @@ TextWithEntities ErrorText(const Webview::Available &info) { Text::Link( "Microsoft Edge WebView2 Runtime", "https://go.microsoft.com/fwlink/p/?LinkId=2124703"), - Ui::Text::WithEntities); + tr::marked); case Error::NoWebKitGTK: return { tr::lng_payments_webview_install_webkit(tr::now) }; case Error::OldWindows: diff --git a/Telegram/SourceFiles/ui/chat/choose_send_as.cpp b/Telegram/SourceFiles/ui/chat/choose_send_as.cpp index 8b2855c664..6663877a1b 100644 --- a/Telegram/SourceFiles/ui/chat/choose_send_as.cpp +++ b/Telegram/SourceFiles/ui/chat/choose_send_as.cpp @@ -243,11 +243,11 @@ void SetupSendAsButton( tr::lng_send_as_premium_required( tr::now, lt_link, - Ui::Text::Link( - Ui::Text::Bold( + tr::link( + tr::bold( tr::lng_send_as_premium_required_link( tr::now))), - Ui::Text::WithEntities), + tr::marked), u"send_as"_q); return false; } diff --git a/Telegram/SourceFiles/ui/chat/choose_theme_controller.cpp b/Telegram/SourceFiles/ui/chat/choose_theme_controller.cpp index 4d12c532fc..3a0924e134 100644 --- a/Telegram/SourceFiles/ui/chat/choose_theme_controller.cpp +++ b/Telegram/SourceFiles/ui/chat/choose_theme_controller.cpp @@ -343,8 +343,8 @@ void ChooseThemeController::initButtons() { Ui::ConfirmBox(box, { .text = tr::lng_chat_theme_gift_replace( lt_name, - rpl::single(Ui::Text::Bold(nowHasTheme->shortName())), - Ui::Text::WithEntities), + rpl::single(tr::bold(nowHasTheme->shortName())), + tr::marked), .confirmed = confirmed, .confirmText = tr::lng_box_yes(), }); diff --git a/Telegram/SourceFiles/ui/controls/download_bar.cpp b/Telegram/SourceFiles/ui/controls/download_bar.cpp index a13777b611..6c24385a62 100644 --- a/Telegram/SourceFiles/ui/controls/download_bar.cpp +++ b/Telegram/SourceFiles/ui/controls/download_bar.cpp @@ -86,7 +86,7 @@ void DownloadBar::show(DownloadBarContent &&content) { _title.setMarkedText( st::defaultTextStyle, (content.count > 1 - ? Ui::Text::Bold( + ? tr::bold( tr::lng_profile_files(tr::now, lt_count, content.count)) : content.singleName)); refreshInfo(_progress.current()); @@ -139,7 +139,7 @@ void DownloadBar::refreshInfo(const DownloadBarProgress &progress) { _info.setMarkedText( st::downloadInfoStyle, (progress.ready < progress.total - ? Text::WithEntities( + ? tr::marked( FormatDownloadText(progress.ready, progress.total)) : Text::Link((_content.count > 1) ? tr::lng_downloads_view_in_section(tr::now) diff --git a/Telegram/SourceFiles/ui/controls/filter_link_header.cpp b/Telegram/SourceFiles/ui/controls/filter_link_header.cpp index 1815a9f1bb..e525783116 100644 --- a/Telegram/SourceFiles/ui/controls/filter_link_header.cpp +++ b/Telegram/SourceFiles/ui/controls/filter_link_header.cpp @@ -513,33 +513,33 @@ object_ptr FilterLinkProcessButton( case FilterLinkHeaderType::AddingFilter: return badge.isEmpty() ? tr::lng_filters_by_link_add_no( - Ui::Text::WithEntities + tr::marked ) | with(QString()) : tr::lng_filters_by_link_add_button( lt_folder, rpl::single(title), - Ui::Text::WithEntities + tr::marked ) | with(badge); case FilterLinkHeaderType::AddingChats: return badge.isEmpty() ? tr::lng_filters_by_link_join_no( - Ui::Text::WithEntities + tr::marked ) | with(QString()) : tr::lng_filters_by_link_and_join_button( lt_count, rpl::single(float64(count)), - Ui::Text::WithEntities) | with(badge); + tr::marked) | with(badge); case FilterLinkHeaderType::AllAdded: - return tr::lng_box_ok(Ui::Text::WithEntities) | with(QString()); + return tr::lng_box_ok(tr::marked) | with(QString()); case FilterLinkHeaderType::Removing: return badge.isEmpty() ? tr::lng_filters_by_link_remove_button( - Ui::Text::WithEntities + tr::marked ) | with(QString()) : tr::lng_filters_by_link_and_quit_button( lt_count, rpl::single(float64(count)), - Ui::Text::WithEntities) | with(badge); + tr::marked) | with(badge); } Unexpected("Type in FilterLinkProcessButton."); }) | rpl::flatten_latest(); diff --git a/Telegram/SourceFiles/ui/controls/location_picker.cpp b/Telegram/SourceFiles/ui/controls/location_picker.cpp index edd641bd45..d29c9815fb 100644 --- a/Telegram/SourceFiles/ui/controls/location_picker.cpp +++ b/Telegram/SourceFiles/ui/controls/location_picker.cpp @@ -546,7 +546,7 @@ void SetupEmptyView( (query ? Icon::NoResults : Icon::Search), (query ? tr::lng_maps_no_places - : tr::lng_maps_choose_to_search)(Text::WithEntities)); + : tr::lng_maps_choose_to_search)(tr::marked)); view->setMinimalHeight(st::recentPeersEmptyHeightMin); view->show(); diff --git a/Telegram/SourceFiles/ui/controls/stars_rating.cpp b/Telegram/SourceFiles/ui/controls/stars_rating.cpp index ccf37071d2..2ed30adc7c 100644 --- a/Telegram/SourceFiles/ui/controls/stars_rating.cpp +++ b/Telegram/SourceFiles/ui/controls/stars_rating.cpp @@ -239,20 +239,20 @@ void AboutRatingBox( ? tr::lng_stars_rating_about( lt_name, rpl::single(TextWithEntities{ name }), - Text::RichLangValue) | rpl::type_erased + tr::rich) | rpl::type_erased : tr::lng_stars_rating_about_your( - Text::RichLangValue) | rpl::type_erased; + tr::rich) | rpl::type_erased; if (data.level < 0) { auto text = (data.stars < 0) ? tr::lng_stars_rating_negative_your( lt_count_decimal, rpl::single(-data.stars * 1.), - Text::RichLangValue) + tr::rich) : tr::lng_stars_rating_negative( lt_name, rpl::single(TextWithEntities{ name }), - Text::RichLangValue); + tr::rich); box->addRow( object_ptr( box, @@ -289,8 +289,8 @@ void AboutRatingBox( tr::now, lt_arrow, Text::IconEmoji(&st::textMoreIconEmoji), - Text::WithEntities)), - Text::RichLangValue); + tr::marked)), + tr::rich); }); const auto aboutPending = box->addRow( object_ptr( @@ -342,7 +342,7 @@ void AboutRatingBox( tr::now, lt_emoji, makeActive(tr::lng_stars_rating_added(tr::now)), - Text::RichLangValue), + tr::rich), }, { st::menuIconRatingUsers, @@ -351,7 +351,7 @@ void AboutRatingBox( tr::now, lt_emoji, makeActive(tr::lng_stars_rating_added(tr::now)), - Text::RichLangValue), + tr::rich), }, { st::menuIconRatingRefund, @@ -360,7 +360,7 @@ void AboutRatingBox( tr::now, lt_emoji, makeInactive(tr::lng_stars_rating_deducted(tr::now)), - Text::RichLangValue), + tr::rich), }, }; const auto context = helper.context(); diff --git a/Telegram/SourceFiles/ui/controls/userpic_button.cpp b/Telegram/SourceFiles/ui/controls/userpic_button.cpp index c9546ca1e0..0f51ea98bb 100644 --- a/Telegram/SourceFiles/ui/controls/userpic_button.cpp +++ b/Telegram/SourceFiles/ui/controls/userpic_button.cpp @@ -310,8 +310,8 @@ void UserpicButton::choosePhotoLocally() { ? (*phrase)( tr::now, lt_user, - Ui::Text::Bold(name), - Ui::Text::WithEntities) + tr::bold(name), + tr::marked) : TextWithEntities()), .confirm = ((type == ChosenType::Suggest) ? tr::lng_profile_suggest_button(tr::now) diff --git a/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp b/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp index eedfba46a1..bc65141e0d 100644 --- a/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp +++ b/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp @@ -10,7 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/labels.h" // Ui::FlatLabel #include "ui/widgets/buttons.h" // Ui::IconButton #include "ui/wrap/slide_wrap.h" // Ui::SlideWrap -#include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "base/platform/base_platform_info.h" #include "lang/lang_keys.h" #include "styles/style_window.h" @@ -47,15 +46,15 @@ private: [[nodiscard]] rpl::producer OutdatedReasonPhrase() { const auto why = Platform::WhySystemBecomesOutdated(); return (why == Platform::OutdateReason::Is32Bit) - ? tr::lng_outdated_title_bits() - : tr::lng_outdated_title(); + ? tr::lng_outdated_title_bits(tr::upper) + : tr::lng_outdated_title(tr::upper); } Bar::Bar(not_null parent, QDate date) : _date(date) , _title( this, - OutdatedReasonPhrase() | Text::ToUpper(), + OutdatedReasonPhrase(), st::windowOutdatedTitle) , _details(this, QString(), diff --git a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp index 6957e1266b..ae99fe0a55 100644 --- a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp @@ -756,7 +756,7 @@ void ShowListBox( const auto title = content->add( object_ptr( content, - base::take(entry.title) | Ui::Text::ToBold(), + base::take(entry.title) | rpl::map(tr::bold), stLabel), entry.icon ? iconTitlePadding : titlePadding); content->add( diff --git a/Telegram/SourceFiles/ui/vertical_list.cpp b/Telegram/SourceFiles/ui/vertical_list.cpp index 73884380b4..fca7301765 100644 --- a/Telegram/SourceFiles/ui/vertical_list.cpp +++ b/Telegram/SourceFiles/ui/vertical_list.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "ui/vertical_list.h" -#include "ui/text/text_utilities.h" +#include "lang/lang_text_entity.h" #include "ui/widgets/box_content_divider.h" #include "ui/widgets/labels.h" #include "ui/wrap/padding_wrap.h" @@ -41,7 +41,7 @@ not_null AddDividerText( RectParts parts) { return AddDividerText( container, - std::move(text) | Ui::Text::ToWithEntities(), + std::move(text) | rpl::map(tr::marked), margins, st, parts); diff --git a/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp b/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp index 0340b1fbbb..58286e926e 100644 --- a/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp +++ b/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_peer.h" #include "info/profile/info_profile_values.h" +#include "lang/lang_text_entity.h" #include "ui/controls/userpic_button.h" #include "ui/rect.h" #include "ui/text/text_utilities.h" @@ -151,8 +152,8 @@ void AddExpandablePeerList( using namespace Info::Profile; auto name = controller->data.bold - ? NameValue(peer) | Ui::Text::ToBold() - : NameValue(peer) | Ui::Text::ToWithEntities(); + ? NameValue(peer) | rpl::map(tr::bold) + : NameValue(peer) | rpl::map(tr::marked); const auto userpic = Ui::CreateChild(line, peer, st); const auto checkbox = Ui::CreateChild( diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 22334b173e..4dcf85beae 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -1108,7 +1108,7 @@ TextWithEntities Manager::ComposeReactionNotification( tr::now, lt_reaction, reactionWithEntities, - Ui::Text::WithEntities); + tr::marked); }; if (hideContent) { return simple(tr::lng_reaction_notext); @@ -1121,7 +1121,7 @@ TextWithEntities Manager::ComposeReactionNotification( reactionWithEntities, lt_text, item->notificationText(), - Ui::Text::WithEntities); + tr::marked); }; if (!media || media->webpage()) { return text(); @@ -1142,8 +1142,8 @@ TextWithEntities Manager::ComposeReactionNotification( lt_reaction, reactionWithEntities, lt_emoji, - Ui::Text::WithEntities(sticker->alt), - Ui::Text::WithEntities); + tr::marked(sticker->alt), + tr::marked); } return simple(tr::lng_reaction_document); } else if (const auto contact = media->sharedContact()) { @@ -1162,8 +1162,8 @@ TextWithEntities Manager::ComposeReactionNotification( lt_reaction, reactionWithEntities, lt_name, - Ui::Text::WithEntities(name), - Ui::Text::WithEntities); + tr::marked(name), + tr::marked); } else if (media->location()) { return simple(tr::lng_reaction_location); // lng_reaction_live_location not used right now :( @@ -1176,7 +1176,7 @@ TextWithEntities Manager::ComposeReactionNotification( reactionWithEntities, lt_title, poll->question, - Ui::Text::WithEntities); + tr::marked); } else if (media->game()) { return simple(tr::lng_reaction_game); } else if (media->invoice()) { diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 861cd2ac3a..adddbb7041 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -1003,7 +1003,7 @@ void Notification::updateNotifyDisplay() { auto title = options.hideNameAndPhoto ? TextWithEntities{ u"Telegram Desktop"_q } : reminder - ? tr::lng_notification_reminder(tr::now, Ui::Text::WithEntities) + ? tr::lng_notification_reminder(tr::now, tr::marked) : topicWithChat(); const auto fullTitle = manager()->addTargetAccountName( std::move(title), diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp index b9f5e59ed5..3c050bd5b6 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp @@ -665,8 +665,8 @@ void CreateForExistingBox( const auto amCreator = window->account().sessionExists() && (window->account().session().userId() == cloud.createdBy); box->setTitle(amCreator - ? (rpl::single(cloud.title) | Ui::Text::ToWithEntities()) - : tr::lng_theme_editor_create_title(Ui::Text::WithEntities)); + ? (rpl::single(cloud.title) | rpl::map(tr::marked)) + : tr::lng_theme_editor_create_title(tr::marked)); box->addRow(object_ptr( box, @@ -790,7 +790,7 @@ void SaveThemeBox( ? GenerateName(collected.accent) : cloud.title; - box->setTitle(tr::lng_theme_editor_save_title(Ui::Text::WithEntities)); + box->setTitle(tr::lng_theme_editor_save_title(tr::marked)); const auto name = box->addRow(object_ptr( box, diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index 35bbc158bf..13ef6e6914 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -108,7 +108,7 @@ constexpr auto kPlayStatusLimit = 2; return !!self->emojiStatusId(); }) | rpl::distinct_until_changed() | rpl::map([](bool has) { const auto makeLink = [](const QString &text) { - return Ui::Text::Link(text); + return tr::link(text); }; return (has ? tr::lng_menu_change_status @@ -382,12 +382,12 @@ MainMenu::MainMenu( parentResized(); - _telegram->setMarkedText(Ui::Text::Link( + _telegram->setMarkedText(tr::link( u"Telegram Desktop"_q, u"https://desktop.telegram.org"_q)); _telegram->setLinksTrusted(); _version->setMarkedText( - Ui::Text::Link( + tr::link( tr::lng_settings_current_version( tr::now, lt_version, @@ -396,7 +396,7 @@ MainMenu::MainMenu( .append(QChar(' ')) .append(QChar(8211)) .append(QChar(' ')) - .append(Ui::Text::Link(tr::lng_menu_about(tr::now), 2))); // Link 2. + .append(tr::link(tr::lng_menu_about(tr::now), 2))); // Link 2. _version->setLink( 1, std::make_shared(Core::App().changelogLink())); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index f8332d3939..b71007e97b 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1719,7 +1719,7 @@ void Filler::addToggleFee() { tr::now, lt_name, TextWithEntities{ user->shortName() }, - Ui::Text::WithEntities) + tr::marked) : tr::lng_context_fee_now( tr::now, lt_name, @@ -1730,7 +1730,7 @@ void Filler::addToggleFee() { ).append(Lang::FormatCountDecimal( user->owner().commonStarsPerMessage(parent) )), - Ui::Text::WithEntities); + tr::marked); const auto action = new QAction(actionParent); action->setDisabled(true); auto result = base::make_unique_q( @@ -1811,7 +1811,7 @@ void PeerMenuDeleteContact( st::mainMenuUserpic), Ui::CreateChild( box, - tr::lng_info_delete_contact() | Ui::Text::ToBold(), + tr::lng_info_delete_contact(tr::bold), box->getDelegate()->style().title)); Ui::ConfirmBox(box, { .text = text, @@ -2073,8 +2073,8 @@ void PeerMenuTodoWantsPremium(TodoWantsPremium type) { } return false; }; - const auto link = Ui::Text::Link( - Ui::Text::Semibold(tr::lng_todo_premium_link(tr::now))); + const auto link = tr::link( + tr::semibold(tr::lng_todo_premium_link(tr::now))); const auto text = [&] { switch (type) { case TodoWantsPremium::Create: return tr::lng_todo_create_premium; @@ -2089,7 +2089,7 @@ void PeerMenuTodoWantsPremium(TodoWantsPremium type) { tr::now, lt_link, link, - Ui::Text::WithEntities), + tr::marked), .filter = filter, .duration = kToastDuration, }); @@ -2256,8 +2256,8 @@ void PeerMenuBlockUserBox( box, tr::lng_blocked_list_confirm_text( lt_name, - rpl::single(Ui::Text::Bold(name)), - Ui::Text::WithEntities), + rpl::single(tr::bold(name)), + tr::marked), st::blockUserConfirmation)); box->addSkip(st::boxMediumSkip); @@ -2296,8 +2296,8 @@ void PeerMenuBlockUserBox( tr::lng_delete_all_from_user( tr::now, lt_user, - Ui::Text::Bold(peer->name()), - Ui::Text::WithEntities), + tr::bold(peer->name()), + tr::marked), true, st::defaultBoxCheckbox)) : nullptr; @@ -3545,7 +3545,7 @@ void MenuAddMarkAsReadAllChatsAction( auto text = rpl::combine( tr::lng_context_mark_read_all_sure(), tr::lng_context_mark_read_all_sure_2( - Ui::Text::RichLangValue) + tr::rich) ) | rpl::map([](QString t1, TextWithEntities t2) { return TextWithEntities() .append(std::move(t1)) @@ -3888,8 +3888,8 @@ void PeerMenuConfirmToggleFee( .text = tr::lng_payment_refund_text( tr::now, lt_name, - Ui::Text::Bold(user->shortName()), - Ui::Text::WithEntities), + tr::bold(user->shortName()), + tr::marked), .confirmed = [=](Fn close) { exception(*refund && (*refund)->checked()); close(); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 1e5f9c1346..0bdaccc359 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -1725,7 +1725,7 @@ void SessionController::suggestArchiveAndMute() { box->setTitle(tr::lng_suggest_hide_new_title()); box->addRow(object_ptr( box, - tr::lng_suggest_hide_new_about(Ui::Text::RichLangValue), + tr::lng_suggest_hide_new_about(tr::rich), st::boxLabel)); box->addButton(tr::lng_suggest_hide_new_to_settings(), [=] { showSettings(Settings::PrivacySecurity::Id()); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 2a2efbe919..62652a7ed2 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 2a2efbe919a1d58584823d892cf8ffe977317310 +Subproject commit 62652a7ed2762824e8ff9b606c7a12c4eb23d99b