1#ifndef WAVELENGTH_STATE_MANAGER_H
2#define WAVELENGTH_STATE_MANAGER_H
137 const QVariant &default_value = QVariant());
163 void SetConnecting(
const QString &frequency,
bool connecting);
QVariant GetActiveSessionData(const QString &frequency, const QString &key, const QVariant &default_value=QVariant())
Retrieves previously stored session data for a specific frequency and key.
Definition wavelength_state_manager.cpp:92
static WavelengthStateManager * GetInstance()
Gets the singleton instance of the WavelengthStateManager.
Definition wavelength_state_manager.h:26
static bool IsWavelengthConnected(const QString &frequency)
Checks if the WebSocket connection for a specific wavelength is currently established and valid.
Definition wavelength_state_manager.cpp:78
void SetActiveWavelength(const QString &frequency)
Sets the specified frequency as the currently active wavelength. Updates the registry and emits the a...
Definition wavelength_state_manager.cpp:20
void AddActiveSessionData(const QString &frequency, const QString &key, const QVariant &value)
Stores arbitrary session data associated with a specific frequency and key. Useful for temporary stat...
Definition wavelength_state_manager.cpp:84
int GetJoinedWavelengthCount()
Gets the total number of wavelengths the user is currently joined to.
Definition wavelength_state_manager.cpp:55
static bool IsWavelengthJoined(const QString &frequency)
Checks if the user is currently considered joined to a specific wavelength (based on registry presenc...
Definition wavelength_state_manager.cpp:74
void UnregisterJoinedWavelength(const QString &frequency)
Unregisters that the user has left or been disconnected from a specific wavelength....
Definition wavelength_state_manager.cpp:51
static QDateTime GetWavelengthCreationTime(const QString &frequency)
Gets the creation timestamp of a specific wavelength.
Definition wavelength_state_manager.cpp:69
static QString GetActiveWavelength()
Gets the frequency identifier of the currently active wavelength.
Definition wavelength_state_manager.cpp:16
static bool IsWavelengthPasswordProtected(const QString &frequency)
Checks if a specific wavelength is password protected.
Definition wavelength_state_manager.cpp:59
bool IsConnecting(const QString &frequency) const
Checks if the application is currently in the process of connecting to a specific wavelength.
Definition wavelength_state_manager.cpp:111
QList< QString > GetJoinedWavelengths()
Gets a list of frequency identifiers for all wavelengths the user is currently joined to....
Definition wavelength_state_manager.cpp:33
void ClearSessionData(const QString &frequency)
Removes all session data associated with a specific frequency.
Definition wavelength_state_manager.cpp:101
WavelengthStateManager(QObject *parent=nullptr)
Private constructor to enforce the singleton pattern.
Definition wavelength_state_manager.h:177
static bool IsActiveWavelengthHost()
Checks if the current user is the host of the currently active wavelength.
Definition wavelength_state_manager.cpp:25
void RegisterJoinedWavelength(const QString &frequency)
Registers that the user has successfully joined a specific wavelength. Adds the frequency to an inter...
Definition wavelength_state_manager.cpp:45
void SetConnecting(const QString &frequency, bool connecting)
Sets or clears the "connecting" status for a specific wavelength. Used to track ongoing connection at...
Definition wavelength_state_manager.cpp:115
WavelengthStateManager & operator=(const WavelengthStateManager &)=delete
Deleted assignment operator to prevent assignment.
~WavelengthStateManager() override=default
Private destructor.
QList< QString > joined_wavelengths_
List of frequencies the user is currently joined to (managed internally).
Definition wavelength_state_manager.h:200
void activeWavelengthChanged(QString frequency)
Emitted when the active wavelength changes via SetActiveWavelength().
QList< QString > connecting_wavelengths_
List of frequencies currently undergoing a connection attempt.
Definition wavelength_state_manager.h:198
static bool IsWavelengthHost(const QString &frequency)
Checks if the current user is the host of a specific wavelength.
Definition wavelength_state_manager.cpp:64
void ClearAllSessionData()
Removes all session data for all frequencies.
Definition wavelength_state_manager.cpp:107
QMap< QString, QMap< QString, QVariant > > session_data_
Stores temporary session data, keyed by frequency, then by data key.
Definition wavelength_state_manager.h:196
WavelengthStateManager(const WavelengthStateManager &)=delete
Deleted copy constructor to prevent copying.
static WavelengthInfo GetWavelengthInfo(const QString &frequency, bool *is_host=nullptr)
Retrieves detailed information about a specific wavelength from the registry.
Definition wavelength_state_manager.cpp:5
Structure holding information about a specific wavelength (frequency).
Definition wavelength_registry.h:13