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,
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; }
void clear();
+signals:
+ void finishedBacklogFetch(BufferId bufferId);
+
public slots:
void requestBacklog(BufferId bufferId);
void messagesReceived(BufferId bufferId, int count);
QHash<BufferId, int> _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
// **************************************************
static bool lessThan(const MessageModelItem *m1, const MessageModelItem *m2);
private:
- Message _msg;
BufferId _redirectedTo;
};