From 34f5400e99eb0ecbf402fd5e7961dfed7b076ed2 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 2 Sep 2019 23:28:05 +0200 Subject: Implement TextMessage delegate Text selection over multiple items doesn't work yet --- src/timeline2/TimelineModel.h | 66 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 3 deletions(-) (limited to 'src/timeline2/TimelineModel.h') diff --git a/src/timeline2/TimelineModel.h b/src/timeline2/TimelineModel.h index e2c7b73a..3af94643 100644 --- a/src/timeline2/TimelineModel.h +++ b/src/timeline2/TimelineModel.h @@ -7,6 +7,65 @@ #include +namespace qml_mtx_events { +Q_NAMESPACE + +enum EventType +{ + // Unsupported event + Unsupported, + /// m.room_key_request + KeyRequest, + /// m.room.aliases + Aliases, + /// m.room.avatar + Avatar, + /// m.room.canonical_alias + CanonicalAlias, + /// m.room.create + Create, + /// m.room.encrypted. + Encrypted, + /// m.room.encryption. + Encryption, + /// m.room.guest_access + GuestAccess, + /// m.room.history_visibility + HistoryVisibility, + /// m.room.join_rules + JoinRules, + /// m.room.member + Member, + /// m.room.name + Name, + /// m.room.power_levels + PowerLevels, + /// m.room.tombstone + Tombstone, + /// m.room.topic + Topic, + /// m.room.redaction + Redaction, + /// m.room.pinned_events + PinnedEvents, + // m.sticker + Sticker, + // m.tag + Tag, + /// m.room.message + AudioMessage, + EmoteMessage, + FileMessage, + ImageMessage, + LocationMessage, + NoticeMessage, + TextMessage, + VideoMessage, + UnknownMessage, +}; +Q_ENUM_NS(EventType) +} + class TimelineModel : public QAbstractListModel { Q_OBJECT @@ -26,8 +85,8 @@ public: }; QHash roleNames() const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; Q_INVOKABLE QColor userColor(QString id, QColor background); Q_INVOKABLE QString displayName(QString id) const; @@ -40,6 +99,7 @@ public slots: private slots: // Add old events at the top of the timeline. + void addBackwardsEvents(const mtx::responses::Messages &msgs); signals: @@ -57,4 +117,4 @@ private: QHash userColors; }; - + -- cgit 1.5.1