|
VR-Engage
2.2
|
Data container for a single chat message entry.
DtChatEntry encapsulates a single chat message in the chat system, including the sender's username, force affiliation, target channel, message content, and display properties such as opacity and visibility. Each entry corresponds to one message bubble in the chat UI.
This simple data class demonstrates the pattern for Qt-compatible data objects. All fields use Qt types (QString, double) for seamless integration with Qt models.
#include <vreChatWindowModel.h>
Public Member Functions | |
| DtChatEntry (const std::string &username, int force, const std::string &channel, const std::string &message) | |
| ~DtChatEntry ()=default | |
| QString | username () const |
| void | setUsername (QString val) |
| QString | channel () const |
| void | setChannel (QString val) |
| int | force () const |
| void | setForce (int val) |
| QString | message () const |
| void | setMessage (QString val) |
| double | opacity () const |
| void | setOpacity (double val) |
| bool | timerStarted () const |
| void | setTimerStarted (bool val) |
| bool | visible () const |
| void | setVisible (bool val) |
| DtChatEntry () | |
| DtChatEntry (const QString &sender, const QString &receiver, const double time, const QString &message) | |
| QString | getSender () const |
| void | setSender (const QString &sender) |
| QString | getReceiver () const |
| void | setReceiver (const QString &receiver) |
| double | getTime () const |
| void | setTime (const double time) |
| QString | getMessage () const |
| void | setMessage (const QString &message) |
Protected Attributes | |
| QString | myUsername |
| QString | myChannel |
| int | myForce |
| QString | myMessage |
| double | myOpacity |
| bool | myTimerStarted |
| bool | myVisible |
| QString | mySender |
| QString | myReceiver |
| double | myTime |
| makVre::DtChatEntry::DtChatEntry | ( | const std::string & | username, |
| int | force, | ||
| const std::string & | channel, | ||
| const std::string & | message ) |
Constructor.
| username | Name of the user who sent the message |
| force | Force identifier of the sender (friendly=1, enemy=2, etc.) |
| channel | Target channel for the message |
| message | Content of the chat message |
Creates a new chat entry with the specified sender information and message content.
References channel(), force(), message(), and username().
|
default |
Default destructor.
| makVre::DtChatEntry::DtChatEntry | ( | ) |
Default constructor initializing empty chat entry.
| makVre::DtChatEntry::DtChatEntry | ( | const QString & | sender, |
| const QString & | receiver, | ||
| const double | time, | ||
| const QString & | message ) |
Constructor with all chat entry fields.
| sender | Entity name (marking text) who sent the message |
| receiver | Entity name (marking text) who received the message |
| time | Simulation time when message was sent |
| message | The text content of the message |
References message().
| QString makVre::DtChatEntry::username | ( | ) | const |
| void makVre::DtChatEntry::setUsername | ( | QString | val | ) |
Sets the username of the message sender.
| val | New username |
| QString makVre::DtChatEntry::channel | ( | ) | const |
Gets the channel the message was sent to.
Referenced by DtChatEntry().
| void makVre::DtChatEntry::setChannel | ( | QString | val | ) |
Sets the channel for the message.
| val | New channel name |
| int makVre::DtChatEntry::force | ( | ) | const |
Gets the force identifier of the sender.
Referenced by DtChatEntry().
| void makVre::DtChatEntry::setForce | ( | int | val | ) |
Sets the force identifier of the sender.
| val | New force identifier |
| QString makVre::DtChatEntry::message | ( | ) | const |
Gets the content of the message.
Referenced by DtChatEntry(), DtChatEntry(), and setMessage().
| void makVre::DtChatEntry::setMessage | ( | QString | val | ) |
Sets the content of the message.
| val | New message text |
| double makVre::DtChatEntry::opacity | ( | ) | const |
Gets the opacity of the message in the UI.
| void makVre::DtChatEntry::setOpacity | ( | double | val | ) |
Sets the opacity of the message in the UI.
| val | New opacity value |
| bool makVre::DtChatEntry::timerStarted | ( | ) | const |
Checks if the message fade timer has started.
| void makVre::DtChatEntry::setTimerStarted | ( | bool | val | ) |
Sets the timer started flag for message fading.
| val | New timer started state |
| bool makVre::DtChatEntry::visible | ( | ) | const |
Checks if the message is visible in the UI.
| void makVre::DtChatEntry::setVisible | ( | bool | val | ) |
Sets the visibility of the message in the UI.
| val | New visibility state |
| QString makVre::DtChatEntry::getSender | ( | ) | const |
Gets the sender's entity name.
| void makVre::DtChatEntry::setSender | ( | const QString & | sender | ) |
Sets the sender's entity name.
| QString makVre::DtChatEntry::getReceiver | ( | ) | const |
Gets the receiver's entity name.
| void makVre::DtChatEntry::setReceiver | ( | const QString & | receiver | ) |
Sets the receiver's entity name.
| double makVre::DtChatEntry::getTime | ( | ) | const |
Gets the simulation time of the message.
| void makVre::DtChatEntry::setTime | ( | const double | time | ) |
Sets the simulation time of the message.
| QString makVre::DtChatEntry::getMessage | ( | ) | const |
Gets the message text content.
| void makVre::DtChatEntry::setMessage | ( | const QString & | message | ) |
Sets the message text content.
References message().
|
protected |
Username of the message sender.
|
protected |
Channel the message was sent to.
|
protected |
Force identifier of the sender (friendly=1, enemy=2, etc.)
|
protected |
Content of the chat message.
Text content of message.
|
protected |
Opacity of the message in the UI (0.0 to 1.0)
|
protected |
Flag indicating if the fade timer has started.
|
protected |
Flag indicating if the message is visible in the UI.
|
protected |
Entity name of message sender.
|
protected |
Entity name of message receiver.
|
protected |
Simulation time of message.