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

View File

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