qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Private Attributes | List of all members
ChatMessage Class Reference

#include <chatmessage.h>

Inheritance diagram for ChatMessage:
Inheritance graph
Collaboration diagram for ChatMessage:
Collaboration graph

Public Types

enum  SystemMessageType { INFO, ERROR, TYPING }
 
enum  MessageType { NORMAL, ACTION, ALERT }
 
using Ptr = std::shared_ptr< ChatMessage >
 
- Public Types inherited from ChatLine
using Ptr = std::shared_ptr< ChatLine >
 

Public Member Functions

 ChatMessage ()
 
 ~ChatMessage ()
 
 ChatMessage (const ChatMessage &)=default
 
ChatMessageoperator= (const ChatMessage &)=default
 
 ChatMessage (ChatMessage &&)=default
 
void markAsDelivered (const QDateTime &time)
 
void markAsBroken ()
 
QString toString () const
 
bool isAction () const
 
void setAsAction ()
 
void hideSender ()
 
void hideDate ()
 
- Public Member Functions inherited from ChatLine
 ChatLine ()
 
virtual ~ChatLine ()
 
QRectF sceneBoundingRect () const
 
void replaceContent (int col, ChatLineContent *lineContent)
 
void layout (qreal width, QPointF scenePos)
 
void moveBy (qreal deltaY)
 
void removeFromScene ()
 
void addToScene (QGraphicsScene *scene)
 
void setVisible (bool visible)
 
void selectionCleared ()
 
void selectionFocusChanged (bool focusIn)
 
void fontChanged (const QFont &font)
 
void reloadTheme ()
 
int getColumnCount ()
 
ChatLineContentgetContent (int col) const
 
ChatLineContentgetContent (QPointF scenePos) const
 
bool isOverSelection (QPointF scenePos)
 

Static Public Member Functions

static ChatMessage::Ptr createChatMessage (const QString &sender, const QString &rawMessage, MessageType type, bool isMe, MessageState state, const QDateTime &date, bool colorizeName=false)
 
static ChatMessage::Ptr createChatInfoMessage (const QString &rawMessage, SystemMessageType type, const QDateTime &date)
 
static ChatMessage::Ptr createFileTransferMessage (const QString &sender, CoreFile &coreFile, ToxFile file, bool isMe, const QDateTime &date)
 
static ChatMessage::Ptr createTypingNotification ()
 
static ChatMessage::Ptr createBusyNotification ()
 Create message placeholder while chatform restructures text. More...
 
- Static Public Member Functions inherited from ChatLine
static bool lessThanBSRectTop (const ChatLine::Ptr &lhs, const qreal &rhs)
 
static bool lessThanBSRectBottom (const ChatLine::Ptr &lhs, const qreal &rhs)
 

Static Protected Member Functions

static QString detectQuotes (const QString &str, MessageType type)
 
static QString wrapDiv (const QString &str, const QString &div)
 

Private Attributes

bool action = false
 

Additional Inherited Members

- Protected Member Functions inherited from ChatLine
QPointF mapToContent (ChatLineContent *c, QPointF pos)
 
void addColumn (ChatLineContent *item, ColumnFormat fmt)
 
void updateBBox ()
 
void visibilityChanged (bool visible)
 

Detailed Description

Definition at line 31 of file chatmessage.h.

Member Typedef Documentation

◆ Ptr

using ChatMessage::Ptr = std::shared_ptr<ChatMessage>

Definition at line 34 of file chatmessage.h.

Member Enumeration Documentation

◆ MessageType

Enumerator
NORMAL 
ACTION 
ALERT 

Definition at line 43 of file chatmessage.h.

◆ SystemMessageType

Enumerator
INFO 
ERROR 
TYPING 

Definition at line 36 of file chatmessage.h.

Constructor & Destructor Documentation

◆ ChatMessage() [1/3]

ChatMessage::ChatMessage ( )

Definition at line 44 of file chatmessage.cpp.

◆ ~ChatMessage()

ChatMessage::~ChatMessage ( )
default

◆ ChatMessage() [2/3]

ChatMessage::ChatMessage ( const ChatMessage )
default

◆ ChatMessage() [3/3]

ChatMessage::ChatMessage ( ChatMessage &&  )
default

Member Function Documentation

◆ createBusyNotification()

ChatMessage::Ptr ChatMessage::createBusyNotification ( )
static

Create message placeholder while chatform restructures text.

It can take a while for chatform to resize large amounts of text, thus a message placeholder is needed to inform users about it.

Returns
created message

Definition at line 216 of file chatmessage.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createChatInfoMessage()

ChatMessage::Ptr ChatMessage::createChatInfoMessage ( const QString &  rawMessage,
SystemMessageType  type,
const QDateTime &  date 
)
static

Definition at line 135 of file chatmessage.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createChatMessage()

ChatMessage::Ptr ChatMessage::createChatMessage ( const QString &  sender,
const QString &  rawMessage,
MessageType  type,
bool  isMe,
MessageState  state,
const QDateTime &  date,
bool  colorizeName = false 
)
static

Definition at line 50 of file chatmessage.cpp.

◆ createFileTransferMessage()

ChatMessage::Ptr ChatMessage::createFileTransferMessage ( const QString &  sender,
CoreFile coreFile,
ToxFile  file,
bool  isMe,
const QDateTime &  date 
)
static

Definition at line 166 of file chatmessage.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createTypingNotification()

ChatMessage::Ptr ChatMessage::createTypingNotification ( )
static

Definition at line 187 of file chatmessage.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ detectQuotes()

QString ChatMessage::detectQuotes ( const QString &  str,
MessageType  type 
)
staticprotected

Definition at line 275 of file chatmessage.cpp.

◆ hideDate()

void ChatMessage::hideDate ( )

Definition at line 268 of file chatmessage.cpp.

Here is the call graph for this function:

◆ hideSender()

void ChatMessage::hideSender ( )

Definition at line 261 of file chatmessage.cpp.

Here is the call graph for this function:

◆ isAction()

bool ChatMessage::isAction ( ) const

Definition at line 251 of file chatmessage.cpp.

◆ markAsBroken()

void ChatMessage::markAsBroken ( )

Definition at line 237 of file chatmessage.cpp.

Here is the call graph for this function:

◆ markAsDelivered()

void ChatMessage::markAsDelivered ( const QDateTime &  time)

Definition at line 229 of file chatmessage.cpp.

Here is the call graph for this function:

◆ operator=()

ChatMessage& ChatMessage::operator= ( const ChatMessage )
default

◆ setAsAction()

void ChatMessage::setAsAction ( )

Definition at line 256 of file chatmessage.cpp.

◆ toString()

QString ChatMessage::toString ( ) const

Definition at line 242 of file chatmessage.cpp.

Here is the call graph for this function:

◆ wrapDiv()

QString ChatMessage::wrapDiv ( const QString &  str,
const QString &  div 
)
staticprotected

Definition at line 301 of file chatmessage.cpp.

Member Data Documentation

◆ action

bool ChatMessage::action = false
private

Definition at line 79 of file chatmessage.h.


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