Manages user preferences related to budgeting, survey balance, work hours, and currency. More...
#include <UserPreferences.h>
Public Member Functions | |
CurrencyDisplayOptions | currenciesDisplayAs () const noexcept |
Retrieves the user's preference for how currencies should be displayed. | |
std::chrono::days | daysInWeek () const noexcept |
Retrieves the number of days in a standard work week based on user preferences. | |
bool | doesExist () const noexcept |
Checks if any user preferences exist. | |
std::chrono::hours | hoursInWeek () const noexcept |
Retrieves the number of hours in a standard work week, as defined in user preferences. | |
std::chrono::days | notifyDueWithin () const noexcept |
Retrieves the notification period for due items from user preferences. | |
pecunia::Currency | preferredCurrency () const noexcept |
Retrieves the user's preferred display currency for the application. | |
void | setCurrenciesDisplayAs (const CurrencyDisplayOptions &displayAs) |
Sets the display format for currencies in the application. | |
void | setDaysInWeek (const std::chrono::days &value) |
Sets the number of days in a typical user-defined work week. | |
void | setHoursInWeek (const std::chrono::hours &value) |
Sets the number of hours in a week for user preferences. | |
void | setNotifyDueWithin (const std::chrono::days &value) |
Sets the notification time period for due tasks. | |
void | setPreferredCurrency (const pecunia::Currency &value) |
Sets the preferred display currency for the user. | |
void | setSurveyWindow (const foundation::Percentage &window) |
Updates the user's preference for the survey window percentage. | |
void | setUsableCurrencies (const std::set< pecunia::Currency > &values) |
Updates the list of usable currencies and stores them persistently. | |
foundation::Percentage | surveyWindow () const noexcept |
Retrieves the survey window percentage preference for user settings. | |
std::set< pecunia::Currency > | usableCurrencies () const noexcept |
Retrieves the list of usable currencies. | |
Manages user preferences related to budgeting, survey balance, work hours, and currency.
This class is responsible for storing, retrieving, and managing various user preferences. It ensures user preferences are persisted across application sessions, allowing for consistent customization of the user experience in terms of financial and time-related settings.
Usage:
This class interacts with a backing store and guarantees safe and consistent access to preference values. This enables the application to dynamically adapt its behavior to the user-defined settings.
|
nodiscardnoexcept |
Retrieves the user's preference for how currencies should be displayed.
This method is used to determine how currency-related data should be presented in the application.
|
nodiscardnoexcept |
Retrieves the number of days in a standard work week based on user preferences.
This function provides the ability to determine the number of days considered as part of the work week, as defined by stored user preferences. This ensures coherent behavior for operations depending on the work week settings.
|
nodiscardnoexcept |
Checks if any user preferences exist.
|
nodiscardnoexcept |
Retrieves the number of hours in a standard work week, as defined in user preferences.
This method is used to obtain the configured or default value for the number of hours in a work week. It ensures the application can consistently use the preferred or default hours for time calculations.
|
nodiscardnoexcept |
Retrieves the notification period for due items from user preferences.
This method is used to obtain the user's preferred number of days prior to a budgeting item becoming due, within which they wish to receive notifications.
|
nodiscardnoexcept |
Retrieves the user's preferred display currency for the application.
This method allows the application to determine and use the currency that aligns with the user's preference. Use this function to obtain the preferred display currency value for any financial or currency-related operations.
void drn::navigation::UserPreferences::setCurrenciesDisplayAs | ( | const CurrencyDisplayOptions & | displayAs | ) |
Sets the display format for currencies in the application.
This method updates the application's settings to define how currencies should be displayed. The updated preference is stored persistently and ensures that subsequent uses of the application adhere to the specified currency display format.
displayAs | The desired format for currency display. |
void drn::navigation::UserPreferences::setDaysInWeek | ( | const std::chrono::days & | value | ) |
Sets the number of days in a typical user-defined work week.
This function updates the user's preference for the number of days they consider a work week. Changes to this preference impact how the application calculates and displays work-associated metrics and schedules. The value is stored persistently, ensuring that it is retained between sessions.
value | The number of days to set as the user's work week. |
void drn::navigation::UserPreferences::setHoursInWeek | ( | const std::chrono::hours & | value | ) |
Sets the number of hours in a week for user preferences.
This function updates the stored value representing the number of hours in a week, allowing the application to adapt its budgeting and scheduling features accordingly.
value | The new number of hours to be stored as the weekly working hours. |
void drn::navigation::UserPreferences::setNotifyDueWithin | ( | const std::chrono::days & | value | ) |
Sets the notification time period for due tasks.
This method specifies the time frame within which notifications about due tasks will be triggered. By setting this value, you can adjust when the application will alert the user about upcoming tasks, ensuring timely reminders for better task management.
value | Specifies the number of days before the due date to trigger task notifications. |
void drn::navigation::UserPreferences::setPreferredCurrency | ( | const pecunia::Currency & | value | ) |
Sets the preferred display currency for the user.
When called, this function updates the user's preferred display currency setting. It interacts with the underlying settings management system to ensure the update is stored persistently. Adjustments made are reflected in the application's behavior, such as displaying amounts in the selected currency format across relevant graphical elements.
value | The currency value to set as the user's preference. |
void drn::navigation::UserPreferences::setSurveyWindow | ( | const foundation::Percentage & | window | ) |
Updates the user's preference for the survey window percentage.
This method sets a user-defined value indicating the percentage window for survey-related preferences. It ensures the value is stored in the application's settings for future reference. Use this method to customize survey-related calculations according to user-defined preference rates.
window | A percentage value to define the survey window rate. |
void drn::navigation::UserPreferences::setUsableCurrencies | ( | const std::set< pecunia::Currency > & | values | ) |
Updates the list of usable currencies and stores them persistently.
This function allows the application to customize the list of currencies that are available for use. It ensures that the updated list is saved and persists across application sessions. Modifications made to the list of usable currencies will influence the behavior of any GUI items or processes that rely on available currency options.
values | A collection representing the updated set of usable currencies. |
|
nodiscardnoexcept |
Retrieves the survey window percentage preference for user settings.
Use this method to get the user-defined survey window percentage rate. When the preference is not set, a default value is returned. This ensures a consistent fallback value in case of any undefined or corrupted settings.
|
nodiscardnoexcept |
Retrieves the list of usable currencies.
This method provides a set of currencies that are considered usable within the application, based on the user's settings.