Limo
A simple mod manager
Loading...
Searching...
No Matches
PasswordField Class Reference

Widget used to enter passwords. Contains a line field for input and a button to show/ hide the password. Can be paired with another PasswordField as repetition check. More...

#include <passwordfield.h>

Inheritance diagram for PasswordField:
Collaboration diagram for PasswordField:

Public Types

enum  Role { main , repeat }
 Role of this field. More...
 

Public Slots

void onPartnerFieldChanged (QString new_password)
 Updates the visual feedback for matching passwords.
 

Signals

void passwordEdited (QString new_password)
 Signals that the current password has been edited by the user.
 
void passwordValidityChanged (bool is_valid)
 Sent when the is_valid_ status of this field changes.
 

Public Member Functions

 PasswordField (QWidget *parent=nullptr)
 Initializes the UI.
 
QString getPassword () const
 Returns the password currently in the password field..
 
ValidatingLineEditgetPasswordLineEdit () const
 Returns the ValidatingLineEdit used for input.
 
void setPartnerField (PasswordField *partner, Role partner_role)
 Sets a partner PasswordField for repetition checking.
 

Private Slots

void onPasswordEdited (QString new_password)
 Updates the visual feedback for matching passwords.
 
void onViewButtonPressed ()
 Toggles password visibility.
 

Private Member Functions

void updateValidationStatus ()
 Updates the is_valid_ flag to be false if role_ == repeat and the passwords mismatch.
 

Private Attributes

ValidatingLineEditpassword_line_edit_
 Used for input. Gives visual feedback is this has a repeat role and the passwords dont match.
 
QPushButton * view_button_
 Button used to show/ hide the password.
 
const QIcon show_icon = QIcon::fromTheme("view-visible")
 Icon used to indicate that the password is to be shown.
 
const QIcon hide_icon = QIcon::fromTheme("view-hidden")
 Icon used to indicate that the password is to be hidden.
 
PasswordFieldpartner_ = nullptr
 Partner PasswordField.
 
Role role_ = main
 Role if this field.
 
bool is_valid_ = true
 Always true if role_ == main. Else only true if both passwords match.
 

Detailed Description

Widget used to enter passwords. Contains a line field for input and a button to show/ hide the password. Can be paired with another PasswordField as repetition check.

Member Enumeration Documentation

◆ Role

Role of this field.

Enumerator
main 

This is the main PasswordField.

repeat 

This PasswordField is meant for repetition checking.

Constructor & Destructor Documentation

◆ PasswordField()

PasswordField::PasswordField ( QWidget * parent = nullptr)
explicit

Initializes the UI.

Parameters
parentParent for this widget, this is passed to the constructor of QDialog.

Member Function Documentation

◆ getPassword()

QString PasswordField::getPassword ( ) const

Returns the password currently in the password field..

Returns
The password.

◆ getPasswordLineEdit()

ValidatingLineEdit * PasswordField::getPasswordLineEdit ( ) const

Returns the ValidatingLineEdit used for input.

Returns
The line edit.

◆ onPartnerFieldChanged

void PasswordField::onPartnerFieldChanged ( QString new_password)
slot

Updates the visual feedback for matching passwords.

Parameters
new_passwordThe new partner input.

◆ onPasswordEdited

void PasswordField::onPasswordEdited ( QString new_password)
privateslot

Updates the visual feedback for matching passwords.

Parameters
new_passwordThe new partner password.

◆ passwordEdited

void PasswordField::passwordEdited ( QString new_password)
signal

Signals that the current password has been edited by the user.

Parameters
new_passwordThe new password as entered by the user.

◆ passwordValidityChanged

void PasswordField::passwordValidityChanged ( bool is_valid)
signal

Sent when the is_valid_ status of this field changes.

Parameters
is_validThe new status.

◆ setPartnerField()

void PasswordField::setPartnerField ( PasswordField * partner,
Role partner_role )

Sets a partner PasswordField for repetition checking.

Parameters
partnerThe partner.
partner_roleRole of the partner.

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