mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Fix emoji in new RoomList
This commit is contained in:
parent
beeb60e4a1
commit
f3d956aebc
6 changed files with 17 additions and 2 deletions
|
@ -13,7 +13,7 @@ Label {
|
|||
property alias elideWidth: metrics.elideWidth
|
||||
|
||||
color: Nheko.colors.text
|
||||
text: metrics.elidedText
|
||||
text: (textFormat == Text.PlainText) ? metrics.elidedText : TimelineManager.escapeEmoji(TimelineManager.htmlEscape(metrics.elidedText))
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.PlainText
|
||||
|
|
|
@ -119,6 +119,7 @@ Page {
|
|||
color: roomItem.importantText
|
||||
elideWidth: textContent.width - timestamp.width - Nheko.paddingMedium
|
||||
fullText: model.roomName
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -146,6 +147,7 @@ Page {
|
|||
font.pixelSize: fontMetrics.font.pixelSize * 0.9
|
||||
elideWidth: textContent.width - (notificationBubble.visible ? notificationBubble.width : 0) - Nheko.paddingSmall
|
||||
fullText: model.lastMessage
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
|
||||
Item {
|
||||
|
|
|
@ -62,7 +62,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const
|
|||
case Roles::AvatarUrl:
|
||||
return room->roomAvatarUrl();
|
||||
case Roles::RoomName:
|
||||
return room->roomName();
|
||||
return room->plainRoomName();
|
||||
case Roles::RoomId:
|
||||
return room->roomId();
|
||||
case Roles::LastMessage:
|
||||
|
|
|
@ -1890,6 +1890,17 @@ TimelineModel::roomName() const
|
|||
QString::fromStdString(info[room_id_].name).toHtmlEscaped());
|
||||
}
|
||||
|
||||
QString
|
||||
TimelineModel::plainRoomName() const
|
||||
{
|
||||
auto info = cache::getRoomInfo({room_id_.toStdString()});
|
||||
|
||||
if (!info.count(room_id_))
|
||||
return "";
|
||||
else
|
||||
return QString::fromStdString(info[room_id_].name);
|
||||
}
|
||||
|
||||
QString
|
||||
TimelineModel::roomAvatarUrl() const
|
||||
{
|
||||
|
|
|
@ -307,6 +307,7 @@ public slots:
|
|||
}
|
||||
|
||||
QString roomName() const;
|
||||
QString plainRoomName() const;
|
||||
QString roomTopic() const;
|
||||
InputBar *input() { return &input_; }
|
||||
Permissions *permissions() { return &permissions_; }
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId);
|
||||
Q_INVOKABLE QColor userColor(QString id, QColor background);
|
||||
Q_INVOKABLE QString escapeEmoji(QString str) const;
|
||||
Q_INVOKABLE QString htmlEscape(QString str) const { return str.toHtmlEscaped(); }
|
||||
|
||||
Q_INVOKABLE QString userPresence(QString id) const;
|
||||
Q_INVOKABLE QString userStatus(QString id) const;
|
||||
|
|
Loading…
Reference in a new issue