Banking_System_Client  1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
BaseDialog Class Referenceabstract

The BaseDialog class provides a base class for creating dialogs with validation support. More...

#include <BaseDialog.h>

Inheritance diagram for BaseDialog:
Inheritance graph
Collaboration diagram for BaseDialog:
Collaboration graph

Public Member Functions

 BaseDialog (QWidget *parent=nullptr)
 Constructor for BaseDialog. More...
 
virtual QVariantMap getData () const =0
 Pure virtual function to get the data from the dialog. More...
 

Protected Member Functions

virtual void setupUI ()=0
 Pure virtual function to set up the user interface.
 
virtual void connectSignals ()
 Connects signals for the dialog.
 
QtMaterialTextField * createInputField (QVBoxLayout *layout, const QString &labelText, IValidationStrategy *validationStrategy, bool isPassword=false)
 Creates an input field with validation. More...
 
void validateInput (QtMaterialTextField *field)
 Validates the input of a specified field. More...
 
void updateConfirmButtonState ()
 Updates the state of the confirm button based on the validity of the form.
 
void setFieldValidityStyle (QtMaterialTextField *field, QLabel *errorLabel, const QString &errorMessage, bool isValid)
 Sets the validity style of an input field. More...
 

Protected Attributes

QMap< QtMaterialTextField *, IValidationStrategy * > validationStrategies_
 Stores validation strategies for input fields.
 
QMap< QtMaterialTextField *, QLabel * > errorLabels_
 Stores error labels for input fields.
 
QtMaterialFlatButton * confirmButton
 The confirm button.
 
QtMaterialFlatButton * cancelButton
 The cancel button.
 

Detailed Description

The BaseDialog class provides a base class for creating dialogs with validation support.

This class is responsible for setting up the user interface, connecting signals, and validating input fields.

Constructor & Destructor Documentation

◆ BaseDialog()

BaseDialog::BaseDialog ( QWidget *  parent = nullptr)

Constructor for BaseDialog.

Parameters
parentThe parent widget.

Member Function Documentation

◆ createInputField()

QtMaterialTextField * BaseDialog::createInputField ( QVBoxLayout *  layout,
const QString &  labelText,
IValidationStrategy validationStrategy,
bool  isPassword = false 
)
protected

Creates an input field with validation.

Parameters
layoutThe layout to add the input field to.
labelTextThe text for the label associated with the input field.
validationStrategyThe validation strategy for the input field.
isPasswordBoolean flag to indicate if the input field is for password input.
Returns
A pointer to the created input field.

Referenced by UpdateEmailDialog::setupUI(), and UpdatePasswordDialog::setupUI().

Here is the caller graph for this function:

◆ getData()

virtual QVariantMap BaseDialog::getData ( ) const
pure virtual

Pure virtual function to get the data from the dialog.

Returns
A QVariantMap containing the data.

Implemented in UpdateUserDialog, UpdatePasswordDialog, UpdateEmailDialog, and CreateUserDialog.

◆ setFieldValidityStyle()

void BaseDialog::setFieldValidityStyle ( QtMaterialTextField *  field,
QLabel *  errorLabel,
const QString &  errorMessage,
bool  isValid 
)
protected

Sets the validity style of an input field.

Parameters
fieldThe input field to update.
errorLabelThe label to display error messages.
errorMessageThe error message to display.
isValidBoolean flag to indicate if the input is valid.

Referenced by validateInput().

Here is the caller graph for this function:

◆ validateInput()

void BaseDialog::validateInput ( QtMaterialTextField *  field)
protected

Validates the input of a specified field.

Parameters
fieldThe input field to validate.

Referenced by connectSignals().

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

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