A security layer simulating fingerprint authentication.
More...
#include <fingerprint_layer.h>
|
| | FingerprintLayer (QWidget *parent=nullptr) |
| | Constructs a FingerprintLayer. Initializes the UI elements (title, fingerprint image label, instructions, progress bar), sets up the layout, creates the progress timer, loads the list of available fingerprint SVG files, and initializes the SVG renderer.
|
| |
| void | Initialize () override |
| | Initializes the layer for display. Resets the progress bar and styles, loads a random fingerprint image, and ensures the layer is fully opaque.
|
| |
| void | Reset () override |
| | Resets the layer to its initial state. Stops the progress timer, resets the progress bar value and style, resets the fingerprint image style, restores the base fingerprint image, and ensures the layer is fully opaque.
|
| |
| | ~FingerprintLayer () override |
| | Destructor. Stops and deletes the progress timer and the SVG renderer.
|
| |
| | SecurityLayer (QWidget *parent=nullptr) |
| | Constructs a SecurityLayer.
|
| |
| | ~SecurityLayer () override=default |
| | Virtual destructor. Ensures proper cleanup for derived classes.
|
| |
|
| void | ProcessFingerprint (bool completed) |
| | Handles the completion of the fingerprint scan. Changes the UI element styles (border, progress bar chunk) to green, updates the fingerprint image to be fully green, and initiates the fade-out animation after a short delay.
|
| |
| void | UpdateProgress () |
| | Slot called periodically by fingerprint_timer_ when the user is holding the mouse button. Increments the progress bar value, updates the visual appearance of the fingerprint scan, and calls ProcessFingerprint(true) when the progress reaches 100%.
|
| |
|
| bool | eventFilter (QObject *obj, QEvent *event) override |
| | Filters mouse press and release events on the fingerprint_image_ label. Starts the fingerprint_timer_ on left mouse button press and stops it on release.
|
| |
| void | LoadRandomFingerprint () |
| | Loads a random fingerprint SVG file from fingerprint_files_ and renders it into base_fingerprint_. Handles potential loading errors. Sets the initial pixmap on fingerprint_image_.
|
| |
| void | UpdateFingerprintScan (int progress_value) const |
| | Updates the visual appearance of the fingerprint image during the scan. Renders the SVG and applies a color overlay: gray for the unscanned part and blue for the scanned part, based on the current progress value.
|
| |
|
| 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 fingerprint authentication.
This layer displays a fingerprint image (loaded from an SVG file) and requires the user to press and hold on the image. A progress bar fills up while the user holds the mouse button. The fingerprint image visually updates during the "scan" process, changing color from gray to blue as the progress increases. Upon successful completion (progress reaches 100%), the UI elements turn green, and the layer fades out, emitting the layerCompleted() signal.
◆ FingerprintLayer()
| FingerprintLayer::FingerprintLayer |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a FingerprintLayer. Initializes the UI elements (title, fingerprint image label, instructions, progress bar), sets up the layout, creates the progress timer, loads the list of available fingerprint SVG files, and initializes the SVG renderer.
- Parameters
-
| parent | Optional parent widget. |
◆ ~FingerprintLayer()
| FingerprintLayer::~FingerprintLayer |
( |
| ) |
|
|
override |
Destructor. Stops and deletes the progress timer and the SVG renderer.
◆ eventFilter()
| bool FingerprintLayer::eventFilter |
( |
QObject * | obj, |
|
|
QEvent * | event ) |
|
overrideprivate |
Filters mouse press and release events on the fingerprint_image_ label. Starts the fingerprint_timer_ on left mouse button press and stops it on release.
- Parameters
-
| obj | The object that generated the event. |
| event | The event being processed. |
- Returns
- True if the event was handled (mouse press/release on the image), false otherwise.
◆ Initialize()
| void FingerprintLayer::Initialize |
( |
| ) |
|
|
overridevirtual |
Initializes the layer for display. Resets the progress bar and styles, loads a random fingerprint image, and ensures the layer is fully opaque.
Implements SecurityLayer.
◆ LoadRandomFingerprint()
| void FingerprintLayer::LoadRandomFingerprint |
( |
| ) |
|
|
private |
Loads a random fingerprint SVG file from fingerprint_files_ and renders it into base_fingerprint_. Handles potential loading errors. Sets the initial pixmap on fingerprint_image_.
◆ ProcessFingerprint
| void FingerprintLayer::ProcessFingerprint |
( |
bool | completed | ) |
|
|
privateslot |
Handles the completion of the fingerprint scan. Changes the UI element styles (border, progress bar chunk) to green, updates the fingerprint image to be fully green, and initiates the fade-out animation after a short delay.
- Parameters
-
| completed | Always true in the current implementation, indicating successful completion. |
◆ Reset()
| void FingerprintLayer::Reset |
( |
| ) |
|
|
overridevirtual |
Resets the layer to its initial state. Stops the progress timer, resets the progress bar value and style, resets the fingerprint image style, restores the base fingerprint image, and ensures the layer is fully opaque.
Implements SecurityLayer.
◆ UpdateFingerprintScan()
| void FingerprintLayer::UpdateFingerprintScan |
( |
int | progress_value | ) |
const |
|
private |
Updates the visual appearance of the fingerprint image during the scan. Renders the SVG and applies a color overlay: gray for the unscanned part and blue for the scanned part, based on the current progress value.
- Parameters
-
| progress_value | The current progress percentage (0-100). |
◆ UpdateProgress
| void FingerprintLayer::UpdateProgress |
( |
| ) |
|
|
privateslot |
Slot called periodically by fingerprint_timer_ when the user is holding the mouse button. Increments the progress bar value, updates the visual appearance of the fingerprint scan, and calls ProcessFingerprint(true) when the progress reaches 100%.
◆ base_fingerprint_
| QImage FingerprintLayer::base_fingerprint_ |
|
private |
The base image of the fingerprint (rendered SVG in gray).
◆ current_fingerprint_
| QString FingerprintLayer::current_fingerprint_ |
|
private |
Path to the currently loaded fingerprint SVG file.
◆ fingerprint_files_
| QStringList FingerprintLayer::fingerprint_files_ |
|
private |
List of paths to available fingerprint SVG files.
◆ fingerprint_image_
| QLabel* FingerprintLayer::fingerprint_image_ |
|
private |
Label displaying the fingerprint image.
◆ fingerprint_progress_
| QProgressBar* FingerprintLayer::fingerprint_progress_ |
|
private |
Progress bar indicating the scan progress.
◆ fingerprint_timer_
| QTimer* FingerprintLayer::fingerprint_timer_ |
|
private |
Timer controlling the progress update while the mouse button is held.
◆ svg_renderer_
| QSvgRenderer* FingerprintLayer::svg_renderer_ |
|
private |
Renderer used to load and draw SVG fingerprint images.
The documentation for this class was generated from the following files: