X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fmessagemodel.h;h=2439d1e0f5fe76bc3ff39cd1fd91821291e285e7;hp=b6b783fb0142150ff0f4aeecd49dc2ad8ecadef2;hb=a66ec86776c22be7b4b57db18a29d3d82e3be1da;hpb=6094c0f6c518be54335adf4ec3e909493a06ebd3 diff --git a/src/client/messagemodel.h b/src/client/messagemodel.h index b6b783fb..2439d1e0 100644 --- a/src/client/messagemodel.h +++ b/src/client/messagemodel.h @@ -34,10 +34,12 @@ class MessageModel : public QAbstractItemModel { Q_OBJECT public: - enum MessageRole { + enum MessageModelRole { DisplayRole = Qt::DisplayRole, EditRole = Qt::EditRole, - MsgIdRole = Qt::UserRole, + BackgroundRole = Qt::BackgroundRole, + MessageRole = Qt::UserRole, + MsgIdRole, BufferIdRole, TypeRole, FlagsRole, @@ -54,7 +56,7 @@ public: MessageModel(QObject *parent); - inline QModelIndex index(int row, int column, const QModelIndex &/*parent*/ = QModelIndex()) const { return createIndex(row, column); } + inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; inline QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } inline int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : messageCount(); } inline int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return 3; } @@ -69,6 +71,9 @@ public: void clear(); +signals: + void finishedBacklogFetch(BufferId bufferId); + public slots: void requestBacklog(BufferId bufferId); void messagesReceived(BufferId bufferId, int count); @@ -109,6 +114,14 @@ private: QHash _messagesWaiting; }; +// inlines +QModelIndex MessageModel::index(int row, int column, const QModelIndex &parent) const { + if(row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent)) + return QModelIndex(); + + return createIndex(row, column); +} + // ************************************************** // MessageModelItem // ************************************************** @@ -140,7 +153,6 @@ public: static bool lessThan(const MessageModelItem *m1, const MessageModelItem *m2); private: - Message _msg; BufferId _redirectedTo; };