A dialog window for creating a new Wavelength frequency.
More...
#include <create_wavelength_dialog.h>
|
| | CreateWavelengthDialog (QWidget *parent=nullptr) |
| | Constructs a WavelengthDialog. Sets up the UI elements (labels, input fields, buttons, checkbox), connects signals and slots for input validation and frequency searching/generation logic, configures the animation type and duration, and initializes the refresh timer for the scanline animation. Connects the show animation finished signal to start the frequency search.
|
| |
| 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 assigned by the server (or the default if search failed).
|
| |
| QString | GetPassword () const |
| | Gets the password entered by the user.
|
| |
| 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.
|
| |
| bool | IsPasswordProtected () const |
| | Checks if the "Password Protected" checkbox is checked.
|
| |
| 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.
|
| |
| | ~CreateWavelengthDialog () override |
| | Destructor. Stops and deletes the refresh timer.
|
| |
| | 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.
|
| |
|
| 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 | 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).
|
| |
|
| 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.
|
| |
|
| static QString | FormatFrequencyText (double frequency) |
| | Static utility function to format a frequency value (double) into a display string with units (Hz, kHz, MHz).
|
| |
| void | OnFrequencyFound () |
| | Slot triggered when the frequency search (FindLowestAvailableFrequency) completes. Updates the frequency label with the found frequency (or default), hides the loading indicator, enables the generate button (if inputs are valid), and triggers animations.
|
| |
| void | StartFrequencySearch () |
| | Starts the asynchronous process of finding the lowest available frequency via the relay server. Called automatically after the show animation finishes. Sets up a timeout for the search.
|
| |
| void | TryGenerate () |
| | Attempts to finalize the wavelength generation process. Checks if a password is required and entered. If valid, accepts the dialog. Uses a static flag to prevent concurrent attempts.
|
| |
| void | ValidateInputs () const |
| | Validates the input fields (currently just the password if protection is enabled). Enables the "Create Wavelength" button only if inputs are valid and a frequency has been found. Hides the status label.
|
| |
|
| 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.
|
| |
|
| static QString | FindLowestAvailableFrequency () |
| | Static function executed concurrently to query the relay server for the next available frequency. Sends an HTTP GET request to the server's API endpoint, optionally providing a preferred starting frequency. Parses the JSON response to extract the frequency. Returns a default value on error or timeout.
|
| |
A dialog window for creating a new Wavelength frequency.
This class provides a user interface for initiating the creation of a new Wavelength session. It automatically searches for the lowest available frequency via a relay server, allows setting a password, and displays the assigned frequency. 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 the relay server API to find an available frequency.
◆ CreateWavelengthDialog()
| CreateWavelengthDialog::CreateWavelengthDialog |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a WavelengthDialog. Sets up the UI elements (labels, input fields, buttons, checkbox), connects signals and slots for input validation and frequency searching/generation logic, configures the animation type and duration, and initializes the refresh timer for the scanline animation. Connects the show animation finished signal to start the frequency search.
- Parameters
-
| parent | Optional parent widget. |
◆ ~CreateWavelengthDialog()
| CreateWavelengthDialog::~CreateWavelengthDialog |
( |
| ) |
|
|
override |
Destructor. Stops and deletes the refresh timer.
◆ FindLowestAvailableFrequency()
| QString CreateWavelengthDialog::FindLowestAvailableFrequency |
( |
| ) |
|
|
staticprivate |
Static function executed concurrently to query the relay server for the next available frequency. Sends an HTTP GET request to the server's API endpoint, optionally providing a preferred starting frequency. Parses the JSON response to extract the frequency. Returns a default value on error or timeout.
- Returns
- The available frequency as a string (e.g., "130.0"), or a default value.
◆ FormatFrequencyText
| QString CreateWavelengthDialog::FormatFrequencyText |
( |
double | frequency | ) |
|
|
staticprivateslot |
Static utility function to format a frequency value (double) into a display string with units (Hz, kHz, MHz).
- Parameters
-
| frequency | The frequency value in Hz. |
- Returns
- A formatted string (e.g., "1.3 MHz").
◆ GetCornerGlowProgress()
| double CreateWavelengthDialog::GetCornerGlowProgress |
( |
| ) |
const |
|
inline |
Gets the current corner glow progress.
◆ GetDigitalizationProgress()
| double CreateWavelengthDialog::GetDigitalizationProgress |
( |
| ) |
const |
|
inline |
Gets the current digitalization progress (vertical scanline position).
◆ GetFrequency()
| QString CreateWavelengthDialog::GetFrequency |
( |
| ) |
const |
|
inline |
Gets the frequency assigned by the server (or the default if search failed).
- Returns
- The frequency string (e.g., "130.0").
◆ GetPassword()
| QString CreateWavelengthDialog::GetPassword |
( |
| ) |
const |
Gets the password entered by the user.
- Returns
- The password string.
◆ GetRefreshTimer()
| QTimer * CreateWavelengthDialog::GetRefreshTimer |
( |
| ) |
const |
|
inline |
Gets a pointer to the internal refresh timer used for scanline animation updates.
◆ GetScanlineOpacity()
| double CreateWavelengthDialog::GetScanlineOpacity |
( |
| ) |
const |
|
inline |
Gets the current opacity of the horizontal scanlines.
◆ InitRenderBuffers()
| void CreateWavelengthDialog::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.
◆ IsPasswordProtected()
| bool CreateWavelengthDialog::IsPasswordProtected |
( |
| ) |
const |
Checks if the "Password Protected" checkbox is checked.
- Returns
- True if the checkbox is checked, false otherwise.
◆ OnFrequencyFound
| void CreateWavelengthDialog::OnFrequencyFound |
( |
| ) |
|
|
privateslot |
Slot triggered when the frequency search (FindLowestAvailableFrequency) completes. Updates the frequency label with the found frequency (or default), hides the loading indicator, enables the generate button (if inputs are valid), and triggers animations.
◆ paintEvent()
| void CreateWavelengthDialog::paintEvent |
( |
QPaintEvent * | event | ) |
|
|
overrideprotected |
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
-
◆ SetCornerGlowProgress()
| void CreateWavelengthDialog::SetCornerGlowProgress |
( |
double | progress | ) |
|
Sets the corner glow progress and triggers a repaint.
◆ SetDigitalizationProgress()
| void CreateWavelengthDialog::SetDigitalizationProgress |
( |
double | progress | ) |
|
Sets the digitalization progress and triggers a repaint. Starts the refresh timer if needed.
◆ SetRefreshTimerInterval()
| void CreateWavelengthDialog::SetRefreshTimerInterval |
( |
const int | interval | ) |
const |
|
inline |
Sets the interval for the refresh timer.
◆ SetScanlineOpacity()
| void CreateWavelengthDialog::SetScanlineOpacity |
( |
double | opacity | ) |
|
Sets the opacity of the horizontal scanlines and triggers a repaint.
◆ StartFrequencySearch
| void CreateWavelengthDialog::StartFrequencySearch |
( |
| ) |
|
|
privateslot |
Starts the asynchronous process of finding the lowest available frequency via the relay server. Called automatically after the show animation finishes. Sets up a timeout for the search.
◆ StartRefreshTimer()
| void CreateWavelengthDialog::StartRefreshTimer |
( |
| ) |
const |
|
inline |
Starts the refresh timer.
◆ StopRefreshTimer()
| void CreateWavelengthDialog::StopRefreshTimer |
( |
| ) |
const |
|
inline |
◆ TryGenerate
| void CreateWavelengthDialog::TryGenerate |
( |
| ) |
|
|
privateslot |
Attempts to finalize the wavelength generation process. Checks if a password is required and entered. If valid, accepts the dialog. Uses a static flag to prevent concurrent attempts.
◆ ValidateInputs
| void CreateWavelengthDialog::ValidateInputs |
( |
| ) |
const |
|
privateslot |
Validates the input fields (currently just the password if protection is enabled). Enables the "Create Wavelength" button only if inputs are valid and a frequency has been found. Hides the status label.
◆ animation_started_
| bool CreateWavelengthDialog::animation_started_ = false |
|
private |
Flag indicating if the show animation has started (used to control scanline drawing).
◆ buffers_initialized_
| bool CreateWavelengthDialog::buffers_initialized_ = false |
|
private |
Flag indicating if the render buffers (scanline_buffer_) have been initialized.
◆ cancel_button_
Button to cancel the dialog.
◆ frequency_
| QString CreateWavelengthDialog::frequency_ = "130.0" |
|
private |
Stores the frequency found by the server or the default value.
◆ frequency_found_
| bool CreateWavelengthDialog::frequency_found_ = false |
|
private |
Flag indicating if the frequency search has completed successfully or timed out.
◆ frequency_label_
| QLabel* CreateWavelengthDialog::frequency_label_ |
|
private |
Label displaying the assigned frequency.
◆ frequency_watcher_
| QFutureWatcher<QString>* CreateWavelengthDialog::frequency_watcher_ |
|
private |
Watches the QFuture returned by the concurrent frequency search.
◆ generate_button_
Button to confirm wavelength creation and close the dialog.
◆ last_scanline_y_
| int CreateWavelengthDialog::last_scanline_y_ = -1 |
|
private |
Stores the last Y position of the scanline to optimize repaint regions.
◆ loading_indicator_
| QLabel* CreateWavelengthDialog::loading_indicator_ |
|
private |
Label indicating that the frequency search is in progress.
◆ password_edit_
Input field for the wavelength password.
◆ password_protected_checkbox_
| CyberCheckBox* CreateWavelengthDialog::password_protected_checkbox_ |
|
private |
Checkbox to enable/disable password protection.
◆ previous_height_
| int CreateWavelengthDialog::previous_height_ = 0 |
|
private |
Stores the previous height to detect resize events for buffer reinitialization.
◆ refresh_timer_
| QTimer* CreateWavelengthDialog::refresh_timer_ |
|
private |
Timer used to trigger repaints for the vertical scanline animation.
◆ scanline_buffer_
| QPixmap CreateWavelengthDialog::scanline_buffer_ |
|
private |
Buffer holding the pre-rendered vertical scanline gradient.
◆ scanline_opacity_
| double CreateWavelengthDialog::scanline_opacity_ |
|
private |
Current opacity for the horizontal scanline effect.
◆ status_label_
| QLabel* CreateWavelengthDialog::status_label_ |
|
private |
Label to display status or error messages.
◆ translator_
Pointer to the translation manager for handling UI translations.
◆ cornerGlowProgress
| double CreateWavelengthDialog::cornerGlowProgress |
|
readwrite |
Property controlling the visibility/intensity of the corner highlight markers (0.0 to 1.0). Animatable.
◆ digitalizationProgress
| double CreateWavelengthDialog::digitalizationProgress |
|
readwrite |
Property controlling the progress of the main vertical scanline reveal animation (0.0 to 1.0). Animatable.
◆ scanlineOpacity
| double CreateWavelengthDialog::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: