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

A dialog window for joining an existing Wavelength frequency. More...

#include <join_wavelength_dialog.h>

Inheritance diagram for JoinWavelengthDialog:
Collaboration diagram for JoinWavelengthDialog:

Public Member Functions

double GetCornerGlowProgress () const
 Gets the current corner glow progress.
 
double GetDigitalizationProgress () const
 Gets the current digitalization progress (vertical scanline position).
 
QString GetFrequency () const
 Gets the frequency entered by the user from the input field. Note: This returns the raw text; unit conversion might be needed.
 
QString GetPassword () const
 Gets the password entered by the user from the input field.
 
QTimer * GetRefreshTimer () const
 Gets a pointer to the internal refresh timer used for scanline animation updates.
 
double GetScanlineOpacity () const
 Gets the current opacity of the horizontal scanlines.
 
 JoinWavelengthDialog (QWidget *parent=nullptr)
 Constructs a JoinWavelengthDialog. Sets up the UI elements (labels, input fields, buttons), connects signals and slots for input validation and joining logic, configures the animation type and duration, and initializes the refresh timer for the scanline animation.
 
void paintEvent (QPaintEvent *event) override
 Overridden paint event handler. Draws the custom dialog appearance. Renders the background gradient, clipped border, the main vertical scanline reveal effect, corner highlight markers, and the horizontal scanline overlay effect based on the corresponding progress/opacity properties.
 
void SetCornerGlowProgress (double progress)
 Sets the corner glow progress and triggers a repaint.
 
void SetDigitalizationProgress (double progress)
 Sets the digitalization progress and triggers a repaint. Starts the refresh timer if needed.
 
void SetRefreshTimerInterval (const int interval) const
 Sets the interval for the refresh timer.
 
void SetScanlineOpacity (double opacity)
 Sets the opacity of the horizontal scanlines and triggers a repaint.
 
void StartRefreshTimer () const
 Starts the refresh timer.
 
void StopRefreshTimer () const
 Stops the refresh timer.
 
 ~JoinWavelengthDialog () override
 Destructor. Stops and deletes the refresh timer.
 
- Public Member Functions inherited from AnimatedDialog
 AnimatedDialog (QWidget *parent=nullptr, AnimationType type=kSlideFromBottom)
 Constructs an AnimatedDialog. Sets necessary window flags and attributes for transparency and animation.
 
int GetAnimationDuration () const
 Gets the current duration for the show and close animations.
 
void SetAnimationDuration (const int duration)
 Sets the duration for the show and close animations.
 
 ~AnimatedDialog () override
 Destructor. Ensures the overlay widget is cleaned up.
 

Properties

double cornerGlowProgress
 Property controlling the visibility/intensity of the corner highlight markers (0.0 to 1.0). Animatable.
 
double digitalizationProgress
 Property controlling the progress of the main vertical scanline reveal animation (0.0 to 1.0). Animatable.
 
double scanlineOpacity
 Property controlling the opacity of the horizontal scanlines effect (0.0 to 1.0). Animatable.
 

Private Slots

void OnAuthFailed ()
 Slot triggered by WavelengthJoiner when authentication fails (incorrect password). Displays an authentication failure message in the status label and triggers a glitch animation.
 
void OnConnectionError (const QString &error_message)
 Slot triggered by WavelengthJoiner when a connection error occurs. Displays an appropriate error message (e.g., "Password required", "Wavelength unavailable") in the status label and triggers a glitch animation.
 
void TryJoin ()
 Attempts to join the wavelength using the entered frequency and password. Shows a wait cursor, calls WavelengthJoiner::JoinWavelength, and handles immediate failure responses by showing an error message and triggering a glitch animation. Uses a static flag to prevent concurrent join attempts.
 
void ValidateInput () const
 Validates the frequency input field. Enables the "Join" button only if the frequency field is not empty. Hides the status label.
 

Private Member Functions

void InitRenderBuffers ()
 Initializes or reinitializes the QPixmap buffer used for rendering the vertical scanline effect. Called when needed by paintEvent, typically on the first paint or after a resize. Creates a pixmap with a vertical gradient representing the scanline glow.
 

Private Attributes

bool animation_started_ = false
 Flag indicating if the show animation has started (used to control scanline drawing).
 
bool buffers_initialized_ = false
 Flag indicating if the render buffers (scanline_buffer_) have been initialized.
 
CyberButtoncancel_button_
 Button to cancel the dialog.
 
double corner_glow_progress_ = 0.0
 Current progress for the corner highlight animation.
 
double digitalization_progress_ = 0.0
 Current progress for the vertical scanline reveal animation.
 
CyberLineEditfrequency_edit_
 Input field for the wavelength frequency.
 
QComboBox * frequency_unit_combo_
 Dropdown for selecting the frequency unit (Hz, kHz, MHz).
 
CyberButtonjoin_button_
 Button to initiate the join attempt.
 
int last_scanline_y_ = -1
 Stores the last Y position of the scanline to optimize repaint regions.
 
CyberLineEditpassword_edit_
 Input field for the wavelength password (optional).
 
int previous_height_ = 0
 Stores the previous height to detect resize events for buffer reinitialization.
 
QTimer * refresh_timer_
 Timer used to trigger repaints for the vertical scanline animation.
 
QPixmap scanline_buffer_
 Buffer holding the pre-rendered vertical scanline gradient.
 
double scanline_opacity_
 Current opacity for the horizontal scanline effect.
 
const int shadow_size_
 Size parameter for shadow effects (potentially unused).
 
QLabel * status_label_
 Label to display status or error messages during the join process.
 
TranslationManagertranslator_ = nullptr
 Pointer to the translation manager for handling UI translations.
 

Additional Inherited Members

- Public Types inherited from AnimatedDialog
enum  AnimationType { kSlideFromBottom , kDigitalMaterialization }
 Enum defining the available animation styles for showing and closing the dialog. More...
 
- Signals inherited from AnimatedDialog
void showAnimationFinished ()
 Emitted when the show animation (AnimateShow) has finished.
 
- Protected Member Functions inherited from AnimatedDialog
void closeEvent (QCloseEvent *event) override
 Overridden close event handler. Prevents immediate closing, starts the close animation (AnimateClose), and fades out the overlay. The actual QDialog::close() is called when the animation finishes.
 
void showEvent (QShowEvent *event) override
 Overridden show event handler. Creates and shows the overlay widget (if applicable), then starts the show animation (AnimateShow).
 
- Protected Attributes inherited from AnimatedDialog
double corner_glow_progress_ = 0.0
 Progress property (0.0 to 1.0) potentially for corner glow effects. Animatable.
 
double digitalization_progress_ = 0.0
 Progress property (0.0 to 1.0) for the digital materialization effect. Animatable.
 

Detailed Description

A dialog window for joining an existing Wavelength frequency.

This class provides a user interface for entering a frequency and an optional password to join a Wavelength session. It inherits from AnimatedDialog to provide a "digital materialization" animation effect on show/close, featuring a moving scanline. It includes input validation and interacts with WavelengthJoiner to handle the joining process, displaying status messages for success, authentication failure, or connection errors.

Constructor & Destructor Documentation

◆ JoinWavelengthDialog()

JoinWavelengthDialog::JoinWavelengthDialog ( QWidget * parent = nullptr)
explicit

Constructs a JoinWavelengthDialog. Sets up the UI elements (labels, input fields, buttons), connects signals and slots for input validation and joining logic, configures the animation type and duration, and initializes the refresh timer for the scanline animation.

Parameters
parentOptional parent widget.
Here is the call graph for this function:

◆ ~JoinWavelengthDialog()

JoinWavelengthDialog::~JoinWavelengthDialog ( )
override

Destructor. Stops and deletes the refresh timer.

Member Function Documentation

◆ GetCornerGlowProgress()

double JoinWavelengthDialog::GetCornerGlowProgress ( ) const
inline

Gets the current corner glow progress.

◆ GetDigitalizationProgress()

double JoinWavelengthDialog::GetDigitalizationProgress ( ) const
inline

Gets the current digitalization progress (vertical scanline position).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFrequency()

QString JoinWavelengthDialog::GetFrequency ( ) const

Gets the frequency entered by the user from the input field. Note: This returns the raw text; unit conversion might be needed.

Returns
The frequency string.
Here is the caller graph for this function:

◆ GetPassword()

QString JoinWavelengthDialog::GetPassword ( ) const

Gets the password entered by the user from the input field.

Returns
The password string.

◆ GetRefreshTimer()

QTimer * JoinWavelengthDialog::GetRefreshTimer ( ) const
inline

Gets a pointer to the internal refresh timer used for scanline animation updates.

◆ GetScanlineOpacity()

double JoinWavelengthDialog::GetScanlineOpacity ( ) const
inline

Gets the current opacity of the horizontal scanlines.

◆ InitRenderBuffers()

void JoinWavelengthDialog::InitRenderBuffers ( )
private

Initializes or reinitializes the QPixmap buffer used for rendering the vertical scanline effect. Called when needed by paintEvent, typically on the first paint or after a resize. Creates a pixmap with a vertical gradient representing the scanline glow.

Here is the caller graph for this function:

◆ OnAuthFailed

void JoinWavelengthDialog::OnAuthFailed ( )
privateslot

Slot triggered by WavelengthJoiner when authentication fails (incorrect password). Displays an authentication failure message in the status label and triggers a glitch animation.

Here is the caller graph for this function:

◆ OnConnectionError

void JoinWavelengthDialog::OnConnectionError ( const QString & error_message)
privateslot

Slot triggered by WavelengthJoiner when a connection error occurs. Displays an appropriate error message (e.g., "Password required", "Wavelength unavailable") in the status label and triggers a glitch animation.

Parameters
error_messageThe error message received from the joiner.
Here is the caller graph for this function:

◆ paintEvent()

void JoinWavelengthDialog::paintEvent ( QPaintEvent * event)
override

Overridden paint event handler. Draws the custom dialog appearance. Renders the background gradient, clipped border, the main vertical scanline reveal effect, corner highlight markers, and the horizontal scanline overlay effect based on the corresponding progress/opacity properties.

Parameters
eventThe paint event.
Here is the call graph for this function:

◆ SetCornerGlowProgress()

void JoinWavelengthDialog::SetCornerGlowProgress ( double progress)

Sets the corner glow progress and triggers a repaint.

◆ SetDigitalizationProgress()

void JoinWavelengthDialog::SetDigitalizationProgress ( double progress)

Sets the digitalization progress and triggers a repaint. Starts the refresh timer if needed.

◆ SetRefreshTimerInterval()

void JoinWavelengthDialog::SetRefreshTimerInterval ( const int interval) const
inline

Sets the interval for the refresh timer.

◆ SetScanlineOpacity()

void JoinWavelengthDialog::SetScanlineOpacity ( double opacity)

Sets the opacity of the horizontal scanlines and triggers a repaint.

◆ StartRefreshTimer()

void JoinWavelengthDialog::StartRefreshTimer ( ) const
inline

Starts the refresh timer.

◆ StopRefreshTimer()

void JoinWavelengthDialog::StopRefreshTimer ( ) const
inline

Stops the refresh timer.

◆ TryJoin

void JoinWavelengthDialog::TryJoin ( )
privateslot

Attempts to join the wavelength using the entered frequency and password. Shows a wait cursor, calls WavelengthJoiner::JoinWavelength, and handles immediate failure responses by showing an error message and triggering a glitch animation. Uses a static flag to prevent concurrent join attempts.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidateInput

void JoinWavelengthDialog::ValidateInput ( ) const
privateslot

Validates the frequency input field. Enables the "Join" button only if the frequency field is not empty. Hides the status label.

Here is the caller graph for this function:

Member Data Documentation

◆ animation_started_

bool JoinWavelengthDialog::animation_started_ = false
private

Flag indicating if the show animation has started (used to control scanline drawing).

◆ buffers_initialized_

bool JoinWavelengthDialog::buffers_initialized_ = false
private

Flag indicating if the render buffers (scanline_buffer_) have been initialized.

◆ cancel_button_

CyberButton* JoinWavelengthDialog::cancel_button_
private

Button to cancel the dialog.

◆ corner_glow_progress_

double JoinWavelengthDialog::corner_glow_progress_ = 0.0
private

Current progress for the corner highlight animation.

◆ digitalization_progress_

double JoinWavelengthDialog::digitalization_progress_ = 0.0
private

Current progress for the vertical scanline reveal animation.

◆ frequency_edit_

CyberLineEdit* JoinWavelengthDialog::frequency_edit_
private

Input field for the wavelength frequency.

◆ frequency_unit_combo_

QComboBox* JoinWavelengthDialog::frequency_unit_combo_
private

Dropdown for selecting the frequency unit (Hz, kHz, MHz).

◆ join_button_

CyberButton* JoinWavelengthDialog::join_button_
private

Button to initiate the join attempt.

◆ last_scanline_y_

int JoinWavelengthDialog::last_scanline_y_ = -1
private

Stores the last Y position of the scanline to optimize repaint regions.

◆ password_edit_

CyberLineEdit* JoinWavelengthDialog::password_edit_
private

Input field for the wavelength password (optional).

◆ previous_height_

int JoinWavelengthDialog::previous_height_ = 0
private

Stores the previous height to detect resize events for buffer reinitialization.

◆ refresh_timer_

QTimer* JoinWavelengthDialog::refresh_timer_
private

Timer used to trigger repaints for the vertical scanline animation.

◆ scanline_buffer_

QPixmap JoinWavelengthDialog::scanline_buffer_
private

Buffer holding the pre-rendered vertical scanline gradient.

◆ scanline_opacity_

double JoinWavelengthDialog::scanline_opacity_
private

Current opacity for the horizontal scanline effect.

◆ shadow_size_

const int JoinWavelengthDialog::shadow_size_
private

Size parameter for shadow effects (potentially unused).

◆ status_label_

QLabel* JoinWavelengthDialog::status_label_
private

Label to display status or error messages during the join process.

◆ translator_

TranslationManager* JoinWavelengthDialog::translator_ = nullptr
private

Pointer to the translation manager for handling UI translations.

Property Documentation

◆ cornerGlowProgress

double JoinWavelengthDialog::cornerGlowProgress
readwrite

Property controlling the visibility/intensity of the corner highlight markers (0.0 to 1.0). Animatable.

◆ digitalizationProgress

double JoinWavelengthDialog::digitalizationProgress
readwrite

Property controlling the progress of the main vertical scanline reveal animation (0.0 to 1.0). Animatable.

◆ scanlineOpacity

double JoinWavelengthDialog::scanlineOpacity
readwrite

Property controlling the opacity of the horizontal scanlines effect (0.0 to 1.0). Animatable.


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