|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
A dialog window for joining an existing Wavelength frequency. More...
#include <join_wavelength_dialog.h>
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. | |
| CyberButton * | cancel_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. | |
| CyberLineEdit * | frequency_edit_ |
| Input field for the wavelength frequency. | |
| QComboBox * | frequency_unit_combo_ |
| Dropdown for selecting the frequency unit (Hz, kHz, MHz). | |
| CyberButton * | join_button_ |
| Button to initiate the join attempt. | |
| int | last_scanline_y_ = -1 |
| Stores the last Y position of the scanline to optimize repaint regions. | |
| CyberLineEdit * | password_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. | |
| TranslationManager * | translator_ = 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. | |
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.
|
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.
| parent | Optional parent widget. |
|
override |
Destructor. Stops and deletes the refresh timer.
|
inline |
Gets the current corner glow progress.
|
inline |
Gets the current digitalization progress (vertical scanline position).
| 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.
| QString JoinWavelengthDialog::GetPassword | ( | ) | const |
Gets the password entered by the user from the input field.
|
inline |
Gets a pointer to the internal refresh timer used for scanline animation updates.
|
inline |
Gets the current opacity of the horizontal scanlines.
|
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.
|
privateslot |
Slot triggered by WavelengthJoiner when authentication fails (incorrect password). Displays an authentication failure message in the status label and triggers a glitch animation.
|
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.
| error_message | The error message received from the joiner. |
|
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.
| event | The paint event. |
| void JoinWavelengthDialog::SetCornerGlowProgress | ( | double | progress | ) |
Sets the corner glow progress and triggers a repaint.
| void JoinWavelengthDialog::SetDigitalizationProgress | ( | double | progress | ) |
Sets the digitalization progress and triggers a repaint. Starts the refresh timer if needed.
|
inline |
Sets the interval for the refresh timer.
| void JoinWavelengthDialog::SetScanlineOpacity | ( | double | opacity | ) |
Sets the opacity of the horizontal scanlines and triggers a repaint.
|
inline |
Starts the refresh timer.
|
inline |
Stops the refresh timer.
|
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.
|
privateslot |
Validates the frequency input field. Enables the "Join" button only if the frequency field is not empty. Hides the status label.
|
private |
Flag indicating if the show animation has started (used to control scanline drawing).
|
private |
Flag indicating if the render buffers (scanline_buffer_) have been initialized.
|
private |
Button to cancel the dialog.
|
private |
Current progress for the corner highlight animation.
|
private |
Current progress for the vertical scanline reveal animation.
|
private |
Input field for the wavelength frequency.
|
private |
Dropdown for selecting the frequency unit (Hz, kHz, MHz).
|
private |
Button to initiate the join attempt.
|
private |
Stores the last Y position of the scanline to optimize repaint regions.
|
private |
Input field for the wavelength password (optional).
|
private |
Stores the previous height to detect resize events for buffer reinitialization.
|
private |
Timer used to trigger repaints for the vertical scanline animation.
|
private |
Buffer holding the pre-rendered vertical scanline gradient.
|
private |
Current opacity for the horizontal scanline effect.
|
private |
Size parameter for shadow effects (potentially unused).
|
private |
Label to display status or error messages during the join process.
|
private |
Pointer to the translation manager for handling UI translations.
|
readwrite |
Property controlling the visibility/intensity of the corner highlight markers (0.0 to 1.0). Animatable.
|
readwrite |
Property controlling the progress of the main vertical scanline reveal animation (0.0 to 1.0). Animatable.
|
readwrite |
Property controlling the opacity of the horizontal scanlines effect (0.0 to 1.0). Animatable.