Support emoji display in PeerListBox status texts.

This commit is contained in:
John Preston 2017-06-30 14:36:13 +03:00
parent 42febdb240
commit 51c0df79fe
2 changed files with 3 additions and 5 deletions

View File

@ -369,7 +369,7 @@ void PeerListRow::paintStatusText(Painter &p, int x, int y, int availableWidth,
auto statusHasOnlineColor = (_statusType == PeerListRow::StatusType::Online);
p.setFont(st::contactsStatusFont);
p.setPen(statusHasOnlineColor ? st::contactsStatusFgOnline : (selected ? st::contactsStatusFgOver : st::contactsStatusFg));
p.drawTextLeft(x, y, outerWidth, (_statusWidth <= availableWidth) ? _status : st::contactsStatusFont->elided(_status, availableWidth));
_status.drawLeftElided(p, x, y, availableWidth, outerWidth);
}
template <typename UpdateCallback>
@ -444,8 +444,7 @@ void PeerListRow::paintDisabledCheckUserpic(Painter &p, int x, int y, int outerW
}
void PeerListRow::setStatusText(const QString &text) {
_status = text;
_statusWidth = st::contactsStatusFont->width(_status);
_status.setText(st::defaultTextStyle, text, _textNameOptions);
}
float64 PeerListRow::checkedRatio() {

View File

@ -152,8 +152,7 @@ private:
std::unique_ptr<Ui::RippleAnimation> _ripple;
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
Text _name;
QString _status;
int _statusWidth = 0;
Text _status;
StatusType _statusType = StatusType::Online;
OrderedSet<QChar> _nameFirstChars;
int _absoluteIndex = -1;