| 29 | } |
| 30 | |
| 31 | class MessageEventModel: public QAbstractListModel |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | public: |
| 35 | enum EventRoles { |
| 36 | EventTypeRole = Qt::UserRole + 1, |
| 37 | TimeRole, |
| 38 | DateRole, |
| 39 | AuthorRole, |
| 40 | ContentRole |
| 41 | }; |
| 42 | |
| 43 | MessageEventModel(QObject* parent=0); |
| 44 | virtual ~MessageEventModel(); |
| 45 | |
| 46 | Q_INVOKABLE void setConnection(QMatrixClient::Connection* connection); |
| 47 | Q_INVOKABLE void changeRoom(QMatrixClient::Room* room); |
| 48 | |
| 49 | //override QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const; |
| 50 | //override QModelIndex parent(const QModelIndex& index) const; |
| 51 | int rowCount(const QModelIndex& parent) const override; |
| 52 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
| 53 | QHash<int, QByteArray> roleNames() const override; |
| 54 | |
| 55 | public slots: |
| 56 | void newMessage(QMatrixClient::Event* messageEvent); |
| 57 | |
| 58 | private: |
| 59 | QMatrixClient::Connection* m_connection; |
| 60 | QMatrixClient::Room* m_currentRoom; |
| 61 | QList<QMatrixClient::Event*> m_currentMessages; |
| 62 | }; |
| 63 | |
| 64 | #endif // LOGMESSAGEMODEL_H |
nothing calls this directly
no outgoing calls
no test coverage detected