![]() |
Banking_System_Client
1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
|
Manages the responses received from the server. More...
#include <ResponseManager.h>
Public Types | |
enum | AvailableRequests { Login = 1 , GetAccountnumber , GetBalance , GetTransactionsHistory , MakeTransaction , TransferAmount , GetDatabase , CreateNewUser , DeleteUser , UpdateUser , UserInit , UpdateEmail , UpdatePassword , JsonParseError = -1 , Connection = -2 } |
Defines the types of requests that can be handled. More... | |
Signals | |
void | userloginSuccess (QString email, QString first_name, QString account_number, QString balance) |
Signal emitted when a user login is successful. More... | |
void | adminLoginSuccess (QString email, QString first_name) |
Signal emitted when an admin login is successful. More... | |
void | ConnectionResponse (bool status) |
Signal emitted for connection response. More... | |
void | TransactionsFetched (const QList< QMap< QString, QString >> &transactions) |
Signal emitted when transactions are fetched. More... | |
void | DatabaseFetched (const QList< QMap< QString, QString >> &databaseContent) |
Signal emitted when the database content is fetched. More... | |
void | BalanceFetched (QString balance) |
Signal emitted when the balance is fetched. More... | |
void | SuccessfullRequest (QString message) |
Signal emitted for a successful request. More... | |
void | FailedRequest (QString message) |
Signal emitted for a failed request. More... | |
Public Member Functions | |
bool | getResponseStatus (QJsonObject Data) |
Checks the status value in the response. More... | |
QString | getResponseMessage (QJsonObject Data) |
Retrieves the message from the response. More... | |
ResponseManager (QObject *parent=nullptr) | |
Constructor for ResponseManager. More... | |
void | handleResponse (QJsonObject Data) |
Handles the response received from the server. More... | |
Manages the responses received from the server.
The ResponseManager class processes server responses and emits signals based on the response type. It handles various response types defined in the AvailableRequests enum and provides feedback through signals to update the application state accordingly.
Defines the types of requests that can be handled.
|
explicit |
Constructor for ResponseManager.
parent | The parent QObject, default is nullptr. |
|
signal |
Signal emitted when an admin login is successful.
Admin's email. | |
first_name | Admin's first name. |
Referenced by handleResponse().
|
signal |
Signal emitted when the balance is fetched.
balance | User's balance. |
Referenced by UIManager::closeUserWidget(), UIManager::createUserWidget(), and handleResponse().
|
signal |
Signal emitted for connection response.
status | Connection status (true for success, false for failure). |
Referenced by handleResponse().
|
signal |
Signal emitted when the database content is fetched.
databaseContent | List of database content. |
Referenced by UIManager::closeAdminWidget(), UIManager::createAdminWidget(), and handleResponse().
|
signal |
Signal emitted for a failed request.
message | Failure message. |
Referenced by handleResponse().
QString ResponseManager::getResponseMessage | ( | QJsonObject | Data | ) |
Retrieves the message from the response.
Data | The QJsonObject representing the response data. |
Referenced by handleResponse().
bool ResponseManager::getResponseStatus | ( | QJsonObject | Data | ) |
Checks the status value in the response.
Data | The QJsonObject representing the response data. |
Referenced by handleResponse().
void ResponseManager::handleResponse | ( | QJsonObject | Data | ) |
Handles the response received from the server.
Data | The QJsonObject representing the response data. |
Referenced by UIManager::responseReady().
|
signal |
Signal emitted for a successful request.
message | Success message. |
Referenced by handleResponse().
|
signal |
Signal emitted when transactions are fetched.
transactions | List of transactions. |
Referenced by UIManager::closeAdminWidget(), UIManager::closeUserWidget(), UIManager::createAdminWidget(), UIManager::createUserWidget(), and handleResponse().
|
signal |
Signal emitted when a user login is successful.
User's email. | |
first_name | User's first name. |
account_number | User's account number. |
balance | User's balance. |
Referenced by handleResponse().