mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Don't use full dump for replies
This commit is contained in:
parent
f704e381c3
commit
9d6bc706ff
3 changed files with 29 additions and 20 deletions
|
@ -71,8 +71,6 @@ Item {
|
|||
RowLayout {
|
||||
id: row
|
||||
|
||||
property var replyData: chat.model.getDump(replyTo, eventId)
|
||||
|
||||
anchors.rightMargin: 1
|
||||
anchors.leftMargin: Nheko.avatarSize + 16
|
||||
anchors.left: parent.left
|
||||
|
@ -87,26 +85,30 @@ Item {
|
|||
|
||||
// fancy reply, if this is a reply
|
||||
Reply {
|
||||
function fromModel(role) {
|
||||
return replyTo != "" ? room.dataById(replyTo, role) : null;
|
||||
}
|
||||
|
||||
visible: replyTo
|
||||
userColor: TimelineManager.userColor(userId, Nheko.colors.base)
|
||||
blurhash: row.replyData.blurhash ?? ""
|
||||
body: row.replyData.body ?? ""
|
||||
formattedBody: row.replyData.formattedBody ?? ""
|
||||
eventId: row.replyData.eventId ?? ""
|
||||
filename: row.replyData.filename ?? ""
|
||||
filesize: row.replyData.filesize ?? ""
|
||||
proportionalHeight: row.replyData.proportionalHeight ?? 1
|
||||
type: row.replyData.type ?? MtxEvent.UnknownMessage
|
||||
typeString: row.replyData.typeString ?? ""
|
||||
url: row.replyData.url ?? ""
|
||||
originalWidth: row.replyData.originalWidth ?? 0
|
||||
isOnlyEmoji: row.replyData.isOnlyEmoji ?? false
|
||||
userId: row.replyData.userId ?? ""
|
||||
userName: row.replyData.userName ?? ""
|
||||
thumbnailUrl: row.replyData.thumbnailUrl ?? ""
|
||||
roomTopic: row.replyData.roomTopic ?? ""
|
||||
roomName: row.replyData.roomName ?? ""
|
||||
callType: row.replyData.callType ?? ""
|
||||
blurhash: fromModel(Room.Blurhash) ?? ""
|
||||
body: fromModel(Room.Body) ?? ""
|
||||
formattedBody: fromModel(Room.FormattedBody) ?? ""
|
||||
eventId: fromModel(Room.EventId) ?? ""
|
||||
filename: fromModel(Room.Filename) ?? ""
|
||||
filesize: fromModel(Room.Filesize) ?? ""
|
||||
proportionalHeight: fromModel(Room.ProportionalHeight) ?? 1
|
||||
type: fromModel(Room.Type) ?? MtxEvent.UnknownMessage
|
||||
typeString: fromModel(Room.TypeString) ?? ""
|
||||
url: fromModel(Room.Url) ?? ""
|
||||
originalWidth: fromModel(Room.OriginalWidth) ?? 0
|
||||
isOnlyEmoji: fromModel(Room.IsOnlyEmoji) ?? false
|
||||
userId: fromModel(Room.UserId) ?? ""
|
||||
userName: fromModel(Room.UserName) ?? ""
|
||||
thumbnailUrl: fromModel(Room.ThumbnailUrl) ?? ""
|
||||
roomTopic: fromModel(Room.RoomTopic) ?? ""
|
||||
roomName: fromModel(Room.RoomName) ?? ""
|
||||
callType: fromModel(Room.CallType) ?? ""
|
||||
}
|
||||
|
||||
// actual message content
|
||||
|
|
|
@ -209,11 +209,16 @@ public:
|
|||
CallType,
|
||||
Dump,
|
||||
};
|
||||
Q_ENUM(Roles);
|
||||
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant data(const mtx::events::collections::TimelineEvents &event, int role) const;
|
||||
Q_INVOKABLE QVariant dataById(QString id, int role)
|
||||
{
|
||||
return data(index(idToIndex(id)), role);
|
||||
}
|
||||
|
||||
bool canFetchMore(const QModelIndex &) const override;
|
||||
void fetchMore(const QModelIndex &) override;
|
||||
|
|
|
@ -178,6 +178,8 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
|||
0,
|
||||
"RoomSettingsModel",
|
||||
"Room Settings needs to be instantiated on the C++ side");
|
||||
qmlRegisterUncreatableType<TimelineModel>(
|
||||
"im.nheko", 1, 0, "Room", "Room needs to be instantiated on the C++ side");
|
||||
|
||||
static auto self = this;
|
||||
qmlRegisterSingletonType<MainWindow>(
|
||||
|
|
Loading…
Reference in a new issue