Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
MessageModel Class Reference

#include </tmp/quassel/src/client/messagemodel.h>

Inheritance diagram for MessageModel:

Public Types

enum  MessageModelRole {
  DisplayRole = Qt::DisplayRole, EditRole = Qt::EditRole, BackgroundRole = Qt::BackgroundRole, MessageRole = Qt::UserRole,
  MsgIdRole, BufferIdRole, TypeRole, FlagsRole,
  TimestampRole, FormatRole, ColumnTypeRole, RedirectedToRole,
  UserRole
}
enum  ColumnType { TimestampColumn, SenderColumn, ContentsColumn, UserColumnType }

Public Slots

void requestBacklog (BufferId bufferId)
void messagesReceived (BufferId bufferId, int count)
void buffersPermanentlyMerged (BufferId bufferId1, BufferId bufferId2)
void insertErrorMessage (BufferInfo bufferInfo, const QString &errorString)

Signals

void finishedBacklogFetch (BufferId bufferId)

Public Member Functions

 MessageModel (QObject *parent)
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
QModelIndex parent (const QModelIndex &) const
int rowCount (const QModelIndex &parent=QModelIndex()) const
int columnCount (const QModelIndex &=QModelIndex()) const
virtual QVariant data (const QModelIndex &index, int role) const
virtual bool setData (const QModelIndex &index, const QVariant &value, int role)
bool insertMessage (const Message &, bool fakeMsg=false)
void insertMessages (const QList< Message > &)
void clear ()

Protected Member Functions

virtual int messageCount () const =0
virtual bool messagesIsEmpty () const =0
virtual const MessageModelItemmessageItemAt (int i) const =0
virtual MessageModelItemmessageItemAt (int i)=0
virtual const MessageModelItemfirstMessageItem () const =0
virtual MessageModelItemfirstMessageItem ()=0
virtual const MessageModelItemlastMessageItem () const =0
virtual MessageModelItemlastMessageItem ()=0
virtual void insertMessage__ (int pos, const Message &)=0
virtual void insertMessages__ (int pos, const QList< Message > &)=0
virtual void removeMessageAt (int i)=0
virtual void removeAllMessages ()=0
virtual Message takeMessageAt (int i)=0
virtual void customEvent (QEvent *event)

Private Slots

void changeOfDay ()

Private Member Functions

void insertMessageGroup (const QList< Message > &)
int insertMessagesGracefully (const QList< Message > &)
int indexForId (MsgId)

Private Attributes

QList< Message_messageBuffer
QTimer _dayChangeTimer
QDateTime _nextDayChange
QHash< BufferId, int > _messagesWaiting

Detailed Description

Definition at line 34 of file messagemodel.h.

Member Enumeration Documentation

Enumerator:
DisplayRole 
EditRole 
BackgroundRole 
MessageRole 
MsgIdRole 
BufferIdRole 
TypeRole 
FlagsRole 
TimestampRole 
FormatRole 
ColumnTypeRole 
RedirectedToRole 
UserRole 

Definition at line 39 of file messagemodel.h.

enum ColumnType
Enumerator:
TimestampColumn 
SenderColumn 
ContentsColumn 
UserColumnType 

Definition at line 55 of file messagemodel.h.

Constructor & Destructor Documentation

MessageModel ( QObject *  parent)

Definition at line 38 of file messagemodel.cpp.

References _dayChangeTimer, _nextDayChange, and changeOfDay().

Member Function Documentation

QModelIndex index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
inline
QModelIndex parent ( const QModelIndex &  ) const
inline

Definition at line 62 of file messagemodel.h.

Referenced by rowCount().

int rowCount ( const QModelIndex &  parent = QModelIndex()) const
inline

Definition at line 63 of file messagemodel.h.

References messageCount(), and parent().

Referenced by clear(), index(), and ChatLineModel::styleChanged().

int columnCount ( const QModelIndex &  = QModelIndex()) const
inline

Definition at line 64 of file messagemodel.h.

Referenced by index(), and ChatLineModel::styleChanged().

QVariant data ( const QModelIndex &  index,
int  role 
) const
virtual
bool setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
virtual

Definition at line 66 of file messagemodel.cpp.

References messageCount(), and messageItemAt().

bool insertMessage ( const Message msg,
bool  fakeMsg = false 
)
void insertMessages ( const QList< Message > &  msglist)

Definition at line 94 of file messagemodel.cpp.

References _messageBuffer, and insertMessagesGracefully().

Referenced by QtUiMessageProcessor::process().

void clear ( )

Definition at line 329 of file messagemodel.cpp.

References _messagesWaiting, removeAllMessages(), and rowCount().

Referenced by Client::setDisconnectedFromCore().

void finishedBacklogFetch ( BufferId  bufferId)
signal

Referenced by messagesReceived().

void messagesReceived ( BufferId  bufferId,
int  count 
)
slot

Definition at line 415 of file messagemodel.cpp.

References _messagesWaiting, and finishedBacklogFetch().

void buffersPermanentlyMerged ( BufferId  bufferId1,
BufferId  bufferId2 
)
slot
void insertErrorMessage ( BufferInfo  bufferInfo,
const QString &  errorString 
)
slot
virtual bool messagesIsEmpty ( ) const
protectedpure virtual
virtual MessageModelItem* messageItemAt ( int  i)
protectedpure virtual

Implemented in ChatLineModel.

virtual const MessageModelItem* firstMessageItem ( ) const
protectedpure virtual

Implemented in ChatLineModel.

virtual MessageModelItem* firstMessageItem ( )
protectedpure virtual

Implemented in ChatLineModel.

virtual const MessageModelItem* lastMessageItem ( ) const
protectedpure virtual

Implemented in ChatLineModel.

Referenced by indexForId().

virtual MessageModelItem* lastMessageItem ( )
protectedpure virtual

Implemented in ChatLineModel.

virtual void insertMessage__ ( int  pos,
const Message  
)
protectedpure virtual
virtual void insertMessages__ ( int  pos,
const QList< Message > &   
)
protectedpure virtual

Implemented in ChatLineModel.

Referenced by insertMessageGroup().

virtual void removeMessageAt ( int  i)
protectedpure virtual

Implemented in ChatLineModel.

virtual void removeAllMessages ( )
protectedpure virtual

Implemented in ChatLineModel.

Referenced by clear().

virtual Message takeMessageAt ( int  i)
protectedpure virtual

Implemented in ChatLineModel.

Referenced by insertMessageGroup().

void customEvent ( QEvent *  event)
protectedvirtual

Definition at line 308 of file messagemodel.cpp.

References _messageBuffer, and insertMessagesGracefully().

void changeOfDay ( )
privateslot
int insertMessagesGracefully ( const QList< Message > &  msglist)
private

Member Data Documentation

QList<Message> _messageBuffer
private

Definition at line 113 of file messagemodel.h.

Referenced by customEvent(), and insertMessages().

QTimer _dayChangeTimer
private

Definition at line 114 of file messagemodel.h.

Referenced by changeOfDay(), and MessageModel().

QDateTime _nextDayChange
private

Definition at line 115 of file messagemodel.h.

Referenced by changeOfDay(), and MessageModel().

QHash<BufferId, int> _messagesWaiting
private

Definition at line 116 of file messagemodel.h.

Referenced by clear(), messagesReceived(), and requestBacklog().


The documentation for this class was generated from the following files: