Singleton class responsible for handling the process of leaving or closing wavelengths.
More...
#include <wavelength_leaver.h>
|
| void | CloseWavelength (QString frequency) |
| | Closes a specific wavelength (only if the current user is the host). Checks if the user is the host for the given frequency. Sends a "close_wavelength" command to the server, closes the WebSocket connection, removes the wavelength from the registry, and emits the wavelengthClosed signal. If the closed wavelength was the active one, sets the active wavelength to "-1".
|
| |
| void | LeaveWavelength () |
| | Leaves the currently active wavelength. Retrieves the active frequency from the registry. If the user is the host, sends a "close_wavelength" command; otherwise, sends a "leave_wavelength" command. Closes the WebSocket connection, removes the wavelength from the registry, sets the active wavelength to "-1", and emits the wavelengthLeft signal.
|
| |
Singleton class responsible for handling the process of leaving or closing wavelengths.
Provides methods to gracefully disconnect from the currently active wavelength (LeaveWavelength) or to close a specific wavelength if the user is the host (CloseWavelength). It interacts with WavelengthRegistry and MessageHandler to send appropriate commands to the server and update the local state.
◆ WavelengthLeaver() [1/2]
| WavelengthLeaver::WavelengthLeaver |
( |
QObject * | parent = nullptr | ) |
|
|
inlineexplicitprivate |
Private constructor to enforce the singleton pattern.
- Parameters
-
| parent | Optional parent QObject. |
◆ ~WavelengthLeaver()
| WavelengthLeaver::~WavelengthLeaver |
( |
| ) |
|
|
overrideprivatedefault |
◆ WavelengthLeaver() [2/2]
Deleted copy constructor to prevent copying.
◆ CloseWavelength()
| void WavelengthLeaver::CloseWavelength |
( |
QString | frequency | ) |
|
Closes a specific wavelength (only if the current user is the host). Checks if the user is the host for the given frequency. Sends a "close_wavelength" command to the server, closes the WebSocket connection, removes the wavelength from the registry, and emits the wavelengthClosed signal. If the closed wavelength was the active one, sets the active wavelength to "-1".
- Parameters
-
| frequency | The frequency identifier of the wavelength to close. |
◆ GetInstance()
◆ LeaveWavelength()
| void WavelengthLeaver::LeaveWavelength |
( |
| ) |
|
Leaves the currently active wavelength. Retrieves the active frequency from the registry. If the user is the host, sends a "close_wavelength" command; otherwise, sends a "leave_wavelength" command. Closes the WebSocket connection, removes the wavelength from the registry, sets the active wavelength to "-1", and emits the wavelengthLeft signal.
◆ operator=()
Deleted assignment operator to prevent assignment.
◆ wavelengthClosed
| void WavelengthLeaver::wavelengthClosed |
( |
QString | frequency | ) |
|
|
signal |
Emitted after the host successfully closes a specific wavelength via CloseWavelength().
- Parameters
-
| frequency | The frequency identifier of the wavelength that was closed. |
◆ wavelengthLeft
| void WavelengthLeaver::wavelengthLeft |
( |
QString | frequency | ) |
|
|
signal |
Emitted after the user successfully leaves the active wavelength via LeaveWavelength().
- Parameters
-
| frequency | The frequency identifier of the wavelength that was left. |
The documentation for this class was generated from the following files: