| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include "settings.h"
- namespace Keys {
- constexpr auto ServiceUrl = "serviceUrl";
- constexpr auto Login = "login";
- constexpr auto Password = "password";
- }
- QString Settings::serviceUrl() const
- {
- return m_settings.value(Keys::ServiceUrl, "https://mynoolightservice.org").toString();
- }
- void Settings::setServiceUrl(const QString &newServiceUrl)
- {
- if (serviceUrl() == newServiceUrl) {
- return;
- }
- m_settings.setValue(Keys::ServiceUrl, newServiceUrl);
- emit serviceUrlChanged();
- }
- QString Settings::login() const
- {
- return m_settings.value(Keys::Login).toString();
- }
- void Settings::setLogin(const QString &newLogin)
- {
- if (login() == newLogin) {
- return;
- }
- m_settings.setValue(Keys::Login, newLogin);
- emit loginChanged();
- }
- QString Settings::password() const
- {
- return m_settings.value(Keys::Password).toString();
- }
- void Settings::setPassword(const QString &newPassword)
- {
- if (password() == newPassword) {
- return;
- }
- m_settings.setValue(Keys::Password, newPassword);
- emit passwordChanged();
- }
|