Fixed emoji drawing in statuses of group call participants.

This commit is contained in:
23rd 2024-03-15 03:06:05 +03:00 committed by John Preston
parent 9e18236b55
commit c3ca8c6258
2 changed files with 30 additions and 27 deletions

View file

@ -129,7 +129,7 @@ MembersRow::MembersRow(
: PeerListRow(participantPeer) : PeerListRow(participantPeer)
, _delegate(delegate) { , _delegate(delegate) {
refreshStatus(); refreshStatus();
_aboutText = participantPeer->about(); _about.setText(st::defaultTextStyle, participantPeer->about());
} }
MembersRow::~MembersRow() = default; MembersRow::~MembersRow() = default;
@ -562,10 +562,10 @@ void MembersRow::paintStatusIcon(
} }
void MembersRow::setAbout(const QString &about) { void MembersRow::setAbout(const QString &about) {
if (_aboutText == about) { if (_about.toString() == about) {
return; return;
} }
_aboutText = about; _about.setText(st::defaultTextStyle, about);
_delegate->rowUpdateRow(this); _delegate->rowUpdateRow(this);
} }
@ -610,13 +610,11 @@ void MembersRow::paintComplexStatusText(
x += skip; x += skip;
availableWidth -= skip; availableWidth -= skip;
const auto &font = st::normalFont; const auto &font = st::normalFont;
const auto about = (style == MembersRowStyle::Video) const auto useAbout = (style == MembersRowStyle::Video)
? QString() ? false
: ((_state == State::RaisedHand && !_raisedHandStatus) : ((_state == State::RaisedHand && !_raisedHandStatus)
|| (_state != State::RaisedHand && !_speaking)) || (_state != State::RaisedHand && !_speaking));
? _aboutText if (!useAbout
: QString();
if (about.isEmpty()
&& _state != State::Invited && _state != State::Invited
&& !_mutedByMe) { && !_mutedByMe) {
paintStatusIcon(p, x, y, st, font, selected, narrowMode); paintStatusIcon(p, x, y, st, font, selected, narrowMode);
@ -641,26 +639,31 @@ void MembersRow::paintComplexStatusText(
selected); selected);
return; return;
} }
p.setFont(font); p.setPen((style == MembersRowStyle::Video)
if (style == MembersRowStyle::Video) { ? st::groupCallVideoSubTextFg
p.setPen(st::groupCallVideoSubTextFg); : _mutedByMe
} else if (_mutedByMe) { ? st::groupCallMemberMutedIcon
p.setPen(st::groupCallMemberMutedIcon); : st::groupCallMemberNotJoinedStatus);
if (!_mutedByMe && useAbout) {
return _about.draw(p, {
.position = QPoint(x, y),
.outerWidth = outerWidth,
.availableWidth = availableWidth,
.elisionLines = 1,
});
} else { } else {
p.setPen(st::groupCallMemberNotJoinedStatus); p.setFont(font);
}
p.drawTextLeft( p.drawTextLeft(
x, x,
y, y,
outerWidth, outerWidth,
(_mutedByMe (_mutedByMe
? tr::lng_group_call_muted_by_me_status(tr::now) ? tr::lng_group_call_muted_by_me_status(tr::now)
: !about.isEmpty()
? font->elided(about, availableWidth)
: _delegate->rowIsMe(peer()) : _delegate->rowIsMe(peer())
? tr::lng_status_connecting(tr::now) ? tr::lng_status_connecting(tr::now)
: tr::lng_group_call_invited_status(tr::now))); : tr::lng_group_call_invited_status(tr::now)));
} }
}
QSize MembersRow::rightActionSize() const { QSize MembersRow::rightActionSize() const {
return _delegate->rowIsNarrow() ? QSize() : QSize( return _delegate->rowIsNarrow() ? QSize() : QSize(

View file

@ -208,7 +208,7 @@ private:
Ui::Animations::Simple _speakingAnimation; // For gray-red/green icon. Ui::Animations::Simple _speakingAnimation; // For gray-red/green icon.
Ui::Animations::Simple _mutedAnimation; // For gray/red icon. Ui::Animations::Simple _mutedAnimation; // For gray/red icon.
Ui::Animations::Simple _activeAnimation; // For icon cross animation. Ui::Animations::Simple _activeAnimation; // For icon cross animation.
QString _aboutText; Ui::Text::String _about;
crl::time _speakingLastTime = 0; crl::time _speakingLastTime = 0;
uint64 _raisedHandRating = 0; uint64 _raisedHandRating = 0;
int _volume = Group::kDefaultVolume; int _volume = Group::kDefaultVolume;