diff options
Diffstat (limited to 'src/ReadReceiptsModel.h')
-rw-r--r-- | src/ReadReceiptsModel.h | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/src/ReadReceiptsModel.h b/src/ReadReceiptsModel.h index d90bf7c1..98e41f8f 100644 --- a/src/ReadReceiptsModel.h +++ b/src/ReadReceiptsModel.h @@ -8,40 +8,7 @@ #include <QAbstractListModel> #include <QObject> #include <QString> - -class ReadReceipt : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString mxid READ mxid CONSTANT) - Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged) - Q_PROPERTY(QString avatarUrl READ avatarUrl NOTIFY avatarUrlChanged) - Q_PROPERTY(QString timestamp READ timestamp CONSTANT) - -public: - explicit ReadReceipt(QString mxid, - QString room_id, - uint64_t timestamp, - QObject *parent = nullptr); - - QString mxid() const { return mxid_; } - QString displayName() const { return displayName_; } - QString avatarUrl() const { return avatarUrl_; } - QString timestamp() const; - -signals: - void displayNameChanged(); - void avatarUrlChanged(); - -private: - QString dateFormat(const QDateTime &then) const; - - QString mxid_; - QString room_id_; - QString displayName_; - QString avatarUrl_; - uint64_t timestamp_; -}; +#include <QDateTime> class ReadReceiptsModel : public QAbstractListModel { @@ -60,7 +27,6 @@ public: }; explicit ReadReceiptsModel(QString event_id, QString room_id, QObject *parent = nullptr); - ~ReadReceiptsModel() override; QString eventId() const { return event_id_; } QString roomId() const { return room_id_; } @@ -77,10 +43,11 @@ public slots: void addUsers(const std::multimap<uint64_t, std::string, std::greater<uint64_t>> &users); private: + QString dateFormat(const QDateTime &then) const; + QString event_id_; QString room_id_; - QVector<ReadReceipt *> readReceipts_; - std::multimap<uint64_t, std::string, std::greater<uint64_t>> users_; + QVector<QPair<QString, QDateTime>> readReceipts_; }; #endif // READRECEIPTSMODEL_H |