mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix QML emojis
This commit is contained in:
parent
bbbd5df75f
commit
8727831de7
4 changed files with 11 additions and 4 deletions
|
@ -173,8 +173,9 @@ Rectangle {
|
|||
|
||||
Text {
|
||||
id: userName
|
||||
text: chat.model.displayName(section.split(" ")[0])
|
||||
text: chat.model.escapeEmoji(chat.model.displayName(section.split(" ")[0]))
|
||||
color: chat.model.userColor(section.split(" ")[0], colors.window)
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,9 +40,8 @@ utils::replaceEmoji(const QString &body)
|
|||
for (auto &code : utf32_string) {
|
||||
// TODO: Be more precise here.
|
||||
if (code > 9000)
|
||||
fmtBody +=
|
||||
QString("<span style=\"font-family: " + userFontFamily + ";\">") +
|
||||
QString::fromUcs4(&code, 1) + "</span>";
|
||||
fmtBody += QString("<font face=\"" + userFontFamily + "\">") +
|
||||
QString::fromUcs4(&code, 1) + "</font>";
|
||||
else
|
||||
fmtBody += QString::fromUcs4(&code, 1);
|
||||
}
|
||||
|
|
|
@ -336,3 +336,9 @@ TimelineModel::formatDateSeparator(QDate date) const
|
|||
|
||||
return date.toString(fmt);
|
||||
}
|
||||
|
||||
QString
|
||||
TimelineModel::escapeEmoji(QString str) const
|
||||
{
|
||||
return utils::replaceEmoji(str);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
Q_INVOKABLE QColor userColor(QString id, QColor background);
|
||||
Q_INVOKABLE QString displayName(QString id) const;
|
||||
Q_INVOKABLE QString formatDateSeparator(QDate date) const;
|
||||
Q_INVOKABLE QString escapeEmoji(QString str) const;
|
||||
|
||||
void addEvents(const mtx::responses::Timeline &events);
|
||||
|
||||
|
|
Loading…
Reference in a new issue