Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
WavelengthCreator Class Referencefinal

Singleton class responsible for initiating the creation of a new wavelength. More...

#include <wavelength_creator.h>

Inheritance diagram for WavelengthCreator:
Collaboration diagram for WavelengthCreator:

Signals

void connectionError (const QString &error_message)
 Emitted if an error occurs during the connection or registration process.
 
void wavelengthClosed (QString frequency)
 Emitted if the WebSocket connection for the wavelength is closed unexpectedly (e.g., during registration or after creation).
 
void wavelengthCreated (QString frequency)
 Emitted when the wavelength has been successfully created and registered with the server.
 

Public Member Functions

bool CreateWavelength (QString frequency, bool is_password_protected, const QString &password)
 Attempts to create and register a new wavelength with the relay server. Checks if the wavelength already exists locally or is pending registration. Creates a new WebSocket connection, connects signals for connection events, errors, and the registration result message. Sends the registration request upon successful connection. Manages a keep-alive timer for the connection.
 

Static Public Member Functions

static WavelengthCreatorGetInstance ()
 Gets the singleton instance of the WavelengthCreator.
 

Private Member Functions

WavelengthCreatoroperator= (const WavelengthCreator &)=delete
 Deleted assignment operator to prevent assignment.
 
 WavelengthCreator (const WavelengthCreator &)=delete
 Deleted copy constructor to prevent copying.
 
 WavelengthCreator (QObject *parent=nullptr)
 Private constructor to enforce the singleton pattern.
 
 ~WavelengthCreator () override=default
 Private destructor.
 

Detailed Description

Singleton class responsible for initiating the creation of a new wavelength.

This class handles the process of connecting to the relay server, sending a registration request for a new frequency (wavelength), and managing the initial WebSocket connection until the registration result is received. It interacts with WavelengthRegistry, WavelengthConfig, AuthenticationManager, and MessageHandler. It emits signals indicating success (wavelengthCreated), failure (connectionError), or closure (wavelengthClosed).

Constructor & Destructor Documentation

◆ WavelengthCreator() [1/2]

WavelengthCreator::WavelengthCreator ( QObject * parent = nullptr)
inlineexplicitprivate

Private constructor to enforce the singleton pattern.

Parameters
parentOptional parent QObject.
Here is the caller graph for this function:

◆ ~WavelengthCreator()

WavelengthCreator::~WavelengthCreator ( )
overrideprivatedefault

Private destructor.

◆ WavelengthCreator() [2/2]

WavelengthCreator::WavelengthCreator ( const WavelengthCreator & )
privatedelete

Deleted copy constructor to prevent copying.

Here is the call graph for this function:

Member Function Documentation

◆ connectionError

void WavelengthCreator::connectionError ( const QString & error_message)
signal

Emitted if an error occurs during the connection or registration process.

Parameters
error_messageA description of the error.
Here is the caller graph for this function:

◆ CreateWavelength()

bool WavelengthCreator::CreateWavelength ( QString frequency,
bool is_password_protected,
const QString & password )

Attempts to create and register a new wavelength with the relay server. Checks if the wavelength already exists locally or is pending registration. Creates a new WebSocket connection, connects signals for connection events, errors, and the registration result message. Sends the registration request upon successful connection. Manages a keep-alive timer for the connection.

Parameters
frequencyThe desired name for the new wavelength.
is_password_protectedTrue if the wavelength should require a password.
passwordThe password to set (if protected).
Returns
True if the creation process was initiated (a connection attempt started), false if the wavelength already exists or is pending.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstance()

static WavelengthCreator * WavelengthCreator::GetInstance ( )
inlinestatic

Gets the singleton instance of the WavelengthCreator.

Returns
Pointer to the singleton WavelengthCreator instance.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

WavelengthCreator & WavelengthCreator::operator= ( const WavelengthCreator & )
privatedelete

Deleted assignment operator to prevent assignment.

Here is the call graph for this function:

◆ wavelengthClosed

void WavelengthCreator::wavelengthClosed ( QString frequency)
signal

Emitted if the WebSocket connection for the wavelength is closed unexpectedly (e.g., during registration or after creation).

Parameters
frequencyThe frequency identifier of the wavelength whose connection closed.
Here is the caller graph for this function:

◆ wavelengthCreated

void WavelengthCreator::wavelengthCreated ( QString frequency)
signal

Emitted when the wavelength has been successfully created and registered with the server.

Parameters
frequencyThe frequency identifier of the newly created wavelength.
Here is the caller graph for this function:

The documentation for this class was generated from the following files: