Use Ui::Text::String to show topic names.

Fixes #27956.
This commit is contained in:
John Preston 2024-05-31 09:08:30 +04:00
parent 27eb3e45be
commit 5cfd86b829
1 changed files with 6 additions and 11 deletions

View File

@ -259,9 +259,9 @@ void PaintRow(
not_null<Entry*> entry,
VideoUserpic *videoUserpic,
PeerData *from,
PeerBadge &fromBadge,
PeerBadge &rowBadge,
Fn<void()> customEmojiRepaint,
const Text::String &fromName,
const Text::String &rowName,
const HiddenSenderInfo *hiddenSenderInfo,
HistoryItem *item,
const Data::Draft *draft,
@ -626,10 +626,10 @@ void PaintRow(
p.drawTextLeft(rectForName.left(), rectForName.top(), context.width, text);
} else if (from) {
if ((history || sublist) && !context.search) {
const auto badgeWidth = fromBadge.drawGetWidth(
const auto badgeWidth = rowBadge.drawGetWidth(
p,
rectForName,
fromName.maxWidth(),
rowName.maxWidth(),
context.width,
{
.peer = from,
@ -663,7 +663,7 @@ void PaintRow(
: context.selected
? st::dialogsNameFgOver
: st::dialogsNameFg);
fromName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
rowName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
} else if (hiddenSenderInfo) {
p.setPen(context.active
? st::dialogsNameFgActive
@ -681,12 +681,7 @@ void PaintRow(
: (context.selected
? st::dialogsNameFgOver
: st::dialogsNameFg));
auto text = entry->chatListName(); // TODO feed name with emoji
auto textWidth = st::semiboldFont->width(text);
if (textWidth > rectForName.width()) {
text = st::semiboldFont->elided(text, rectForName.width());
}
p.drawTextLeft(rectForName.left(), rectForName.top(), context.width, text);
rowName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
}
}