1#ifndef WAVELENGTH_EVENT_BROKER_H
2#define WAVELENGTH_EVENT_BROKER_H
35 void PublishEvent(
const QString &event_type,
const QVariantMap &data = QVariantMap());
48 template<
typename Receiver,
typename Func>
49 requires std::derived_from<Receiver, QObject> &&
50 std::invocable<Func, const QVariantMap &>
51 void SubscribeToEvent(
const QString &event_type, Receiver *receiver, Func slot);
69 void MessageSent(
const QString &frequency,
const QString &message);
78 void UserKicked(
const QString &frequency,
const QString &reason);
81 void UiStateChanged(
const QString &component,
const QVariant &state);
84 void SystemMessage(
const QString &frequency,
const QString &message);
void WavelengthClosed(const QString &frequency)
Publishes a "wavelength_closed" event. Data: {"frequency": QString}.
Definition wavelength_event_broker.cpp:41
void WavelengthLeft(const QString &frequency)
Publishes a "wavelength_left" event. Data: {"frequency": QString}.
Definition wavelength_event_broker.cpp:35
WavelengthEventBroker & operator=(const WavelengthEventBroker &)=delete
Deleted assignment operator to prevent assignment.
void UserKicked(const QString &frequency, const QString &reason)
Publishes a "user_kicked" event. Data: {"frequency": QString, "reason": QString}.
Definition wavelength_event_broker.cpp:73
void AuthenticationFailed(const QString &frequency)
Publishes an "authentication_failed" event. Data: {"frequency": QString}.
Definition wavelength_event_broker.cpp:67
void MessageSent(const QString &frequency, const QString &message)
Publishes a "message_sent" event. Data: {"frequency": QString, "message": QString}...
Definition wavelength_event_broker.cpp:54
void WavelengthJoined(const QString &frequency)
Publishes a "wavelength_joined" event. Data: {"frequency": QString}.
Definition wavelength_event_broker.cpp:29
void ActiveWavelengthChanged(const QString &frequency)
Publishes an "active_wavelength_changed" event. Data: {"frequency": QString}.
Definition wavelength_event_broker.cpp:94
void WavelengthCreated(const QString &frequency)
Publishes a "wavelength_created" event. Data: {"frequency": QString}.
Definition wavelength_event_broker.cpp:23
void ConnectionError(const QString &error_message)
Publishes a "connection_error" event. Data: {"error": QString}.
Definition wavelength_event_broker.cpp:61
WavelengthEventBroker(const WavelengthEventBroker &)=delete
Deleted copy constructor to prevent copying.
WavelengthEventBroker(QObject *parent=nullptr)
Private constructor to enforce the singleton pattern.
Definition wavelength_event_broker.h:103
void UiStateChanged(const QString &component, const QVariant &state)
Publishes a "ui_state_changed" event. Data: {"component": QString, "state": QVariant}...
Definition wavelength_event_broker.cpp:80
static WavelengthEventBroker * GetInstance()
Gets the singleton instance of the WavelengthEventBroker.
Definition wavelength_event_broker.h:24
void PublishEvent(const QString &event_type, const QVariantMap &data=QVariantMap())
Publishes an event of a specific type with associated data. Emits the eventPublished signal,...
Definition wavelength_event_broker.cpp:18
void MessageReceived(const QString &frequency, const QString &message)
Publishes a "message_received" event. Data: {"frequency": QString, "message": QString}...
Definition wavelength_event_broker.cpp:47
void SubscribeToEvent(const QString &event_type, Receiver *receiver, Func slot)
Subscribes a receiver object's slot to a specific event type. Uses a template to ensure the receiver ...
Definition wavelength_event_broker.cpp:9
void eventPublished(const QString &eventType, const QVariantMap &data)
Signal emitted whenever any event is published via PublishEvent(). Subscribed components connect to t...
~WavelengthEventBroker() override=default
Private destructor.
void SystemMessage(const QString &frequency, const QString &message)
Publishes a "system_message" event. Data: {"frequency": QString, "message": QString}...
Definition wavelength_event_broker.cpp:87