A security layer simulating a retina scan process.
More...
#include <retina_scan_layer.h>
|
| void | Initialize () override |
| | Initializes the layer for display. Resets the layer state, generates a new random eye image, ensures the layer is fully opaque, and starts the scan animation after a short delay.
|
| |
| void | Reset () override |
| | Resets the layer to its initial state. Stops timers, resets the scanline position and progress bar, resets UI element styles, clears the eye image, and ensures the layer is fully opaque.
|
| |
| | RetinaScanLayer (QWidget *parent=nullptr) |
| | Constructs a RetinaScanLayer. Initializes the UI elements (title, eye image container, instructions, progress bar), sets up the layout, creates timers for the scan animation and completion, and prepares the base image buffer.
|
| |
| | ~RetinaScanLayer () override |
| | Destructor. Stops and deletes the timers.
|
| |
| | SecurityLayer (QWidget *parent=nullptr) |
| | Constructs a SecurityLayer.
|
| |
| | ~SecurityLayer () override=default |
| | Virtual destructor. Ensures proper cleanup for derived classes.
|
| |
|
| void | FinishScan () |
| | Slot called when the scan completes (either by timer or scanline finishing). Changes the UI element styles (border, progress bar chunk) to green, displays the final eye image without the scanline, and initiates the fade-out animation after a short delay.
|
| |
| void | UpdateScan () |
| | Slot called periodically by scan_timer_ to update the scan animation. Increments the progress bar, moves the scanline position, redraws the eye image with the updated scanline, and stops the animation when the scanline completes its pass.
|
| |
|
| void | GenerateEyeImage () |
| | Generates a random eye image (iris color, patterns, reflections) and draws it onto base_eye_image_. Sets the initial pixmap on the eye_image_ label.
|
| |
| void | StartScanAnimation () const |
| | Starts the scan animation timers (scan_timer_ and complete_timer_).
|
| |
|
| QImage | base_eye_image_ |
| | Stores the generated eye image without the scanline overlay.
|
| |
| QTimer * | complete_timer_ |
| | Timer defining the total duration of the scan process.
|
| |
| QLabel * | eye_image_ |
| | Label displaying the eye image with the animated scanline.
|
| |
| QProgressBar * | scan_progress_ |
| | Progress bar indicating the scan progress.
|
| |
| QTimer * | scan_timer_ |
| | Timer controlling the scanline movement and progress bar update.
|
| |
| int | scanline_ |
| | Current vertical position of the scanline (0 to 200).
|
| |
|
| void | layerCompleted () |
| | Emitted when the user successfully completes the security challenge presented by this layer.
|
| |
| void | layerFailed () |
| | Emitted when the user fails the security challenge (e.g., incorrect code, timeout, collision). Note: Not all layers currently implement failure conditions that emit this signal.
|
| |
A security layer simulating a retina scan process.
This layer displays a randomly generated eye image within a circular scanner interface. An animated scanline moves vertically across the eye image while a progress bar fills up. The scan takes a fixed duration. Upon completion, the UI elements turn green, and the layer fades out, emitting the layerCompleted() signal.
◆ RetinaScanLayer()
| RetinaScanLayer::RetinaScanLayer |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a RetinaScanLayer. Initializes the UI elements (title, eye image container, instructions, progress bar), sets up the layout, creates timers for the scan animation and completion, and prepares the base image buffer.
- Parameters
-
| parent | Optional parent widget. |
◆ ~RetinaScanLayer()
| RetinaScanLayer::~RetinaScanLayer |
( |
| ) |
|
|
override |
Destructor. Stops and deletes the timers.
◆ FinishScan
| void RetinaScanLayer::FinishScan |
( |
| ) |
|
|
privateslot |
Slot called when the scan completes (either by timer or scanline finishing). Changes the UI element styles (border, progress bar chunk) to green, displays the final eye image without the scanline, and initiates the fade-out animation after a short delay.
◆ GenerateEyeImage()
| void RetinaScanLayer::GenerateEyeImage |
( |
| ) |
|
|
private |
Generates a random eye image (iris color, patterns, reflections) and draws it onto base_eye_image_. Sets the initial pixmap on the eye_image_ label.
◆ Initialize()
| void RetinaScanLayer::Initialize |
( |
| ) |
|
|
overridevirtual |
Initializes the layer for display. Resets the layer state, generates a new random eye image, ensures the layer is fully opaque, and starts the scan animation after a short delay.
Implements SecurityLayer.
◆ Reset()
| void RetinaScanLayer::Reset |
( |
| ) |
|
|
overridevirtual |
Resets the layer to its initial state. Stops timers, resets the scanline position and progress bar, resets UI element styles, clears the eye image, and ensures the layer is fully opaque.
Implements SecurityLayer.
◆ StartScanAnimation()
| void RetinaScanLayer::StartScanAnimation |
( |
| ) |
const |
|
private |
Starts the scan animation timers (scan_timer_ and complete_timer_).
◆ UpdateScan
| void RetinaScanLayer::UpdateScan |
( |
| ) |
|
|
privateslot |
Slot called periodically by scan_timer_ to update the scan animation. Increments the progress bar, moves the scanline position, redraws the eye image with the updated scanline, and stops the animation when the scanline completes its pass.
◆ base_eye_image_
| QImage RetinaScanLayer::base_eye_image_ |
|
private |
Stores the generated eye image without the scanline overlay.
◆ complete_timer_
| QTimer* RetinaScanLayer::complete_timer_ |
|
private |
Timer defining the total duration of the scan process.
◆ eye_image_
| QLabel* RetinaScanLayer::eye_image_ |
|
private |
Label displaying the eye image with the animated scanline.
◆ scan_progress_
| QProgressBar* RetinaScanLayer::scan_progress_ |
|
private |
Progress bar indicating the scan progress.
◆ scan_timer_
| QTimer* RetinaScanLayer::scan_timer_ |
|
private |
Timer controlling the scanline movement and progress bar update.
◆ scanline_
| int RetinaScanLayer::scanline_ |
|
private |
Current vertical position of the scanline (0 to 200).
The documentation for this class was generated from the following files: