X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fmessagemodel.h;h=2439d1e0f5fe76bc3ff39cd1fd91821291e285e7;hp=2e30dd2105e53d86209eb25da2d455210a84a40a;hb=d8d9cc49774faf66170790ea687c37584e5e7a51;hpb=2c16b8e356817cb4a4bf7fcd59c0c7429b0100e1 diff --git a/src/client/messagemodel.h b/src/client/messagemodel.h index 2e30dd21..2439d1e0 100644 --- a/src/client/messagemodel.h +++ b/src/client/messagemodel.h @@ -34,11 +34,12 @@ class MessageModel : public QAbstractItemModel { Q_OBJECT public: - enum MessageRole { + enum MessageModelRole { DisplayRole = Qt::DisplayRole, EditRole = Qt::EditRole, BackgroundRole = Qt::BackgroundRole, - MsgIdRole = Qt::UserRole, + MessageRole = Qt::UserRole, + MsgIdRole, BufferIdRole, TypeRole, FlagsRole, @@ -55,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; } @@ -70,6 +71,9 @@ public: void clear(); +signals: + void finishedBacklogFetch(BufferId bufferId); + public slots: void requestBacklog(BufferId bufferId); void messagesReceived(BufferId bufferId, int count); @@ -110,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 // ************************************************** @@ -141,7 +153,6 @@ public: static bool lessThan(const MessageModelItem *m1, const MessageModelItem *m2); private: - Message _msg; BufferId _redirectedTo; };