|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
A security layer simulating a security question challenge. More...
#include <security_question_layer.h>
Public Member Functions | |
| void | Initialize () override |
| Initializes the layer for display. Resets the input field and styles, sets the initial question text, starts the hint timer, sets focus on the input field, and ensures the layer is fully opaque. | |
| void | Reset () override |
| Resets the layer to its initial state. Stops the hint timer, clears the input field and question label, resets styles, makes the input field editable, and ensures the layer is fully opaque. | |
| SecurityQuestionLayer (QWidget *parent=nullptr) | |
| Constructs a SecurityQuestionLayer. Initializes the UI elements (title, instructions, question label, input field), sets up the layout, and creates the hint timer. Connects the input field's returnPressed signal to the checking slot. | |
| ~SecurityQuestionLayer () override | |
| Destructor. Stops and deletes the hint timer. | |
Public Member Functions inherited from SecurityLayer | |
| SecurityLayer (QWidget *parent=nullptr) | |
| Constructs a SecurityLayer. | |
| ~SecurityLayer () override=default | |
| Virtual destructor. Ensures proper cleanup for derived classes. | |
Private Slots | |
| void | CheckSecurityAnswer () |
| Checks the security answer (always accepts in this implementation). Called when the user presses Enter the input field. Changes UI colors to green, updates the label text, and initiates the fade-out animation after a short delay. | |
| void | SecurityQuestionTimeout () const |
| Slot called by security_question_timer_ after a timeout (10 seconds). Updates the security_question_label_ with a hint message. | |
Private Attributes | |
| QLineEdit * | security_question_input_ |
| Input field for the user to type their answer. | |
| QLabel * | security_question_label_ |
| Label displaying the security question prompt or hint. | |
| QTimer * | security_question_timer_ |
| Timer controlling when the hint is displayed. | |
| TranslationManager * | translator_ |
| Pointer to the translation manager for handling UI translations. | |
Additional Inherited Members | |
Signals inherited from SecurityLayer | |
| 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 security question challenge.
This layer presents a generic security question prompt and an input field. It includes a timer that reveals a hint after a delay, suggesting the user doesn't need a question if they are legitimate. In this implementation, any answer entered by the user is considered correct as part of a joke/Easter egg. Upon "successful" authentication (any input followed by Enter), the UI elements turn green, and the layer fades out, emitting the layerCompleted() signal.
|
explicit |
Constructs a SecurityQuestionLayer. Initializes the UI elements (title, instructions, question label, input field), sets up the layout, and creates the hint timer. Connects the input field's returnPressed signal to the checking slot.
| parent | Optional parent widget. |
|
override |
Destructor. Stops and deletes the hint timer.
|
privateslot |
Checks the security answer (always accepts in this implementation). Called when the user presses Enter the input field. Changes UI colors to green, updates the label text, and initiates the fade-out animation after a short delay.
|
overridevirtual |
Initializes the layer for display. Resets the input field and styles, sets the initial question text, starts the hint timer, sets focus on the input field, and ensures the layer is fully opaque.
Implements SecurityLayer.
|
overridevirtual |
Resets the layer to its initial state. Stops the hint timer, clears the input field and question label, resets styles, makes the input field editable, and ensures the layer is fully opaque.
Implements SecurityLayer.
|
privateslot |
Slot called by security_question_timer_ after a timeout (10 seconds). Updates the security_question_label_ with a hint message.
|
private |
Input field for the user to type their answer.
|
private |
Label displaying the security question prompt or hint.
|
private |
Timer controlling when the hint is displayed.
|
private |
Pointer to the translation manager for handling UI translations.