Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
SecurityQuestionLayer Class Referencefinal

A security layer simulating a security question challenge. More...

#include <security_question_layer.h>

Inheritance diagram for SecurityQuestionLayer:
Collaboration diagram for SecurityQuestionLayer:

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.
 
TranslationManagertranslator_
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SecurityQuestionLayer()

SecurityQuestionLayer::SecurityQuestionLayer ( QWidget * parent = nullptr)
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.

Parameters
parentOptional parent widget.
Here is the call graph for this function:

◆ ~SecurityQuestionLayer()

SecurityQuestionLayer::~SecurityQuestionLayer ( )
override

Destructor. Stops and deletes the hint timer.

Member Function Documentation

◆ CheckSecurityAnswer

void SecurityQuestionLayer::CheckSecurityAnswer ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

void SecurityQuestionLayer::Initialize ( )
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.

Here is the call graph for this function:

◆ Reset()

void SecurityQuestionLayer::Reset ( )
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.

Here is the caller graph for this function:

◆ SecurityQuestionTimeout

void SecurityQuestionLayer::SecurityQuestionTimeout ( ) const
privateslot

Slot called by security_question_timer_ after a timeout (10 seconds). Updates the security_question_label_ with a hint message.

Here is the caller graph for this function:

Member Data Documentation

◆ security_question_input_

QLineEdit* SecurityQuestionLayer::security_question_input_
private

Input field for the user to type their answer.

◆ security_question_label_

QLabel* SecurityQuestionLayer::security_question_label_
private

Label displaying the security question prompt or hint.

◆ security_question_timer_

QTimer* SecurityQuestionLayer::security_question_timer_
private

Timer controlling when the hint is displayed.

◆ translator_

TranslationManager* SecurityQuestionLayer::translator_
private

Pointer to the translation manager for handling UI translations.


The documentation for this class was generated from the following files: