1#ifndef SECURITY_CODE_LAYER_H
2#define SECURITY_CODE_LAYER_H
48 void Reset()
override;
76 bool eventFilter(QObject *obj, QEvent *event)
override;
96 SecurityCode(
const QString &c,
const QString &h,
const bool num =
true)
void ShowErrorEffect()
Triggers a visual error effect on the input fields. Temporarily changes the background and border col...
Definition security_code_layer.cpp:302
bool is_current_code_numeric_
Flag indicating if the current_security_code_ is numeric only.
Definition security_code_layer.h:141
~SecurityCodeLayer() override
Destructor.
Definition security_code_layer.cpp:123
QVector< SecurityCode > security_codes_
Vector storing all available SecurityCode entries (code, hint, type).
Definition security_code_layer.h:144
QLabel * security_code_hint_
Label displaying the hint for the current security code.
Definition security_code_layer.h:137
void Reset() override
Resets the layer to its initial state. Clears input fields, resets their styles, clears the hint,...
Definition security_code_layer.cpp:145
void SetInputValidators(bool numeric_only)
Sets the input validators for all code input fields based on whether the current code is numeric.
Definition security_code_layer.cpp:180
QList< QLineEdit * > code_inputs_
List containing pointers to the four QLineEdit widgets for code input.
Definition security_code_layer.h:135
QString GetEnteredCode() const
Gets the code currently entered by the user by concatenating the text from all input fields.
Definition security_code_layer.cpp:294
QString GetRandomSecurityCode(QString &hint, bool &is_numeric)
Selects a random security code from the internal list.
Definition security_code_layer.cpp:345
QString current_security_code_
The currently active security code that the user needs to enter.
Definition security_code_layer.h:139
void OnDigitEntered()
Slot called when the text in any input field changes. Handles automatic focus progression to the next...
Definition security_code_layer.cpp:192
SecurityCodeLayer(QWidget *parent=nullptr)
Constructs a SecurityCodeLayer. Initializes the UI elements (title, instructions, input fields,...
Definition security_code_layer.cpp:15
void Initialize() override
Initializes the layer for display. Resets the input fields, selects a new random security code and hi...
Definition security_code_layer.cpp:126
bool eventFilter(QObject *obj, QEvent *event) override
Filters events for the input fields to handle navigation keys. Intercepts KeyPress events for QLineEd...
Definition security_code_layer.cpp:224
void CheckSecurityCode()
Checks if the entered code matches the current security code. Called when all input fields are filled...
Definition security_code_layer.cpp:254
TranslationManager * translator_
Pointer to the translation manager for handling UI translations.
Definition security_code_layer.h:146
void ResetInputs()
Clears all input fields and resets their styles to the default (error/red) state. Sets focus on the f...
Definition security_code_layer.cpp:154
SecurityLayer(QWidget *parent=nullptr)
Constructs a SecurityLayer.
Definition security_layer.h:20
Manages the loading and delivery of translations for applications.
Definition translation_manager.h:15
SecurityCode(const QString &c, const QString &h, const bool num=true)
Constructs a SecurityCode entry.
Definition security_code_layer.h:96
QString hint
A hint related to the security code.
Definition security_code_layer.h:86
QString code
The 4-character security code (can be digits or letters).
Definition security_code_layer.h:84
bool is_numeric
Flag indicating if the code consists only of digits.
Definition security_code_layer.h:88