A widget that manages and displays messages within a CommunicationStream.
More...
#include <stream_display.h>
|
| struct | MessageData |
| | Internal struct to hold data for messages waiting in the queue. More...
|
| |
|
| void | AddMessage (const QString &message, const QString &message_id, StreamMessage::MessageType type) |
| | Adds a new message to the display queue or updates an existing progress message. If the message_id is provided and corresponds to a currently displayed progress message, the content of that message is updated. Otherwise, a new MessageData entry is created (extracting sender, checking for attachments) and added to the processing queue. Starts the processing timer if the queue was empty.
|
| |
| void | Clear () |
| | Clears all messages from the display and the processing queue. Calls ClearMessages() on the CommunicationStream, clears the internal queue and map, and stops the message processing timer.
|
| |
| void | SetFrequency (const QString &frequency, const QString &name=QString()) |
| | Sets the frequency identifier and optional name for the stream. Updates the name displayed in the CommunicationStream and clears any existing messages.
|
| |
| | StreamDisplay (QWidget *parent=nullptr) |
| | Constructs a WavelengthStreamDisplay widget. Creates the main layout, instantiates the CommunicationStream, initializes the message queue, progress message map, and the message processing timer.
|
| |
|
| void | OnStreamMessageDestroyed (const QObject *object) |
| | Slot called when a StreamMessage associated with a progress ID is destroyed. Removes the corresponding entry from the displayed_progress_messages_ map to prevent dangling pointers and incorrect update attempts.
|
| |
| void | ProcessNextQueuedMessage () |
| | Processes the next message from the message_queue_. Dequeues a message, checks if it's an update to an existing progress message. If not, calls the appropriate AddMessage method on CommunicationStream. If it's a progress message, adds the returned StreamMessage pointer to the displayed_progress_messages_ map and connects its destroyed() signal. Restarts the timer with a random delay if the queue is not empty.
|
| |
A widget that manages and displays messages within a CommunicationStream.
This class acts as a controller for the CommunicationStream widget. It receives messages via the AddMessage slot, queues them, and processes them sequentially with a delay to create a staggered display effect. It handles updating existing progress messages based on their unique ID and manages the lifecycle of displayed messages. It also provides slots to forward control signals (like audio amplitude and transmitting user) to the underlying CommunicationStream.
◆ StreamDisplay()
| StreamDisplay::StreamDisplay |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a WavelengthStreamDisplay widget. Creates the main layout, instantiates the CommunicationStream, initializes the message queue, progress message map, and the message processing timer.
- Parameters
-
| parent | Optional parent widget. |
◆ AddMessage()
Adds a new message to the display queue or updates an existing progress message. If the message_id is provided and corresponds to a currently displayed progress message, the content of that message is updated. Otherwise, a new MessageData entry is created (extracting sender, checking for attachments) and added to the processing queue. Starts the processing timer if the queue was empty.
- Parameters
-
| message | The message content (potentially HTML). |
| message_id | A unique identifier for progress messages, empty otherwise. |
| type | The type of the message (Received, Transmitted, System). |
◆ Clear()
| void StreamDisplay::Clear |
( |
| ) |
|
Clears all messages from the display and the processing queue. Calls ClearMessages() on the CommunicationStream, clears the internal queue and map, and stops the message processing timer.
◆ ClearTransmittingUser
| void StreamDisplay::ClearTransmittingUser |
( |
| ) |
const |
|
slot |
◆ OnStreamMessageDestroyed
| void StreamDisplay::OnStreamMessageDestroyed |
( |
const QObject * | object | ) |
|
|
privateslot |
Slot called when a StreamMessage associated with a progress ID is destroyed. Removes the corresponding entry from the displayed_progress_messages_ map to prevent dangling pointers and incorrect update attempts.
- Parameters
-
| object | Pointer to the QObject that was destroyed (the StreamMessage). |
◆ ProcessNextQueuedMessage
| void StreamDisplay::ProcessNextQueuedMessage |
( |
| ) |
|
|
privateslot |
Processes the next message from the message_queue_. Dequeues a message, checks if it's an update to an existing progress message. If not, calls the appropriate AddMessage method on CommunicationStream. If it's a progress message, adds the returned StreamMessage pointer to the displayed_progress_messages_ map and connects its destroyed() signal. Restarts the timer with a random delay if the queue is not empty.
◆ SetAudioAmplitude
| void StreamDisplay::SetAudioAmplitude |
( |
qreal | amplitude | ) |
const |
|
slot |
Forwards the audio amplitude level to the CommunicationStream.
- Parameters
-
| amplitude | The current audio amplitude level. |
◆ SetFrequency()
| void StreamDisplay::SetFrequency |
( |
const QString & | frequency, |
|
|
const QString & | name = QString() ) |
Sets the frequency identifier and optional name for the stream. Updates the name displayed in the CommunicationStream and clears any existing messages.
- Parameters
-
| frequency | The frequency identifier (e.g., "100.0"). |
| name | Optional display name for the frequency. |
◆ SetGlitchIntensity
| void StreamDisplay::SetGlitchIntensity |
( |
qreal | intensity | ) |
const |
|
slot |
Sets the intensity of the glitch effect in the CommunicationStream.
- Parameters
-
| intensity | The desired glitch intensity level. |
◆ SetTransmittingUser
| void StreamDisplay::SetTransmittingUser |
( |
const QString & | userId | ) |
const |
|
slot |
Forwards the transmitting user ID to the CommunicationStream.
- Parameters
-
| userId | The identifier of the user currently transmitting audio. |
◆ communication_stream_
The underlying widget that handles the visual rendering of the stream and messages.
◆ displayed_progress_messages_
| QMap<QString, StreamMessage *> StreamDisplay::displayed_progress_messages_ |
|
private |
Map tracking currently displayed progress messages by their unique ID to allow updates.
◆ message_queue_
Queue holding messages waiting to be processed and displayed.
◆ message_timer_
| QTimer* StreamDisplay::message_timer_ |
|
private |
Timer controlling the delay between displaying queued messages.
The documentation for this class was generated from the following files: