Use more simple tr::... text helpers.

This commit is contained in:
John Preston
2025-12-15 12:15:25 +04:00
parent 629158fedb
commit 08a979e638
213 changed files with 1657 additions and 1643 deletions

View File

@@ -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<Info::Profile::FloatingIcon>(
result,

View File

@@ -592,7 +592,7 @@ void SetupFingerprintTooltip(not_null<Ui::RpWidget*> widget) {
}
const auto text = tr::lng_confcall_e2e_about(
tr::now,
Ui::Text::WithEntities);
tr::marked);
if (text.empty()) {
return;
}

View File

@@ -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<Ui::FlatLabel>(
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); });

View File

@@ -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;
}

View File

@@ -57,8 +57,8 @@ object_ptr<Ui::GenericBox> 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<PeerData*> peer) {
return rpl::single(Ui::Text::Bold(peer->shortName()));
return rpl::single(tr::bold(peer->shortName()));
};
box->addRow(
object_ptr<Ui::FlatLabel>(
@@ -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<Ui::FlatLabel>(
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));

View File

@@ -899,14 +899,14 @@ object_ptr<Ui::BoxContent> 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));
}
});
};

View File

@@ -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;
}

View File

@@ -1360,7 +1360,7 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> 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);

View File

@@ -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<void()> &&close) {
handler->onClick({});
close();

View File

@@ -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),

View File

@@ -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);

View File

@@ -105,15 +105,15 @@ object_ptr<RpWidget> 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);