2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Set name / phone texts on-demand.

This commit is contained in:
John Preston
2022-08-09 14:12:19 +03:00
parent ceb7d5f238
commit 8bc807dc40
98 changed files with 426 additions and 260 deletions

View File

@@ -663,8 +663,8 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
}
}
const auto showPause = updateStatusText();
const auto nameVersion = parent()->fromOriginal()->nameVersion;
if (nameVersion > _nameVersion) {
const auto nameVersion = parent()->fromOriginal()->nameVersion();
if (_nameVersion < nameVersion) {
updateName();
}
const auto radial = isRadialAnimation();
@@ -879,18 +879,31 @@ const style::RoundCheckbox &Voice::checkboxStyle() const {
}
void Voice::updateName() {
auto version = 0;
if (const auto forwarded = parent()->Get<HistoryMessageForwarded>()) {
if (parent()->fromOriginal()->isChannel()) {
_name.setText(st::semiboldTextStyle, tr::lng_forwarded_channel(tr::now, lt_channel, parent()->fromOriginal()->name), Ui::NameTextOptions());
_name.setText(
st::semiboldTextStyle,
tr::lng_forwarded_channel(
tr::now,
lt_channel,
parent()->fromOriginal()->name()),
Ui::NameTextOptions());
} else {
_name.setText(st::semiboldTextStyle, tr::lng_forwarded(tr::now, lt_user, parent()->fromOriginal()->name), Ui::NameTextOptions());
_name.setText(
st::semiboldTextStyle,
tr::lng_forwarded(
tr::now,
lt_user,
parent()->fromOriginal()->name()),
Ui::NameTextOptions());
}
} else {
_name.setText(st::semiboldTextStyle, parent()->from()->name, Ui::NameTextOptions());
_name.setText(
st::semiboldTextStyle,
parent()->from()->name(),
Ui::NameTextOptions());
}
version = parent()->fromOriginal()->nameVersion;
_nameVersion = version;
_nameVersion = parent()->fromOriginal()->nameVersion();
}
int Voice::duration() const {