A security layer simulating handprint authentication.
More...
#include <handprint_layer.h>
|
| | HandprintLayer (QWidget *parent=nullptr) |
| | Constructs a HandprintLayer. Initializes the UI elements (title, handprint image label, instructions, progress bar), sets up the layout, creates the progress timer, loads the list of available handprint SVG files, and initializes the SVG renderer.
|
| |
| void | Initialize () override |
| | Initializes the layer for display. Resets the progress bar and styles, loads the handprint 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 handprint image style, restores the base handprint image, and ensures the layer is fully opaque.
|
| |
| | ~HandprintLayer () 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 | ProcessHandprint (bool completed) |
| | Handles the completion of the handprint scan. Changes the UI element styles (border, progress bar chunk) to green, updates the handprint image to be fully green, and initiates the fade-out animation after a short delay.
|
| |
| void | UpdateProgress () |
| | Slot called periodically by handprint_timer_ when the user is holding the mouse button. Increments the progress bar value, updates the visual appearance of the handprint scan, and calls ProcessHandprint(true) when the progress reaches 100%.
|
| |
|
| bool | eventFilter (QObject *obj, QEvent *event) override |
| | Filters mouse press and release events on the handprint_image_ label. Starts the handprint_timer_ on left mouse button press and stops it on release.
|
| |
| void | LoadRandomHandprint () |
| | Loads the handprint SVG file from handprint_files_ and renders it into base_handprint_. Handles potential loading errors. Sets the initial pixmap on handprint_image_. Note: Currently only supports one hardcoded handprint file.
|
| |
| void | UpdateHandprintScan (int progress_value) const |
| | Updates the visual appearance of the handprint 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.
|
| |
|
| QImage | base_handprint_ |
| | The base image of the handprint (rendered SVG in gray).
|
| |
| QString | current_handprint_ |
| | Path to the currently loaded handprint SVG file.
|
| |
| QStringList | handprint_files_ |
| | List of paths to available handprint SVG files (currently only one).
|
| |
| QLabel * | handprint_image_ |
| | Label displaying the handprint image.
|
| |
| QProgressBar * | handprint_progress_ |
| | Progress bar indicating the scan progress.
|
| |
| QTimer * | handprint_timer_ |
| | Timer controlling the progress update while the mouse button is held.
|
| |
| QSvgRenderer * | svg_renderer_ |
| | Renderer used to load and draw the SVG handprint image.
|
| |
|
| 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 handprint authentication.
This layer displays a handprint 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 handprint 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.
◆ HandprintLayer()
| HandprintLayer::HandprintLayer |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a HandprintLayer. Initializes the UI elements (title, handprint image label, instructions, progress bar), sets up the layout, creates the progress timer, loads the list of available handprint SVG files, and initializes the SVG renderer.
- Parameters
-
| parent | Optional parent widget. |
◆ ~HandprintLayer()
| HandprintLayer::~HandprintLayer |
( |
| ) |
|
|
override |
Destructor. Stops and deletes the progress timer and the SVG renderer.
◆ eventFilter()
| bool HandprintLayer::eventFilter |
( |
QObject * | obj, |
|
|
QEvent * | event ) |
|
overrideprivate |
Filters mouse press and release events on the handprint_image_ label. Starts the handprint_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 HandprintLayer::Initialize |
( |
| ) |
|
|
overridevirtual |
Initializes the layer for display. Resets the progress bar and styles, loads the handprint image, and ensures the layer is fully opaque.
Implements SecurityLayer.
◆ LoadRandomHandprint()
| void HandprintLayer::LoadRandomHandprint |
( |
| ) |
|
|
private |
Loads the handprint SVG file from handprint_files_ and renders it into base_handprint_. Handles potential loading errors. Sets the initial pixmap on handprint_image_. Note: Currently only supports one hardcoded handprint file.
◆ ProcessHandprint
| void HandprintLayer::ProcessHandprint |
( |
bool | completed | ) |
|
|
privateslot |
Handles the completion of the handprint scan. Changes the UI element styles (border, progress bar chunk) to green, updates the handprint 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 HandprintLayer::Reset |
( |
| ) |
|
|
overridevirtual |
Resets the layer to its initial state. Stops the progress timer, resets the progress bar value and style, resets the handprint image style, restores the base handprint image, and ensures the layer is fully opaque.
Implements SecurityLayer.
◆ UpdateHandprintScan()
| void HandprintLayer::UpdateHandprintScan |
( |
int | progress_value | ) |
const |
|
private |
Updates the visual appearance of the handprint 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 HandprintLayer::UpdateProgress |
( |
| ) |
|
|
privateslot |
Slot called periodically by handprint_timer_ when the user is holding the mouse button. Increments the progress bar value, updates the visual appearance of the handprint scan, and calls ProcessHandprint(true) when the progress reaches 100%.
◆ base_handprint_
| QImage HandprintLayer::base_handprint_ |
|
private |
The base image of the handprint (rendered SVG in gray).
◆ current_handprint_
| QString HandprintLayer::current_handprint_ |
|
private |
Path to the currently loaded handprint SVG file.
◆ handprint_files_
| QStringList HandprintLayer::handprint_files_ |
|
private |
List of paths to available handprint SVG files (currently only one).
◆ handprint_image_
| QLabel* HandprintLayer::handprint_image_ |
|
private |
Label displaying the handprint image.
◆ handprint_progress_
| QProgressBar* HandprintLayer::handprint_progress_ |
|
private |
Progress bar indicating the scan progress.
◆ handprint_timer_
| QTimer* HandprintLayer::handprint_timer_ |
|
private |
Timer controlling the progress update while the mouse button is held.
◆ svg_renderer_
| QSvgRenderer* HandprintLayer::svg_renderer_ |
|
private |
Renderer used to load and draw the SVG handprint image.
The documentation for this class was generated from the following files: