Merge pull request #6805 from lat9nq/fix-user-profiles

config: Only read/write current_user on global config
This commit is contained in:
Morph 2021-08-02 23:58:41 -04:00 committed by GitHub
commit d16a337d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -873,10 +873,6 @@ void Config::ReadShortcutValues() {
void Config::ReadSystemValues() { void Config::ReadSystemValues() {
qt_config->beginGroup(QStringLiteral("System")); qt_config->beginGroup(QStringLiteral("System"));
ReadBasicSetting(Settings::values.current_user);
Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0,
Service::Account::MAX_USERS - 1);
ReadGlobalSetting(Settings::values.language_index); ReadGlobalSetting(Settings::values.language_index);
ReadGlobalSetting(Settings::values.region_index); ReadGlobalSetting(Settings::values.region_index);
@ -897,6 +893,10 @@ void Config::ReadSystemValues() {
} }
if (global) { if (global) {
ReadBasicSetting(Settings::values.current_user);
Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0,
Service::Account::MAX_USERS - 1);
const auto custom_rtc_enabled = const auto custom_rtc_enabled =
ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool(); ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool();
if (custom_rtc_enabled) { if (custom_rtc_enabled) {
@ -1406,7 +1406,6 @@ void Config::SaveShortcutValues() {
void Config::SaveSystemValues() { void Config::SaveSystemValues() {
qt_config->beginGroup(QStringLiteral("System")); qt_config->beginGroup(QStringLiteral("System"));
WriteBasicSetting(Settings::values.current_user);
WriteGlobalSetting(Settings::values.language_index); WriteGlobalSetting(Settings::values.language_index);
WriteGlobalSetting(Settings::values.region_index); WriteGlobalSetting(Settings::values.region_index);
WriteGlobalSetting(Settings::values.time_zone_index); WriteGlobalSetting(Settings::values.time_zone_index);
@ -1418,6 +1417,8 @@ void Config::SaveSystemValues() {
0, Settings::values.rng_seed.UsingGlobal()); 0, Settings::values.rng_seed.UsingGlobal());
if (global) { if (global) {
WriteBasicSetting(Settings::values.current_user);
WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(),
false); false);
WriteSetting(QStringLiteral("custom_rtc"), WriteSetting(QStringLiteral("custom_rtc"),